From Chris.Hefling at nmhs.org Mon Oct 2 12:56:24 2006 From: Chris.Hefling at nmhs.org (Hefling, Chris) Date: Mon, 2 Oct 2006 14:56:24 -0500 Subject: [Omaha.pm] LWP Message-ID: <804D74BA90FBB5418AA7C966CD7D731703210BB8@w2k3ex01.nmhs.org> ARGH.....Can someone please tell me how to get rid of this data in every file I pull using the following code...I have been pulling my hair out trying to figure this out! Content-Language: en-US Transfer-Encoding: chunked 119 DATA............... 0 Code snippet.... $req = HTTP::Request->new(GET => 'https://www.blahblah.com'); $req = POST $url, ['command' => 'fileget', 'ifilename' => $files1[0], 'xfilename' => $files1[1]]; $req->content_type('application/x-www-form-urlencoded'); $res = $ua->request($req); $content=$res->content; print FILE $res->content; This message and any included attachments are from Nebraska Methodist Health System and its affiliates and are intended only for the addressee. The message may contain privileged, confidential and/or proprietary information intended only for the person(s) named. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Nebraska Methodist Health System and its affiliates in Omaha, Nebraska, U.S.A at (402)354-2280. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/omaha-pm/attachments/20061002/389594fa/attachment.html From andy at petdance.com Mon Oct 2 12:58:26 2006 From: andy at petdance.com (Andy Lester) Date: Mon, 2 Oct 2006 14:58:26 -0500 Subject: [Omaha.pm] LWP In-Reply-To: <804D74BA90FBB5418AA7C966CD7D731703210BB8@w2k3ex01.nmhs.org> References: <804D74BA90FBB5418AA7C966CD7D731703210BB8@w2k3ex01.nmhs.org> Message-ID: <0DB304C7-6D95-4497-A3D5-C9DBA44310B7@petdance.com> On Oct 2, 2006, at 2:56 PM, Hefling, Chris wrote: > ARGH?..Can someone please tell me how to get rid of this data in > every file I pull using the following code?I have been pulling my > hair out trying to figure this out! > > > > Content-Language: en-US > > Transfer-Encoding: chunked Sounds like it could be a problem on the server side if it's sending headers where it shouldn't be. Also, you may want to look at WWW::Mechanize to simplify your field fill-ins. -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From pbaker at omnihotels.com Mon Oct 2 13:32:42 2006 From: pbaker at omnihotels.com (Sean Baker) Date: Mon, 2 Oct 2006 15:32:42 -0500 Subject: [Omaha.pm] LWP Message-ID: <29AB736ABCE5C745ABF9C93B02F2C27B0695C5DB@exchange2k3.omnihotels.net> Do you mean to "print FILE $content"? >>$content=$res->content; >>print FILE $res->content; I think the 0 is returning from $res->content.....I haven't tested it though. Sean Baker Software Architect Omni Hotels (402) 952-6508 pbaker at omnihotels.com ________________________________ This message and any included attachments are from Nebraska Methodist Health System and its affiliates and are intended only for the addressee. The message may contain privileged, confidential and/or proprietary information intended only for the person(s) named. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Nebraska Methodist Health System and its affiliates in Omaha, Nebraska, U.S.A at (402)354-2280. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/omaha-pm/attachments/20061002/ec317b51/attachment.html From andy at petdance.com Mon Oct 2 13:34:27 2006 From: andy at petdance.com (Andy Lester) Date: Mon, 2 Oct 2006 15:34:27 -0500 Subject: [Omaha.pm] LWP In-Reply-To: <804D74BA90FBB5418AA7C966CD7D731703210BB8@w2k3ex01.nmhs.org> References: <804D74BA90FBB5418AA7C966CD7D731703210BB8@w2k3ex01.nmhs.org> Message-ID: On Oct 2, 2006, at 2:56 PM, Hefling, Chris wrote: > $req = HTTP::Request->new(GET => 'https://www.blahblah.com'); > > $req = POST $url, ['command' => 'fileget', 'ifilename' => > $files1[0], 'xfilename' => $files1[1]]; > > $req->content_type('application/x-www-form-urlencoded'); > > $res = $ua->request($req); > > $content=$res->content; > > print FILE $res->content; > > Can we see the entire program? Do you have warnings and strict on at the top? use strict; use warnings; If not, do that first, and try it again. -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From Chris.Hefling at nmhs.org Mon Oct 2 13:37:59 2006 From: Chris.Hefling at nmhs.org (Hefling, Chris) Date: Mon, 2 Oct 2006 15:37:59 -0500 Subject: [Omaha.pm] LWP In-Reply-To: Message-ID: <804D74BA90FBB5418AA7C966CD7D731703210BB9@w2k3ex01.nmhs.org> #!/usr/local/bin/perl # # Program: askedi.pl [put/get] [trading partner id] [file param] [optional date param] # Date: 07/20/2006 # Last Update: 08/18/2006 # Author: Chris Hefling # Synopsis: Put/Get files for ASK-EDI # # Read Trading Partner username and password from conf/[tp number].cnf # # Load Libraries # use strict; use Crypt::SSLeay; use LWP::UserAgent; use LWP::Simple; use HTTP::Request::Common qw(POST); use HTTP::Cookies; # # Initialize Variables # my $content; # Login Variables my $cookie_file; my $login_URL; my $username; my @username; my $password; my @password; # Script Argument Variables my $arg1=@ARGV[0]; my $arg2=@ARGV[1]; my $arg3=@ARGV[2]; my $arg4=@ARGV[3]; # File Counter Variables my $cnt; my $total; # Logging Variables my $logfile=""; my $text; my $ecode; my $logfile="/cie/egate/client/scripts/askedi/log/askedi.log"; my $lockfile="/cie/egate/client/scripts/askedi/lock.txt"; # Get|Put Variables my $temp_file; my $recieve_disp_page; my $getfiles_URL; my $recv_dir="/cie/egate/client/scripts/askedi/files"; my $tempdir="/cie/egate/client/scripts/askedi/temp"; # Mail Variables my $message=""; my $mailto = "Chris.Hefling\@nmhs.org"; my $subject = "Claims File $arg1 Error"; # Date Variables my $rdate; my ($sec,$min,$hour,$mday,$mon,$year, $wday,$yday,$isdst) = localtime time; $year=$year + 1900; $mon=$mon + 1; if("$mon" < 10){ $mon="0$mon"; } if("$mday" < 10){ $mday="0$mday"; } my $cdate="$year$mon$mday"; # Check arg4 for manual filedate to use instead of todays date # Format of (yyyymmdd) # if("$arg4" ne ""){ $cdate="$arg4"; } # # Start Sub Routines # # Mail Routine sub smail { unless(open (MAIL, "|/usr/sbin/sendmail -t")) { warn "Error starting sendmail: $!"; } else { print MAIL "From: no.reply\@nmhs.org\n"; print MAIL "To: $mailto\n"; print MAIL "Subject: $subject\n\n"; print MAIL "$message"; close(MAIL) || warn "Error closing mail: $!"; } } # # Log routine sub print_log(){ if("$ecode" eq "1" || "$ecode" eq "2"){ $message="$text"; smail(); } $rdate="$mon/$mday/$year $hour:$min:$sec"; print LOG "$rdate $text\n"; } # # End Sub Routines # # Start Application # # Open log file # open LOG, ">>$logfile" or die "can't open $logfile $!"; if (-e "$lockfile") { $text="A runtime lock exists because of a previous failed login. The file \"lock.txt\" must be deleted for this program to run."; $ecode="1"; print_log(); print "$ecode"; exit(1); } # # Check for command line arguments # if("$arg1" eq "" || "$arg2" eq ""){ print "#\n"; print "# Usage: perl $0 [get|put] [trading partner ID] [optional]\n"; print "#\n\n"; print "1"; exit(1); } if("$arg1" eq "put" && "$arg3" eq ""){ print "#\n"; print "# Usage: perl $0 [get|put] [trading partner ID] [param]\n"; print "#\n\n"; print "1"; exit(1); } if("$arg1" ne "get" && "$arg1" ne "put"){ print "#\n"; print "# Usage: perl $0 [get|put] [trading partner ID] [optional]\n"; print "#\n\n"; print "1"; exit(1); } # # Test for the existance and readability of the config file # Load username and password from config file # my $confdir="/cie/egate/client/scripts/askedi/conf"; if ((-e "$confdir/$arg2.cnf") && (-r "$confdir/$arg2.cnf") && (-s "$confdir/$arg2.cnf")){ open(CONF, "<$confdir/$arg2.cnf"); while() { my($line) = $_; if(/^username/){ @username=split('=', $line); $username=@username[1]; $username=~s/\"//g; $username=~s/\;//g; chomp $username; } if(/^password/){ @password=split('=', $line); $password=@password[1]; $password=~s/\"//g; $password=~s/\;//g; chomp $password; } } $text="Configuration loaded for $arg1:$arg2:$arg3"; print_log(); } else { $text="Problems with the $arg2 configuration file, exiting program"; $ecode="1"; print_log(); print "$ecode"; exit(1); } # # START LOGIN PROCESS # my $ua = LWP::UserAgent->new(env_proxy => 1, keep_alive => 1, timeout => 30, ); my $cookie_jar = HTTP::Cookies->new(file => "/cookies/ask-edi-cookies.txt", autosave => 1, ignore_discard => 1); $ua->cookie_jar( $cookie_jar); $ua->agent('Mozilla/5.0'); my $url = 'https://clyde.bcbsks.com/askedi/filetransfer'; my $req = POST $url, ['username' => $username, 'password' => $password, 'link' => '', 'command' => 'logon']; my $res = $ua->request($req); $cookie_jar->extract_cookies($res); if ($res->is_success) { if ($res->as_string !~ /failed/){ #print $res->as_string; $text="$username logged in."; print_log(); } else { $text="$username login failed."; open LOCK, ">$lockfile" or die "can't open $lockfile $!"; close(LOCK); $ecode="1"; print_log(); print "$ecode"; exit(1); } } # # END LOGIN PROCESS # # START FILE GET PROCESS # if ("$arg1" eq "get"){ my $req = HTTP::Request->new(GET => 'https://clyde.bcbsks.com/askedi/jsps/ask_tp_receive.jsp'); #$cookie_jar->add_cookie_header($req); $res = $ua->request($req); unless(open(TEMP_WRITE, ">$tempdir/tempfile.txt")){ $text="Can not write to temp file, exiting program."; $ecode="1"; print_log(); print "$ecode"; exit(1); } # Write page to temp file so we can read in the data print TEMP_WRITE $res->content; # Read the saved page so we can create a file list unless(open(TEMP_READ, "$tempdir/tempfile.txt")){ $text="Can not read from temp file, exiting program."; $ecode="1"; print_log(); print "$ecode"; exit(1); } my $line=""; my $file=""; my @files=""; my @files1=""; # Loop through the data while (defined ($line = )) { if ($line =~ /GetFile/){ # Lets remove some of the erroneous characters so we can create an array $line=~s/'//g; $line=~s/\(//g; $line=~s/\)//g; $line=~s/;">//g; @files=split(/GetFile/,$line); @files1=split(/,/,$files[1]); if("$files1[0]" eq "sIFName"){ # Do nothing, we do not need the first line } else { $total++; # Open a file so we can write the data to it # remove space before filename $files1[1]=~s/ //g; open(TESTIT, ">$recv_dir/testfile.txt"); unless(open(FILE, ">$recv_dir/$files1[1]")){ $text="Can not open $recv_dir/$files1[1], exiting program."; $ecode="1"; print_log(); print "$ecode"; exit(1); } # Send the request to retrieve the file $req = HTTP::Request->new(GET => 'https://clyde.bcbsks.com/askedi/filetransfer'); #$cookie_jar->add_cookie_header($req); $req = POST $url, ['command' => 'fileget', 'ifilename' => $files1[0], 'xfilename' => $files1[1]]; $req->content_type('application/x-www-form-urlencoded'); #$req->header('Content-Type' => 'text/html; charset=UTF-8'); $res = $ua->request($req); $content=$res->content; print TESTIT $content; # Write the receiving file to our local server $cnt++; #unless(print FILE $res->as_string){ unless(print FILE $res->content){ $text="Can not write recieving data to file."; $ecode="1"; print_log(); print "$ecode"; exit(1); } $text="$cnt Writing $files1[1]"; print_log(); } } } $text="$total files received $cnt files written"; print_log(); } # # END FILE GET PROCESS # # START FILE PUT PROCESS # if ("$arg1" eq "put"){ #print "Start the file put process.\n"; # Access the putfiles files page so we can send the file my $GS_URL = 'https://clyde.bcbsks.com/askedi/filetransfer'; my $fdir="/cie/data/Claim_Cycle/transmit/medbne_prof/"; my $adir="/cie/data/Claim_Cycle/transmit/medbne_prof/archive/"; my $afile = $adir . "medbne_prof_" . $arg3 . "_" . $cdate . ".dat"; my $file = $fdir . "medbne_prof_" . $arg3 . "_" . $cdate . ".dat"; if ("$arg3" ne ""){ if (-e "$file") { $text="$cdate file exists, continue processing."; print_log(); } else { $text="$cdate file does not exist, exiting program."; $ecode="1"; print_log(); print "$ecode"; exit(1); } } else { $text="File parameter not supplied on command line."; $ecode="1"; print_log(); print "$ecode"; exit(1); } my $request = POST($GS_URL, Content_Type => 'form-data', Content => ['filename' => [$file,$file], 'command' => 'fileput', 'transmit' => 'Transmit', 'name' => 'frmtransmit']); my $response = $ua->request($request); die "request failed" unless $response->is_success; my $record = $response->content; $text="$file successfully transmitted."; print_log(); rename $file, $afile; if (-e "$afile") { $text="$afile has been archived.\n"; print_log(); } else { $text="$afile failed to archive.\n"; $ecode="2"; print_log(); print "$ecode"; exit(2); } } # # END FILE PUT PROCESS # # END PROGRAM # print "0"; This message and any included attachments are from Nebraska Methodist Health System and its affiliates and are intended only for the addressee. The message may contain privileged, confidential and/or proprietary information intended only for the person(s) named. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Nebraska Methodist Health System and its affiliates in Omaha, Nebraska, U.S.A at (402)354-2280. From pbaker at omnihotels.com Mon Oct 2 13:41:15 2006 From: pbaker at omnihotels.com (Sean Baker) Date: Mon, 2 Oct 2006 15:41:15 -0500 Subject: [Omaha.pm] LWP Message-ID: <29AB736ABCE5C745ABF9C93B02F2C27B0695C60C@exchange2k3.omnihotels.net> >># END FILE PUT PROCESS >># >># END PROGRAM >># >>print "0"; Hi - Are you trying to avoid printing the 0? Sean From Chris.Hefling at nmhs.org Mon Oct 2 13:42:15 2006 From: Chris.Hefling at nmhs.org (Hefling, Chris) Date: Mon, 2 Oct 2006 15:42:15 -0500 Subject: [Omaha.pm] LWP In-Reply-To: <29AB736ABCE5C745ABF9C93B02F2C27B0695C60C@exchange2k3.omnihotels.net> Message-ID: <804D74BA90FBB5418AA7C966CD7D731703210BBA@w2k3ex01.nmhs.org> No, just the CHUNK information. -----Original Message----- From: omaha-pm-bounces+chris.hefling=nmhs.org at pm.org [mailto:omaha-pm-bounces+chris.hefling=nmhs.org at pm.org] On Behalf Of Sean Baker Sent: Monday, October 02, 2006 3:41 PM To: Perl Mongers of Omaha, Nebraska USA Subject: Re: [Omaha.pm] LWP >># END FILE PUT PROCESS >># >># END PROGRAM >># >>print "0"; Hi - Are you trying to avoid printing the 0? Sean _______________________________________________ Omaha-pm mailing list Omaha-pm at pm.org http://mail.pm.org/mailman/listinfo/omaha-pm This message and any included attachments are from Nebraska Methodist Health System and its affiliates and are intended only for the addressee. The message may contain privileged, confidential and/or proprietary information intended only for the person(s) named. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Nebraska Methodist Health System and its affiliates in Omaha, Nebraska, U.S.A at (402)354-2280. From Chris.Hefling at nmhs.org Mon Oct 2 13:48:08 2006 From: Chris.Hefling at nmhs.org (Hefling, Chris) Date: Mon, 2 Oct 2006 15:48:08 -0500 Subject: [Omaha.pm] LWP In-Reply-To: <29AB736ABCE5C745ABF9C93B02F2C27B0695C60C@exchange2k3.omnihotels.net> Message-ID: <804D74BA90FBB5418AA7C966CD7D731703210BBB@w2k3ex01.nmhs.org> If we download files using the ASK-EDI web interface we don't seem to have any of that chunk information in the files, but when we use my program to download the files that chunk information is in the files. -----Original Message----- From: omaha-pm-bounces+chris.hefling=nmhs.org at pm.org [mailto:omaha-pm-bounces+chris.hefling=nmhs.org at pm.org] On Behalf Of Sean Baker Sent: Monday, October 02, 2006 3:41 PM To: Perl Mongers of Omaha, Nebraska USA Subject: Re: [Omaha.pm] LWP >># END FILE PUT PROCESS >># >># END PROGRAM >># >>print "0"; Hi - Are you trying to avoid printing the 0? Sean _______________________________________________ Omaha-pm mailing list Omaha-pm at pm.org http://mail.pm.org/mailman/listinfo/omaha-pm This message and any included attachments are from Nebraska Methodist Health System and its affiliates and are intended only for the addressee. The message may contain privileged, confidential and/or proprietary information intended only for the person(s) named. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Nebraska Methodist Health System and its affiliates in Omaha, Nebraska, U.S.A at (402)354-2280. From andy at petdance.com Mon Oct 2 14:14:31 2006 From: andy at petdance.com (Andy Lester) Date: Mon, 2 Oct 2006 16:14:31 -0500 Subject: [Omaha.pm] LWP In-Reply-To: <804D74BA90FBB5418AA7C966CD7D731703210BB9@w2k3ex01.nmhs.org> References: <804D74BA90FBB5418AA7C966CD7D731703210BB9@w2k3ex01.nmhs.org> Message-ID: <20061002211431.GA19717@petdance.com> > use strict; Put in a use warnings here. > use Crypt::SSLeay; > use LWP::UserAgent; > use LWP::Simple; You don't need LWP::Simple if you're using LWP::UserAgent. > # Script Argument Variables > my $arg1=@ARGV[0]; > my $arg2=@ARGV[1]; > my $arg3=@ARGV[2]; > my $arg4=@ARGV[3]; I would strongly suggest naming these something meaningful. Also, @ARGV[n] should be $ARGV[n]. OK, I have to run, so I can't walk through this like I planned. For now, put on "use warnings" and see what comes out. I will bet a nickel it will find your prlblem. -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From jay at jays.net Fri Oct 6 04:51:21 2006 From: jay at jays.net (Jay Hannah) Date: Fri, 6 Oct 2006 06:51:21 -0500 Subject: [Omaha.pm] Reminder: Meeting Tue, 10 Oct @ 7pm! In-Reply-To: <4508C559.7010607@jays.net> References: <29AB736ABCE5C745ABF9C93B02F2C27B05A37C5D@exchange2k3.omnihotels.net> <9ac12b1c0609121336xb3dd53eo84a42e7a2aa78525@mail.gmail.com> <450736B0.5090009@jays.net> <4507FF2C.5050603@cfwebtools.com> <4508C559.7010607@jays.net> Message-ID: <42E00D65-6E06-4E79-A0D5-0C17F07843AC@jays.net> Just a friendly reminder. Any food preferences out there? We should probably elect a food /chair(wo)?man/. We need more chairs. :) j On Sep 13, 2006, at 9:58 PM, Jay Hannah wrote: > http://omaha.pm.org/ > Tue, 10 Oct 2006 @ 7pm! > > By request, Jay Hannah will be giving the following presentations: > > 1) Intro to Perl OO programming > 2) Fun with fork. Demos of forking and %SIG handling. > > It'll be a humdinger. Plus the food is to die for. Or maybe booze > instead. :) > > j From jay at jays.net Fri Oct 6 05:29:25 2006 From: jay at jays.net (Jay Hannah) Date: Fri, 6 Oct 2006 07:29:25 -0500 Subject: [Omaha.pm] Perl: datetime stamps (2006-09-28T18:38:07.97-05:0 0) In-Reply-To: <16F8D15756891C4EA961565331A3B350056D402F@JDHEXC01.heiskell.com> References: <16F8D15756891C4EA961565331A3B350056D402F@JDHEXC01.heiskell.com> Message-ID: On Sep 29, 2006, at 8:53 AM, Thompson, Kenn wrote: >> Sean Baker wrote: >> Class::Date and Gmtime perhaps? Hmmm..... > > Seems I remember a wrapper being written for Class::Date that did > nothing > but format the output of Class::Date into various local application > formats. > Why wouldn't that approach apply here, unless you were trying to > improve on > performance? Ya, I thought so too so I tried that back on Sep 29. But %z and tzoffset doesn't seem to work. At least not on my Mac... ---- $ cat j.pl #!/usr/bin/perl use Class::Date; my $stamp = Class::Date::date(time); local $Class::Date::DATE_FORMAT="%Y-%m-%dT%H:%M:%S %z %Z"; print "$stamp\n"; print $stamp->tzoffset; print "\n"; $ perl j.pl 2006-10-06T07:20:57 +0000 CDT -18000 ---- Over on the OTA forum Stephen Adkins posted really tight Date::Format examples (below). They work great on my Mac and are tighter than my Date::Calc version so I think Stephen wins the cookie. (One of these days I'm going to win me one of those cookies. -grin-) j ------ Forwarded Message From: Stephen Adkins Date: Fri, 29 Sep 2006 16:58:31 -0400 To: Subject: [OTA-Impl-Forum] Re: Perl: datetime stamps (2006-09-28T18:38:07.97-05:00) Jay, I use Date::Format and Date::Parse for most of my time/date handling needs in perl. The following two scripts are alternate (and easy) ways to print out dates in ISO (and hence OTA) format (depending on whether you need fractions of seconds or not). Stephen :::::::::::::: go :::::::::::::: #!/usr/bin/perl -w use strict; use Date::Format; my $time = time(); print time2str("%Y-%m-%dT%H:%M:%S%z", $time), "\n"; :::::::::::::: go2 :::::::::::::: #!/usr/bin/perl -w use strict; use Date::Format; use Time::HiRes; my ($time, $usec) = Time::HiRes::gettimeofday(); my $frac = sprintf("%02d", int($usec/10000)); # only top two digits, zero padded print time2str("%Y-%m-%dT%H:%M:%S.$frac%z", $time), "\n"; spadkins at pompeii:/home/spadkins> go; go2 2006-09-29T16:51:34-0400 2006-09-29T16:51:34.79-0400 From jay at jays.net Wed Oct 11 05:00:30 2006 From: jay at jays.net (Jay Hannah) Date: Wed, 11 Oct 2006 07:00:30 -0500 Subject: [Omaha.pm] Fwd: [Kc] draft bylaws of Kansas City netflixprize team References: <934f64a20610092327u503b03f2xa321fb94a8cb93b9@mail.gmail.com> Message-ID: <0060BA2F-4392-4946-AB2D-3688C8B04840@jays.net> Wow. The Kansas City group is really going to town with a Netflix Prize attempt. :) http://www.netflixprize.com/ j Begin forwarded message: > From: "David Nicol" > Date: October 10, 2006 1:27:27 AM CDT > To: "Matthew Wilson" > Cc: kc at mail.pm.org > Subject: [Kc] draft bylaws of Kansas City netflixprize team > > On 10/7/06, Matthew Wilson wrote: >> It's taken me about 10 hours > > > Dave's Proposal: > > * the Kansas City netflixprize (NFP) team will be abbreviated to > KCNFPT > > * KCNFPT is a cooperative effort to win a progress prize in the NFP > contest > > * in the event of winning a prize, proceeds will be divided by > share weight > > * share weight is a linear function of hours worked for KCNFPT, so > that > the sum of all participant's share weights is 1 > > * hours worked are cumulative and nonrevocable > > * to add submitted hours worked to your total they must be approved > by holders > of over half of the share weight before your submission, i.e. > hours approval > motions require 50% share weight to carry > > * you're not allowed to work more than 30 hours a week on KCNFPT > unless > you're currently unemployed, in which case you may work up to 60 > hours > a week on it > > * hours are submitted weekly through the KCNFPT hours submission > mechanism, > which will probably be a web interface by Dave but might just be the > mailing list > > * that's the KCNFPT mailing list, which has not been set up yet > > * on joining KCNFPT, a new participant must declare how many hours > they've > put into their work on the NFP before joining, and that becomes > their initial > hours tally > > * people who leave the team are not eligible for a share, but > leaving the team > can be blocked by a 10% share > > * joining and leaving motions require a 90% approval by share > weight to carry > > * amending these bylaws, which are the contract under which the > team operates > as a team,requires full consensus without abstention (although a 90% > majority can kick > the blocks out to achieve that) > > subject to debate: > > > * participants may leave KCNFPT, but if they leave they may not use > methods > developed within the KCNFPT process in their own NFP submissions or > in the > NFP submissions of other teams; it is expected that multiple NFP > teams may > be used to allow submission of results for scoring more often than > would > otherwise be allowed, and if any team including participating > kcnfpt members > wins, it will be as if kcnfpt had won > > > * there will be a non-disclosure agreement to prevent > leaking of team-proprietary methods before the contest > is over (or we give up) > > > > *********************** > > Executive summary: The team will attempt to support Matthew > Wilson, and > possibly other capable and motivated heros who may appear, by > discussing > direction and strategy and by spiking possibile improvements. Time > invested > in the team equals weight of your share in the event we win > something. Even > without winning, the collaborative experience will be worthwhile as > an example > of a collaborative experience if nothing else. The potential > upside beyond > the contest at hand is the forming of an execution-capable software > engineering > team who are willing and able to work for deferred reward, who may > then seek > future projects with greater expected reward/effort ratios. > _______________________________________________ > kc mailing list > kc at pm.org > http://mail.pm.org/mailman/listinfo/kc From ryan at cfwebtools.com Wed Oct 11 12:39:01 2006 From: ryan at cfwebtools.com (Ryan Stille) Date: Wed, 11 Oct 2006 14:39:01 -0500 Subject: [Omaha.pm] OO book Message-ID: <452D4855.9020906@cfwebtools.com> Jay, what was the OO book you were recommending last night? And did you say we have it in "the library"? -Ryan From jay at jays.net Wed Oct 11 15:57:59 2006 From: jay at jays.net (Jay Hannah) Date: Wed, 11 Oct 2006 17:57:59 -0500 Subject: [Omaha.pm] OO book In-Reply-To: <452D4855.9020906@cfwebtools.com> References: <452D4855.9020906@cfwebtools.com> Message-ID: <452D76F7.8020902@jays.net> Ryan Stille wrote: > Jay, what was the OO book you were recommending last night? http://www.manning.com/conway/ > And did you say we have it in "the library"? Yup. I don't think anyone ever logs into this thing so I stopped putting books into it: http://library.reboottheuser.com/login.php And come to think of it we DON'T have that book because it's O'Reilly (not Manning) that has sent me lots of free books. :) There is a Manning user group program that I could delve if we're interested. Want to be deputized? j From jay at jays.net Fri Oct 13 09:09:16 2006 From: jay at jays.net (Jay Hannah) Date: Fri, 13 Oct 2006 11:09:16 -0500 Subject: [Omaha.pm] [Bioperl-l] Documentation typo: Bio::Search::Result::GenericResult In-Reply-To: References: Message-ID: <452FBA2C.7070003@jays.net> Thanks Brian! My first BioPerl patch has been applied! A one byte typo correction! I'm so excited! :) /home/repository/bioperl/bioperl-live/Bio/Search/Result/GenericResult.pm,v ---------------------------- revision 1.27 date: 2006/10/10 22:41:46; author: bosborne; state: Exp; lines: +4 -4 next_hit, not next_hits ---------------------------- I'm a simple man who takes great satisfaction in the simple things. :) j Brian Osborne wrote: > j, > > No need, not for something so simple. > > Brian O. > > > On 10/7/06 6:34 PM, "Jay Hannah" wrote: >> Except that "next_hits()" does not exist. Should be "next_hit()". >> >> (Should I have posted a patch instead?) > From jhannah at omnihotels.com Fri Oct 20 11:40:29 2006 From: jhannah at omnihotels.com (Jay Hannah) Date: Fri, 20 Oct 2006 13:40:29 -0500 Subject: [Omaha.pm] Burned be a one-liner Message-ID: <29AB736ABCE5C745ABF9C93B02F2C27B05A37EA9@exchange2k3.omnihotels.net> -laugh- I was wondering why my report was wrong. Don't make this mistake. :) j $ cat j A B A B XXX B A B A $ cat j | perl -ne '/(\w) (\w)/; print "$1 $2\n";' | sort | uniq -c 3 A B 2 B A ---- Question: There aren't 3 "A B" strings in my file. Why does my one-liner lie to me? Answer: Because $1 and $2 are not cleared when the regex doesn't match on the XXX line. doh! From jhannah at omnihotels.com Fri Oct 20 11:41:04 2006 From: jhannah at omnihotels.com (Jay Hannah) Date: Fri, 20 Oct 2006 13:41:04 -0500 Subject: [Omaha.pm] Burned by a one-liner Message-ID: <29AB736ABCE5C745ABF9C93B02F2C27B05A37EAA@exchange2k3.omnihotels.net> > Subject: Burned be a one-liner Errr... Burned BY a one-liner. -grin- j From jhannah at omnihotels.com Fri Oct 20 11:44:01 2006 From: jhannah at omnihotels.com (Jay Hannah) Date: Fri, 20 Oct 2006 13:44:01 -0500 Subject: [Omaha.pm] another quickie report Message-ID: <29AB736ABCE5C745ABF9C93B02F2C27B05A37EAB@exchange2k3.omnihotels.net> Given data like this: 2006-10-16 00:00:00,298 (Pairs.pm:231)> HD 00 180353311CF983 [AUSSTH|18OCT06|22OCT06|4] [PALSRQ|ERRRP-DEEIND-ERC10|Omni Farm] 0.350898 2006-10-16 00:00:04,515 (Pairs.pm:231)> 1P 1P 0A1953311D3112 [CANCUN|02NOV06|05NOV06|3] [PALSRQ|PALSRP|Omni Farm] 1.202273 Create a report like this: BOOKRQ BOOKRP 5547 messages averaging 1.57 seconds each AALSRQ AALSRP 8946 messages averaging 0.73 seconds each PALSRQ ERRRP 64200 messages averaging 0.69 seconds each PALSRQ PALSRP 99857 messages averaging 1.20 seconds each RPINRQ RPINRP 12294 messages averaging 0.59 seconds each Solution: while (<>) { my ($in, $out, $time) = /\[.*\] \[(\w+)\|(\w+).*(\d+\.\d+)/; next unless $in; $stats{$in}{$out}{total} += $time; $stats{$in}{$out}{cnt}++; } my ($in, $out); foreach $in (keys %stats) { foreach $out (keys %{$stats{$in}}) { $cnt = $stats{$in}{$out}{cnt}; $total = $stats{$in}{$out}{total}; printf("%s %s %d messages averaging %0.2f seconds each\n", $in, $out, $cnt, $total / $cnt); } } From sjedwards at omnihotels.com Fri Oct 20 15:38:06 2006 From: sjedwards at omnihotels.com (Sean J. Edwards) Date: Fri, 20 Oct 2006 17:38:06 -0500 Subject: [Omaha.pm] [Bioperl-l] Documentation typo: Bio::Search::Result::GenericResult In-Reply-To: <452FBA2C.7070003@jays.net> References: <452FBA2C.7070003@jays.net> Message-ID: <1161383886.32669.2.camel@sjedwards.omnihotels.com> Jay, Are you done with my book yet? On Fri, 2006-10-13 at 11:09 -0500, Jay Hannah wrote: > Thanks Brian! > > My first BioPerl patch has been applied! A one byte typo correction! I'm so excited! :) > > /home/repository/bioperl/bioperl-live/Bio/Search/Result/GenericResult.pm,v > ---------------------------- > revision 1.27 > date: 2006/10/10 22:41:46; author: bosborne; state: Exp; lines: +4 -4 > next_hit, not next_hits > ---------------------------- > > I'm a simple man who takes great satisfaction in the simple things. :) > > j > > > > > Brian Osborne wrote: > > j, > > > > No need, not for something so simple. > > > > Brian O. > > > > > > On 10/7/06 6:34 PM, "Jay Hannah" wrote: > >> Except that "next_hits()" does not exist. Should be "next_hit()". > >> > >> (Should I have posted a patch instead?) > > > > _______________________________________________ > Omaha-pm mailing list > Omaha-pm at pm.org > http://mail.pm.org/mailman/listinfo/omaha-pm > -- -=Sean Edwards=- Omni Hotels Reservation Center 11819 Miami St 3rd Floor Omaha, NE 68164 sjedwards at omnihotels.com 402-952-6528 Omni Hotels is proud to be ranked Highest In Guest Satisfaction Among Upscale Hotel Chains by J.D. Power and Associates for the second consecutive year. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/omaha-pm/attachments/20061020/d0ed00ff/attachment.html From jhannah at omnihotels.com Mon Oct 23 14:33:00 2006 From: jhannah at omnihotels.com (Jay Hannah) Date: Mon, 23 Oct 2006 16:33:00 -0500 Subject: [Omaha.pm] Pick a random array element ... beware the web experts :) Message-ID: <29AB736ABCE5C745ABF9C93B02F2C27B05A37ED6@exchange2k3.omnihotels.net> This is a great little explanation I hit Googling for how to pick a random array element today: http://www.webmasterworld.com/forum13/668.htm Except.... at the end when he shows the one liner: #now all together @a = ($text1,$text2,$text3,...,'unused element'); print $a[int rand($#a)]; It's wrong. The correct print statement is: print $a[int rand($#a + 1)]; because $#a is not the number of elements, its the highest index of @a. Here's the bug demo'd: $ cat j2.pl my @a = ("X", "Y"); for (1..50) { print $a[ int rand($#a) ]; } print "\n"; for (1..50) { print $a[ int rand($#a + 1) ]; } print "\n"; $ perl j2.pl XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XYXYYXXYYXXXXYYXXXYXXYYXXXYYYYXYYXXYYXYXXYYXXYXYYX Oops. Beware the experts*. :) j * and emails from me. >:) From dave.nerd at gmail.com Mon Oct 23 14:39:24 2006 From: dave.nerd at gmail.com (Dave M) Date: Mon, 23 Oct 2006 16:39:24 -0500 Subject: [Omaha.pm] Pick a random array element ... beware the web experts :) In-Reply-To: <29AB736ABCE5C745ABF9C93B02F2C27B05A37ED6@exchange2k3.omnihotels.net> References: <29AB736ABCE5C745ABF9C93B02F2C27B05A37ED6@exchange2k3.omnihotels.net> Message-ID: <9ac12b1c0610231439p14740b8ap8718b0ed52f6ee3b@mail.gmail.com> On 10/23/06, Jay Hannah wrote: > > This is a great little explanation I hit Googling for how to pick a > random array element today: > > http://www.webmasterworld.com/forum13/668.htm > > Except.... at the end when he shows the one liner: > > #now all together > @a = ($text1,$text2,$text3,...,'unused element'); > print $a[int rand($#a)]; > > It's wrong. The correct print statement is: > > print $a[int rand($#a + 1)]; > Just to be difficult :), what's wrong with this: print "rand = ", $a[int rand(@a)], "\n"; ? From andy at petdance.com Mon Oct 23 17:00:37 2006 From: andy at petdance.com (Andy Lester) Date: Mon, 23 Oct 2006 19:00:37 -0500 Subject: [Omaha.pm] Pick a random array element ... beware the web experts :) In-Reply-To: <29AB736ABCE5C745ABF9C93B02F2C27B05A37ED6@exchange2k3.omnihotels.net> References: <29AB736ABCE5C745ABF9C93B02F2C27B05A37ED6@exchange2k3.omnihotels.net> Message-ID: On Oct 23, 2006, at 4:33 PM, Jay Hannah wrote: > print $a[int rand($#a + 1)]; > > because $#a is not the number of elements, its the highest index of > @a. All you really needs is @a[rand @a]. xoxo, Andy -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From jay at jays.net Wed Oct 25 05:52:22 2006 From: jay at jays.net (Jay Hannah) Date: Wed, 25 Oct 2006 07:52:22 -0500 Subject: [Omaha.pm] Pick a random array element ... beware the web experts :) In-Reply-To: References: <29AB736ABCE5C745ABF9C93B02F2C27B05A37ED6@exchange2k3.omnihotels.net> Message-ID: <8B260CD4-7406-4451-96EB-D77C0B03E83F@jays.net> On Oct 23, 2006, at 7:00 PM, Andy Lester wrote: > All you really needs is @a[rand @a]. ?! Well... paint me pink and call me Sally... $ cat j.pl my @a = ("A", "B", "C"); for (1..50) { print @a[rand @a]; } print "\n"; $ perl j.pl BACCACACCCCBCABCBCABBCACCCCBCBCCBACCABCBABBAABCACC Andy is some mad genius type! Where do you hang out learning all this stuff? j From jay at jays.net Wed Oct 25 05:55:29 2006 From: jay at jays.net (Jay Hannah) Date: Wed, 25 Oct 2006 07:55:29 -0500 Subject: [Omaha.pm] Pick a random array element ... beware the web experts :) In-Reply-To: <9ac12b1c0610231439p14740b8ap8718b0ed52f6ee3b@mail.gmail.com> References: <29AB736ABCE5C745ABF9C93B02F2C27B05A37ED6@exchange2k3.omnihotels.net> <9ac12b1c0610231439p14740b8ap8718b0ed52f6ee3b@mail.gmail.com> Message-ID: <5D1FF144-4D47-45B9-B090-F43AE4A62963@jays.net> On Oct 23, 2006, at 4:39 PM, Dave M wrote: > Just to be difficult :), what's wrong with this: > > print "rand = ", $a[int rand(@a)], "\n"; Nothing? I just tried it and it seems to do what I thought it would. (It suffers from not being as neato as Andy's Perl Golfy version though. -grin-) j $ cat j.pl my @a = ("A", "B", "C"); for (1..50) { print "rand = ", $a[int rand(@a)], "\n"; } $ perl j.pl | head rand = A rand = B rand = A rand = B rand = C rand = C rand = C rand = B rand = B rand = B From andy at petdance.com Wed Oct 25 06:45:12 2006 From: andy at petdance.com (Andy Lester) Date: Wed, 25 Oct 2006 08:45:12 -0500 Subject: [Omaha.pm] Pick a random array element ... beware the web experts :) In-Reply-To: <8B260CD4-7406-4451-96EB-D77C0B03E83F@jays.net> References: <29AB736ABCE5C745ABF9C93B02F2C27B05A37ED6@exchange2k3.omnihotels.net> <8B260CD4-7406-4451-96EB-D77C0B03E83F@jays.net> Message-ID: > > Where do you hang out learning all this stuff? I've been doing Perl for over 10 years. :-) -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From jay at jays.net Fri Oct 27 04:21:57 2006 From: jay at jays.net (Jay Hannah) Date: Fri, 27 Oct 2006 06:21:57 -0500 Subject: [Omaha.pm] Jay on IRC - print "$j " . int($j) . "\n"; # prints '14 13' Message-ID: For the archive, here's me on IRC a year ago or something. #perl is explaining perl and C black magic to me. There may or may not have been a bug in my Perl / kernel installation... That was one of those mind blowing mornings where perl was not doing what I thought it should. :) j #perl: +ascent_ +phuct +nocarrier +Skunk *** End of /NAMES list. *** Channel Mode is +spmtnl 123 *** Channel created at Monday, April 16, 2001 5:48:56 AM *** #perl You're not channel operator *** Mode change "+v dferret" on #perl by Roderick dferret: my $j = (log 16384) / (log 2); dferret: print "$j " . int($j) . "\n"; # prints '14 13' dferret: Whats up with that? If $j is really 13.9999999999 why doesn't it print like that? dferret: (Linux 2.4.17) joe321: number_format($num, 2) == 12.34 joe321: oops joe321: wrong language Kyriel: Beat me, daddy, eight-to-the-bar. Somni: perldoc -q decimal Somni: and follow the perlop reference dferret: I understand perldoc -q decimal. I don't understand why, if $j is really 13.99999999999 when I do a print $j it prints "14"...? dferret: If 'print $j' spit out 13.999999999999 I'd understand the problem. *** taer (~tdunn at adsl-64-175-241-190.dsl.sntc01.pacbell.net) has joined channel #perl *** Mode change "+v taer" on #perl by Roderick Somni: dferret: because floating point numbers are imprecise corwin_: [corwin at gw3 corwin]$ perl -le '$a = 13.99999999999; print $a' corwin_: 13.99999999999 cfedde: remember all that limit stuff from calculus? Well here it is again. Psyche^: they are precise... they're just not real numbers in the mathematical sense :-) Somni: the floating point value doesn't match the reality of the calculation; I would call that imprecise dferret: So you're saying that print might round a floating point up to 14? I thought print would always print 13.9999999999 as 13.9999999999999, but I'm getting "14". I didn't think print would round. wadi3: how can I store the output of an sql statement in a $var? cfedde: wadi3: read about the DBI corwin_: beat me to it cfedde :-) Psyche^: floats are computer numbers and not mathematical numbers. you just expect too much from the poor things... cfedde: dferret: perl -le 'my $j = (log 16384) / (log 2); print "$j " . int($j)' cfedde: 14 14 *** Signoff: taer (Ping timeout: 378 seconds) dferret: I get '14 13' w/ Perl 5.8.0 on Linux 2.4.17 cfedde: perl -v -> This is perl, v5.8.2 built for i386-freebsd dferret: Did I compile in the PRINT_FUNCTION_ROUNDS var? :p Somni: I get 14 14 with 5.8.0 on Linux 2.4.22 Somni: dferret: it has nothing to do with print Psyche^: 14 14 5.8.2 2.6.0t11 dferret: Must be a Linux bug. I'll email Linus. -grin- *** Signoff: wadi3 () dferret: What do you mean it's not print? The only reason int($j) would spit out 13 on my box is that $j is really 13.9999999999 but print $j is showing 14 -- meaning that print is rounding, right? - ponder- Somni: dferret: print is how you happen to be stringifying the number Somni: it has to do with how computers deal with floating point values dferret: I expected it to stringify 13.999999999 as 13.9999999999, not 14. I didn't know print would stringify upwards. Somni: how have you determined 13.9999999999 is the correct result? even bc says it's supposed to be 14.00000000000000000014 cfedde: dferret: there has to be something odd in the way that your math libraries are working. Is your perl using some wierd version of log? dferret: I figured it must be slightly < 14 because int($j) spits out 13. int() rounds down, right? Somni: my TI-85 says it's 14 *** alkatraz (~ugh at ip68-9-124-191.ri.ri.cox.net) has joined channel #perl *** Mode change "+v alkatraz" on #perl by Roderick dferret: How would I know what log perl is using? Somni: int rounds towards zero, effectively; it just strips off the integral part cfedde: s/ingegral/fractional/ dferret: Right, do that's how I "deetermined" that it must be 13.9999999999 not 14.000000000001 Somni: integral, and returns it *** Signoff: morfic (Quit: Leaving) dferret: s/do/so/ *** morfic (~U3N at cs662583-130.satx.rr.com) has joined channel #perl *** Mode change "+v morfic" on #perl by Roderick Somni: dferret: what does bc or dc say? dferret: ...err... command line? Can't find those commands. (Excuse my ignorance.) Somni: echo "l(16384) / l(2)" | bc -l dferret: bc: command not found Somni: write a C program then cfedde: what kind of flakey linux distribution does not have bc? Somni: #include \n#include \nint main () { printf("%.20f\n", log(16384) / log(2)); return 1; } Somni: or something to that effect *** Signoff: zerologic (Read error: Connection reset by peer) dferret: jhannah at hannibal:~/cgi-bin$ ./j dferret: 14.00000000000000000000 Somni: is perl linked to the same libm your new program is? *** Signoff: epyon_II (Ping timeout: 624 seconds) *** tdunn (~tdunn at adsl-64-175-241-190.dsl.sntc01.pacbell.net) has joined channel #perl *** Mode change "+v tdunn" on #perl by Roderick Somni: ldd j; ldd `which perl` dferret: ldd shows both my perl and my new C prog are using the exact same /lib/lib* files... Somni: do you have Devel::Peek installed? *** zubs (~zubz at user-0ccemmv.cable.mindspring.com) has joined channel #perl *** Mode change "+v zubs" on #perl by Roderick dferret: yes... zubs: if i want to find any of these characters \/:*?"<>| what would the regex code look like? Somni: perl -MDevel::Peek -wle '$j = log(16384) / log(2); Dump ($j);' Somni: zubs: perldoc perlre, perldoc perlretut, perldoc perlrequick *** Signoff: morfic (Quit: Leaving) Somni: dferret: paste the result to knowpaced knowpaced: I'm a pastebot! Paste stuff at http://pastebot.nd.edu/perl zubs: thx dferret: SV = PVNV(0x8165510) at 0x814bfb0 dferret: REFCNT = 1 dferret: FLAGS = (NOK,pIOK,pNOK) dferret: IV = 13 dferret: NV = 14 dferret: PV = 0 Somni: ugh dferret: What does that mean? -laugh- dngor: dferret: Bzt. corwin_: dferret: knowpaced knowpaced: I'm a pastebot! Paste stuff at http://pastebot.nd.edu/perl *** Signoff: tdunn (Ping timeout: 240 seconds) *** Signoff: joe321 () *** Mode change "+l 121" on #perl by Roderick Somni: dferret: at most it's proof your problem has nothing to do with print Somni: that perl is shoving two different values in the IV and NV elements is a little odd dferret: -ponder- We're way over my head here. dferret grins *** morfic (~U3N at cs662583-130.satx.rr.com) has joined channel #perl *** Mode change "+v morfic" on #perl by Roderick Psyche^: i get FLAGS = (NOK,pNOK) NV = 14 *** tdunn (~tdunn at adsl-64-175-241-190.dsl.sntc01.pacbell.net) has joined channel #perl Psyche^: why is IV set at all? *** Mode change "+v tdunn" on #perl by Roderick Somni: it's set on mine too Somni: but to 14 Psyche^: your perl sucks, mine is better. bwuahahaha *** Signoff: tdunn (Read error: Operation timed out) Somni: heh dferret: 5.8.0 problem? Somni: dferret: nope Somni: probably some combination of compile flags Somni: paste perl -V output to knowpaced, that's PASTE TO KNOWPACED knowpaced: I'm a pastebot! Paste stuff at http://pastebot.nd.edu/perl knowpaced: "dferret" at 68.13.20.113 pasted "perl -V" at http:// pastebot.nd.edu:80/304 Somni: Psyche^: do you have uselongdouble defined in your perl -V? Psyche^: uselongdouble=undef Somni: dferret: that may be your culprit, though it's hard to say Somni: you could try recompiling without it, upgrade to 5.8.2, or just stick it out Somni: I may compile a perl with it enabled to see if that's it when I get back cwilbur: evening all. *** zubs has left channel #perl dferret: I was justs surprised as all sheeot that it happened. I thought print always printed whatever.... I guess something wacky must be happening internally. Anyhoozit, I'll probaby just use sprintf to turn 13.999999999999 into 14? Somni: the value -is- 14, something is being miscalculated internally cwilbur: this sounds like a floating point rounding problem. Somni: it did initially cwilbur: though I have only skimmed about a page of scrollback. Somni: but the IV for the value is 13, when every calculation I've done makes it out as 14 Somni: and several versions of perl agree Somni: anyways, afk, dinner *** Signoff: Somni (dinner) cwilbur: right, but if the floating-point math comes out to 13.999999, wouldn't the IV most appropriately be 13? dferret: I don't know anything about IV, so w/ Somni gone talking to me will be like talking to a wall. -grin- cfedde: It appears that different implementations of the log function over estemate or underestemate. dferret: Ya, my mystery though was that print is printing 14, not 13.99999999999 like I'd expect. dferret: perl -le 'my $j = (log 16384) / (log 2); print "$j " . int ($j)' dferret: On my system that prints "14 13". Everyone else gets "14 14". cfedde: yes. I was the silly person that pasted the command line yuo just pasted back dferret: My explanation is that $j is 13.9999999999999 so int takes it to 13, which I expect. I didn't expect print to "round" to 14 though...? (I'm just recapping for cwilbur.) cwilbur: well, the next question is, what's different about your system? cwilbur: (both my systems say 14 14.) dferret: Somni's theory was that I have USE_LONG_DOUBLE compiled into perl. cwilbur: that could be. cwilbur: neither of my systems have USE_LONG_DOUBLE compiled in. cfedde: dferret: is this a perl that came with your distribution? or did you compile it yourself? dferret: ? I'm on perl 5.8.0. Is this something I should take the time to actually formalize for Perl 5 porters? dferret: This isn't my server -- I don't know what distro it is or how Perl got on there. I can call the guy. cfedde: don't worry about it. cwilbur: it's probably worth documenting. dferret: Is it a bug? I expected print to print 13.9999999999, but maybe that was a bad assumption? dferret: Maybe I should just learn that print might "round" too? Or would that be a lesson that no one should learn? cfedde: perl -le 'print 13.9999999999999, " ", 13.99999999999999' cfedde: 13.9999999999999 14 cfedde: isn't that odd? Psyche^: no, 14 is even. cwilbur: print probably tries to do the right thing. dferret: I get 13.9999999999999 13.99999999999999 cwilbur: having taken rounding error into account. cfedde: Keep extending the 9s on the second one till you get 14 dferret: (Because of my USE_LONG_DOUBLE?) Psyche^: same as cfedde here cfedde: it's the default number template for printf cfedde: because of USE_LONG_DOUBLE, yes cfedde: s/f$//; *** elkane (kane at phree.ne.client2.attbi.com) has joined channel #perl *** Mode change "+v elkane" on #perl by Roderick dferret: perl -le 'print 13.9999999999999999, " ", 13.99999999999999999' dferret: 13.9999999999999999 14 dferret: Your cutoff is 14 9s, mine is 17? cfedde: I guess that you win! *** peanuter (worldapart at host-64-179-13-126.syr.choiceone.net) has joined channel #perl cwilbur: well, you're using long doubles. *** Mode change "+v peanuter" on #perl by Roderick dferret: So my log is rounding to a precision my print can't handle? cfedde: dferret: no that's not it. *** Signoff: jaredy (Quit: leaving) cfedde: read the description of $# in perldoc perlvar *** jaredy (~jaredy at dorms-pppoe-1-74-225.pittsburgh.resnet.pitt.edu) has joined channel #perl *** Mode change "+v jaredy" on #perl by Roderick dferret: perldoc says: Use of $# is deprecated. -grin- cfedde: but it gives you a hint about what is happening. dferret: perl -e 'print $#' doesn't print anything cfedde: perl's print is written in terms of printf. If your perl defines USE_LONG_DOUBLE then it changes the number of digits that print prints before rounding. dferret: hmm... Why would you ever want print to round? Wouldn't you want it to always print the full float? Rounding is for printf, isn't it? cfedde: perl -e 'printf "%5.2f %5.2f\n", 13.99, 13.999' cfedde: perl's print rounds by default. cfedde: and apparently USE_LONG_DOUBLE controls some aspect of it. Leolo: purl, seen kismet purl: kismet was last seen on #perl 4 hours, 31 minutes and 3 seconds ago, saying: Ok, IBMs little download dealio is.... weird [Wed Dec 10 19:33:59 2003] *** Signoff: elkane () dferret: Seems strange to me. I would think that print wouldn't round by default so it would be easy to see the whole float. dferret: perl -le 'my $j = (log 16384) / (log 2); printf("% 0.200f", $j)' dferret: 13.999999999999999999132638262011596452794037759304046630859375000000000 000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000 arp: nice cfedde: Where do you suppose accuracy of that number begins to falter? dferret: So what's the easy way to print a whole float? If I can't trust print to do it because print is rounding? I can't printf 'cause I don't know where the float actually ends? dferret: "whole float" as in to whatever precision $j is actually living in memory. cfedde: remember that even double floats are approximations of the actual value with some posible error. dferret: Sure. I understand. In the case above I would expect print to print "13.999999999999999999132638262011596452794037759304046630859375". If I wanted it rounded I'd printf it myself. You said print rounds by default -- is there a way to disable that? cfedde: nope whorian: hi *** yoo (~momo at 200.86.20.13) has joined channel #perl *** Mode change "+v yoo" on #perl by Roderick dferret: weird. cfedde: and the the authors of perl are probably smarter than you about were the error begins. dferret: I'm sure they are. Listening to a Damian lecture gives me a headache due to excessive brilliance. -grin- *** yoo has left channel #perl cfedde: the number of decemal places that print uses is usualy too many for most practical purposes anyway. cfedde: perldoc perlnumber dngor: EYE-NUMBINGLY BRIGHT whorian: WHAT dferret: The lesson I learned tonight is: Just because print spits out a round number doesn't mean that your scalar has a round number in it. It may be rounded. I didn't know that. I thought print would always print all the precision in memory. cfedde: usualy when you are working with floating point numbers you want to see if your result is within some error brackets. dferret: s/It may be rounded/print may be rounding your scalar for you/ dferret: error brackets? cfedde: s/ may be/is/ dferret: ya. cfedde: usualy you want to test that your result is within say 10e-3 or 10e-6 of what you expect cfedde: digits beyond the expected accuracy are just noise. Leolo: there's a var that controls print's precision, iirc dferret: Ya, but I don't know what I'm expecting, I'm just expecting something rediculously close to an integer, so I'll just use sprintf("%.0f", $j) to force it into an int for me... I didn't know I had to be paranoid in that way. cfedde: Leolo: we found $#. but it appears to be depreciated. Leolo: $# The output format for printed numbers. Leolo: right dferret grins Leolo: dferret : why not use int() to force it into an int? cfedde: dferret: you need to decide what "rediculously close" means in your context. cfedde: Leolo: read the backlog dferret laughs dferret: I could paste the backlog into channel? -mischevious grin- Leolo: the back-log can't be nearly as boring as the proposal I'm writting dferret: I hope it's a bikeshed. I like bikesheds. From jay at jays.net Mon Oct 30 05:49:13 2006 From: jay at jays.net (Jay Hannah) Date: Mon, 30 Oct 2006 07:49:13 -0600 Subject: [Omaha.pm] Did someone borrow "Beginning Perl for Bioinformatics" from me? Message-ID: <20A981BF-5FFB-4085-B7CB-45CF4488E5D6@jays.net> The owner is looking for me to return it and I don't see to have it. :) j