From tigerpeng2001 at yahoo.com Fri Jul 4 17:02:14 2008 From: tigerpeng2001 at yahoo.com (tiger peng) Date: Fri, 4 Jul 2008 17:02:14 -0700 (PDT) Subject: [Chicago-talk] Any Suggestion on Free Web Page/Site tool? Message-ID: <872802.26497.qm@web58701.mail.re1.yahoo.com> I want to build my own website on a Linux box in my basement, but I only have little experience on it and built some very simple pages with vi and perl CGI. I googled some free tool, but do not know which one is good. Could anyone provided some suggestions? Thanks, Tiger -------------- next part -------------- An HTML attachment was scrubbed... URL: From richard at rushlogistics.com Sun Jul 6 12:48:54 2008 From: richard at rushlogistics.com (Richard Reina) Date: Sun, 06 Jul 2008 15:48:54 -0400 (EDT) Subject: [Chicago-talk] detecting whether a scalar is number or a string. Message-ID: <20080706194854.56CA9589E@alexander.xo.com> Hello and Happy Sunday to All, Can someone tell me please how I can test whether a string is number or not. so to differentiate from: my $string = "anssds"; and $string = "5879873454"; Thanks for your attention. Have a great day! From shawn.c.carroll at gmail.com Sun Jul 6 12:57:24 2008 From: shawn.c.carroll at gmail.com (Shawn Carroll) Date: Sun, 6 Jul 2008 14:57:24 -0500 Subject: [Chicago-talk] detecting whether a scalar is number or a string. In-Reply-To: <20080706194854.56CA9589E@alexander.xo.com> References: <20080706194854.56CA9589E@alexander.xo.com> Message-ID: On Sun, Jul 6, 2008 at 2:48 PM, Richard Reina wrote: > Hello and Happy Sunday to All, > > Can someone tell me please how I can test whether a string is number or not. > > so to differentiate from: > > my $string = "anssds"; > > and > > $string = "5879873454"; > > Thanks for your attention. Have a great day! > _______________________________________________ $string =~ m/[:digit:]/; -or- $string =~ m/[:alpha:]; -- shawn.c.carroll at gmail.com Perl Programmer Soccer Referee From chicago.pm at galumph.com Sun Jul 6 13:19:39 2008 From: chicago.pm at galumph.com (Elliot Shank) Date: Sun, 06 Jul 2008 15:19:39 -0500 Subject: [Chicago-talk] detecting whether a scalar is number or a string. In-Reply-To: References: <20080706194854.56CA9589E@alexander.xo.com> Message-ID: <487128DB.9050006@galumph.com> Shawn Carroll wrote: > On Sun, Jul 6, 2008 at 2:48 PM, Richard Reina > wrote: >> Can someone tell me please how I can test whether a string is >> number or not. >> >> so to differentiate from: >> >> my $string = "anssds"; >> >> and >> >> $string = "5879873454"; >> >> Thanks for your attention. Have a great day! >> _______________________________________________ > > $string =~ m/[:digit:]/; -or- $string =~ m/[:alpha:]; Also see Scalar::Util::looks_like_number(), which actually asks the perl VM. From richard at rushlogistics.com Sun Jul 6 17:41:37 2008 From: richard at rushlogistics.com (Richard Reina) Date: Sun, 06 Jul 2008 20:41:37 -0400 (EDT) Subject: [Chicago-talk] detecting whether a scalar is number or a string. In-Reply-To: <20080706194854.56CA9589E@alexander.xo.com> Message-ID: <20080707004137.4A6881DE1@victory.xo.com> Thanks for the reply but when I try: $string = "859684"; if ($string =~ m/[:digit:]/) { print "this is numeric\n"; } I get: POSIX syntax [: :] belongs in character classes regex; ---- Chicago.pm chatter wrote: > > On Sun, Jul 6, 2008 at 2:48 PM, Richard Reina wrote: > > Hello and Happy Sunday to All, > > > > Can someone tell me please how I can test whether a string is number or not. > > > > so to differentiate from: > > > > my $string = "anssds"; > > > > and > > > > $string = "5879873454"; > > > > Thanks for your attention. Have a great day! > > _______________________________________________ > > $string =~ m/[:digit:]/; > -or- > $string =~ m/[:alpha:]; > > -- > shawn.c.carroll at gmail.com > Perl Programmer > Soccer Referee > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From shawn.c.carroll at gmail.com Sun Jul 6 18:03:27 2008 From: shawn.c.carroll at gmail.com (Shawn Carroll) Date: Sun, 6 Jul 2008 20:03:27 -0500 Subject: [Chicago-talk] detecting whether a scalar is number or a string. In-Reply-To: <20080707004137.4A6881DE1@victory.xo.com> References: <20080706194854.56CA9589E@alexander.xo.com> <20080707004137.4A6881DE1@victory.xo.com> Message-ID: Sorry, too quick to answer: $string =~ m/[[:digit:]]/; -or- $string =~ m/[[:alpha:]]/; http://perldoc.perl.org/perlre.html#Regular-Expressions For further instruction. On Sun, Jul 6, 2008 at 7:41 PM, Richard Reina wrote: > > Thanks for the reply but when I try: > > $string = "859684"; > > if ($string =~ m/[:digit:]/) { > print "this is numeric\n"; > } > > I get: > > POSIX syntax [: :] belongs in character classes regex; > > > ---- Chicago.pm chatter wrote: >> >> On Sun, Jul 6, 2008 at 2:48 PM, Richard Reina wrote: >> > Hello and Happy Sunday to All, >> > >> > Can someone tell me please how I can test whether a string is number or not. >> > >> > so to differentiate from: >> > >> > my $string = "anssds"; >> > >> > and >> > >> > $string = "5879873454"; >> > >> > Thanks for your attention. Have a great day! >> > _______________________________________________ >> >> $string =~ m/[:digit:]/; >> -or- >> $string =~ m/[:alpha:]; >> >> -- >> shawn.c.carroll at gmail.com >> Perl Programmer >> Soccer Referee >> _______________________________________________ >> Chicago-talk mailing list >> Chicago-talk at pm.org >> http://mail.pm.org/mailman/listinfo/chicago-talk >> > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > -- shawn.c.carroll at gmail.com Perl Programmer Soccer Referee From andy at petdance.com Sun Jul 6 18:05:53 2008 From: andy at petdance.com (Andy Lester) Date: Sun, 6 Jul 2008 20:05:53 -0500 Subject: [Chicago-talk] detecting whether a scalar is number or a string. In-Reply-To: References: <20080706194854.56CA9589E@alexander.xo.com> <20080707004137.4A6881DE1@victory.xo.com> Message-ID: <639A7152-C6E5-4497-9AE6-5E1F2612DE87@petdance.com> On Jul 6, 2008, at 8:03 PM, Shawn Carroll wrote: > Sorry, too quick to answer: > $string =~ m/[[:digit:]]/; > -or- > $string =~ m/[[:alpha:]]/; > But that's incomplete because $string = "lsdkf3123" will be seen as a number, when it is not. The low tech way to do it is my $n = $string + 0; if ( $n == $string ) { # then string is a number } This is all answered in the FAQ anyway. -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From andy at petdance.com Sun Jul 6 18:12:04 2008 From: andy at petdance.com (Andy Lester) Date: Sun, 6 Jul 2008 20:12:04 -0500 Subject: [Chicago-talk] detecting whether a scalar is number or a string. In-Reply-To: <639A7152-C6E5-4497-9AE6-5E1F2612DE87@petdance.com> References: <20080706194854.56CA9589E@alexander.xo.com> <20080707004137.4A6881DE1@victory.xo.com> <639A7152-C6E5-4497-9AE6-5E1F2612DE87@petdance.com> Message-ID: The Big question, Richard, is why you want to know if it's a number or not. What will you do based on whether it is or isn't? Are you trying to validate input to a subroutine? Then take a look at Params::Validate which already has solved this problem. xoa -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From joshua.mcadams at gmail.com Sun Jul 6 18:42:29 2008 From: joshua.mcadams at gmail.com (Joshua McAdams) Date: Sun, 6 Jul 2008 20:42:29 -0500 Subject: [Chicago-talk] Any Suggestion on Free Web Page/Site tool? In-Reply-To: <872802.26497.qm@web58701.mail.re1.yahoo.com> References: <872802.26497.qm@web58701.mail.re1.yahoo.com> Message-ID: <49d805d70807061842r5c77b64fnf2d0c936b744bc8e@mail.gmail.com> > I want to build my own website on a Linux box in my basement, but I only > have little experience on it and built some very simple pages with vi and > perl CGI. I googled some free tool, but do not know which one is good. Could > anyone provided some suggestions? Apache with CGI scripts is a decent starting place. If you want to do something more complex, Catalyst or Jifty would be good choices. From richard at rushlogistics.com Sun Jul 6 19:04:56 2008 From: richard at rushlogistics.com (Richard Reina) Date: Sun, 06 Jul 2008 22:04:56 -0400 (EDT) Subject: [Chicago-talk] detecting whether a scalar is number or a string. In-Reply-To: <20080706194854.56CA9589E@alexander.xo.com> <20080707004137.4A6881DE1@victory.xo.com> <639A7152-C6E5-4497-9AE6-5E1F2612DE87@petdance.com> Message-ID: <20080707020456.CEDB726FE@courageux.xo.com> Andy, Thanks so much for the response. It's just a one time use, throw away script to validate data before it gets entered into a table. I will try your "low tech" way and if it works for me I am going to run with it. Thanks again! Have an awesome week everybody! ---- Chicago.pm chatter wrote: > > The Big question, Richard, is why you want to know if it's a number or > not. What will you do based on whether it is or isn't? Are you > trying to validate input to a subroutine? Then take a look at > Params::Validate which already has solved this problem. > > xoa > > -- > Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance > > > > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From andy at petdance.com Sun Jul 6 19:06:03 2008 From: andy at petdance.com (Andy Lester) Date: Sun, 6 Jul 2008 21:06:03 -0500 Subject: [Chicago-talk] detecting whether a scalar is number or a string. In-Reply-To: <20080707020456.CEDB726FE@courageux.xo.com> References: <20080707020456.CEDB726FE@courageux.xo.com> Message-ID: <008F89DF-7179-49E2-85CA-ADF5CBB2FBBA@petdance.com> On Jul 6, 2008, at 9:04 PM, Richard Reina wrote: > Thanks so much for the response. It's just a one time use, throw > away script to validate data before it gets entered into a table. I > will try your "low tech" way and if it works for me I am going to > run with it. Doesn't the database have validation on it, then? Why not let the DB do that part of the job? -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From richard at rushlogistics.com Mon Jul 7 04:23:07 2008 From: richard at rushlogistics.com (richard at rushlogistics.com) Date: Mon, 7 Jul 2008 11:23:07 +0000 Subject: [Chicago-talk] detecting whether a scalar is number or a string. In-Reply-To: <008F89DF-7179-49E2-85CA-ADF5CBB2FBBA@petdance.com> References: <20080707020456.CEDB726FE@courageux.xo.com><008F89DF-7179-49E2-85CA-ADF5CBB2FBBA@petdance.com> Message-ID: <1040315381-1215429804-cardhu_decombobulator_blackberry.rim.net-1084948009-@bxe199.bisx.prod.on.blackberry> Good point. Ill address it with the DB administrator. Thanks again Sent via BlackBerry from T-Mobile -----Original Message----- From: Andy Lester Date: Sun, 6 Jul 2008 21:06:03 To: Chicago.pm chatter Subject: Re: [Chicago-talk] detecting whether a scalar is number or a string. On Jul 6, 2008, at 9:04 PM, Richard Reina wrote: > Thanks so much for the response. It's just a one time use, throw > away script to validate data before it gets entered into a table. I > will try your "low tech" way and if it works for me I am going to > run with it. Doesn't the database have validation on it, then? Why not let the DB do that part of the job? -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance _______________________________________________ Chicago-talk mailing list Chicago-talk at pm.org http://mail.pm.org/mailman/listinfo/chicago-talk From richard at rushlogistics.com Mon Jul 7 04:36:39 2008 From: richard at rushlogistics.com (Richard Reina) Date: Mon, 07 Jul 2008 07:36:39 -0400 (EDT) Subject: [Chicago-talk] detecting whether a scalar is number or a string. In-Reply-To: <20080706194854.56CA9589E@alexander.xo.com> <20080707004137.4A6881DE1@victory.xo.com> Message-ID: <20080707113639.47BBE4E64@bellona.xo.com> Well, It looked promising but, #!/usr/bin/perl -w my $string = "sdadada"; my $n = $string + 0; if ( $n == $string ) { print"string is a number\n"; } else { print "string is a string\n"; } Gives me: Argument "sdadada" isn't numeric in addition (+) at test_string line 5. string is a number ---- Chicago.pm chatter wrote: > > > On Jul 6, 2008, at 8:03 PM, Shawn Carroll wrote: > > > Sorry, too quick to answer: > > $string =~ m/[[:digit:]]/; > > -or- > > $string =~ m/[[:alpha:]]/; > > > > But that's incomplete because $string = "lsdkf3123" will be seen as a > number, when it is not. > > The low tech way to do it is > > my $n = $string + 0; > if ( $n == $string ) { > # then string is a number > } > > This is all answered in the FAQ anyway. > > > -- > Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance > > > > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From tzz at lifelogs.com Mon Jul 7 05:59:58 2008 From: tzz at lifelogs.com (Ted Zlatanov) Date: Mon, 07 Jul 2008 07:59:58 -0500 Subject: [Chicago-talk] detecting whether a scalar is number or a string. In-Reply-To: <008F89DF-7179-49E2-85CA-ADF5CBB2FBBA@petdance.com> (Andy Lester's message of "Sun, 6 Jul 2008 21:06:03 -0500") References: <20080707020456.CEDB726FE@courageux.xo.com> <008F89DF-7179-49E2-85CA-ADF5CBB2FBBA@petdance.com> Message-ID: <86k5fxj1dd.fsf@lifelogs.com> On Sun, 6 Jul 2008 21:06:03 -0500 Andy Lester wrote: AL> On Jul 6, 2008, at 9:04 PM, Richard Reina wrote: >> Thanks so much for the response. It's just a one time use, throw >> away script to validate data before it gets entered into a table. I >> will try your "low tech" way and if it works for me I am going to >> run with it. AL> Doesn't the database have validation on it, then? Why not let the DB AL> do that part of the job? ...because failing a networked, stateful transaction to a database is far more costly than first checking if a number is valid? Worse, some databases don't even tell you which column generated the problem under certain conditions. I'd use Regexp::Common, with awareness of the DB schema. You don't want to pass a bigint to a table column that can't handle it, for example. Ted From me at heyjay.com Mon Jul 7 06:35:11 2008 From: me at heyjay.com (Jay Strauss) Date: Mon, 7 Jul 2008 08:35:11 -0500 Subject: [Chicago-talk] detecting whether a scalar is number or a string. In-Reply-To: <86k5fxj1dd.fsf@lifelogs.com> References: <20080707020456.CEDB726FE@courageux.xo.com> <008F89DF-7179-49E2-85CA-ADF5CBB2FBBA@petdance.com> <86k5fxj1dd.fsf@lifelogs.com> Message-ID: Hi, as Andy pointed out its in the FAQ. Which you can do by: perldoc -q number (but quoted here for your reading enjoyment) How do I determine whether a scalar is a number/whole/integer/float? Assuming that you don't care about IEEE notations like "NaN" or "Infinity", you probably just want to use a regular expression. if (/\D/) { print "has nondigits\n" } if (/^\d+$/) { print "is a whole number\n" } if (/^-?\d+$/) { print "is an integer\n" } if (/^[+-]?\d+$/) { print "is a +/- integer\n" } if (/^-?\d+\.?\d*$/) { print "is a real number\n" } if (/^-?(?:\d+(?:\.\d*)?|\.\d+)$/) { print "is a decimal number\n" } if (/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/) { print "a C float\n" } There are also some commonly used modules for the task. Scalar::Util (distributed with 5.8) provides access to perl's internal function "looks_like_number" for determining whether a variable looks like a number. Data::Types exports functions that validate data types using both the above and other regular expressions. Thirdly, there is "Regexp::Common" which has regular expressions to match various types of numbers. Those three modules are available from the CPAN. If you're on a POSIX system, Perl supports the "POSIX::strtod" function. Its semantics are somewhat cumbersome, so here's a "getnum" wrapper function for more convenient access. This function takes a string and returns the number it found, or "undef" for input that isn't a C float. The "is_numeric" function is a front end to "getnum" if you just want to say, "Is this a float?" sub getnum { use POSIX qw(strtod); my $str = shift; $str =~ s/^\s+//; $str =~ s/\s+$//; $! = 0; my($num, $unparsed) = strtod($str); if (($str eq '') || ($unparsed != 0) || $!) { return undef; } else { return $num; } } sub is_numeric { defined getnum($_[0]) } Or you could check out the String::Scanf module on the CPAN instead. The POSIX module (part of the standard Perl distribution) provides the "strtod" and "strtol" for converting strings to double and longs, respectively. HTH Jay From lembark at wrkhors.com Mon Jul 7 14:04:45 2008 From: lembark at wrkhors.com (Steven Lembark) Date: Mon, 07 Jul 2008 17:04:45 -0400 Subject: [Chicago-talk] detecting whether a scalar is number or a string. In-Reply-To: <20080706194854.56CA9589E@alexander.xo.com> References: <20080706194854.56CA9589E@alexander.xo.com> Message-ID: <487284ED.2090208@wrkhors.com> > my $string = "anssds"; > > and > > $string = "5879873454"; use Scalar::Util qw( looks_like_number ); if( looks_like_number $scalar ) { # perl will do math on it. } else { # perl will not do math on it. } From andy at petdance.com Tue Jul 8 09:59:26 2008 From: andy at petdance.com (Andy Lester) Date: Tue, 8 Jul 2008 11:59:26 -0500 Subject: [Chicago-talk] Just Enough C For Open Source Programmers Message-ID: <8DE776CF-BBC6-4F9D-95C0-CA8EE1D74B0C@petdance.com> I'll be speaking at Polyglot Programmers tonight at 7, doing a test run of my talk "Just Enough C For Open Source Programmers." Come and learn the basics of C so you're not floundering when you dig into the internals of Perl, Postgres, MySQL, Apache, whatever. It's at the Rice IIT campus. http://www.uniforum.chi.il.us/meetings/poly_just_enough_c.html xoxo, Andy -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From richard at rushlogistics.com Tue Jul 8 10:21:40 2008 From: richard at rushlogistics.com (Richard Reina) Date: Tue, 08 Jul 2008 13:21:40 -0400 (EDT) Subject: [Chicago-talk] detecting whether a scalar is number or a string. In-Reply-To: <20080706194854.56CA9589E@alexander.xo.com> Message-ID: <20080708172140.5EF7520C6@victory.xo.com> Tnank you very much Steve. Nice solution. ---- Chicago.pm chatter wrote: > > > > my $string = "anssds"; > > > > and > > > > $string = "5879873454"; > > use Scalar::Util qw( looks_like_number ); > > if( looks_like_number $scalar ) > { > # perl will do math on it. > } > else > { > # perl will not do math on it. > } > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From mdemir3000 at gmail.com Fri Jul 11 10:35:37 2008 From: mdemir3000 at gmail.com (Mike Demir) Date: Fri, 11 Jul 2008 12:35:37 -0500 Subject: [Chicago-talk] Removing an element from an array Message-ID: <32091ab60807111035n4650773fwf17930fd287cd81d@mail.gmail.com> Hi: So here is my quandry. I have a list of stock symbols stored in array (@sym), and am looking to test each symbol against a series of conditions (foo1, foo2....). When the condition is met, I would like to remove that symbol and return to the top of the loop to start working on the next symbol. I'm having no trouble getting the test conditions to work, or the looping to work. However I can't seem to remove the symbol from the array. It's a conceptual thing at this point, so a solution is nice but not required. Need to understand. So here's what I had attempted... foreach $symbol(@symbol) { if(foo1) -------------- next part -------------- An HTML attachment was scrubbed... URL: From mdemir3000 at gmail.com Fri Jul 11 10:51:31 2008 From: mdemir3000 at gmail.com (Mike Demir) Date: Fri, 11 Jul 2008 12:51:31 -0500 Subject: [Chicago-talk] Delete element from array Message-ID: <32091ab60807111051h5cf60efi6aae45e888ef20fb@mail.gmail.com> Hi: So here is my quandry. I have a list of stock symbols stored in array (@sym), and am looking to test each symbol against a series of conditions (foo1, foo2....). When the condition is met, I would like to remove that symbol and return to the top of the loop to start working on the next symbol. If the symbol fails all the test conditions, it should remain in the array. I'm having no trouble getting the test conditions to work, or the looping to work. However I can't seem to remove the symbol from the array. It's a conceptual thing at this point, so a solution is nice but not required. Need to understand. What I'm seeing is that only the $symbol[0] gets deleted. So here's what I had attempted... foreach $symbol (@symbol) { if (foo1) { delete $symbol[]; next; }; if (foo2) { delete $symbol[]; next; }; . . . } Many thanks for your time. Mike -------------- next part -------------- An HTML attachment was scrubbed... URL: From briank at kappacs.com Fri Jul 11 10:58:34 2008 From: briank at kappacs.com (Brian Katzung) Date: Fri, 11 Jul 2008 12:58:34 -0500 Subject: [Chicago-talk] Removing an element from an array In-Reply-To: <32091ab60807111035n4650773fwf17930fd287cd81d@mail.gmail.com> References: <32091ab60807111035n4650773fwf17930fd287cd81d@mail.gmail.com> Message-ID: <48779F4A.9040307@kappacs.com> Hi Mike. Per "man perlsyn": If any part of LIST is an array, "foreach" will get very confused if you add or remove elements within the loop body, for example with "splice". So don't do that. I recommend building a new list. You can either retain or consume the old list. # Retain original array my @subset; foreach $symbol (@symbol) { push(@subset, $symbol) if (conditions); } # Consume original array my @subset; while (defined($symbol = shift(@symbol)) { push(@subset, $symbol) if (conditions); } - Brian Mike Demir wrote: > Hi: > > So here is my quandry. I have a list of stock symbols stored in array > (@sym), and am looking to test each symbol against a series of > conditions (foo1, foo2....). When the condition is met, I would like to > remove that symbol and return to the top of the loop to start working on > the next symbol. I'm having no trouble getting the test conditions to > work, or the looping to work. However I can't seem to remove the symbol > from the array. It's a conceptual thing at this point, so a solution is > nice but not required. Need to understand. > > So here's what I had attempted... > > foreach $symbol(@symbol) { > if(foo1) -- Brian Katzung, Kappa Computer Solutions, LLC Leveraging UNIX, GNU/Linux, open source, and custom software solutions for business and beyond Phone: 877.367.8837 x1 http://www.kappacs.com From briank at kappacs.com Fri Jul 11 11:01:50 2008 From: briank at kappacs.com (Brian Katzung) Date: Fri, 11 Jul 2008 13:01:50 -0500 Subject: [Chicago-talk] Removing an element from an array In-Reply-To: <48779F4A.9040307@kappacs.com> References: <32091ab60807111035n4650773fwf17930fd287cd81d@mail.gmail.com> <48779F4A.9040307@kappacs.com> Message-ID: <4877A00E.7090906@kappacs.com> Sorry, should that should be: while (defined($symbol = shift(@symbol))) (three close parens). - Brian Brian Katzung wrote: > Hi Mike. > > Per "man perlsyn": > > If any part of LIST is an array, "foreach" will get very confused if > you add or remove elements within the loop body, for example with > "splice". So don't do that. > > I recommend building a new list. You can either retain or consume the > old list. > > # Retain original array > my @subset; > foreach $symbol (@symbol) > { > push(@subset, $symbol) if (conditions); > } > > # Consume original array > my @subset; > while (defined($symbol = shift(@symbol)) > { > push(@subset, $symbol) if (conditions); > } > > - Brian > > > Mike Demir wrote: >> Hi: >> >> So here is my quandry. I have a list of stock symbols stored in array >> (@sym), and am looking to test each symbol against a series of >> conditions (foo1, foo2....). When the condition is met, I would like >> to remove that symbol and return to the top of the loop to start >> working on the next symbol. I'm having no trouble getting the test >> conditions to work, or the looping to work. However I can't seem to >> remove the symbol from the array. It's a conceptual thing at this >> point, so a solution is nice but not required. Need to understand. >> >> So here's what I had attempted... >> >> foreach $symbol(@symbol) { >> if(foo1) > -- Brian Katzung, Kappa Computer Solutions, LLC Leveraging UNIX, GNU/Linux, open source, and custom software solutions for business and beyond Phone: 877.367.8837 x1 http://www.kappacs.com From davidy at nationalcycle.com Fri Jul 11 11:03:33 2008 From: davidy at nationalcycle.com (David Young) Date: Fri, 11 Jul 2008 13:03:33 -0500 Subject: [Chicago-talk] Delete element from array Message-ID: delete is meant for hashes, not arrays. Why not push the items you want to keep onto a new array, and then overwrite the original? Like this: foreach $symbol (@symbol) { if (foo1) { next; }; if (foo2) { next; }; . . . push(@keep, $symbol); } @symbol = @keep; >>> mdemir3000 at gmail.com 07/11/08 12:51PM >>> Hi: So here is my quandry. I have a list of stock symbols stored in array (@sym), and am looking to test each symbol against a series of conditions (foo1, foo2....). When the condition is met, I would like to remove that symbol and return to the top of the loop to start working on the next symbol. If the symbol fails all the test conditions, it should remain in the array. I'm having no trouble getting the test conditions to work, or the looping to work. However I can't seem to remove the symbol from the array. It's a conceptual thing at this point, so a solution is nice but not required. Need to understand. What I'm seeing is that only the $symbol[0] gets deleted. So here's what I had attempted... foreach $symbol (@symbol) { if (foo1) { delete $symbol[]; next; }; if (foo2) { delete $symbol[]; next; }; . . . } Many thanks for your time. Mike From Andy_Bach at wiwb.uscourts.gov Fri Jul 11 11:14:58 2008 From: Andy_Bach at wiwb.uscourts.gov (Andy_Bach at wiwb.uscourts.gov) Date: Fri, 11 Jul 2008 13:14:58 -0500 Subject: [Chicago-talk] Delete element from array In-Reply-To: <32091ab60807111051h5cf60efi6aae45e888ef20fb@mail.gmail.com> References: <32091ab60807111051h5cf60efi6aae45e888ef20fb@mail.gmail.com> Message-ID: As you found: if (foo1) { delete $symbol[]; next; doesn't work - You've got nothing in the array box, so you probably end up deleting element zero. Basically you're running into the array iterator question, C-ishly you could do (note, I pluralized the array name): for (my $i = 0; $i < $#symbols, $i++) { if ( foo ) { delete $symbols[$i]; Other options are keeping track of symbols you want removed and removing all at the end or using grep if ( foo ) { # delete $badsymbols .= ($badsymbols ? '|' : '' ) . 'foo'; ... } # foreach @symbols = grep { ! /$badsymbols/ } @symbols; afterwards. Here you need to worry about anchors if there is overlap (e.g. "foo" and "fool" are possible). You can take advantage of the fact that in the for loop the scalar that gets the array element is a ref to the actual array element. That is, if you undefined the scalar, it undefines the element in the array so: use warnings; use strict; my @symbols = qw(foo fiv fib fink fort futz); print "Sym: ", join(", ", @symbols), "\n"; foreach my $symbol (@symbols) { if ($symbol eq 'fib') { #delete $symbol[]; undef($symbol); next; }; } @symbols = grep { defined() } @symbols; print "Sym: ", join(", ", @symbols), "\n"; a ------------------- Andy Bach Systems Mangler Internet: andy_bach at wiwb.uscourts.gov Voice: (608) 261-5738 Fax: 264-5932 Accordion, n.: A bagpipe with pleats. From leland at protoplasmic.org Fri Jul 11 11:39:56 2008 From: leland at protoplasmic.org (Leland Johnson) Date: Fri, 11 Jul 2008 13:39:56 -0500 Subject: [Chicago-talk] Delete element from array In-Reply-To: <32091ab60807111051h5cf60efi6aae45e888ef20fb@mail.gmail.com> References: <32091ab60807111051h5cf60efi6aae45e888ef20fb@mail.gmail.com> Message-ID: <1d2646c30807111139l2b90f22bk1da6eda5b218f4d0@mail.gmail.com> This is a perfect place to use the grep function. You want an array of good symbols, so grep can select all elements that are not bad. my @sym = ...; sub symbol_is_bad { my $symbol = shift; if (foo1) { return 1; } if (foo2) { return 1; } ... return; } my @good_sym = grep { not symbol_is_bad($_) } @sym; -- Leland Johnson On Fri, Jul 11, 2008 at 12:51 PM, Mike Demir wrote: > Hi: > > So here is my quandry. I have a list of stock symbols stored in array > (@sym), and am looking to test each symbol against a series of conditions > (foo1, foo2....). When the condition is met, I would like to remove that > symbol and return to the top of the loop to start working on the next > symbol. If the symbol fails all the test conditions, it should remain in the > array. I'm having no trouble getting the test conditions to work, or the > looping to work. However I can't seem to remove the symbol from the array. > It's a conceptual thing at this point, so a solution is nice but not > required. Need to understand. > > What I'm seeing is that only the $symbol[0] gets deleted. > > So here's what I had attempted... > > foreach $symbol (@symbol) { > if (foo1) { > delete $symbol[]; > next; > }; > if (foo2) { > delete $symbol[]; > next; > }; > . > . > . > } > > Many thanks for your time. > > Mike > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Andy_Bach at wiwb.uscourts.gov Fri Jul 11 12:44:51 2008 From: Andy_Bach at wiwb.uscourts.gov (Andy_Bach at wiwb.uscourts.gov) Date: Fri, 11 Jul 2008 14:44:51 -0500 Subject: [Chicago-talk] Delete element from array In-Reply-To: References: <32091ab60807111051h5cf60efi6aae45e888ef20fb@mail.gmail.com> Message-ID: Another cute trick - use a hash for your bad (or good, which ever is easist to know ahead of time) symbols: use warnings; use strict; my @symbols = qw(foo fiv fib fink fort futz); my %bad_symbols = ( foo => 1, fort => 1, ); print "Sym: ", join(", ", @symbols), "\n"; @symbols = grep { not $bad_symbols{$_} } @symbols; print "Sym: ", join(", ", @symbols), "\n"; In a process like this: sub symbol_is_bad { my $symbol = shift; if (foo1) { return 1; } if (foo2) { return 1; } ... return; } my @good_sym = grep { not symbol_is_bad($_) } @sym; depending upon the size and repetiveness of the data and dynamicn-ness and cost of the tests, the sub is good candidate for 'memoization'. There's a CPAN module for this, but basically it's a matter of avoiding the retest by caching the results (in a hash say): my %bad_symbols; sub symbol_is_bad { my ($test_sym) = @_; return 1 if $bad_symbols{$test_sym}; my $symbol = shift; if (foo1) { $bad_symbols{$test_symj}++; return 1; } if (foo2) { $bad_symbols{$test_symj}++; return 1; } ... return; } ]my @good_sym = grep { not symbol_is_bad($_) } @sym; Following PBP, you might want to refactor there to remove the various returns (and set a specific return value for failure) inside the "if" tests - set a flag and handle it at the end, using elsif to make it case stmt but .... a ------------------- Andy Bach Systems Mangler Internet: andy_bach at wiwb.uscourts.gov Voice: (608) 261-5738 Fax: 264-5932 Accordion, n.: A bagpipe with pleats. From Andy_Bach at wiwb.uscourts.gov Fri Jul 11 12:54:59 2008 From: Andy_Bach at wiwb.uscourts.gov (Andy_Bach at wiwb.uscourts.gov) Date: Fri, 11 Jul 2008 14:54:59 -0500 Subject: [Chicago-talk] Delete element from array In-Reply-To: References: <32091ab60807111051h5cf60efi6aae45e888ef20fb@mail.gmail.com> Message-ID: > ... There's a CPAN module for this, but basically > it's a matter of avoiding the retest by > caching the results (in a hash say): my %bad_symbols; sub symbol_is_bad { my ($test_sym) = @_; return 1 if $bad_symbols{$test_sym}; my $symbol = shift; if (foo1) { Sorry, I missed the shift already in there: my %bad_symbols; sub symbol_is_bad { my $symbol = shift; return 1 if $bad_symbols{$symbol}; if (foo1) { $bad_symbols{$symbol}++; would be fine. The module is Memoize - Make functions faster by trading space for time DESCRIPTION ?Memoizing? a function makes it faster by trading space for time. It does this by caching the return values of the function in a table. If you call the function again with the same arguments, "memoize" jumps in and gives you the value out of the table, instead of letting the function compute the value all over again. It's quite slick in that it'll handle any sub that has consistent input->return values as easily as: use Memoize; memoize('symbol_is_bad'); a ------------------- Andy Bach Systems Mangler Internet: andy_bach at wiwb.uscourts.gov Voice: (608) 261-5738 Fax: 264-5932 Accordion, n.: A bagpipe with pleats. From andy at petdance.com Fri Jul 11 12:57:21 2008 From: andy at petdance.com (Andy Lester) Date: Fri, 11 Jul 2008 14:57:21 -0500 Subject: [Chicago-talk] Delete element from array In-Reply-To: References: <32091ab60807111051h5cf60efi6aae45e888ef20fb@mail.gmail.com> Message-ID: <8B627C86-1E75-43F8-A142-2DC8610CADB2@petdance.com> In all this discussion, did anyone ask if the original array of accounts actually needs to be an array? If the order doesn't matter, than turn the array into a hash and work with it that way. xoa -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From lembark at wrkhors.com Fri Jul 11 15:24:16 2008 From: lembark at wrkhors.com (Steven Lembark) Date: Fri, 11 Jul 2008 18:24:16 -0400 Subject: [Chicago-talk] detecting whether a scalar is number or a string. In-Reply-To: <20080708172140.5EF7520C6@victory.xo.com> References: <20080708172140.5EF7520C6@victory.xo.com> Message-ID: <4877DD90.4060305@wrkhors.com> >> use Scalar::Util qw( looks_like_number ); > Tnank you very much Steve. > > Nice solution. Thank Graham Barr. From lembark at wrkhors.com Fri Jul 11 15:33:54 2008 From: lembark at wrkhors.com (Steven Lembark) Date: Fri, 11 Jul 2008 18:33:54 -0400 Subject: [Chicago-talk] Removing an element from an array In-Reply-To: <32091ab60807111035n4650773fwf17930fd287cd81d@mail.gmail.com> References: <32091ab60807111035n4650773fwf17930fd287cd81d@mail.gmail.com> Message-ID: <4877DFD2.8030305@wrkhors.com> > So here is my quandry. I have a list of stock symbols stored in array > (@sym), and am looking to test each symbol against a series of > conditions (foo1, foo2....). When the condition is met, I would like to > remove that symbol and return to the top of the loop to start working on > the next symbol. I'm having no trouble getting the test conditions to > work, or the looping to work. However I can't seem to remove the symbol > from the array. It's a conceptual thing at this point, so a solution is > nice but not required. Need to understand. > > So here's what I had attempted... > > foreach $symbol(@symbol) { > if(foo1) > With every you can remove the current item without confusing Perl but you have to finish the cycle each time. If you want to remove arbitrary data, that sounds more like a hash: iterating the keys won't get confused if you delete a value since the list of keys is taken as a snapshot when the loop starts. my %sym2data = (); # build whatever data structure you want. # instead of pusing the values onto one # long queue insert them as data keyed # by the symbol -- or whatever unit of # processin you like. push @{ $sym2data{ $symbol } }, [ blah blah blah ]; ... for my $sym ( keys %sym2data ) { if( $sym ~~ whatever ) { my $data = delete $sym2data{ $sym }; for( @$data ) { # do what you want with the data } # now the data goes out of scope and # you recover the space. } } If you need the keys in order use something like: for my $sym ( sort keys %sym2data ) { ... } If you need to keep cycling through incoming data you can put a data acquisition point at the start of each loop: LOOP: for( ;; ) { add_more_data \%sym2data; for my $sym ( keys %sym2data ) { if( $sym ~~ whatever ) { # do the deed next LOOP } } } again, the point is that you can delete $hash{ $key } while iterating keys %hash with impunity. From lembark at wrkhors.com Fri Jul 11 15:37:03 2008 From: lembark at wrkhors.com (Steven Lembark) Date: Fri, 11 Jul 2008 18:37:03 -0400 Subject: [Chicago-talk] Delete element from array In-Reply-To: <32091ab60807111051h5cf60efi6aae45e888ef20fb@mail.gmail.com> References: <32091ab60807111051h5cf60efi6aae45e888ef20fb@mail.gmail.com> Message-ID: <4877E08F.8010302@wrkhors.com> Mike Demir wrote: > Hi: > > So here is my quandry. I have a list of stock symbols stored in array > (@sym), and am looking to test each symbol against a series of > conditions (foo1, foo2....). When the condition is met, I would like to > remove that symbol and return to the top of the loop to start working on > the next symbol. If the symbol fails all the test conditions, it should > remain in the array. I'm having no trouble getting the test conditions > to work, or the looping to work. However I can't seem to remove the > symbol from the array. It's a conceptual thing at this point, so a > solution is nice but not required. Need to understand. > > What I'm seeing is that only the $symbol[0] gets deleted. > > So here's what I had attempted... > > foreach $symbol (@symbol) { > if (foo1) { > delete $symbol[]; > next; > }; > if (foo2) { > delete $symbol[]; > next; > }; > . > . > . > } Iterate the index and use splice; moderately expensive but it should work. for( 0 .. $#symz ) { if( whatever ) { my $data = splice @symz, $_, 1; ... } } That or if the symbols are unique, use them as hash keys (see preveious message). From d_tassone at yahoo.com Mon Jul 14 11:36:34 2008 From: d_tassone at yahoo.com (Domenico Tassone) Date: Mon, 14 Jul 2008 11:36:34 -0700 Subject: [Chicago-talk] Jobs for Software Developers in Chicago In-Reply-To: References: Message-ID: <014d01c8e5e0$8bab3f30$6401a8c0@SABINA> Not sure how I got on their mailing list... dt ------------------------------------------------------------ Title: C++ Software Developer (Relocation to Chicago is available) Responsibilities: Maintain code/develop new functionality/new features (enhancements) for electronic trading system Diagnose problems/develop solutions to meet trading/business goals and communicate clearly with multi-disciplinary colleagues. Experience: 3+ years experience developing C++ based software (Academic equivalent 3+ will be considered) years of commercial software development work experience strongly desired. Excellent understanding of the Standard Template Library (STL) and POSIX threads required. Excellent UNIX/Linux/SQL skills required. Familiarity with web technologies (php, AJAX) preferred. Troubleshooting and teamwork skills are essential. Familiarity with financial markets is desirable but not required. ------------------------------------------------------------ Title: Linux System Administrator (Relocation to Chicago not available) Responsibilities: Handle configuration/installation/monitoring/support of Linux systems. OS rollouts/installations/testing. Patch application and performance of OS/application up-grades on existing systems. Perform systems/network troubleshooting and optimization. Experience: Prior experience with administration of Linux based systems required including configuration/installation/maintenance. Proficient with UNIX scripting languages like Perl, shell (sh), AWK, etc. Solid troubleshooting skills required Knowledge of version/revision control practices and procedures ------------------------------------------------------------ If you are interested in one of these openings, please email me a copy of your resume as an MS Word attachment and indicate which position is of interest. Thank you, Tamara Polansky BCI - Financial Services Recruiting (312) 460-8222 x 117 tamara at brokerageconsultants.com www.bcius.com If you do not wish to receive these messages in the future, please reply to this e-mail, with "remove" in the subject. From andy at petdance.com Mon Jul 14 11:48:03 2008 From: andy at petdance.com (Andy Lester) Date: Mon, 14 Jul 2008 13:48:03 -0500 Subject: [Chicago-talk] Jobs for Software Developers in Chicago In-Reply-To: <014d01c8e5e0$8bab3f30$6401a8c0@SABINA> References: <014d01c8e5e0$8bab3f30$6401a8c0@SABINA> Message-ID: On Jul 14, 2008, at 1:36 PM, Domenico Tassone wrote: > Not sure how I got on their mailing list... If they're Perl-related jobs, please let the sender know they can post to jobs.perl.org for free. In either case, please don't forward them here. Thanks, Andy -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From michael at potter.name Mon Jul 14 17:10:57 2008 From: michael at potter.name (Michael Potter) Date: Mon, 14 Jul 2008 19:10:57 -0500 Subject: [Chicago-talk] core dump using DBI Message-ID: <2379dacc0807141710t1ff721dcp93a9e569868fd6e8@mail.gmail.com> Monks, I am core dumping in this fragment of code: ---------------------------------------------- foreach my $TableName (@TableNames) { my $SelectSub = qq{ SELECT * FROM $TableName WHERE ARTKEY1 = ? }; my $sth_ssa = $DbHandle->prepare($SelectSub); $sth_ssa->execute($artkeyA); $Counter = 0; while (my $hsa = $sth_ssa->fetchrow_hashref()) { $Counter++; delete $hsa->{ARTKEY1}; $hsa->{TABLENAME} = $TableName; push @aa, $hsa; } $sth_ssa->finish(); my $sth_ssb = $DbHandle->prepare($SelectSub); $sth_ssb->execute($artkeyB); $Counter = 0; while (my $hsb = $sth_ssb->fetchrow_hashref()) { $Counter++; delete $hsb->{ARTKEY1}; $hsb->{TABLENAME} = $TableName; push @ab, $hsb; } $sth_ssb->finish(); } ------------------------------------- I pulled up the core dump in the debugger and it is failing with this error: malloc_common.extend_brk(internal error: assertion failed at line 3626 in file frame.c There is another loop that surrounds this loop and runs about 27,000 times. The loop you see runs about 20 times for each of the 27,000. It fails at about 6200. I shifted the data to confirm that the actual data is not the problem. I am on AIX/DB2/Perl 5.8.5. I know it would be ideal if I could create a sample application that would reproduce this problem, but with all the data required to reproduce the problem this is not practical. I also suspect the problem is in DBI and way over my head to debug. My next action will be to move this loop to it's own script so that memory will be cleaned up by the termination of the script, then I will execute that script 27,000 times. Any better ideas? -- Michael Potter From briank at kappacs.com Mon Jul 14 19:52:13 2008 From: briank at kappacs.com (Brian Katzung) Date: Mon, 14 Jul 2008 21:52:13 -0500 Subject: [Chicago-talk] core dump using DBI In-Reply-To: <2379dacc0807141710t1ff721dcp93a9e569868fd6e8@mail.gmail.com> References: <2379dacc0807141710t1ff721dcp93a9e569868fd6e8@mail.gmail.com> Message-ID: <487C10DD.3040706@kappacs.com> Hi Michael. If I'm following you correctly, you're talking about 1,080,000 queries and who knows how many results row fetches. I would seriously try to take a step back and see if you can refactor. With that amount of iteration and number of database requests, would it make more sense to make a single linear pass through all the rows of all the relevant tables and build your local (in memory) data structures in parallel? - Brian Michael Potter wrote: > Monks, > > I am core dumping in this fragment of code: > ---------------------------------------------- > foreach my $TableName (@TableNames) > { > my $SelectSub = qq{ > SELECT * FROM > $TableName > WHERE ARTKEY1 = ? > }; > > my $sth_ssa = $DbHandle->prepare($SelectSub); > $sth_ssa->execute($artkeyA); > $Counter = 0; > while (my $hsa = $sth_ssa->fetchrow_hashref()) > { > $Counter++; > delete $hsa->{ARTKEY1}; > $hsa->{TABLENAME} = $TableName; > push @aa, $hsa; > } > $sth_ssa->finish(); > > my $sth_ssb = $DbHandle->prepare($SelectSub); > $sth_ssb->execute($artkeyB); > $Counter = 0; > while (my $hsb = $sth_ssb->fetchrow_hashref()) > { > $Counter++; > delete $hsb->{ARTKEY1}; > $hsb->{TABLENAME} = $TableName; > push @ab, $hsb; > } > $sth_ssb->finish(); > } > ------------------------------------- > > I pulled up the core dump in the debugger and it is failing with this error: > malloc_common.extend_brk(internal error: assertion failed at line 3626 > in file frame.c > > There is another loop that surrounds this loop and runs about 27,000 > times. The loop you see runs about 20 times for each of the 27,000. > It fails at about 6200. I shifted the data to confirm that the actual > data is not the problem. > > I am on AIX/DB2/Perl 5.8.5. > > I know it would be ideal if I could create a sample application that > would reproduce this problem, but with all the data required to > reproduce the problem this is not practical. I also suspect the > problem is in DBI and way over my head to debug. > > My next action will be to move this loop to it's own script so that > memory will be cleaned up by the termination of the script, then I > will execute that script 27,000 times. > > Any better ideas? > -- Brian Katzung, Kappa Computer Solutions, LLC Leveraging UNIX, GNU/Linux, open source, and custom software solutions for business and beyond Phone: 877.367.8837 x1 http://www.kappacs.com From michael at potter.name Mon Jul 14 20:24:26 2008 From: michael at potter.name (Michael Potter) Date: Mon, 14 Jul 2008 22:24:26 -0500 Subject: [Chicago-talk] core dump using DBI In-Reply-To: <487C10DD.3040706@kappacs.com> References: <2379dacc0807141710t1ff721dcp93a9e569868fd6e8@mail.gmail.com> <487C10DD.3040706@kappacs.com> Message-ID: <2379dacc0807142024n26063476k3175c9af7f18ec1a@mail.gmail.com> yea, your calculation is about right. What I do not show in my sample code is that I do a @aa = (); @ab = (); before the foreach loop. Performance is fine: 6000 of the 27000 records are processed in a very acceptable time. Only the 20*2 records that are being compared need to be in memory at one time, so memory should not be an issue either. (apparently it is tho ;). As far as refactoring, I started out trying to write one multi-table select but ran into issues with column names being identical between the tables. I am sure I could overcome that with more syntax in the select, but decided the SELECT * in a foreach was less error prone. -- Michael Potter On Mon, Jul 14, 2008 at 9:52 PM, Brian Katzung wrote: > Hi Michael. > > If I'm following you correctly, you're talking about 1,080,000 queries and > who knows how many results row fetches. > > I would seriously try to take a step back and see if you can refactor. With > that amount of iteration and number of database requests, would it make more > sense to make a single linear pass through all the rows of all the relevant > tables and build your local (in memory) data structures in parallel? > > - Brian > > Michael Potter wrote: >> >> Monks, >> >> I am core dumping in this fragment of code: >> ---------------------------------------------- >> foreach my $TableName (@TableNames) >> { >> my $SelectSub = qq{ >> SELECT * FROM >> $TableName >> WHERE ARTKEY1 = ? >> }; >> >> my $sth_ssa = $DbHandle->prepare($SelectSub); >> $sth_ssa->execute($artkeyA); >> $Counter = 0; >> while (my $hsa = $sth_ssa->fetchrow_hashref()) >> { >> $Counter++; >> delete $hsa->{ARTKEY1}; >> $hsa->{TABLENAME} = $TableName; >> push @aa, $hsa; >> } >> $sth_ssa->finish(); >> >> my $sth_ssb = $DbHandle->prepare($SelectSub); >> $sth_ssb->execute($artkeyB); >> $Counter = 0; >> while (my $hsb = $sth_ssb->fetchrow_hashref()) >> { >> $Counter++; >> delete $hsb->{ARTKEY1}; >> $hsb->{TABLENAME} = $TableName; >> push @ab, $hsb; >> } >> $sth_ssb->finish(); >> } >> ------------------------------------- >> >> I pulled up the core dump in the debugger and it is failing with this >> error: >> malloc_common.extend_brk(internal error: assertion failed at line 3626 >> in file frame.c >> >> There is another loop that surrounds this loop and runs about 27,000 >> times. The loop you see runs about 20 times for each of the 27,000. >> It fails at about 6200. I shifted the data to confirm that the actual >> data is not the problem. >> >> I am on AIX/DB2/Perl 5.8.5. >> >> I know it would be ideal if I could create a sample application that >> would reproduce this problem, but with all the data required to >> reproduce the problem this is not practical. I also suspect the >> problem is in DBI and way over my head to debug. >> >> My next action will be to move this loop to it's own script so that >> memory will be cleaned up by the termination of the script, then I >> will execute that script 27,000 times. >> >> Any better ideas? >> > > -- > Brian Katzung, Kappa Computer Solutions, LLC > Leveraging UNIX, GNU/Linux, open source, and custom > software solutions for business and beyond > Phone: 877.367.8837 x1 http://www.kappacs.com > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From jon-chicagotalk at jrock.us Mon Jul 14 21:47:44 2008 From: jon-chicagotalk at jrock.us (Jonathan Rockway) Date: Mon, 14 Jul 2008 23:47:44 -0500 Subject: [Chicago-talk] core dump using DBI In-Reply-To: <2379dacc0807141710t1ff721dcp93a9e569868fd6e8@mail.gmail.com> (Michael Potter's message of "Mon, 14 Jul 2008 19:10:57 -0500") References: <2379dacc0807141710t1ff721dcp93a9e569868fd6e8@mail.gmail.com> Message-ID: <87zlojah3j.fsf@bar.jrock.us> * On Mon, Jul 14 2008, Michael Potter wrote: > I am on AIX/DB2/Perl 5.8.5. FWIW, I've had massive problems with IBM's DB2 DBD. It is some of the worst C code I've ever seen. It rarely allocates memory before using it, so I'm really surprised that it ever works at all. Here is my patch from a year ago, still unapplied: http://rt.cpan.org/Public/Bug/Display.html?id=28655 This is just one of many buffer overflow problems, though. Applying the patch will only fix one problem, not the whole module. Basically, if you want correct results and stability, I would recommend against using DBD::DB2. It's a shame that IBM doesn't care about Perl libraries, but they don't, so it's best to "take your business elsewhere"... or write a real driver yourself :) Regards, Jonathan Rockway -- print just => another => perl => hacker => if $,=$" From lembark at wrkhors.com Tue Jul 15 13:46:46 2008 From: lembark at wrkhors.com (Steven Lembark) Date: Tue, 15 Jul 2008 16:46:46 -0400 Subject: [Chicago-talk] core dump using DBI In-Reply-To: <2379dacc0807142024n26063476k3175c9af7f18ec1a@mail.gmail.com> References: <2379dacc0807141710t1ff721dcp93a9e569868fd6e8@mail.gmail.com> <487C10DD.3040706@kappacs.com> <2379dacc0807142024n26063476k3175c9af7f18ec1a@mail.gmail.com> Message-ID: <487D0CB6.9030605@wrkhors.com> > the tables. I am sure I could overcome that with more syntax in the > select, but decided the SELECT * in a foreach was less error prone. Catch is that you move a whole lot of data out of the database that you don't need to. The added overhead shows up in convering all of the numeric content to ascii and constructing the hash/arrayref's required to house the stuff in perl. All told, if the subset of data is small (which seems to be the case here) then you are probably better off joining the tables. Alias the tables in your select if you don't want to spell them out: select a.foo, # take foo from a (sometable) b.bar, # take bar from b (othertable) bletch # bletch is unique between tables from sometable a, othertable b where a.join_field = b.join_field ; My habit is to alias the tables to a, b, c, etc. You can also use join syntax: select a.foo, b.bar, bletch from sometable a join othertable b on a.field = b.field ; which has benefits if there are more than two tables (or if you want an outer join). From lembark at wrkhors.com Tue Jul 15 13:48:43 2008 From: lembark at wrkhors.com (Steven Lembark) Date: Tue, 15 Jul 2008 16:48:43 -0400 Subject: [Chicago-talk] core dump using DBI In-Reply-To: <87zlojah3j.fsf@bar.jrock.us> References: <2379dacc0807141710t1ff721dcp93a9e569868fd6e8@mail.gmail.com> <87zlojah3j.fsf@bar.jrock.us> Message-ID: <487D0D2B.40202@wrkhors.com> > Basically, if you want correct results and stability, I would recommend > against using DBD::DB2. It's a shame that IBM doesn't care about Perl > libraries, but they don't, so it's best to "take your business > elsewhere"... or write a real driver yourself :) Which also makes pushing more of the work into the database important: the less data you have to manage via the DBD driver the fewer glitches that can bite you. From michael at potter.name Tue Jul 15 19:30:48 2008 From: michael at potter.name (Michael Potter) Date: Tue, 15 Jul 2008 21:30:48 -0500 Subject: [Chicago-talk] core dump using DBI In-Reply-To: <487D0D2B.40202@wrkhors.com> References: <2379dacc0807141710t1ff721dcp93a9e569868fd6e8@mail.gmail.com> <87zlojah3j.fsf@bar.jrock.us> <487D0D2B.40202@wrkhors.com> Message-ID: <2379dacc0807151930g386758d0scea97cd3e8fac0a9@mail.gmail.com> Guys, Thanks for all the great discussion. The resolution I choose was to break it into two scripts to avoid the issue. Every column in every row is important to me so reducing the columns read was not an option. -- Michael Potter From jason at hostedlabs.com Mon Jul 21 10:57:25 2008 From: jason at hostedlabs.com (Jason Rexilius) Date: Mon, 21 Jul 2008 12:57:25 -0500 Subject: [Chicago-talk] BARcamp Chicago 2008 Message-ID: <4884CE05.9030504@hostedlabs.com> Hey Everyone! Its time for BARcamp Chicago 2008! Last years was great and this year will be even better. A quick intro for those who dont know: BARcamp Chicago as a weekend long (60 hours straight) technology fest. People call it an "un-conference" or a "user-defined conference" or a "Burning Man for coding". It happens once a year here in Chicago and is free to all. Come give a talk, listen, learn, code and drink. FYI- BARcamp is not about bar's but a play on FOO=BAR and Oreillys private camp called FoO camp (Friends of Oreilly) in the Valley. We are shooting for the weekend of August 15th, but here is the rub. (like every year) we need to find a venue. Requirements for space are: 1) In Chicago 2) Open for use the whole weekend, 24 hours a day. 3) Allow beer and drinks (most colleges dont). 4) Room for ~300 people. We have event insurance and can chip in cash if our sponsors are good to us this year ;-) And as always, sponsors are welcome. We have no prospectus or ROI or anything and no set amounts. If you are start-up chip in $50 or whatever you can spare, if you are further along, help out the community ;-) Its really about YOU, the engineer, the entrepreneur, the manager, the hacker, the coder, the artist. YOU the Chicago Tech community. Come make it happen and like the previous years, have a blast! If you want to keep up with it, you can join the mailing list: send email to: barcamp-unsubscribe at corp.hostedlabs.com?Subject=subscribe Or check out the wiki: http://barcampchicago.com/ Feel free to ping me with questions, suggestions, offers of help ;-) -jason From jason at hostedlabs.com Mon Jul 21 11:03:31 2008 From: jason at hostedlabs.com (Jason Rexilius) Date: Mon, 21 Jul 2008 13:03:31 -0500 Subject: [Chicago-talk] BARcamp Chicago 2008 In-Reply-To: <4884CE05.9030504@hostedlabs.com> References: <4884CE05.9030504@hostedlabs.com> Message-ID: <4884CF73.7000001@hostedlabs.com> Im an idiot.. copy-paste to fast. Corrected: If you want to keep up with it, you can join the mailing list: send email to: barcamp-subscribe at corp.hostedlabs.com?Subject=subscribe Or check out the wiki: http://barcampchicago.com/ -jason From fasteliteprogrammer at yahoo.com Tue Jul 22 06:33:09 2008 From: fasteliteprogrammer at yahoo.com (Craig Petty) Date: Tue, 22 Jul 2008 06:33:09 -0700 (PDT) Subject: [Chicago-talk] cpanplus Question Message-ID: <246624.31422.qm@web36501.mail.mud.yahoo.com> When i do a cpan -m cisco it will show me what module are installed right? From frag at ripco.com Tue Jul 22 10:21:39 2008 From: frag at ripco.com (Mike Fragassi) Date: Tue, 22 Jul 2008 12:21:39 -0500 (CDT) Subject: [Chicago-talk] Downtown Perl Monger Meeting tonight (fwd) Message-ID: If you're not out of town at OSCON, come to the meeting tonight; there'll be pizza and bioinformatics. Note: the location has changed, to Google Chicago's HQ, 22 W Kinzie. Also, you must email Nola to RSVP (see email below), or the security guards won't let you up. -- Mike F. ---------- Forwarded message ---------- Date: Mon, 21 Jul 2008 11:46:53 -0500 From: Nola Stowe To: windycity-pm Subject: [WindyCity-pm] Windy City PM Meeting is ON! Tuesday July 22 Location: Google Chicago 6:30 food starts 7:00 meeting starts Topic: "The Human Genome Project and other projects and agencies have generated a wealth of gene and protein sequence information to organize and analyze. This application of computer science is known as Bioinformatics. Clyde Forrester will present a brief overview of genetics and bioinformatics, and whole bunch of links to resources." Performics as you know was bought out by Google and we had moved to the Google office at 22 W Kinzie. I am working on the details but will have food provided. We'll start at 6:30 with some food and socialization. (MikeF, I'll save some for you!) Josh is out of town so i will be hosting the meeting. Email me if you are coming so I can put you on the list! Foward to any other Perl lists if you want, this is the only one I am subscribed to. -- http://rubygeek.com - my blog featuring: Ruby, PHP and Perl http://DevChix.com - boys can't have all the fun _______________________________________________ WindyCity-pm mailing list WindyCity-pm at pm.org http://mail.pm.org/mailman/listinfo/windycity-pm From brian.d.foy at gmail.com Tue Jul 22 10:49:22 2008 From: brian.d.foy at gmail.com (brian d foy) Date: Tue, 22 Jul 2008 10:49:22 -0700 Subject: [Chicago-talk] cpanplus Question In-Reply-To: <246624.31422.qm@web36501.mail.mud.yahoo.com> References: <246624.31422.qm@web36501.mail.mud.yahoo.com> Message-ID: <2715accf0807221049q71e5015do8982c8991f2fdaac@mail.gmail.com> On Tue, Jul 22, 2008 at 6:33 AM, Craig Petty wrote: > When i do a cpan -m cisco The -m makes (downloads and builds without installing) the module. If you want to see which modules are in @INC, use -a. % cpan -a Note that the cpan command has nothing to do with CPANPLUS, though. :) -- brian d foy http://www.pair.com/~comdog/ From michael at potter.name Thu Jul 24 17:20:05 2008 From: michael at potter.name (Michael Potter) Date: Thu, 24 Jul 2008 19:20:05 -0500 Subject: [Chicago-talk] Serving Web Services using Perl Message-ID: <2379dacc0807241720w3abc6014g47ef5933f3d46887@mail.gmail.com> Mongers, Is there a module for serving web services using Perl. That is, without using Apache. I know there are modules that implement web servers, so I suspect there would be something that would serve web services. The reason I want this is a way to prototype a web service for a client as a way to get them to ok the actual implementation. What I am hoping exists is similar to they way other frameworks work: 1) .wsdl is used as input to a command line tool 2) command line tool outputs a Perl module skeleton. 3) I fill in the skeleton with business logic. 4) plug .wsdl and .pm into framework. 5) ask customer to test to see if the web service suits their needs. -- Michael Potter From andy at petdance.com Thu Jul 24 17:25:05 2008 From: andy at petdance.com (Andy Lester) Date: Thu, 24 Jul 2008 17:25:05 -0700 Subject: [Chicago-talk] Serving Web Services using Perl In-Reply-To: <2379dacc0807241720w3abc6014g47ef5933f3d46887@mail.gmail.com> References: <2379dacc0807241720w3abc6014g47ef5933f3d46887@mail.gmail.com> Message-ID: On Jul 24, 2008, at 5:20 PM, Michael Potter wrote: > Is there a module for serving web services using Perl. That is, > without using Apache. I believe that SOAP::Lite will do it. -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From joshua.mcadams at gmail.com Thu Jul 24 17:41:20 2008 From: joshua.mcadams at gmail.com (Joshua McAdams) Date: Thu, 24 Jul 2008 17:41:20 -0700 Subject: [Chicago-talk] Perl on a Stick and/or Perl Polos Message-ID: <49d805d70807241741y45942931kbdb91fa88a970d57@mail.gmail.com> If anyone wants "Perl on a Stick" or a black Perl logo'ed Polo, let me know and I'll pick them up at OSCON for you. Perl on a stick is a 1GB flash drive with the Perl logo on it and Strawberry Perl inside. TPF is selling these for $15. The Polos are black with the Perl logo on the chest. They are like the white/gray ones that you see some of us wear from time to time. These are selling for $25. If you want either, let me know and I'll bring them with me if there are any still available. You can pay me back when I give you the stuff. Josh From kent at c2group.net Fri Jul 25 02:58:57 2008 From: kent at c2group.net (Kent Cowgill) Date: Fri, 25 Jul 2008 04:58:57 -0500 Subject: [Chicago-talk] Perl on a Stick and/or Perl Polos In-Reply-To: <49d805d70807241741y45942931kbdb91fa88a970d57@mail.gmail.com> References: <49d805d70807241741y45942931kbdb91fa88a970d57@mail.gmail.com> Message-ID: <1DC81495-1936-4B60-832C-913B3DDAF381@c2group.net> I'll take a polo. Size medium, unless they look like they run small, and then a large. :) On Jul 24, 2008, at 7:41 PM, Joshua McAdams wrote: > If anyone wants "Perl on a Stick" or a black Perl logo'ed Polo, let me > know and I'll pick them up at OSCON for you. > > Perl on a stick is a 1GB flash drive with the Perl logo on it and > Strawberry Perl inside. TPF is selling these for $15. > > The Polos are black with the Perl logo on the chest. They are like > the white/gray ones that you see some of us wear from time to time. > These are selling for $25. > > If you want either, let me know and I'll bring them with me if there > are any still available. You can pay me back when I give you the > stuff. > > Josh > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > -Kent Cowgill C2 Group, Inc. kent at c2group.net http://www.c2group.net 312.804.0160 From younda at rcn.com Fri Jul 25 13:01:03 2008 From: younda at rcn.com (David J. Young) Date: Fri, 25 Jul 2008 16:01:03 -0400 (EDT) Subject: [Chicago-talk] Perl on a Stick and/or Perl Polos Message-ID: <20080725160103.BHX89319@ms14.lnh.mail.rcn.net> Hey Josh, I'd like an XL size polo, if you can get one. Thanx! ydy ---- Original message ---- >Date: Thu, 24 Jul 2008 17:41:20 -0700 >From: "Joshua McAdams" >Subject: [Chicago-talk] Perl on a Stick and/or Perl Polos >To: "Chicago.pm chatter" > >If anyone wants "Perl on a Stick" or a black Perl logo'ed Polo, let me >know and I'll pick them up at OSCON for you. > >Perl on a stick is a 1GB flash drive with the Perl logo on it and >Strawberry Perl inside. TPF is selling these for $15. > >The Polos are black with the Perl logo on the chest. They are like >the white/gray ones that you see some of us wear from time to time. >These are selling for $25. > >If you want either, let me know and I'll bring them with me if there >are any still available. You can pay me back when I give you the >stuff. > >Josh >_______________________________________________ >Chicago-talk mailing list >Chicago-talk at pm.org >http://mail.pm.org/mailman/listinfo/chicago-talk From gsmith at vereduscorp.com Thu Jul 31 06:25:19 2008 From: gsmith at vereduscorp.com (Gene Smith) Date: Thu, 31 Jul 2008 09:25:19 -0400 Subject: [Chicago-talk] Work from Home PERL Developer opening Message-ID: <3147070A791AED4E8C2C1D2A681544666EBC68@vcfile12.veredus.local> Hello all, I have a job opening that I'm sure someone would be interested in. I am looking for someone that would be interested in a PERL Developer position. The ideal candidate will have experience with PERL, Linux, XML, and Web Services. The Web Services experience is not essential. I would like to find someone that really enjoys PERL and would have no problem working with that everyday. The work will primarily be done at your home. Please let me know if you or anyone you know is interested. This is a good opportunity with a great company. Regards, Gene Smith Veredus Corporation 678-420-7492 - Direct 404-846-9385 - Fax Advancing Business with People www.vereduscorp.com www.linkedin.com/in/genesmith -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/jpeg Size: 3441 bytes Desc: image001.jpg URL: From fasteliteprogrammer at yahoo.com Thu Jul 31 07:12:06 2008 From: fasteliteprogrammer at yahoo.com (Craig Petty) Date: Thu, 31 Jul 2008 07:12:06 -0700 (PDT) Subject: [Chicago-talk] Work from Home PERL Developer opening In-Reply-To: <3147070A791AED4E8C2C1D2A681544666EBC68@vcfile12.veredus.local> Message-ID: <253118.14197.qm@web36504.mail.mud.yahoo.com> What you have to do and how much does it pay? --- On Thu, 7/31/08, Gene Smith wrote: From: Gene Smith Subject: [Chicago-talk] Work from Home PERL Developer opening To: chicago-talk at pm.org Date: Thursday, July 31, 2008, 8:25 AM Hello all, ? I have a job opening that I?m sure someone would be interested in.? I am looking for someone that would be interested in a PERL Developer position.? The ideal candidate will have experience with PERL, Linux, XML, and Web Services.?? The Web Services experience is not essential.?? I would like to find someone that really enjoys PERL and would have no problem working with that everyday.? The work will primarily be done at your home.? Please let me know if you or anyone you know is interested.?? This is a good opportunity with a great company.? ? Regards, Gene Smith Veredus Corporation 678-420-7492 - Direct 404-846-9385 - Fax? Advancing Business with People www.vereduscorp.com www.linkedin.com/in/genesmith ? _______________________________________________ Chicago-talk mailing list Chicago-talk at pm.org http://mail.pm.org/mailman/listinfo/chicago-talk -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/jpeg Size: 3441 bytes Desc: image001.jpg URL: From andy at petdance.com Thu Jul 31 07:13:44 2008 From: andy at petdance.com (Andy Lester) Date: Thu, 31 Jul 2008 09:13:44 -0500 Subject: [Chicago-talk] Work from Home PERL Developer opening In-Reply-To: <253118.14197.qm@web36504.mail.mud.yahoo.com> References: <253118.14197.qm@web36504.mail.mud.yahoo.com> Message-ID: <1D1841E0-480D-4F17-A4F3-B88B0F35F703@petdance.com> On Jul 31, 2008, at 9:12 AM, Craig Petty wrote: > What you have to do and how much does it pay? Please don't have this conversation here on the list. Job ads should be posted to jobs.perl.org anyway. xoa -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance