From bduggan at matatu.org Thu Nov 10 06:52:18 2016 From: bduggan at matatu.org (Brian Duggan) Date: Thu, 10 Nov 2016 09:52:18 -0500 Subject: [Philadelphia-pm] Monday Meeting? Message-ID: <20161110145218.GA79992@haraka> Hi Folks, Is there interest in having a meeting this coming Monday? If so, any volunteers for talks or topics? If not, I'm happy to give a little talk about promises. Brian From bduggan at matatu.org Thu Nov 10 09:13:55 2016 From: bduggan at matatu.org (Brian Duggan) Date: Thu, 10 Nov 2016 12:13:55 -0500 Subject: [Philadelphia-pm] Monday Meeting? In-Reply-To: <20724.1478796991@plover.com> References: <20161110145218.GA79992@haraka> <20724.1478796991@plover.com> Message-ID: <20161110171355.GA85945@haraka> On Thursday, November 10, Mark Dominus wrote: > > If so, any volunteers for talks or topics? > > I have a great talk prepared that I would like to give. I did it for > LA.pm last month and it was very well-received. Excellent! Meeting on! See everyone on Monday. Brian From rsindlin at gmail.com Thu Nov 10 11:40:06 2016 From: rsindlin at gmail.com (Randall Sindlinger) Date: Thu, 10 Nov 2016 14:40:06 -0500 Subject: [Philadelphia-pm] Monday Meeting? In-Reply-To: <20161110171355.GA85945@haraka> References: <20161110145218.GA79992@haraka> <20724.1478796991@plover.com> <20161110171355.GA85945@haraka> Message-ID: Sounds great! See you then. Thanks Brian and Mark! - ?Randall? On Thu, Nov 10, 2016 at 12:13 PM, Brian Duggan wrote: > > Meeting on! See everyone on Monday. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mjd at plover.com Thu Nov 10 08:56:31 2016 From: mjd at plover.com (Mark Dominus) Date: Thu, 10 Nov 2016 16:56:31 +0000 Subject: [Philadelphia-pm] Monday Meeting? In-Reply-To: Your message of "Thu, 10 Nov 2016 09:52:18 -0500." <20161110145218.GA79992@haraka> Message-ID: <20724.1478796991@plover.com> > Is there interest in having a meeting this coming Monday? Yes! > If so, any volunteers for talks or topics? I have a great talk prepared that I would like to give. I did it for LA.pm last month and it was very well-received. From waltman at pobox.com Sun Nov 13 17:55:42 2016 From: waltman at pobox.com (Walt Mankowski) Date: Sun, 13 Nov 2016 20:55:42 -0500 Subject: [Philadelphia-pm] Monday Meeting? In-Reply-To: References: <20161110145218.GA79992@haraka> <20724.1478796991@plover.com> <20161110171355.GA85945@haraka> Message-ID: <20161114015542.GF23551@mawode.com> I'd like to go, but I've been fighting a cold for the past few days so I'm not sure if I'll be feeling up to it. Walt On Thu, Nov 10, 2016 at 02:40:06PM -0500, Randall Sindlinger wrote: > Sounds great! See you then. > > Thanks Brian and Mark! > > - > ?Randall? > > > On Thu, Nov 10, 2016 at 12:13 PM, Brian Duggan wrote: > > > > > Meeting on! See everyone on Monday. > > > > > _______________________________________________ > Philadelphia-pm mailing list > Philadelphia-pm at pm.org > http://mail.pm.org/mailman/listinfo/philadelphia-pm -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 163 bytes Desc: not available URL: From morgan at morganjones.org Mon Nov 14 09:40:00 2016 From: morgan at morganjones.org (Morgan Jones) Date: Mon, 14 Nov 2016 12:40:00 -0500 Subject: [Philadelphia-pm] Monday Meeting? In-Reply-To: <20161110171355.GA85945@haraka> References: <20161110145218.GA79992@haraka> <20724.1478796991@plover.com> <20161110171355.GA85945@haraka> Message-ID: <9159470E-CBB1-4476-BE76-9A9DD0C46711@morganjones.org> Barring worsening of what I think are just allergies I?ll be there. Thanks for organizing, Brian. -morgan > On Nov 10, 2016, at 12:13, Brian Duggan wrote: > > On Thursday, November 10, Mark Dominus wrote: >>> If so, any volunteers for talks or topics? >> >> I have a great talk prepared that I would like to give. I did it for >> LA.pm last month and it was very well-received. > > Excellent! > > Meeting on! See everyone on Monday. > > Brian > > _______________________________________________ > Philadelphia-pm mailing list > Philadelphia-pm at pm.org > http://mail.pm.org/mailman/listinfo/philadelphia-pm From mjd-perl-pm at plover.com Mon Nov 14 10:03:37 2016 From: mjd-perl-pm at plover.com (Mark Dominus) Date: Mon, 14 Nov 2016 18:03:37 +0000 Subject: [Philadelphia-pm] Monday Meeting? In-Reply-To: Your message of "Mon, 14 Nov 2016 12:40:00 -0500." <9159470E-CBB1-4476-BE76-9A9DD0C46711@morganjones.org> Message-ID: <18100.1479146617@plover.com> Maybe I should say what my talk will be about. Red Flags About ten years ago I was working on a second book: Most programmers write the first code that comes into their heads. It's pretty bad code. If you add a second phase, in which you edit the code, tighten it up, and trim out the unnecessary stuff, the result is much better. This book will teach you how to do that. I would get a PM group to send me some code samples, then I would make their code better and write a talk about it, and go visit them and give the talk. The book didn't get published. Tonight I'll show a detailed example of how to clean up a Perl module written by someone else. Then I'll tell a sad story, and I'll make a surprising announcement. The book web site is at http://perl.plover.com/flagbook/ if anyone is interested in seeing what didn't come to pass. From waltman at pobox.com Mon Nov 14 10:42:25 2016 From: waltman at pobox.com (Walt Mankowski) Date: Mon, 14 Nov 2016 13:42:25 -0500 Subject: [Philadelphia-pm] Monday Meeting? In-Reply-To: <18100.1479146617@plover.com> References: <9159470E-CBB1-4476-BE76-9A9DD0C46711@morganjones.org> <18100.1479146617@plover.com> Message-ID: <20161114184225.GB19812@mawode.com> Sounds great, but I'm afraid my cold/allergies have gotten the best of me today. I'm too sniffley to meetup tonight. I'll be heading right home after I'm done at work. Walt On Mon, Nov 14, 2016 at 06:03:37PM +0000, Mark Dominus wrote: > > Maybe I should say what my talk will be about. > > Red Flags > > About ten years ago I was working on a second book: > > Most programmers write the first code that comes into > their heads. It's pretty bad code. If you add a second > phase, in which you edit the code, tighten it up, and trim > out the unnecessary stuff, the result is much better. This > book will teach you how to do that. > > I would get a PM group to send me some code samples, then I > would make their code better and write a talk about it, and go > visit them and give the talk. > > The book didn't get published. Tonight I'll show a detailed > example of how to clean up a Perl module written by someone > else. Then I'll tell a sad story, and I'll make a surprising > announcement. > > > The book web site is at http://perl.plover.com/flagbook/ if anyone is > interested in seeing what didn't come to pass. > > > _______________________________________________ > Philadelphia-pm mailing list > Philadelphia-pm at pm.org > http://mail.pm.org/mailman/listinfo/philadelphia-pm -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 163 bytes Desc: not available URL: From jkeen at verizon.net Mon Nov 14 10:50:50 2016 From: jkeen at verizon.net (James E Keenan) Date: Mon, 14 Nov 2016 13:50:50 -0500 Subject: [Philadelphia-pm] Monday Meeting? In-Reply-To: <18100.1479146617@plover.com> References: <18100.1479146617@plover.com> Message-ID: On 11/14/2016 01:03 PM, Mark Dominus wrote: > > > The book didn't get published. Tonight I'll show a detailed > example of how to clean up a Perl module written by someone > else. Then I'll tell a sad story, and I'll make a surprising > announcement. > > How long are you going to keep us out-of-towners in suspense, mjd? ;-) Jim Keenan From mjd-perl-pm at plover.com Mon Nov 14 13:10:01 2016 From: mjd-perl-pm at plover.com (Mark Dominus) Date: Mon, 14 Nov 2016 21:10:01 +0000 Subject: [Philadelphia-pm] Monday Meeting? In-Reply-To: Your message of "Mon, 14 Nov 2016 13:50:50 -0500." Message-ID: <983.1479157801@plover.com> > Jim Keenan: > How long are you going to keep us out-of-towners in suspense, mjd? ;-) I did actually tell the LA.pm last month, but asked them to hush it up until I was ready for a general announcement. David Farrell invited me to talk to NY.pm sometime in the next couple of months so if I didn't make a general public announcement before that, then I will when I come visit. There's still time to come to tonight's meeting if you want in on the secret. From morgan at morganjones.org Thu Nov 17 17:40:37 2016 From: morgan at morganjones.org (Morgan Jones) Date: Thu, 17 Nov 2016 20:40:37 -0500 Subject: [Philadelphia-pm] selective splitting? Message-ID: <565843E7-64AF-47B1-BC1A-6349E97185BB@morganjones.org> mjd?s talk Monday has me thinking about peer review and how helpful it can be. So here goes. I can certainly work around this but as a learning experience I?m wondering if someone has a straightforward answer. Can I split on only instances of a character that is not surrounded by in this case parentheses? I have a semicolon separated string that contains a date, a string, an ip address and a user agent string. The catch is the user agent string contains a semicolon however it?s between parentheses. So what I want is to split on semicolons that are not surrounded by parentheses. For example: $v = ?20161116172606Z;accepted-terms-of-use via CAS;192.168.1.5;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari/602.2.14?; It seems to me I should be able to split like this: my ($date, $ignore, $ip, $agent) = split /[^\(]+[^\;]*\;[^\)]*[^\)]+/, $v; From a little reading I may need to use look aheads which are new to me. Here?s an attempt at that that is of course not working: my ($date, $ignore, $ip, $agent) = split /(? References: <565843E7-64AF-47B1-BC1A-6349E97185BB@morganjones.org> Message-ID: <20161118024012.GA23439@gaia.in.perlhack.com> Hi Morgan, I totes agree re: peer review! Lookaround assertions are what I'd reach for first for your problem, too, but I think they fall short: my $v = '20161116172606Z;accepted-terms-of-use via CAS;192.168.1.5;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari/602.2.14'; my @naive_parts = split /;/, $v; my @parts = split /(? mjd?s talk Monday has me thinking about peer review and how helpful it can be. So here goes. I can certainly work around this but as a learning experience I?m wondering if someone has a straightforward answer. Can I split on only instances of a character that is not surrounded by in this case parentheses? > > I have a semicolon separated string that contains a date, a string, an ip address and a user agent string. The catch is the user agent string contains a semicolon however it?s between parentheses. So what I want is to split on semicolons that are not surrounded by parentheses. > > For example: > $v = ?20161116172606Z;accepted-terms-of-use via CAS;192.168.1.5;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari/602.2.14?; > > It seems to me I should be able to split like this: > my ($date, $ignore, $ip, $agent) = split /[^\(]+[^\;]*\;[^\)]*[^\)]+/, $v; > > From a little reading I may need to use look aheads which are new to me. Here?s an attempt at that that is of course not working: > my ($date, $ignore, $ip, $agent) = > split /(? \; > (?!))/x, $v; > > > Does anyone have a suggestion or see what I?m missing? > > thanks, > > -morgan > _______________________________________________ > Philadelphia-pm mailing list > Philadelphia-pm at pm.org > http://mail.pm.org/mailman/listinfo/philadelphia-pm -------------- next part -------------- #!/usr/bin/perl use Data::Dumper; my $v = '20161116172606Z;accepted-terms-of-use via CAS;192.168.1.5;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari/602.2.14'; my @parens_parts = $v =~ m/(\(.+?\))/g; print Dumper \@parens_parts; print "\n"; my $fake_semicolon = '#SEMICOLON#'; map { if ( m/;/ ) { my $orig = $_; $_ =~ s/;/$fake_semicolon/g; $v =~ s/$orig/$_/; } } @parens_parts; # Now $v has your fake_semicolon in place of all the troublesome semicolons: print "$v\n\n"; # Now splitting is trivial! my @naive_parts = split /;/, $v; #my @parts = split /(? References: <565843E7-64AF-47B1-BC1A-6349E97185BB@morganjones.org> Message-ID: On 11/17/2016 08:40 PM, Morgan Jones wrote: > mjd?s talk Monday has me thinking about peer review and how helpful it can be. So here goes. I can certainly work around this but as a learning experience I?m wondering if someone has a straightforward answer. Can I split on only instances of a character that is not surrounded by in this case parentheses? > > I have a semicolon separated string that contains a date, a string, an ip address and a user agent string. The catch is the user agent string contains a semicolon however it?s between parentheses. So what I want is to split on semicolons that are not surrounded by parentheses. > > For example: > $v = ?20161116172606Z;accepted-terms-of-use via CAS;192.168.1.5;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari/602.2.14?; > > It seems to me I should be able to split like this: > my ($date, $ignore, $ip, $agent) = split /[^\(]+[^\;]*\;[^\)]*[^\)]+/, $v; > > From a little reading I may need to use look aheads which are new to me. Here?s an attempt at that that is of course not working: > my ($date, $ignore, $ip, $agent) = > split /(? \; > (?!))/x, $v; > > > Does anyone have a suggestion or see what I?m missing? > I often find that trying to write the One Regex to Rule Them All is a time-consuming experience that leads to unreadable code. Sometimes partially processing a string with one regex and then completing the processing with a second is more readable, even if not, in principle, as fast. How far does this get you? my ($date, $ignore, $ip, $agent) = split /;/, $v, 4; Thank you very much. Jim Keenan From nate at perlhack.com Thu Nov 17 19:27:49 2016 From: nate at perlhack.com (Nate Smith) Date: Thu, 17 Nov 2016 22:27:49 -0500 Subject: [Philadelphia-pm] selective splitting? In-Reply-To: References: <565843E7-64AF-47B1-BC1A-6349E97185BB@morganjones.org> Message-ID: <20161118032749.GB23439@gaia.in.perlhack.com> On Thu, Nov 17, 2016 at 09:11:50PM -0500, James E Keenan wrote: > I often find that trying to write the One Regex to Rule Them All is > a time-consuming experience that leads to unreadable code. > Sometimes partially processing a string with one regex and then > completing the processing with a second is more readable, even if > not, in principle, as fast. > > How far does this get you? > > my ($date, $ignore, $ip, $agent) = split /;/, $v, 4; I love this! It happens to work here b/c the field with the unwanted semicolons is the last one, but you definitely win on brevity! -Nate From morgan at morganjones.org Thu Nov 17 22:24:40 2016 From: morgan at morganjones.org (Morgan Jones) Date: Fri, 18 Nov 2016 01:24:40 -0500 Subject: [Philadelphia-pm] selective splitting? In-Reply-To: <20161118024012.GA23439@gaia.in.perlhack.com> References: <565843E7-64AF-47B1-BC1A-6349E97185BB@morganjones.org> <20161118024012.GA23439@gaia.in.perlhack.com> Message-ID: <85F2DAF9-6286-48DE-9D83-61F0967C17D1@morganjones.org> Nate, That?s an elegant and simple solution, thanks. It?s also much more readable than what I was working on. I?ll integrate it tomorrow. -morgan > On Nov 17, 2016, at 21:40, Nate Smith wrote: > > > Hi Morgan, > > I totes agree re: peer review! > > Lookaround assertions are what I'd reach for first for your problem, too, but I think they fall short: > > my $v = '20161116172606Z;accepted-terms-of-use via CAS;192.168.1.5;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari/602.2.14'; > my @naive_parts = split /;/, $v; > my @parts = split /(? map { print "$_\n" } @parts; > > If you run that, it'll say > > Variable length lookbehind not implemented in regex m/(? > So my understanding is that the RE engine can't validate a variable width look-behind assertion, though I don't know why. > > Workarounds people have come up with are using the '\K' escape (see perldoc perlre), or reversing the string and doing a look-ahead instead! > > I've never used the '\K' method and don't understand it. Reversing the string won't work for you b/c you want both look-ahead /and/ look-behind in the same re. > > Given all of that, my brain wants to treat this as a two step process like a compiler might. > > 1) using either another regex or the range operator[s], substitute a placeholder for all the semicolons that are inside parens > 2) perform your split with a dead simple split regex, /;/ > 3) replace the placeholders with semicolons on each part after it's been split > > See attached sample code! > > Cheers, > Nate > > PS Nice meeting you all on Monday! > > On Thu, Nov 17, 2016 at 08:40:37PM -0500, Morgan Jones wrote: >> mjd?s talk Monday has me thinking about peer review and how helpful it can be. So here goes. I can certainly work around this but as a learning experience I?m wondering if someone has a straightforward answer. Can I split on only instances of a character that is not surrounded by in this case parentheses? >> >> I have a semicolon separated string that contains a date, a string, an ip address and a user agent string. The catch is the user agent string contains a semicolon however it?s between parentheses. So what I want is to split on semicolons that are not surrounded by parentheses. >> >> For example: >> $v = ?20161116172606Z;accepted-terms-of-use via CAS;192.168.1.5;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari/602.2.14?; >> >> It seems to me I should be able to split like this: >> my ($date, $ignore, $ip, $agent) = split /[^\(]+[^\;]*\;[^\)]*[^\)]+/, $v; >> >> From a little reading I may need to use look aheads which are new to me. Here?s an attempt at that that is of course not working: >> my ($date, $ignore, $ip, $agent) = >> split /(?> \; >> (?!))/x, $v; >> >> >> Does anyone have a suggestion or see what I?m missing? >> >> thanks, >> >> -morgan >> _______________________________________________ >> Philadelphia-pm mailing list >> Philadelphia-pm at pm.org >> http://mail.pm.org/mailman/listinfo/philadelphia-pm > From bduggan at matatu.org Fri Nov 18 04:43:13 2016 From: bduggan at matatu.org (Brian Duggan) Date: Fri, 18 Nov 2016 07:43:13 -0500 Subject: [Philadelphia-pm] selective splitting? In-Reply-To: <85F2DAF9-6286-48DE-9D83-61F0967C17D1@morganjones.org> References: <565843E7-64AF-47B1-BC1A-6349E97185BB@morganjones.org> <20161118024012.GA23439@gaia.in.perlhack.com> <85F2DAF9-6286-48DE-9D83-61F0967C17D1@morganjones.org> Message-ID: <20161118124313.GA55447@haraka.fios-router.home> Hi All, I'll go ahead and throw in a perl 6 solution: $ cat split.pl #!/usr/bin/env perl6 my $v = '20161116172606Z;accepted-terms-of-use via CAS;192.168.1.5;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari/602.2.14'; grammar log { token TOP { [ | ]+ %% ';' } token outer { <-[;()]>+ } token inner { <-[()]>+ } token balanced { [ ? '(' ')' ? ] + } } say log.parse($v); And the output: $ perl6 split.pl ?20161116172606Z;accepted-terms-of-use via CAS;192.168.1.5;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari/602.2.14? outer => ?20161116172606Z? outer => ?accepted-terms-of-use via CAS? outer => ?192.168.1.5? balanced => ?Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari/602.2.14? outer => ?Mozilla/5.0 ? inner => ?Macintosh; Intel Mac OS X 10_12_1? outer => ? AppleWebKit/602.2.14 ? inner => ?KHTML, like Gecko? outer => ? Version/10.0.1 Safari/602.2.14? Brian On Friday, November 18, Morgan Jones wrote: > Nate, > > That?s an elegant and simple solution, thanks. It?s also much more readable than what I was working on. I?ll integrate it tomorrow. > > -morgan > > > > On Nov 17, 2016, at 21:40, Nate Smith wrote: > > > > > > Hi Morgan, > > > > I totes agree re: peer review! > > > > Lookaround assertions are what I'd reach for first for your problem, too, but I think they fall short: > > > > my $v = '20161116172606Z;accepted-terms-of-use via CAS;192.168.1.5;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari/602.2.14'; > > my @naive_parts = split /;/, $v; > > my @parts = split /(? > map { print "$_\n" } @parts; > > > > If you run that, it'll say > > > > Variable length lookbehind not implemented in regex m/(? > > > So my understanding is that the RE engine can't validate a variable width look-behind assertion, though I don't know why. > > > > Workarounds people have come up with are using the '\K' escape (see perldoc perlre), or reversing the string and doing a look-ahead instead! > > > > I've never used the '\K' method and don't understand it. Reversing the string won't work for you b/c you want both look-ahead /and/ look-behind in the same re. > > > > Given all of that, my brain wants to treat this as a two step process like a compiler might. > > > > 1) using either another regex or the range operator[s], substitute a placeholder for all the semicolons that are inside parens > > 2) perform your split with a dead simple split regex, /;/ > > 3) replace the placeholders with semicolons on each part after it's been split > > > > See attached sample code! > > > > Cheers, > > Nate > > > > PS Nice meeting you all on Monday! > > > > On Thu, Nov 17, 2016 at 08:40:37PM -0500, Morgan Jones wrote: > >> mjd?s talk Monday has me thinking about peer review and how helpful it can be. So here goes. I can certainly work around this but as a learning experience I?m wondering if someone has a straightforward answer. Can I split on only instances of a character that is not surrounded by in this case parentheses? > >> > >> I have a semicolon separated string that contains a date, a string, an ip address and a user agent string. The catch is the user agent string contains a semicolon however it?s between parentheses. So what I want is to split on semicolons that are not surrounded by parentheses. > >> > >> For example: > >> $v = ?20161116172606Z;accepted-terms-of-use via CAS;192.168.1.5;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari/602.2.14?; > >> > >> It seems to me I should be able to split like this: > >> my ($date, $ignore, $ip, $agent) = split /[^\(]+[^\;]*\;[^\)]*[^\)]+/, $v; > >> > >> From a little reading I may need to use look aheads which are new to me. Here?s an attempt at that that is of course not working: > >> my ($date, $ignore, $ip, $agent) = > >> split /(? >> \; > >> (?!))/x, $v; > >> > >> > >> Does anyone have a suggestion or see what I?m missing? > >> > >> thanks, > >> > >> -morgan > >> _______________________________________________ > >> Philadelphia-pm mailing list > >> Philadelphia-pm at pm.org > >> http://mail.pm.org/mailman/listinfo/philadelphia-pm > > > > _______________________________________________ > Philadelphia-pm mailing list > Philadelphia-pm at pm.org > http://mail.pm.org/mailman/listinfo/philadelphia-pm