From lembark at wrkhors.com Thu Oct 1 14:21:07 2015 From: lembark at wrkhors.com (Steven Lembark) Date: Thu, 1 Oct 2015 16:21:07 -0500 Subject: [Chicago-talk] Interpolation problem In-Reply-To: <89C26EC2-31E0-44A4-B03C-478DAC4CCE66@gmail.com> References: <20150930132357.y3foaemkg4g8cgog@hostingemail.xo.com> <4064C305-A142-4911-A9B7-65D2B87D024A@gmail.com> <89C26EC2-31E0-44A4-B03C-478DAC4CCE66@gmail.com> Message-ID: <20151001162107.30092f49@cannibal> > I was under the impression that single quotes would prevent the > placeholders (?) from interpolating. Will give it a try. Issue is which layer of software does the interpolation. The '?' doesnt' mean anything to Perl to MySQL gets it as-is through quoting on the Perly side. The '@' does mean soemthing to Perl: Interoplate an array. At that point you have to escape the '@' in order to avoid Perl's interrepting it as an array you want merged into the string. One way is escaping it with "\@foo", another is telling Perl not to interpolate the string at all (which usually works for SQL since you don't generally build the stuff on the fly from variables): my $sql = 'blah blah @foo blah blah'; my $sql = q{ whatever @foo whatever }; my $sql = <<'SQL'; select foo from bar where blah = @bletch SQL One reson to store your SQL strings outside of Perl in YAML or JSON (I usually use YAML) is that the quoting issues are dealt with for you when the string is imported: --- query_1 : - | your sql here with the '|' preserving format query_2 : - drop table if exists foobar - | create table foobar ( fields... ) query_3 : - | select whatever from foobar where bletch = @blort Nice thing about this approach is also keeping the SQL content out of your code, which usually easier to maintain since you don't have to worry about accidentally botching the code to modify some SQL. -- Steven Lembark 3646 Flora Pl Workhorse Computing St Louis, MO 63110 lembark at wrkhors.com +1 888 359 3508 From richard at rushlogistics.com Sat Oct 3 09:59:32 2015 From: richard at rushlogistics.com (richard at rushlogistics.com) Date: Sat, 03 Oct 2015 11:59:32 -0500 Subject: [Chicago-talk] Hash Question Message-ID: <20151003115932.4surm5nocg00408g@hostingemail.xo.com> I have a hash reference with that originates from a DBI fetch? $sth->fetchall_hashref('ID'); and has the following structure: $VAR1 = { ????????? '12' => { ??????????????????? 'opp_team' => 'Storm', ??????????????????? 'GAME_ID' => '1', ??????????????????? 'DATE_FORMAT(g.DATE,\'%m-%d-%y\')' => '09-04-15', ??????????????????? 'NAME' => 'Strikeout', ??????????????????? 'STATUS' => 'PNDG', ??????????????????? 'ACC_TYPE_ID' => '11', ??????????????????? 'ID' => '12', ??????????????????? 'PERIOD' => '1', ??????????????????? 'TIME_DENOM' => 'inning' ????????????????? }, ????????? '11' => { ??????????????????? 'ID' => '11', ??????????????????? 'ACC_TYPE_ID' => '11', ??????????????????? 'TIME_DENOM' => 'inning', ??????????????????? 'PERIOD' => '1', ??????????????????? 'NAME' => 'Strikeout', ??????????????????? 'DATE_FORMAT(g.DATE,\'%m-%d-%y\')' => '09-04-15', ??????????????????? 'GAME_ID' => '1', ??????????????????? 'opp_team' => 'Storm', ??????????????????? 'STATUS' => 'PNDG' ????????????????? } ??????? }; Is there a way to access one element in the hash reference? I am trying print "Opp Team: $logro_ref->{'opp_team'}\n"; with no success. Thanks From amead2 at alanmead.org Sat Oct 3 14:04:18 2015 From: amead2 at alanmead.org (Alan Mead) Date: Sat, 3 Oct 2015 16:04:18 -0500 Subject: [Chicago-talk] Hash Question In-Reply-To: <20151003115932.4surm5nocg00408g@hostingemail.xo.com> References: <20151003115932.4surm5nocg00408g@hostingemail.xo.com> Message-ID: <561042D2.8090406@alanmead.org> I don't understand what you're doing, so I don't know if this helps but you have an 'opp_team' for keys 11 and 12. You need to access them like a multidimensional array: print $VAR1->{'11'}->{'opp_team'},"\n"; print $VAR1->{'12'}->{'opp_team'},"\n"; This also works: print "$VAR1->{12}->{opp_team}\n"; -Alan On 10/3/2015 11:59 AM, richard at rushlogistics.com wrote: > I have a hash reference with that originates from a DBI fetch $sth->fetchall_hashref('ID'); and has the following structure: > > $VAR1 = { > '12' => { > 'opp_team' => 'Storm', > 'GAME_ID' => '1', > 'DATE_FORMAT(g.DATE,\'%m-%d-%y\')' => '09-04-15', > 'NAME' => 'Strikeout', > 'STATUS' => 'PNDG', > 'ACC_TYPE_ID' => '11', > 'ID' => '12', > 'PERIOD' => '1', > 'TIME_DENOM' => 'inning' > }, > '11' => { > 'ID' => '11', > 'ACC_TYPE_ID' => '11', > 'TIME_DENOM' => 'inning', > 'PERIOD' => '1', > 'NAME' => 'Strikeout', > 'DATE_FORMAT(g.DATE,\'%m-%d-%y\')' => '09-04-15', > 'GAME_ID' => '1', > 'opp_team' => 'Storm', > 'STATUS' => 'PNDG' > } > }; > > Is there a way to access one element in the hash reference? I am trying print "Opp Team: $logro_ref->{'opp_team'}\n"; with no success. > > Thanks > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk -- Alan D. Mead, Ph.D. President, Talent Algorithms Inc. science + technology = better workers +815.588.3846 (Office) +267.334.4143 (Mobile) http://www.alanmead.org Announcing the Journal of Computerized Adaptive Testing (JCAT), a peer-reviewed electronic journal designed to advance the science and practice of computerized adaptive testing: http://www.iacat.org/jcat From gatorreina at gmail.com Sat Oct 3 14:36:27 2015 From: gatorreina at gmail.com (Richard Reina) Date: Sat, 3 Oct 2015 16:36:27 -0500 Subject: [Chicago-talk] Hash Question In-Reply-To: <561042D2.8090406@alanmead.org> References: <20151003115932.4surm5nocg00408g@hostingemail.xo.com> <561042D2.8090406@alanmead.org> Message-ID: 2015-10-03 16:04 GMT-05:00 Alan Mead : > I don't understand what you're doing, so I don't know if this helps but > you have an 'opp_team' for keys 11 and 12. You need to access them like > a multidimensional array: > > print $VAR1->{'11'}->{'opp_team'},"\n"; > print $VAR1->{'12'}->{'opp_team'},"\n"; > > This also works: > > print "$VAR1->{12}->{opp_team}\n"; > > Thanks for the reply I ended up using something along those lines. -------------- next part -------------- An HTML attachment was scrubbed... URL: From madcityzen at gmail.com Sat Oct 10 22:56:51 2015 From: madcityzen at gmail.com (Doug Bell) Date: Sun, 11 Oct 2015 00:56:51 -0500 Subject: [Chicago-talk] October 22 - The Why of Git Message-ID: This month I will be giving a talk on Git internals, and how they effect how you use Git commands like commit, merge, pull, and rebase. The presentation will go over some common errors and explain what they mean, and how resolving them will affect the internal data of your repository. RSVP on the Chicago.PM Meetup: http://www.meetup.com/ChicagoPM/events/225737511/ Doug Bell madcityzen at gmail.com From shlomif at shlomifish.org Sun Oct 11 01:27:55 2015 From: shlomif at shlomifish.org (Shlomi Fish) Date: Sun, 11 Oct 2015 11:27:55 +0300 Subject: [Chicago-talk] October 22 - The Why of Git In-Reply-To: References: Message-ID: <20151011112755.772d77b4@telaviv1.shlomifish.org> Hi Doug, On Sun, 11 Oct 2015 00:56:51 -0500 Doug Bell wrote: > This month I will be giving a talk on Git internals, and how they effect how > you use Git commands like commit, merge, pull, and rebase. The presentation > will go over some common errors and explain what they mean, and how resolving > them will affect the internal data of your repository. > Good luck with that! Hope you have an enjoyable talk. I have a request, though: can you please tell the git developers that they should get rid of the use of https://metacpan.org/release/Error from Git's Perl code? I am the co-maintainer of it along with https://metacpan.org/author/PEVANS and we have officially deprecated it and actively discourage its use. ( I cannot send a message to the git's mailing lists because I'm blocked from the @vger.kernel.org domain on which they are hosted, and git did not have a bug tracker last time I checked. ) Regards, Shlomi Fish -- ----------------------------------------------------------------- Shlomi Fish Chuck Norris reads all messages posted to LKML (= the Linux Kernel Mailing List), understands them all, and he kills all gnomes he sees in sight. Please reply to list if it's a mailing list post - http://shlom.in/reply . From madcityzen at gmail.com Sun Oct 11 10:47:09 2015 From: madcityzen at gmail.com (Doug Bell) Date: Sun, 11 Oct 2015 12:47:09 -0500 Subject: [Chicago-talk] October 22 - The Why of Git In-Reply-To: <20151011112755.772d77b4@telaviv1.shlomifish.org> References: <20151011112755.772d77b4@telaviv1.shlomifish.org> Message-ID: <54B8894B-7DC1-4D89-9642-A649EF7B5498@gmail.com> This is not the venue to discuss problems with the Git mailing lists. Perhaps try another form of communication? There's an IRC channel on freenode, perhaps someone in there can help? Doug Bell madcityzen at gmail.com > On Oct 11, 2015, at 3:27 AM, Shlomi Fish wrote: > > Hi Doug, > > On Sun, 11 Oct 2015 00:56:51 -0500 > Doug Bell wrote: > >> This month I will be giving a talk on Git internals, and how they effect how >> you use Git commands like commit, merge, pull, and rebase. The presentation >> will go over some common errors and explain what they mean, and how resolving >> them will affect the internal data of your repository. >> > > Good luck with that! Hope you have an enjoyable talk. > > I have a request, though: can you please tell the git developers that they > should get rid of the use of https://metacpan.org/release/Error from Git's Perl > code? I am the co-maintainer of it along with > https://metacpan.org/author/PEVANS and we have officially deprecated it and > actively discourage its use. > > ( I cannot send a message to the git's mailing lists because I'm blocked from > the @vger.kernel.org domain on which they are hosted, and git did not have a > bug tracker last time I checked. ) > > Regards, > > Shlomi Fish > > -- > ----------------------------------------------------------------- > Shlomi Fish > > Chuck Norris reads all messages posted to LKML (= the Linux Kernel Mailing > List), understands them all, and he kills all gnomes he sees in sight. > > Please reply to list if it's a mailing list post - http://shlom.in/reply . > _______________________________________________ > 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 richard at rushlogistics.com Sun Oct 11 13:07:20 2015 From: richard at rushlogistics.com (richard at rushlogistics.com) Date: Sun, 11 Oct 2015 15:07:20 -0500 Subject: [Chicago-talk] Multi dimensional hash Message-ID: <20151011150720.6ln58o7jogcgscs0@hostingemail.xo.com> If I have the following hash reference: my $input_hash = {? ?????? Hometown => 'Chicago', ?????? FName => 'Jim',? ?????? LName => 'Brown', ?????? Nickname => 'Jimbo', }; Is there a way that I can create a multimensional hash like they've done here http://perlmaven.com/multi-dimensional-hashes But instead have it structured with the input_hash's key name as one of the dimensions? So that I would have: $validtn_hash{class}{input_hash_key} = input_hash value; # where City and Name are examples of classes $validtn_hash{"City"}{Hometown} = $input_hash->{Hometown}; $validtn_hash{"Name"}{FName} = $input_hash->{FName}; $validtn_hash{"Name"}{LName} = $input_hash->{LName}; $validtn_hash{"Name"}{Nickname} = $input_hash->{Nickname}; Or is this even possible? Thanks From shlomif at shlomifish.org Sun Oct 11 13:23:51 2015 From: shlomif at shlomifish.org (Shlomi Fish) Date: Sun, 11 Oct 2015 23:23:51 +0300 Subject: [Chicago-talk] October 22 - The Why of Git In-Reply-To: <54B8894B-7DC1-4D89-9642-A649EF7B5498@gmail.com> References: <20151011112755.772d77b4@telaviv1.shlomifish.org> <54B8894B-7DC1-4D89-9642-A649EF7B5498@gmail.com> Message-ID: <20151011232351.3621c1eb@telaviv1.shlomifish.org> Hi Doug, On Sun, 11 Oct 2015 12:47:09 -0500 Doug Bell wrote: > This is not the venue to discuss problems with the Git mailing lists. You misunderstood me. The main problem is not with the Git mailing lists, it is with the fact that the Perl code that git contains make use of Error.pm, which is an old, poorly behaving, and deprecated, module that should not be used. What prevents me from bringing it to the attention of the git developers is my block from @vger.kernel.org and the fact that git does not have a bug tracker, but I care less about fixing these issues as long as the problem with Error.pm is fixed. > Perhaps > try another form of communication? There's an IRC channel on freenode, > perhaps someone in there can help? I guess I can try. From what I saw, Git's core developers aren't present on #git on Freenode, and it's mostly a users-to-users support. Regards, Shlomi Fish -- ----------------------------------------------------------------- Shlomi Fish If the mountain will not come to Muhammad, then Muhammad will go to the mountain. ? Francis Bacon Please reply to list if it's a mailing list post From madcityzen at gmail.com Sun Oct 11 14:01:49 2015 From: madcityzen at gmail.com (Doug Bell) Date: Sun, 11 Oct 2015 16:01:49 -0500 Subject: [Chicago-talk] October 22 - The Why of Git In-Reply-To: <20151011232351.3621c1eb@telaviv1.shlomifish.org> References: <20151011112755.772d77b4@telaviv1.shlomifish.org> <54B8894B-7DC1-4D89-9642-A649EF7B5498@gmail.com> <20151011232351.3621c1eb@telaviv1.shlomifish.org> Message-ID: <6A6ECA05-1B66-4019-A0B1-E8DDAC4FDC05@gmail.com> > On Oct 11, 2015, at 3:23 PM, Shlomi Fish wrote: > > Hi Doug, > > On Sun, 11 Oct 2015 12:47:09 -0500 > Doug Bell wrote: > >> This is not the venue to discuss problems with the Git mailing lists. > > You misunderstood me. The main problem is not with the Git mailing lists, it is > with the fact that the Perl code that git contains make use of Error.pm This mailing list is still not the correct venue to discuss problems with Git core development. Do you know why you can't access the kernel.org mailing lists? Doug Bell madcityzen at gmail.com From madcityzen at gmail.com Sun Oct 11 14:09:24 2015 From: madcityzen at gmail.com (Doug Bell) Date: Sun, 11 Oct 2015 16:09:24 -0500 Subject: [Chicago-talk] Multi dimensional hash In-Reply-To: <20151011150720.6ln58o7jogcgscs0@hostingemail.xo.com> References: <20151011150720.6ln58o7jogcgscs0@hostingemail.xo.com> Message-ID: <3B510A0E-0E26-4B04-9B63-CF8909B20E2F@gmail.com> What you have there should work. You could also simplify it with loops or slices: for my $name_key ( qw( FName LName Nickname ) ) { $validtn_hash{ Name }{ $name_key } = $input_hash->{ $name_key }; } # OR $validtn_hash{ Name }{ $_ } = $input_hash->{ $_ } for qw( FName LName Nickname ); # OR @{ $validtn_hash{ Name } }{qw( FName LName Nickname )} = @{ $input_hash }{qw( FName LName Nickname )}; Doug Bell madcityzen at gmail.com > On Oct 11, 2015, at 3:07 PM, richard at rushlogistics.com wrote: > > If I have the following hash reference: > > my $input_hash = { > > Hometown => 'Chicago', > FName => 'Jim', > LName => 'Brown', > Nickname => 'Jimbo', > > }; > > Is there a way that I can create a multimensional hash like they've done here http://perlmaven.com/multi-dimensional-hashes > > But instead have it structured with the input_hash's key name as one of the dimensions? So that I would have: > > $validtn_hash{class}{input_hash_key} = input_hash value; # where City and Name are examples of classes > > $validtn_hash{"City"}{Hometown} = $input_hash->{Hometown}; > $validtn_hash{"Name"}{FName} = $input_hash->{FName}; > $validtn_hash{"Name"}{LName} = $input_hash->{LName}; > $validtn_hash{"Name"}{Nickname} = $input_hash->{Nickname}; > > Or is this even possible? > > Thanks > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk From richard at rushlogistics.com Sun Oct 11 16:07:24 2015 From: richard at rushlogistics.com (richard at rushlogistics.com) Date: Sun, 11 Oct 2015 18:07:24 -0500 Subject: [Chicago-talk] Multi dimensional hash In-Reply-To: <3B510A0E-0E26-4B04-9B63-CF8909B20E2F@gmail.com> References: <20151011150720.6ln58o7jogcgscs0@hostingemail.xo.com> <3B510A0E-0E26-4B04-9B63-CF8909B20E2F@gmail.com> Message-ID: <20151011180724.rh4ppjuvc4gok8c0@hostingemail.xo.com> Doug, ? Thanks for the help. This got me where I need to go. On Sun, 11 Oct 2015 16:09:24 -0500, Doug Bell wrote: What you have there should work. You could also simplify it with loops or slices: for my $name_key ( qw( FName LName Nickname ) ) { $validtn_hash{ Name }{ $name_key } = $input_hash->{ $name_key }; } # OR $validtn_hash{ Name }{ $_ } = $input_hash->{ $_ } for qw( FName LName Nickname ); # OR @{ $validtn_hash{ Name } }{qw( FName LName Nickname )} = @{ $input_hash }{qw( FName LName Nickname )}; Doug Bell madcityzen at gmail.com > On Oct 11, 2015, at 3:07 PM, richard at rushlogistics.com wrote: > > If I have the following hash reference: > > my $input_hash = { Hometown => 'Chicago', FName => 'Jim', LName => 'Brown', > Nickname => 'Jimbo', > > }; > > Is there a way that I can create a multimensional hash like they've > done here http://perlmaven.com/multi-dimensional-hashes > > But instead have it structured with the input_hash's key name as one > of the dimensions? So that I would have: > > $validtn_hash{class}{input_hash_key} = input_hash value; # where City > and Name are examples of classes > > $validtn_hash{"City"}{Hometown} = $input_hash->{Hometown}; > $validtn_hash{"Name"}{FName} = $input_hash->{FName}; > $validtn_hash{"Name"}{LName} = $input_hash->{LName}; > $validtn_hash{"Name"}{Nickname} = $input_hash->{Nickname}; > > Or is this even possible? Thanks > > _______________________________________________ > 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: