From faber at linuxnj.com Tue Dec 5 06:51:17 2006 From: faber at linuxnj.com (Faber J. Fedor) Date: Tue, 5 Dec 2006 09:51:17 -0500 Subject: [ABE.pm] beer good. php bad. In-Reply-To: <20061128232036.GC2837@knight> References: <20061128232036.GC2837@knight> Message-ID: <20061205145117.GC11259@neptune.faber.nom> On 28/11/06 18:20 -0500, Ricardo SIGNES wrote: > To celebrate how good beer is, let's grab some beers on Wednesday, December 6, > a week from tomorrow. Where are we drinking at tomorrow? Mach Guts again? If so, send me the address again so I can google-map it. I got lost the last time there. 7 PM? > Hopefully by then I'll have recovered and will no longer > feel the need to badmouth PHP, especially if Faber is there. :-? -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com From rjbs-perl-abe at lists.manxome.org Tue Dec 5 07:12:12 2006 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Tue, 5 Dec 2006 10:12:12 -0500 Subject: [ABE.pm] beer good. php bad. In-Reply-To: <20061205145117.GC11259@neptune.faber.nom> References: <20061128232036.GC2837@knight> <20061205145117.GC11259@neptune.faber.nom> Message-ID: <20061205151212.GA25494@zodiac.codesimply.com> * "Faber J. Fedor" [2006-12-05T09:51:17] > On 28/11/06 18:20 -0500, Ricardo SIGNES wrote: > > To celebrate how good beer is, let's grab some beers on Wednesday, December > > 6, a week from tomorrow. > > Where are we drinking at tomorrow? Mach Guts again? If so, send me the > address again so I can google-map it. I got lost the last time there. > 7 PM? I don't know the exact address, but it's on Linden between Garrison and Spruce. I suggest Googlemapping Mac's Hobby Hall, Bethlehem, PA. That's a few doors down. 19:00 sounds good. -- rjbs From rjbs-perl-abe at lists.manxome.org Fri Dec 15 17:03:54 2006 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Fri, 15 Dec 2006 20:03:54 -0500 Subject: [ABE.pm] what rjbs is up to Message-ID: <20061216010354.GB1226@knight.local> Programmery People: How's it going? I am stuck on a bus and going insane. So far it's taken us 2.25 hours to get from Philadelphia to Quakertown, but I think things are going to speed up now. Anyway, I thought I'd use this time to finally talk about some of the stuff I've been up to. Some of it has been fun. I think I already talked, at the bar, about some of the memory optimizing I've been doing in Perl Email Project code. It's nice to pick the low-hanging fruit, now and then. It's especially nice when the fruit is hanging low from a really commonly-used module. It would be neat if there were some way to see what kind of performance impact one's code changes has on every install in the world, but I think that's what they call "spyware." http://use.perl.org/~rjbs/journal/31737 http://use.perl.org/~rjbs/journal/31749 Today I wrote up another bizarre and hateful problem that came out of that process. Basically it goes like this: calling UNIVERASL::can or UNIVERSAL::isa as functions sucks. If you call them on an object with special behavior for isa or can, it's skipped. Instead, you should call them as a method, and use eval{} to avoid dying. I only recently discovered the ridiculous side effect in older perls. If you ever pass in a gigantic string, especially with certain characteristics, you can bloat your memory usage up in insane, hateful ways. http://use.perl.org/~rjbs/journal/31922 A very simple-to-generate long string can exhaust memory when used as an invocant under perl-5.6, with no problem. That is, I can exhaust your several gigs of RAM with a string of a meg or so and one call to isa. Ack! I also had some fun tweaking Sub::Exporter, but I think you're all sick of hearing me talk about how much I love my favorite module. If my modules were my children, all the others would gang up and smother Sub::Exporter out of jealousy. Sub::Exporter would never do anything like that. Why can't my other chil^Wmodules be more like Sub::Exporter? http://use.perl.org/~rjbs/journal/31812 Then I played with those improvements to produce something I've had sitting on a back burner forever. It's a mixin that provides places to stick ... stuff. A mixin is like a little shard of a class that you mix into your class to give it extra magical powers. It's analagous to the way that a module of routines is mixed into the core language to give the language extra magical powers. When you use, say, Math::Trig, it's like you're mixing trig routines right into the language. If you used Mixin::Serialize (which doesn't exist), you'd be mixing trig /methods/ right into your /class/. Sub::Exporter is really good for making mixins... but I won't get into that. Anyway, I hate writing code. I prefer to sort of dangle a string into a glass that's supersaturated with code solute and then watching the code grow on the glass while I enjoy a beer. There are lots of tools to eliminate writing repetitive code. A popular one is Class::Accessor, which installs methods into your class for accessing the guts of your object, assuming your object is a blessed hash reference. There's also Class::MethodMaker, Class::Meta, Moose, and more. What I wanted was a simple way to add more datapoints to an object without having to worry about what the object was -- I wanted it to work whether it was a hashref, a coderef, or any other nonsense. Further, I wanted to be able to change the way the datapoints were stored, too. Sometimes I'd just want them in memory, other times in different kinds of databases... and sometimes I'd have to use databases that already existed. Finally, I wanted to be able to store an arbitrary number of named fields for any object. I didn't want to have to say, up front, "yeah, so this class is going to have a flavor field, a moonphase field, and a rsPLSchottky field." So, this was actually fairly straightforward, with a couple bits of abstraction. I released this distribution, last week: http://search.cpan.org/dist/Mixin-ExtraFields/ It lets you write code like this: package Corporate::WorkOrder; use Mixin::ExtraFields -fields => { id => 'workorder_id', moniker => 'note', driver => 'HashGuts', }; and now your WorkOrder objects can be dealt with like so: $order->set_note(moonphase => 'waning gibbous'); The "driver" sets up how things are stored, and you can change them in and out without anything else having to change. Also, since you can give different monikers, you can have a bunch of these extra sets of fields, each using a unique storage driver and/or location. This has been really convenient for cleaning up several similar (but, if I may say so, inferior) implementations of this kind of concept at work. In fact, as soon as I replaced one or two, I found that it had become so easy to change how they worked that I was able to change a line here or there and greatly simplify some code. The other fun thing is that Mixin::ExtraFields is a class that mixes things in out of ingredients. It doesn't mix itself in like many mixins do. That means it can be subclassed to mix things differently. I've already written a few subclasses, like one that mixes in a Data::Hive, so you can say this: $t_shirt->notes->quality->inspected_by->SET("Number 8"); Just by using "Mixin::ExtraFields::Hive" insead of the normal class. There's also a ::Param subclass, which gives you a param method like those found on CGI and CGI::Application and Catalyst and lots of other webby things. I need to write some more drivers. I've written one for our proprietary ORML (like Class::DBI) at work, but that doesn't help people outside of the VPN. I might write one for Class::DBI or DBIx::Class. I've also thought about writing one like HashGuts, but using inside-out techniques. I have no idea if this scratches anyone's itch but my own, but it was a lot of fun, and I hope that I can popularize, at least a little, the Mixin:: namespace and construction technique. Well, we're finally coming down 378 into Bethlehem. It's 20:02, and I'm famished. I'm going to get some dinner and go home. -- rjbs From faber at linuxnj.com Mon Dec 18 10:44:20 2006 From: faber at linuxnj.com (Faber J. Fedor) Date: Mon, 18 Dec 2006 13:44:20 -0500 Subject: [ABE.pm] Curious Message-ID: <20061218184419.GA3345@neptune.faber.nom> I'm debugging some code. I've got a hash that looks like this: DB<10> x $dataHRef 0 HASH(0x870fa08) 19890131 => HASH(0x87e699c) 1 => 0.311103 10 => 0.628309 2 => '-0.412132' 3 => 0.376397 4 => '-0.020074' 5 => 0.700074 6 => '-0.172132' 7 => '-0.652206' 8 => '-0.673162' 9 => '-1.566985' I did this DB<11> x keys %$dataHRef 0 19890131 which is what I expected. So in my code I say 249: my $date = keys %$dataHRef; but DB<12> x $date 0 1 What?! -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com From jeff at smashing.org Mon Dec 18 11:02:46 2006 From: jeff at smashing.org (Jeff Horwitz) Date: Mon, 18 Dec 2006 14:02:46 -0500 (EST) Subject: [ABE.pm] Curious In-Reply-To: <20061218184419.GA3345@neptune.faber.nom> References: <20061218184419.GA3345@neptune.faber.nom> Message-ID: when you assign its value to $date, you're calling "keys %$dataHRef" in a scalar context. this returns the number of keys in the hash, which in this case is 1. -jeff On Mon, 18 Dec 2006, Faber J. Fedor wrote: > I'm debugging some code. I've got a hash that looks like this: > > DB<10> x $dataHRef > 0 HASH(0x870fa08) > 19890131 => HASH(0x87e699c) > 1 => 0.311103 > 10 => 0.628309 > 2 => '-0.412132' > 3 => 0.376397 > 4 => '-0.020074' > 5 => 0.700074 > 6 => '-0.172132' > 7 => '-0.652206' > 8 => '-0.673162' > 9 => '-1.566985' > > I did this > > DB<11> x keys %$dataHRef > 0 19890131 > > which is what I expected. So in my code I say > > 249: my $date = keys %$dataHRef; > > but > > DB<12> x $date > 0 1 > > > What?! > > -- > > Regards, > > Faber Fedor > President > Linux New Jersey, Inc. > 908-320-0357 > 800-706-0701 > > http://www.linuxnj.com > > > > _______________________________________________ > ABE-pm mailing list > ABE-pm at pm.org > http://mail.pm.org/mailman/listinfo/abe-pm > From mct at toren.net Mon Dec 18 11:06:20 2006 From: mct at toren.net (Michael C. Toren) Date: Mon, 18 Dec 2006 14:06:20 -0500 Subject: [ABE.pm] Curious In-Reply-To: <20061218184419.GA3345@neptune.faber.nom> References: <20061218184419.GA3345@neptune.faber.nom> Message-ID: <20061218190620.GB22450@netisland.net> On Mon, Dec 18, 2006 at 01:44:20PM -0500, Faber J. Fedor wrote: > I did this > > DB<11> x keys %$dataHRef > 0 19890131 > > which is what I expected. So in my code I say > > 249: my $date = keys %$dataHRef; > > but > > DB<12> x $date > 0 1 In the above, "keys %$dataHRef" is returning a list with one element. You're then evaluating that list in scalar context, which returns the number of elements in the list -- 1. If instead what you were hoping for was the name of the first key, you can do: my $date = (keys %$dataHRef)[0]; or: my ($date) = keys %$dataHRef; HTH, -mct From rjbs-perl-abe at lists.manxome.org Mon Dec 18 11:42:06 2006 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Mon, 18 Dec 2006 14:42:06 -0500 Subject: [ABE.pm] Curious In-Reply-To: <20061218184419.GA3345@neptune.faber.nom> References: <20061218184419.GA3345@neptune.faber.nom> Message-ID: <20061218194205.GA27360@zodiac.codesimply.com> * "Faber J. Fedor" [2006-12-18T13:44:20] > I'm debugging some code. I've got a hash that looks like this: > > DB<10> x $dataHRef > 0 HASH(0x870fa08) > 19890131 => HASH(0x87e699c) > ... > > I did this > > DB<11> x keys %$dataHRef > 0 19890131 > > which is what I expected. So in my code I say > > 249: my $date = keys %$dataHRef; As has been noted, it's a context issue. I would advise that even this solution: my ($date) = keys %$dataHRef; is not great, since if there is more than one key, the order in which they keys are returned is not ideal. If you want the latest or earliest key, you'll need to sort, or use more structure. In the debugger, x defaults to list context. Always check "x scalar FOO" also. -- rjbs From faber at linuxnj.com Mon Dec 18 18:56:34 2006 From: faber at linuxnj.com (Faber J. Fedor) Date: Mon, 18 Dec 2006 21:56:34 -0500 Subject: [ABE.pm] Curious In-Reply-To: <20061218194205.GA27360@zodiac.codesimply.com> References: <20061218184419.GA3345@neptune.faber.nom> <20061218194205.GA27360@zodiac.codesimply.com> Message-ID: <20061219025634.GA3990@neptune.faber.nom> On 18/12/06 14:42 -0500, Ricardo SIGNES wrote: > As has been noted, it's a context issue. I would advise that even this > solution: > > my ($date) = keys %$dataHRef; > > is not great, since if there is more than one key, I never would have thought of this. It worked well in one situation where I do have just one key. Thanks to all who responded. As for my previous problem, I worked around it using a foreach. Kinda stupid to use for one key, but it came in handy later when there was a case with multiple keys! I do have a stylistic(?) question. My hash (again): 0 HASH(0x870fa08) 19890131 => HASH(0x87e699c) 1 => 0.311103 10 => 0.628309 2 => '-0.412132' 3 => 0.376397 4 => '-0.020074' 5 => 0.700074 6 => '-0.172132' 7 => '-0.652206' 8 => '-0.673162' 9 => '-1.566985' Yes, just one key. I pass it to a function and I want to access the sub-hash (the 1 through 10 elements). Is there a better way than this: sub foo { my ($hashref) = @_; my ($date) = keys %$hashref; for(my $i=1; $i<=10; $i++) { $hashref->{$date}->{$i} = $moonphase * 2; } } $ end of foo The 'my ($date) = keys %$hashref;' looks like nothing more than an intermediate variable which we should be able to get rid of. Can we? I would try to replace '$hashref->{$date}' with '$hashref->{keys %$hashref}' but not only does it get computed on each pass for no good reason, it just looks tacky. -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com From rjbs-perl-abe at lists.manxome.org Mon Dec 18 20:38:37 2006 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Mon, 18 Dec 2006 23:38:37 -0500 Subject: [ABE.pm] Curious In-Reply-To: <20061219025634.GA3990@neptune.faber.nom> References: <20061218184419.GA3345@neptune.faber.nom> <20061218194205.GA27360@zodiac.codesimply.com> <20061219025634.GA3990@neptune.faber.nom> Message-ID: <20061219043837.GA30482@zodiac.codesimply.com> * "Faber J. Fedor" [2006-12-18T21:56:34] > I do have a stylistic(?) question. > > My hash (again): > 0 HASH(0x870fa08) > 19890131 => HASH(0x87e699c) > ... > > Yes, just one key. I pass it to a function and I want to access the sub-hash > (the 1 through 10 elements). Is there a better way than this: > > sub foo { > my ($hashref) = @_; > > my ($date) = keys %$hashref; > > for(my $i=1; $i<=10; $i++) { > $hashref->{$date}->{$i} = $moonphase * 2; > } > } $ end of foo Assuming that you're calling foo like this: foo($hashref) You could, instead, write: foo($_) for values %$hashref foo would then be defined: sub foo { my ($bucket) = @_; for my $i (1 .. 10) { $bucket{$i} = $moonphase * 2; } } Since the values in $hashref are references, you can pass them around without always giving the same referring structure to get at them. Each copy of the reference points to the same thing. -- rjbs From faber at linuxnj.com Mon Dec 18 20:51:16 2006 From: faber at linuxnj.com (Faber J. Fedor) Date: Mon, 18 Dec 2006 23:51:16 -0500 Subject: [ABE.pm] Curious In-Reply-To: <20061219043837.GA30482@zodiac.codesimply.com> References: <20061218184419.GA3345@neptune.faber.nom> <20061218194205.GA27360@zodiac.codesimply.com> <20061219025634.GA3990@neptune.faber.nom> <20061219043837.GA30482@zodiac.codesimply.com> Message-ID: <20061219045116.GA4619@neptune.faber.nom> On 18/12/06 23:38 -0500, Ricardo SIGNES wrote: > Assuming that you're calling foo like this: foo($hashref) > > You could, instead, write: foo($_) for values %$hashref Cool! Thanks! -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com From fiedlert at gmail.com Wed Dec 20 23:48:36 2006 From: fiedlert at gmail.com (Ted Fiedler) Date: Thu, 21 Dec 2006 02:48:36 -0500 Subject: [ABE.pm] Net::Flickr:;Backup woes Message-ID: <814422ce0612202348m7018e1e5j2d1c9ec2837d40ec@mail.gmail.com> OK so Im feeling like a bit of a n00b. Im (trying) using Net::Flicker::Backup to backup my photos on flickr. My code looks like this #!/usr/bin/perl # use strict; use warnings; use Net::Flickr::Backup; my $cfg = "/home/tfiedler/cfg"; my $flickr = Net::Flickr::Backup->new($cfg); $flickr->backup(); and "/home/tfiedler/cfg" looks like this [flickr] api_key=myapikey api_secret=mysecret auth_token=myauthtoken [backup] photos_root=/home/tfiedler/flickr/backup [rdf] do_dump=1 rdfdump_root=/home/tfiedler/flickr/backup According to the docs I should be OK, here is the error I am getting Invalid API handler at /usr/local/share/perl/5.8.7/Net/Flickr/API.pm line 160. Can't locate object method "unself" via package "Net::Flickr::Backup" at /usr/local/share/perl/5.8.7/Net/Flickr/API.pm line 147. I have tried changing the flickr block to flick ( as per the docs ) and I still get the same error. Any ideas? Ted -- "You are never dedicated to something you have complete confidence in. No one is fanatically shouting that the sun is going to rise tomorrow. They know it's going to rise tomorrow. " -- Robert M Pirsig From geoff at modperlcookbook.org Thu Dec 21 05:24:35 2006 From: geoff at modperlcookbook.org (Geoffrey Young) Date: Thu, 21 Dec 2006 08:24:35 -0500 Subject: [ABE.pm] Net::Flickr:;Backup woes In-Reply-To: <814422ce0612202348m7018e1e5j2d1c9ec2837d40ec@mail.gmail.com> References: <814422ce0612202348m7018e1e5j2d1c9ec2837d40ec@mail.gmail.com> Message-ID: <458A8B13.6010205@modperlcookbook.org> Ted Fiedler wrote: > OK so Im feeling like a bit of a n00b. > > Im (trying) using Net::Flicker::Backup to backup my photos on flickr. > > I have tried changing the flickr block to flick ( as per the docs ) > and I still get the same error. Any ideas? http://use.perl.org/~geoff/journal/29409 I haven't tried Net::Flickr::Backup, but I was never able to figure out the auth bits and get other flickr apis to work, so I ended up with MIME::Lite: http://use.perl.org/~geoff/journal/29409 shouldn't be that hard to script a file with photos you've already sent and email over the rest. when I first started posting to flickr I sent off ~200 of my current images to flickr via email and about 5 minutes later they were all there. HTH --Geoff From rjbs-perl-abe at lists.manxome.org Thu Dec 21 05:44:56 2006 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Thu, 21 Dec 2006 08:44:56 -0500 Subject: [ABE.pm] Net::Flickr:;Backup woes In-Reply-To: <814422ce0612202348m7018e1e5j2d1c9ec2837d40ec@mail.gmail.com> References: <814422ce0612202348m7018e1e5j2d1c9ec2837d40ec@mail.gmail.com> Message-ID: <20061221134456.GA1091@zodiac.codesimply.com> * Ted Fiedler [2006-12-21T02:48:36] > According to the docs I should be OK, here is the error I am getting > > Invalid API handler at /usr/local/share/perl/5.8.7/Net/Flickr/API.pm line 160. > Can't locate object method "unself" via package "Net::Flickr::Backup" > at /usr/local/share/perl/5.8.7/Net/Flickr/API.pm line 147. "unself" looks like a typo for undef. The real problem is the warning, which causes init to return 0. It's because: if ($self->{cfg}->param("flickr.api_handler") !~ /^(?:XPath|LibXML)$/) { Which do you need to use? I dunno! Let me know how it goes. I am very very eager to get Flickr backups working for me. -- rjbs From rjbs-perl-abe at lists.manxome.org Thu Dec 21 05:55:06 2006 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Thu, 21 Dec 2006 08:55:06 -0500 Subject: [ABE.pm] Net::Flickr:;Backup woes In-Reply-To: <458A8B13.6010205@modperlcookbook.org> References: <814422ce0612202348m7018e1e5j2d1c9ec2837d40ec@mail.gmail.com> <458A8B13.6010205@modperlcookbook.org> Message-ID: <20061221135506.GB1091@zodiac.codesimply.com> * Geoffrey Young [2006-12-21T08:24:35] > I haven't tried Net::Flickr::Backup, but I was never able to figure out > the auth bits and get other flickr apis to work, so I ended up with > MIME::Lite: > > http://use.perl.org/~geoff/journal/29409 I had no problem with Flickr::Upload... once I figured out that auth thing. All the Flickr API bits talk about getting auth tokens, but nothing seems to adequately explain how to get one. Finally I noticed that the flickr_upload script included code to get one, so I used that. I wrote a script to upload images from my jgal-created galleries to Flickr, with tags, description, and other stuff: http://rjbs.manxome.org/hacks/perl/jgal2flickr Tagging was essential, since I was uploading about 2000 photos and needed to identify what had been in what batch. I'm hoping that this has prepared me for getting the backup working. I don't want to lose any notes, set definitions, comments, and soo n. -- rjbs From faber at linuxnj.com Thu Dec 21 14:19:24 2006 From: faber at linuxnj.com (Faber J. Fedor) Date: Thu, 21 Dec 2006 17:19:24 -0500 Subject: [ABE.pm] "Rotating" a table Message-ID: <20061221221924.GA14143@neptune.faber.nom> I'm using this (so far) awesome graphics package called ChartDirector (http://www.advsofteng.com/). It's not FLOSS but I haven't found anything that will do as much as CD in as little time. Anywho, to make my plots, ChartDirector likes arrays refs. To plot my two sets of x data data with labels I would create the arrayrefs like this: my $data1 = [ 1,2,3,4,5]; my $data2 = [ 6,7,8,9,10]; my $labels = ['Jan', 'Feb', 'Mar', 'Apr', 'May']; (This is how they do it in the sample code.) The data I'm plotting is in a table that looks like this: year, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10 What I need to do is to put all the years in one arrayref, all the d1s in another array ref, the d2' in an arrayref, etc. For ease of coding, I should prolly put all of those arrayrefs into another arrayref. What is a good method to "rotate" the table? In my "proof of concept" code I did this: my $dataHRef = $rptDBH->selectall_hashref($stmt, 'year'); foreach my $date (sort keys %$dataHRef) { push(@labels, $date); push(@Decile1, %$dataHRef->{$date}->{'d1'}); push(@Decile2, %$dataHRef->{$date}->{'d2'}); push(@Decile3, %$dataHRef->{$date}->{'d3'}); push(@Decile4, %$dataHRef->{$date}->{'d4'}); push(@Decile5, %$dataHRef->{$date}->{'d5'}); push(@Decile6, %$dataHRef->{$date}->{'d6'}); push(@Decile7, %$dataHRef->{$date}->{'d7'}); push(@Decile8, %$dataHRef->{$date}->{'d8'}); push(@Decile9, %$dataHRef->{$date}->{'d9'}); push(@Decile10, %$dataHRef->{$date}->{'d10'}); } Which is kinda lame, you must admit. The date ordering is very important. Any suggestion to make this code less lame and independent of the number '10'? I may have five or or fifteen data sets to plot. -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com From rjbs-perl-abe at lists.manxome.org Thu Dec 21 14:29:01 2006 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Thu, 21 Dec 2006 17:29:01 -0500 Subject: [ABE.pm] "Rotating" a table In-Reply-To: <20061221221924.GA14143@neptune.faber.nom> References: <20061221221924.GA14143@neptune.faber.nom> Message-ID: <20061221222901.GA10642@zodiac.codesimply.com> * "Faber J. Fedor" [2006-12-21T17:19:24] > blah blah blah > I have not read your email, but I read the subject. I'm about to wander off, though, so here is my only advice: http://search.cpan.org/~bjeps/Data-Xtab-1.01/Xtab.pm Help? -- rjbs From fiedlert at gmail.com Fri Dec 22 04:59:35 2006 From: fiedlert at gmail.com (Ted Fiedler) Date: Fri, 22 Dec 2006 07:59:35 -0500 Subject: [ABE.pm] Net::Flickr:;Backup woes In-Reply-To: <20061221135506.GB1091@zodiac.codesimply.com> References: <814422ce0612202348m7018e1e5j2d1c9ec2837d40ec@mail.gmail.com> <458A8B13.6010205@modperlcookbook.org> <20061221135506.GB1091@zodiac.codesimply.com> Message-ID: <814422ce0612220459j674d734ek6f3e38761a7a659d@mail.gmail.com> > > I'm hoping that this has prepared me for getting the backup working. I don't > want to lose any notes, set definitions, comments, and soo n. > I had initial trouble w/ the uploading as well - the key for me as well was using the flickr_upload script to format the url to get the auth token. Following the documentation to get the same result - resulted in consistent failure. I still have had no luck w/ backups - I have over 2000 pics and NO backup of them. Im going to try changing unself to undef to see what happens - Ive also tried to comment out all of the code that was sending errors and hoping that my config was OK - but still no luck. If I dont get something in a week or so - Ill either try coding something myself or checking out some of the ruby code, which would be a nice 1st project coding Ruby... Ted -- "You are never dedicated to something you have complete confidence in. No one is fanatically shouting that the sun is going to rise tomorrow. They know it's going to rise tomorrow. " -- Robert M Pirsig From faber at linuxnj.com Sat Dec 23 18:26:08 2006 From: faber at linuxnj.com (Faber J. Fedor) Date: Sat, 23 Dec 2006 21:26:08 -0500 Subject: [ABE.pm] "Rotating" a table In-Reply-To: <20061221222901.GA10642@zodiac.codesimply.com> References: <20061221221924.GA14143@neptune.faber.nom> <20061221222901.GA10642@zodiac.codesimply.com> Message-ID: <20061224022608.GA21667@neptune.faber.nom> On 21/12/06 17:29 -0500, Ricardo SIGNES wrote: > * "Faber J. Fedor" [2006-12-21T17:19:24] > > blah blah blah > > > > I have not read your email, but I read the subject. I'm about to wander off, > though, so here is my only advice: > > http://search.cpan.org/~bjeps/Data-Xtab-1.01/Xtab.pm > > Help? Nope, but Data::Pivot looks perfect. Now if I can only figure out how to make it work... -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com From faber at linuxnj.com Tue Dec 26 17:52:45 2006 From: faber at linuxnj.com (Faber J. Fedor) Date: Tue, 26 Dec 2006 20:52:45 -0500 Subject: [ABE.pm] Suggestions on manipulating CSV files? Message-ID: <20061227015245.GB21326@neptune.faber.nom> This is sort of a continuation of "Tie::Hashing to files" from back in Oct (http://mail.pm.org/pipermail/abe-pm/2006-October/000602.html). Not only did I find another bug in FlatFile.pm (but that's for another post), I don't think it's suitable for what I need. I've got three CSV files, two columns each. The first colum in all three files is the CUSIP (read: unique ID) and are not in order. Some files may not contain all of the CUSIPs. I need to do something like this: foreach (CUSIP in primaryfile) { getvalue(CUSIP, primaryfile); getvalue(CUSIP, secondaryfile); getvalue(CUSIP, tertiaryfile); crunch_numbers( $from, $all, $three_ files); write_to_secondary_file() if($high_tide); write to primary_file() } FlatFile can do it, but not very quickly; looking up the CUSIP in each file takes four seconds per lookup = 12 seconds per loop. Since I have 3000 CUSIPS to process, well, you do the math. I'm thinking or reading the files line by line into hashes, do the manipulations, delete the underlying files and recreate them. Seems like there should be a better way. Any ideas? -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com From faber at linuxnj.com Tue Dec 26 17:55:38 2006 From: faber at linuxnj.com (Faber J. Fedor) Date: Tue, 26 Dec 2006 20:55:38 -0500 Subject: [ABE.pm] I found a bug, now what? Message-ID: <20061227015538.GC21326@neptune.faber.nom> As mentioned previously, I found another bug in FlatFile. At least I think it's a bug because *I* don't think it should do what it does. So what's the procedure to put in a bug report? I can create a patch file and come up with before and after code samples. Then where do I send them? I know Rick posted the previous FlatFile patch to some website but beyond that I'm clueless. -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com From rjbs-perl-abe at lists.manxome.org Tue Dec 26 18:18:38 2006 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Tue, 26 Dec 2006 21:18:38 -0500 Subject: [ABE.pm] I found a bug, now what? In-Reply-To: <20061227015538.GC21326@neptune.faber.nom> References: <20061227015538.GC21326@neptune.faber.nom> Message-ID: <20061227021838.GA2476@zodiac.codesimply.com> * "Faber J. Fedor" [2006-12-26T20:55:38] > So what's the procedure to put in a bug report? I can create a patch > file and come up with before and after code samples. Then where do I > send them? rt.cpan.org is the semi-universal bug tracker; always check the module documentation for an alternative first FlatFile's ticket queue is here: http://rt.cpan.org/Public/Dist/Display.html?Name=FlatFile -- rjbs From rjbs-perl-abe at lists.manxome.org Tue Dec 26 18:26:32 2006 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Tue, 26 Dec 2006 21:26:32 -0500 Subject: [ABE.pm] Suggestions on manipulating CSV files? In-Reply-To: <20061227015245.GB21326@neptune.faber.nom> References: <20061227015245.GB21326@neptune.faber.nom> Message-ID: <20061227022632.GB2476@zodiac.codesimply.com> * "Faber J. Fedor" [2006-12-26T20:52:45] > I've got three CSV files, two columns each. The first colum in all > three files is the CUSIP (read: unique ID) and are not in order. Some > files may not contain all of the CUSIPs. > > I need to do something like this: > > foreach (CUSIP in primaryfile) { > getvalue(CUSIP, primaryfile); > getvalue(CUSIP, secondaryfile); > getvalue(CUSIP, tertiaryfile); > crunch_numbers( $from, $all, $three_ files); > write_to_secondary_file() if($high_tide); > write to primary_file() > } The way that I'd solve this would depend on the nature of the crunching algorithm. I might want to have those three datasets distinct (as three hashes, maybe), or merged into one hash with arrayrefs as values. Pick the one that makes things easier for you to maintain and more efficient. > I'm thinking or reading the files line by line into hashes, do the > manipulations, delete the underlying files and recreate them. ...and of course keep in mind that you may want to do something like "write out to a new file, then unlink the old one, then make a new link for that name to the new one, then unlink the old name," just to be paranoid. It sounds simple enough that it's not crazy to just do this. A module may exist to do it, but it might take more time to find than to implement. Of course, DO use a CSV processing module, not split/join. ;) -- rjbs From rjbs-perl-abe at lists.manxome.org Tue Dec 26 18:33:35 2006 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Tue, 26 Dec 2006 21:33:35 -0500 Subject: [ABE.pm] jan 3, beer and food? Message-ID: <20061227023335.GC2476@zodiac.codesimply.com> Next Wednesday, January 3rd, is the first Wednesday of the month. Beer and food at the new usual place? I feel like the months are passing faster and faster. I must be getting old. -- rjbs From faber at linuxnj.com Tue Dec 26 18:44:09 2006 From: faber at linuxnj.com (Faber J. Fedor) Date: Tue, 26 Dec 2006 21:44:09 -0500 Subject: [ABE.pm] jan 3, beer and food? In-Reply-To: <20061227023335.GC2476@zodiac.codesimply.com> References: <20061227023335.GC2476@zodiac.codesimply.com> Message-ID: <20061227024409.GA21690@neptune.faber.nom> On 26/12/06 21:33 -0500, Ricardo SIGNES wrote: > Next Wednesday, January 3rd, is the first Wednesday of the month. Beer and > food at the new usual place? Sure. There's still a few things on the menu I have to try. I still can't beleive how good that ham sandwich was. What street is that on? Linden? > I feel like the months are passing faster and faster. I must be getting old. Wait until the kid arrives! (and why is your reply-to not set to the ML? Drives me nuts!) -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com From rjbs-perl-abe at lists.manxome.org Wed Dec 27 04:25:35 2006 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Wed, 27 Dec 2006 07:25:35 -0500 Subject: [ABE.pm] jan 3, beer and food? In-Reply-To: <20061227024409.GA21690@neptune.faber.nom> References: <20061227023335.GC2476@zodiac.codesimply.com> <20061227024409.GA21690@neptune.faber.nom> Message-ID: <20061227122535.GA11296@zodiac.codesimply.com> * "Faber J. Fedor" [2006-12-26T21:44:09] > On 26/12/06 21:33 -0500, Ricardo SIGNES wrote: > > Next Wednesday, January 3rd, is the first Wednesday of the month. Beer and > > food at the new usual place? > > What street is that on? Linden? Yup. >> I feel like the months are passing faster and faster. I must be getting old > > (and why is your reply-to not set to the ML? Drives me nuts!) The setting of mailing list reply-to headers is a religious issue. -- rjbs From fiedlert at gmail.com Wed Dec 27 16:09:30 2006 From: fiedlert at gmail.com (Ted Fiedler) Date: Wed, 27 Dec 2006 19:09:30 -0500 Subject: [ABE.pm] jan 3, beer and food? In-Reply-To: <20061227122535.GA11296@zodiac.codesimply.com> References: <20061227023335.GC2476@zodiac.codesimply.com> <20061227024409.GA21690@neptune.faber.nom> <20061227122535.GA11296@zodiac.codesimply.com> Message-ID: <814422ce0612271609x3a5475efgeccf158eb00b34c6@mail.gmail.com> > > > Next Wednesday, January 3rd, is the first Wednesday of the month. Beer and > > > food at the new usual place? Ill be there. See you then. -- "You are never dedicated to something you have complete confidence in. No one is fanatically shouting that the sun is going to rise tomorrow. They know it's going to rise tomorrow. " -- Robert M Pirsig