From enobacon at gmail.com Wed Nov 4 15:39:12 2009 From: enobacon at gmail.com (Seven till Seven) Date: Wed, 4 Nov 2009 15:39:12 -0800 Subject: [Pdx-pm] Bucardo -- November meeting next week Message-ID: <200911041539.12379.enobacon@gmail.com> Wed. November 11th, 6:53pm at FreeGeek -- 1731 SE 10th Ave. Topic: Bucardo Speaker: Selena Deckelmann Bucardo is a mature replication system written in Perl for PostgreSQL that supports asynchronous replication for both master-slave and multi-master systems. Originally designed for slow and unreliable networks, it has remarkable recovery ability, an easy to use command-line interface and development is active! Uses for Bucardo include: a slave read-only database, multi-master replication, data warehousing and just having fun moving your data around! Will include overview replication for PostgreSQL in general, a tour of features, and a basic configuration walk through. As always, the meeting will be followed by social hour at the LuckyLab. -- http://pdx.pm.org From enobacon at gmail.com Fri Nov 6 22:16:52 2009 From: enobacon at gmail.com (The Dread Parrot) Date: Fri, 6 Nov 2009 22:16:52 -0800 Subject: [Pdx-pm] Fwd: Perl Oasis 2010 / Orlando Perl Workshop Message-ID: <200911062216.52881.enobacon@gmail.com> ---------- Forwarded Message: ---------- Subject: Perl Oasis 2010 / Orlando Perl Workshop Date: Friday 06 November 2009 11:50 From: Chris Prather Hi All, Perl Oasis 2010 is happening on January 16th 2010 at the Orlando Four Points Sheraton, and sponsored by Magazines.com. The Perl Oasis is a day long conference focusing on practical applications of Perl. The conference is being organized by the Orlando Area Perl Mongers and is scheduled for January 16, 2010 in Orlando, FL. The conference registration is currently at Early Bird prices ($20 / $10 for students), we expect this to double approximately two weeks before the conference (January 2nd). Also we have secured a block of rooms at the Venue at a special rate but this rate is for a *very* short time only: All reservations must be received on or before November 25, 2009. They will release all rooms after this date, rooms must be prepaid or they are lost. Hotel dates Jan 15-18 for the $75 rate, I think they will add a few days on either side. Hotel Reservations Department at 1-800-327-1366 between the hours of 9AM - 6PM (EST I assume), Monday through Friday only The Website for the conference is http://perloasis.org/opw2010, and there is an IRC channel set up for communicating with the organizers and other participants, it is #orlando on irc.perl.org. We thank you and look forward to seeing you in January! -Chris ------------------------------------------------------- -- http://pdx.pm.org From enobacon at gmail.com Wed Nov 11 13:28:51 2009 From: enobacon at gmail.com (Seven till Seven) Date: Wed, 11 Nov 2009 13:28:51 -0800 Subject: [Pdx-pm] Bucardo -- meeting tonight Message-ID: <200911111328.51196.enobacon@gmail.com> Wed. November 11th, 6:53pm at FreeGeek -- 1731 SE 10th Ave. Liquor Update: Jonathan is planning to bring some scotch/bourbon/whiskey and recommends that "advanced users" do likewise. Topic: Bucardo Speaker: Selena Deckelmann Bucardo is a mature replication system written in Perl for PostgreSQL that supports asynchronous replication for both master-slave and multi-master systems. Originally designed for slow and unreliable networks, it has remarkable recovery ability, an easy to use command-line interface and development is active! Uses for Bucardo include: a slave read-only database, multi-master replication, data warehousing and just having fun moving your data around! Will include overview replication for PostgreSQL in general, a tour of features, and a basic configuration walk through. As always, the meeting will be followed by social hour at the LuckyLab. -- http://pdx.pm.org From gorthx at gmail.com Tue Nov 17 09:30:30 2009 From: gorthx at gmail.com (gabrielle) Date: Tue, 17 Nov 2009 09:30:30 -0800 Subject: [Pdx-pm] Books and News from the O'Reilly User Group Program--November Message-ID: <48bb92b0911170930k674ed81fr5be07f7a7bbc219f@mail.gmail.com> Here's this month's selection from O'Reilly! The rules: Get a book, write a review. We have a spot on the pdx.pm wiki for reviews if you don't have your own blog. Book order will go in next Wednesday. gabrielle --- Friends with Benefits (No Starch) http://post.oreilly.com/rd/9z1zsdcjjrdksa74he8hobg6p58nl9bqlgculbuj1v8 QuickBooks 2010: The Missing Manual http://post.oreilly.com/rd/9z1z0acuu6mnbtp7hm92hkl85oj1v3u873mobfknoao iPod: The Missing Manual, Eighth Edition http://post.oreilly.com/rd/9z1zfqbul765am5f4jdc4dfugfbjvt849oooumqt9s0 iPhone Game Development http://post.oreilly.com/rd/9z1zbh0l5ngbf4s5jgfiv7vhb83729bibi0crtslr7g Beautiful Testing http://post.oreilly.com/rd/9z1zn90bvvkhur744jgdjjhj2dk2ikl6qo44pcu82oo The Sustainable Network http://post.oreilly.com/rd/9z1z8ht24j4ks64m98ljd5ikk61o9msmgpet7ne1t60 Premiere Elements 8: The Missing Manual http://post.oreilly.com/rd/9z1zljf5anoluftdghdnvo0d236tf7ssa6ro2i8ki20 Photoshop Elements 8 for Mac: The Missing Manual http://post.oreilly.com/rd/9z1zkvdgboupr5g8c3l146q8pigfadlkc5hph32mmmg The Art of SEO http://post.oreilly.com/rd/9z1zu83mqmsdnvbh3u3ajo497bjvp04fiq4glvu4lr8 Head First iPhone Development http://post.oreilly.com/rd/9z1zhhg66r7gdq0vg4e9tnabh2vrrg8pk95dnfb357o Confessions of a Public Speaker http://post.oreilly.com/rd/9z1zmq7j1gc2a3q7lg22nbcj40t2588t7756vms57b0 VMware Cookbook http://post.oreilly.com/rd/9z1zli2146opq42em8v3rn1odrrr60qhjcbqk43cgk0 Great Java http://post.oreilly.com/rd/9z1z1qhr1kf1h8h48fk70acp2e7jnqp4drbvmr65280 Windows 7 Annoyances: Rough Cuts Version http://post.oreilly.com/rd/9z1z7ko4fcd923d71henj4lcrjocabk2u6u0nekc9lo C# 4.0 in a Nutshell: Rough Cuts Version, Fourth Edition http://post.oreilly.com/rd/9z1zg3oaknmg3co4c7m9fq422lsruc89v6sek95rh2o Debug It! (Pragmatic Bookshelf) http://post.oreilly.com/rd/9z1zokafsug4tpkclmacb3q6qegbcgq18n8suvsf3fg Getting Started with Google Wave http://post.oreilly.com/rd/9z1zrmrmtq3hi2fan4q1ablgrg97u2velgru4bh33co >From Camera to Computer (Rocky Nook) http://post.oreilly.com/rd/9z1zjkohpq1f2abh4ea0pef791jqs3jin6ovibu3nb0 Log4J http://post.oreilly.com/rd/9z1z48ep2hmrki8tjhv143thsj07vlfcc82jn6f6uqg Make: Technology on Your Time Volume 20 http://post.oreilly.com/rd/9z1zrqigkoub4t24k6lsr5gf162ffp0cvk06s2d9qb8 Hello, Android, Second Edition (Pragmatic Bookshelf) http://post.oreilly.com/rd/9z1z41ivgkpmksuu6fhi3hr33pbaqp5sogg8d873qkg Grails (Pragmatic Bookshelf) http://post.oreilly.com/rd/9z1z169ht52cbqm61aemjr14fubqd878akfakencc90 From herda05 at gmail.com Wed Nov 18 06:50:36 2009 From: herda05 at gmail.com (Daniel Herrington) Date: Wed, 18 Nov 2009 06:50:36 -0800 Subject: [Pdx-pm] Extra level in Hash of Array Message-ID: <4B0409BC.7070400@gmail.com> All, I have two code snippets that should do the same thing, but do not produce the same data structure. I can't seem to figure out why. Code A: ... if ($boxNameH{$boxName}) { #If we already have a list created my $refBoxName = $boxNameH{$boxName}; my @derefArray = @$refBoxName; $derefArray[0]++; push (@derefArray, $jobName); $boxNameH{$boxName} = \@derefArray; $caJIL{$jobName}{"$jilCommand"} = "$jilValue"; } else { #We're the first one my @derefArray; $derefArray[0] = 1; push (@derefArray, $jobName); $boxNameH{$boxName} = \@derefArray; $caJIL{$jobName}{"$jilCommand"} = "$jilValue"; } ... Using Dumper, the data in %boxNameH is: 3108$VAR1 = { 'CPO_TNC_WCONV0' => [ 2, 'CPO_TNC_WCONVERSION_CHMOD', 'CPO_TNC_WCONVERSION_SETUP' ], 'CURRENTLINK_25' => [ 1, 'CURRENT_LINK_25' ], ... Code B: ... my %newBoxNameH; foreach (@arBoxNames) { my $boxName = $_; my $newBoxName; my @jobNamesList; if ($ref_hlqMap->{$boxName}) { $newBoxName = $ref_hlqMap->{$boxName} ; } else { $newBoxName = $boxName; } print __LINE__ . " $newBoxName\n"; my $ref_arJobNamesB = $ref_boxNameH->{$boxName}; my @arJobNamesB = $ref_arJobNamesB; foreach (@arJobNamesB) { my $jobName = $_; my $newJobName; if ($ref_hlqMap->{$jobName}) { $newJobName = $ref_hlqMap->{$jobName}; } else { $newJobName = $jobName; } if ($newBoxNameH{$newBoxName}) { my $ref_arJobNames = $newBoxNameH{$newBoxName}; my @arJobNames = @$ref_arJobNames; push (@arJobNames,$newJobName); $newBoxNameH{$newBoxName} = \@arJobNames; } else { my @arJobNames; push (@arJobNames,$newJobName); $newBoxNameH{$newBoxName} = \@arJobNames; } } ... 289$VAR1 = { 'CURRENTLINK_25' => [ [ 1, 'CURRENT_LINK_25' ] ], 'CPO_TNC_WCONV0' => [ [ 2, 'CPO_TNC_WCONVERSION_CHMOD', 'CPO_TNC_WCONVERSION_SETUP' ] ] }; ... You can see in Code B's dump that the list is actually embedded another layer down as if Code B produces a Hash of Array of Array. I just can't seem to figure out why this is happening? thanks, -- Daniel B. Herrington Director of Field Services Robert Mark Technologies dherrington at robertmarktechnologies.com o: 651-769-2574 m: 503-358-8575 From dherrington at robertmarktech.com Wed Nov 18 07:12:07 2009 From: dherrington at robertmarktech.com (Daniel Herrington) Date: Wed, 18 Nov 2009 07:12:07 -0800 Subject: [Pdx-pm] Different data structures for Hash of array, same code (mostly) Message-ID: <4B040EC7.10807@robertmarktech.com> All, Sorry if this is a double post, but I didn't get a confirmaiton that my last email made it. I have two code snippets that should do the same thing, but do not produce the same data structure. I can't seem to figure out why. Code A: ... if ($boxNameH{$boxName}) { #If we already have a list created my $refBoxName = $boxNameH{$boxName}; my @derefArray = @$refBoxName; $derefArray[0]++; push (@derefArray, $jobName); $boxNameH{$boxName} = \@derefArray; $caJIL{$jobName}{"$jilCommand"} = "$jilValue"; } else { #We're the first one my @derefArray; $derefArray[0] = 1; push (@derefArray, $jobName); $boxNameH{$boxName} = \@derefArray; $caJIL{$jobName}{"$jilCommand"} = "$jilValue"; } ... Using Dumper, the data in %boxNameH is: 3108$VAR1 = { 'CPO_TNC_WCONV0' => [ 2, 'CPO_TNC_WCONVERSION_CHMOD', 'CPO_TNC_WCONVERSION_SETUP' ], 'CURRENTLINK_25' => [ 1, 'CURRENT_LINK_25' ], ... Code B: ... my %newBoxNameH; foreach (@arBoxNames) { my $boxName = $_; my $newBoxName; my @jobNamesList; if ($ref_hlqMap->{$boxName}) { $newBoxName = $ref_hlqMap->{$boxName} ; } else { $newBoxName = $boxName; } print __LINE__ . " $newBoxName\n"; my $ref_arJobNamesB = $ref_boxNameH->{$boxName}; my @arJobNamesB = $ref_arJobNamesB; foreach (@arJobNamesB) { my $jobName = $_; my $newJobName; if ($ref_hlqMap->{$jobName}) { $newJobName = $ref_hlqMap->{$jobName}; } else { $newJobName = $jobName; } if ($newBoxNameH{$newBoxName}) { my $ref_arJobNames = $newBoxNameH{$newBoxName}; my @arJobNames = @$ref_arJobNames; push (@arJobNames,$newJobName); $newBoxNameH{$newBoxName} = \@arJobNames; } else { my @arJobNames; push (@arJobNames,$newJobName); $newBoxNameH{$newBoxName} = \@arJobNames; } } ... 289$VAR1 = { 'CURRENTLINK_25' => [ [ 1, 'CURRENT_LINK_25' ] ], 'CPO_TNC_WCONV0' => [ [ 2, 'CPO_TNC_WCONVERSION_CHMOD', 'CPO_TNC_WCONVERSION_SETUP' ] ] }; ... You can see in Code B's dump that the list is actually embedded another layer down as if Code B produces a Hash of Array of Array. I just can't seem to figure out why this is happening? thanks, -- Daniel B. Herrington Director of Field Services Robert Mark Technologies dherrington at robertmarktechnologies.com o: 651-769-2574 m: 503-358-8575 From hdp.perl.pm.pdx at weftsoar.net Wed Nov 18 09:11:27 2009 From: hdp.perl.pm.pdx at weftsoar.net (Hans Dieter Pearcey) Date: Wed, 18 Nov 2009 12:11:27 -0500 Subject: [Pdx-pm] Different data structures for Hash of array, same code (mostly) In-Reply-To: <4B040EC7.10807@robertmarktech.com> References: <4B040EC7.10807@robertmarktech.com> Message-ID: <1258563940-sup-2408@glaive> Excerpts from Daniel Herrington's message of Wed Nov 18 10:12:07 -0500 2009: > my @arJobNamesB = $ref_arJobNamesB; I bet you meant '@$ref_arJobNamesB'. Your code would probably be easier to skim for this kind of thing if it were less verbose. For example: > if ($newBoxNameH{$newBoxName}) { > my $ref_arJobNames = $newBoxNameH{$newBoxName}; > my @arJobNames = @$ref_arJobNames; > push (@arJobNames,$newJobName); > $newBoxNameH{$newBoxName} = \@arJobNames; > } else { > my @arJobNames; > push (@arJobNames,$newJobName); > $newBoxNameH{$newBoxName} = \@arJobNames; > } my @foo; push @foo, $x; $thing = \@foo; can be much more easily written as $thing = [ $x ]; In fact, the whole conditional I quoted above could be one line. push @{ $newBoxNameH{$newBoxName} }, $newJobName; Perl will automatically turn the nonexistent hash element into an array reference for you. If this is too magical for your taste, default it to an empty arrayref first: $newBoxNameH{$newBoxName} ||= []; hdp. From shlomif at iglu.org.il Wed Nov 18 08:55:59 2009 From: shlomif at iglu.org.il (Shlomi Fish) Date: Wed, 18 Nov 2009 18:55:59 +0200 Subject: [Pdx-pm] Different data structures for Hash of array, same code (mostly) In-Reply-To: <4B040EC7.10807@robertmarktech.com> References: <4B040EC7.10807@robertmarktech.com> Message-ID: <200911181855.59915.shlomif@iglu.org.il> Hi Daniel! On Wednesday 18 Nov 2009 17:12:07 Daniel Herrington wrote: > All, > > Sorry if this is a double post, but I didn't get a confirmaiton that my > last email made it. It did. > > I have two code snippets that should do the same thing, but do not > produce the same data structure. I can't seem to figure out why. > It seems your code snippets contain many anti-patterns. Let me say what I find wrong with them. If you wonder why a certain portion of code does not work as it should, you can always use the perl debugger interactively: http://perl-begin.org/topics/debugging/ > Code A: > ... > if ($boxNameH{$boxName}) { First I should note that I find these code snippets hard to read. They do not contain any empty lines, separating code paragraphs, and the variable names are given in camelCase or CamelCase with weird System hungarian notation (not even Apps Hungarian - see: http://en.wikipedia.org/wiki/Hungarian_notation#Systems_vs._Apps_Hungarian ), with a significant leading intendation which makes it hard to follow inside an email and "#Comments" instead of "# comments". Now let me continue. > #If we already have a list created > my $refBoxName = $boxNameH{$boxName}; > my @derefArray = @$refBoxName; > $derefArray[0]++; > push (@derefArray, $jobName); > $boxNameH{$boxName} = \@derefArray; OK, why are you dereferencing an array and just replacing it. You can just do (untested): <<<< my $box = $boxNameH{$boxName}; $box->[0]++; push @$box, $jobName; >>> Much easier, shorter and clearer. I should note that doing $box->[0]++ seems redundant in this case. Are you counting the number of jobs there? You can easily determine it based on scalar(@$box). > $caJIL{$jobName}{"$jilCommand"} = "$jilValue"; Why are you using "$jilCommand" And "$jilValue" in quotes. Normally the quotes are not needed (they are when you are trying to stringify objects. What is the meaning of the jil prefix? > } else { > #We're the first one > my @derefArray; > $derefArray[0] = 1; > push (@derefArray, $jobName); > $boxNameH{$boxName} = \@derefArray; > $caJIL{$jobName}{"$jilCommand"} = "$jilValue"; > } Again, you don't need to count the number of jobs explicitly. > ... > Using Dumper, the data in %boxNameH is: > 3108$VAR1 = { > 'CPO_TNC_WCONV0' => [ > 2, > 'CPO_TNC_WCONVERSION_CHMOD', > 'CPO_TNC_WCONVERSION_SETUP' > ], > 'CURRENTLINK_25' => [ > 1, > 'CURRENT_LINK_25' > ], > ... > > Code B: > ... > my %newBoxNameH; > foreach (@arBoxNames) { > my $boxName = $_; Why are you doing such a weird loop? Just do: <<<< foreach my $boxName (@arBoxNames) { ... } >>>> No need to loop over @arBoxNames with the default variable. > my $newBoxName; > my @jobNamesList; > if ($ref_hlqMap->{$boxName}) { > $newBoxName = $ref_hlqMap->{$boxName} ; } else { > $newBoxName = $boxName; > } You need to fix your indentation here. Prefarably use: <<< $newBoxName = $ref_hlqMap->{$boxName} || $boxName; >>> > print __LINE__ . " $newBoxName\n"; Why not use STDERR, or a logging module? > my $ref_arJobNamesB = $ref_boxNameH->{$boxName}; Implement my commentaries to your code below too. Both of these code snippets seem entirely different to me at first glance. Your first one has no loops. Regards, Shlomi Fish > my @arJobNamesB = $ref_arJobNamesB; > foreach (@arJobNamesB) { > my $jobName = $_; > my $newJobName; > if ($ref_hlqMap->{$jobName}) { > $newJobName = $ref_hlqMap->{$jobName}; > } else { > $newJobName = $jobName; > } > if ($newBoxNameH{$newBoxName}) { > my $ref_arJobNames = $newBoxNameH{$newBoxName}; > my @arJobNames = @$ref_arJobNames; > push (@arJobNames,$newJobName); > $newBoxNameH{$newBoxName} = \@arJobNames; > } else { > my @arJobNames; > push (@arJobNames,$newJobName); > $newBoxNameH{$newBoxName} = \@arJobNames; > } > } > ... > 289$VAR1 = { > 'CURRENTLINK_25' => [ > [ > 1, > 'CURRENT_LINK_25' > ] > ], > 'CPO_TNC_WCONV0' => [ > [ > 2, > 'CPO_TNC_WCONVERSION_CHMOD', > 'CPO_TNC_WCONVERSION_SETUP' > ] > ] > }; > ... > > You can see in Code B's dump that the list is actually embedded another > layer down as if Code B produces a Hash of Array of Array. I just can't > seem to figure out why this is happening? > > thanks, > -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Optimising Code for Speed - http://shlom.in/optimise Chuck Norris read the entire English Wikipedia in 24 hours. Twice. From dherrington at robertmarktech.com Wed Nov 18 12:39:49 2009 From: dherrington at robertmarktech.com (Daniel Herrington) Date: Wed, 18 Nov 2009 12:39:49 -0800 Subject: [Pdx-pm] Different data structures for Hash of array, same code (mostly) In-Reply-To: <1258563940-sup-2408@glaive> References: <4B040EC7.10807@robertmarktech.com> <1258563940-sup-2408@glaive> Message-ID: <4B045B95.4020601@robertmarktech.com> All, Hans, that deref was the problem, thanks. Verbosity tends to be a holdover from when I was less secure in my Pearl coding and wanted to know exactly what I did. I refactor towards verbosity when I run into problems, which in this case didn't actually help solve anything. I was actually using the following when i went to test and noticed the issue: push (@{$newBoxNameH{$newBoxName}}, $newJobName); This replaced that whole code snippet in B. Shlomi, thanks for the tips. The Code in snippet A was from over a year ago, before I started getting serious with Pearl and learned about how to handle complex data structure and dereferencing. I know I need to go back and refactor the sub that A came from, and one day as God is my witness I will ;) As always, time is the issue. The variable names aren't meant to be Hungarian, just simply how I started with Pearl and identifying an array from a hash, etc. Now it's just laziness as those names pop into my head when thinking of new variables. I do like my variables to be somewhat related to the data they contain, but it's an evolving standard in my head. Again, thanks all for the help and sorry for the double post. Dan H. Hans Dieter Pearcey wrote: > Excerpts from Daniel Herrington's message of Wed Nov 18 10:12:07 -0500 2009: > >> my @arJobNamesB = $ref_arJobNamesB; >> > > I bet you meant '@$ref_arJobNamesB'. > > Your code would probably be easier to skim for this kind of thing if it were > less verbose. For example: > > >> if ($newBoxNameH{$newBoxName}) { >> my $ref_arJobNames = $newBoxNameH{$newBoxName}; >> my @arJobNames = @$ref_arJobNames; >> push (@arJobNames,$newJobName); >> $newBoxNameH{$newBoxName} = \@arJobNames; >> } else { >> my @arJobNames; >> push (@arJobNames,$newJobName); >> $newBoxNameH{$newBoxName} = \@arJobNames; >> } >> > > my @foo; > push @foo, $x; > $thing = \@foo; > > can be much more easily written as > > $thing = [ $x ]; > > In fact, the whole conditional I quoted above could be one line. > > push @{ $newBoxNameH{$newBoxName} }, $newJobName; > > Perl will automatically turn the nonexistent hash element into an array > reference for you. If this is too magical for your taste, default it to an > empty arrayref first: > > $newBoxNameH{$newBoxName} ||= []; > > hdp. > _______________________________________________ > Pdx-pm-list mailing list > Pdx-pm-list at pm.org > http://mail.pm.org/mailman/listinfo/pdx-pm-list > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jshirley at gmail.com Wed Nov 18 13:15:09 2009 From: jshirley at gmail.com (J. Shirley) Date: Wed, 18 Nov 2009 13:15:09 -0800 Subject: [Pdx-pm] Different data structures for Hash of array, same code (mostly) In-Reply-To: <4B045B95.4020601@robertmarktech.com> References: <4B040EC7.10807@robertmarktech.com> <1258563940-sup-2408@glaive> <4B045B95.4020601@robertmarktech.com> Message-ID: <756703690911181315j37898d7awc57fe6985bed186a@mail.gmail.com> Is it intentional, ironic or just amusing that you are referring to Perl as "Pearl"? :) -J 2009/11/18 Daniel Herrington > All, > > Hans, that deref was the problem, thanks. Verbosity tends to be a holdover > from when I was less secure in my Pearl coding and wanted to know exactly > what I did. I refactor towards verbosity when I run into problems, which in > this case didn't actually help solve anything. I was actually using the > following when i went to test and noticed the issue: > > push (@{$newBoxNameH{$newBoxName}}, $newJobName); > > This replaced that whole code snippet in B. > > Shlomi, thanks for the tips. The Code in snippet A was from over a year > ago, before I started getting serious with Pearl and learned about how to > handle complex data structure and dereferencing. I know I need to go back > and refactor the sub that A came from, and one day as God is my witness I > will ;) As always, time is the issue. > > The variable names aren't meant to be Hungarian, just simply how I started > with Pearl and identifying an array from a hash, etc. Now it's just laziness > as those names pop into my head when thinking of new variables. I do like my > variables to be somewhat related to the data they contain, but it's an > evolving standard in my head. > > Again, thanks all for the help and sorry for the double post. > > Dan H. > > > Hans Dieter Pearcey wrote: > > Excerpts from Daniel Herrington's message of Wed Nov 18 10:12:07 -0500 2009: > > > my @arJobNamesB = $ref_arJobNamesB; > > > I bet you meant '@$ref_arJobNamesB'. > > Your code would probably be easier to skim for this kind of thing if it were > less verbose. For example: > > > > if ($newBoxNameH{$newBoxName}) { > my $ref_arJobNames = $newBoxNameH{$newBoxName}; > my @arJobNames = @$ref_arJobNames; > push (@arJobNames,$newJobName); > $newBoxNameH{$newBoxName} = \@arJobNames; > } else { > my @arJobNames; > push (@arJobNames,$newJobName); > $newBoxNameH{$newBoxName} = \@arJobNames; > } > > > my @foo; > push @foo, $x; > $thing = \@foo; > > can be much more easily written as > > $thing = [ $x ]; > > In fact, the whole conditional I quoted above could be one line. > > push @{ $newBoxNameH{$newBoxName} }, $newJobName; > > Perl will automatically turn the nonexistent hash element into an array > reference for you. If this is too magical for your taste, default it to an > empty arrayref first: > > $newBoxNameH{$newBoxName} ||= []; > > hdp. > _______________________________________________ > Pdx-pm-list mailing listPdx-pm-list at pm.orghttp://mail.pm.org/mailman/listinfo/pdx-pm-list > > > _______________________________________________ > Pdx-pm-list mailing list > Pdx-pm-list at pm.org > http://mail.pm.org/mailman/listinfo/pdx-pm-list > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dherrington at robertmarktech.com Wed Nov 18 13:22:01 2009 From: dherrington at robertmarktech.com (Daniel Herrington) Date: Wed, 18 Nov 2009 13:22:01 -0800 Subject: [Pdx-pm] Different data structures for Hash of array, same code (mostly) In-Reply-To: <756703690911181315j37898d7awc57fe6985bed186a@mail.gmail.com> References: <4B040EC7.10807@robertmarktech.com> <1258563940-sup-2408@glaive> <4B045B95.4020601@robertmarktech.com> <756703690911181315j37898d7awc57fe6985bed186a@mail.gmail.com> Message-ID: <4B046579.1050304@robertmarktech.com> Problems with my dictionary...that's been fixed. J. Shirley wrote: > Is it intentional, ironic or just amusing that you are referring to > Perl as "Pearl"? :) > > -J > > 2009/11/18 Daniel Herrington > > > All, > > Hans, that deref was the problem, thanks. Verbosity tends to be a > holdover from when I was less secure in my Pearl coding and wanted > to know exactly what I did. I refactor towards verbosity when I > run into problems, which in this case didn't actually help solve > anything. I was actually using the following when i went to test > and noticed the issue: > > push (@{$newBoxNameH{$newBoxName}}, $newJobName); > > This replaced that whole code snippet in B. > > Shlomi, thanks for the tips. The Code in snippet A was from over a > year ago, before I started getting serious with Pearl and learned > about how to handle complex data structure and dereferencing. I > know I need to go back and refactor the sub that A came from, and > one day as God is my witness I will ;) As always, time is the issue. > > The variable names aren't meant to be Hungarian, just simply how I > started with Pearl and identifying an array from a hash, etc. Now > it's just laziness as those names pop into my head when thinking > of new variables. I do like my variables to be somewhat related to > the data they contain, but it's an evolving standard in my head. > > Again, thanks all for the help and sorry for the double post. > > Dan H. > > > Hans Dieter Pearcey wrote: >> Excerpts from Daniel Herrington's message of Wed Nov 18 10:12:07 -0500 2009: >> >>> my @arJobNamesB = $ref_arJobNamesB; >>> >> I bet you meant '@$ref_arJobNamesB'. >> >> Your code would probably be easier to skim for this kind of thing if it were >> less verbose. For example: >> >> >>> if ($newBoxNameH{$newBoxName}) { >>> my $ref_arJobNames = $newBoxNameH{$newBoxName}; >>> my @arJobNames = @$ref_arJobNames; >>> push (@arJobNames,$newJobName); >>> $newBoxNameH{$newBoxName} = \@arJobNames; >>> } else { >>> my @arJobNames; >>> push (@arJobNames,$newJobName); >>> $newBoxNameH{$newBoxName} = \@arJobNames; >>> } >>> >> my @foo; >> push @foo, $x; >> $thing = \@foo; >> >> can be much more easily written as >> >> $thing = [ $x ]; >> >> In fact, the whole conditional I quoted above could be one line. >> >> push @{ $newBoxNameH{$newBoxName} }, $newJobName; >> >> Perl will automatically turn the nonexistent hash element into an array >> reference for you. If this is too magical for your taste, default it to an >> empty arrayref first: >> >> $newBoxNameH{$newBoxName} ||= []; >> >> hdp. >> _______________________________________________ >> Pdx-pm-list mailing list >> Pdx-pm-list at pm.org >> http://mail.pm.org/mailman/listinfo/pdx-pm-list >> > > _______________________________________________ > Pdx-pm-list mailing list > Pdx-pm-list at pm.org > http://mail.pm.org/mailman/listinfo/pdx-pm-list > > > -- Daniel B. Herrington Director of Field Services Robert Mark Technologies dherrington at robertmarktechnologies.com o: 651-769-2574 m: 503-358-8575 -------------- next part -------------- An HTML attachment was scrubbed... URL: From pagaltzis at gmx.de Fri Nov 20 08:04:35 2009 From: pagaltzis at gmx.de (Aristotle Pagaltzis) Date: Fri, 20 Nov 2009 17:04:35 +0100 Subject: [Pdx-pm] Different data structures for Hash of array, same code (mostly) In-Reply-To: <4B046579.1050304@robertmarktech.com> References: <4B040EC7.10807@robertmarktech.com> <1258563940-sup-2408@glaive> <4B045B95.4020601@robertmarktech.com> <756703690911181315j37898d7awc57fe6985bed186a@mail.gmail.com> <4B046579.1050304@robertmarktech.com> Message-ID: <20091120160435.GB16203@klangraum.plasmasturm.org> * Daniel Herrington [2009-11-18 22:25]: > J. Shirley wrote: > >Is it intentional, ironic or just amusing that you are referring to > >Perl as "Pearl"? :) > > Problems with my dictionary...that's been fixed. Cupertino effect strikes again? Regards, -- Aristotle Pagaltzis // From triddle at gmail.com Sun Nov 29 07:58:35 2009 From: triddle at gmail.com (Tyler Riddle) Date: Sun, 29 Nov 2009 07:58:35 -0800 Subject: [Pdx-pm] A call for XML documents Message-ID: Hello fellow mongers, I'm putting together a software package to unmarshal XML documents as fast as possible and I'm currently trying to bang out the API. My use case so far is the MediaWiki dump file format but I'd like to see other real world XML document examples to throw at my API and see how it stands up. Anyone have some XML documents they deal with or know where I can find a repository of them? Links would be appreciated! Thanks, Tyler Riddle -- If you wish to make an apple pie from scratch you must first invent the universe. -- Carl Sagan From erik at hollensbe.org Sun Nov 29 08:02:09 2009 From: erik at hollensbe.org (Erik Hollensbe) Date: Sun, 29 Nov 2009 11:02:09 -0500 Subject: [Pdx-pm] A call for XML documents In-Reply-To: References: Message-ID: <4B129B01.1000903@hollensbe.org> On 11/29/2009 10:58 AM, Tyler Riddle wrote: > Hello fellow mongers, > > I'm putting together a software package to unmarshal XML documents as > fast as possible and I'm currently trying to bang out the API. My use > case so far is the MediaWiki dump file format but I'd like to see > other real world XML document examples to throw at my API and see how > it stands up. Anyone have some XML documents they deal with or know > where I can find a repository of them? Links would be appreciated! > > Thanks, > > Tyler Riddle > Python's "feedparser" project had a ton of test documents that were very handy when I wrote an atom parser. Maybe you'll find them useful. Also, there is an XML standard battery, but I cannot remember the name; I imagine the libxml project does, though. -Erik From shlomif at iglu.org.il Mon Nov 30 01:30:33 2009 From: shlomif at iglu.org.il (Shlomi Fish) Date: Mon, 30 Nov 2009 11:30:33 +0200 Subject: [Pdx-pm] A call for XML documents In-Reply-To: References: Message-ID: <200911301130.34104.shlomif@iglu.org.il> On Sunday 29 Nov 2009 17:58:35 Tyler Riddle wrote: > Hello fellow mongers, > > I'm putting together a software package to unmarshal XML documents as > fast as possible and I'm currently trying to bang out the API. My use > case so far is the MediaWiki dump file format but I'd like to see > other real world XML document examples to throw at my API and see how > it stands up. Anyone have some XML documents they deal with or know > where I can find a repository of them? Links would be appreciated! > I've placed a collection of XML files I'm using for my homepage and other sites here: http://www.shlomifish.org/Files/files/Shlomif-XMLs.tar.xz (You need http://tukaani.org/xz/ to open it). Most of them should validate, and some of them have Hebrew UTF-8 characters. Moreover, I should note that most pages of my sites - http://web-cpan.berlios.de/latemp/examples/ - validate as XHTML 1.1, and so are also valid XML files. Hope it helps. Regards, Shlomi Fish -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ "The Human Hacking Field Guide" - http://shlom.in/hhfg Chuck Norris read the entire English Wikipedia in 24 hours. Twice. From igal at pragmaticraft.com Mon Nov 30 15:18:51 2009 From: igal at pragmaticraft.com (Igal Koshevoy) Date: Mon, 30 Nov 2009 15:18:51 -0800 Subject: [Pdx-pm] Winter Coders Social, Tuesday, December 8, 2009, 6-11pm Message-ID: <4B1452DB.1080801@pragmaticraft.com> Hey Perl Mongers, this year's Winter Coders Social is coming up and you're invited. This is a fun free, annual event that members of many local user groups get together at to mingle, eat and play games. This is the third time the event's been held and it's been lots of fun every time. Please view the event details and sign up to bring some food: http://calagator.org/events/1250457765 See you there! -igal From jaleto at gmail.com Mon Nov 30 18:48:49 2009 From: jaleto at gmail.com (Jonathan Leto) Date: Mon, 30 Nov 2009 18:48:49 -0800 Subject: [Pdx-pm] Winter Coders Social, Tuesday, December 8, 2009, 6-11pm In-Reply-To: <4B1452DB.1080801@pragmaticraft.com> References: <4B1452DB.1080801@pragmaticraft.com> Message-ID: <9aaadf9c0911301848l2879db1asbe303207196f3fc9@mail.gmail.com> Howdy, I will definitely make it out. I tried to add myself to the potluck spreadsheet, but I do not have access to edit. Is there a potluck spreadsheet XML RPC protocol, perhaps? Duke On Mon, Nov 30, 2009 at 3:18 PM, Igal Koshevoy wrote: > Hey Perl Mongers, this year's Winter Coders Social is coming up and > you're invited. This is a fun free, annual event that members of many > local user groups get together at to mingle, eat and play games. This is > the third time the event's been held and it's been lots of fun every time. > > Please view the event details and sign up to bring some food: > http://calagator.org/events/1250457765 > > See you there! > > -igal > > > _______________________________________________ > Pdx-pm-list mailing list > Pdx-pm-list at pm.org > http://mail.pm.org/mailman/listinfo/pdx-pm-list > -- Jonathan "Duke" Leto jonathan at leto.net http://leto.net From igal at pragmaticraft.com Mon Nov 30 19:03:13 2009 From: igal at pragmaticraft.com (Igal Koshevoy) Date: Mon, 30 Nov 2009 19:03:13 -0800 Subject: [Pdx-pm] Winter Coders Social, Tuesday, December 8, 2009, 6-11pm In-Reply-To: <9aaadf9c0911301848l2879db1asbe303207196f3fc9@mail.gmail.com> References: <4B1452DB.1080801@pragmaticraft.com> <9aaadf9c0911301848l2879db1asbe303207196f3fc9@mail.gmail.com> Message-ID: <4B148771.7020707@pragmaticraft.com> My Duke, Thanks for the comment. The instructions incorrectly asked people to add themselves to the read-only spreadsheet, rather than enter information into the form linked later in the page. I've rewritten the text and hope it's clearer now. -igal Jonathan Leto wrote: > Howdy, > > I will definitely make it out. I tried to add myself to the potluck > spreadsheet, but I do not have access to edit. Is there a potluck > spreadsheet XML RPC protocol, perhaps? > > Duke > > > > On Mon, Nov 30, 2009 at 3:18 PM, Igal Koshevoy wrote: > >> Hey Perl Mongers, this year's Winter Coders Social is coming up and >> you're invited. This is a fun free, annual event that members of many >> local user groups get together at to mingle, eat and play games. This is >> the third time the event's been held and it's been lots of fun every time. >> >> Please view the event details and sign up to bring some food: >> http://calagator.org/events/1250457765 >> >> See you there! >> >> -igal From rmb32 at cornell.edu Mon Nov 30 20:20:05 2009 From: rmb32 at cornell.edu (Robert Buels) Date: Mon, 30 Nov 2009 20:20:05 -0800 Subject: [Pdx-pm] Winter Coders Social, Tuesday, December 8, 2009, 6-11pm In-Reply-To: <4B148771.7020707@pragmaticraft.com> References: <4B1452DB.1080801@pragmaticraft.com> <9aaadf9c0911301848l2879db1asbe303207196f3fc9@mail.gmail.com> <4B148771.7020707@pragmaticraft.com> Message-ID: <4B149975.7040505@cornell.edu> My web browser doesn't support forms. Do you have a SOAP service with WSDL that I could use to query attendees and submit my RSVP? Rob Igal Koshevoy wrote: > My Duke, > > Thanks for the comment. The instructions incorrectly asked people to add > themselves to the read-only spreadsheet, rather than enter information > into the form linked later in the page. > > I've rewritten the text and hope it's clearer now. > > -igal > > Jonathan Leto wrote: >> Howdy, >> >> I will definitely make it out. I tried to add myself to the potluck >> spreadsheet, but I do not have access to edit. Is there a potluck >> spreadsheet XML RPC protocol, perhaps? >> >> Duke >> >> >> >> On Mon, Nov 30, 2009 at 3:18 PM, Igal Koshevoy wrote: >> >>> Hey Perl Mongers, this year's Winter Coders Social is coming up and >>> you're invited. This is a fun free, annual event that members of many >>> local user groups get together at to mingle, eat and play games. This is >>> the third time the event's been held and it's been lots of fun every time. >>> >>> Please view the event details and sign up to bring some food: >>> http://calagator.org/events/1250457765 >>> >>> See you there! >>> >>> -igal > _______________________________________________ > Pdx-pm-list mailing list > Pdx-pm-list at pm.org > http://mail.pm.org/mailman/listinfo/pdx-pm-list > -- Robert Buels Bioinformatics Analyst, Sol Genomics Network Boyce Thompson Institute for Plant Research Tower Rd Ithaca, NY 14853 Tel: 503-889-8539 rmb32 at cornell.edu http://www.sgn.cornell.edu From clone206 at gmail.com Mon Nov 30 15:23:40 2009 From: clone206 at gmail.com (Kevin) Date: Mon, 30 Nov 2009 15:23:40 -0800 Subject: [Pdx-pm] Winter Coders Social, Tuesday, December 8, 2009, 6-11pm In-Reply-To: <4B1452DB.1080801@pragmaticraft.com> References: <4B1452DB.1080801@pragmaticraft.com> Message-ID: <7819424F-B0F6-4AB0-8DC4-AA4F0BB25485@gmail.com> Was that meant to be "fun-free", with a hyphen? ;) -Kevin W On Nov 30, 2009, at 3:18 PM, Igal Koshevoy wrote: > Hey Perl Mongers, this year's Winter Coders Social is coming up and > you're invited. This is a fun free, annual event that members of many > local user groups get together at to mingle, eat and play games. > This is > the third time the event's been held and it's been lots of fun every > time. > > Please view the event details and sign up to bring some food: > http://calagator.org/events/1250457765 > > See you there! > > -igal > > > _______________________________________________ > Pdx-pm-list mailing list > Pdx-pm-list at pm.org > http://mail.pm.org/mailman/listinfo/pdx-pm-list