From fiedlert at gmail.com Wed Apr 2 13:14:45 2008 From: fiedlert at gmail.com (Ted Fiedler) Date: Wed, 02 Apr 2008 16:14:45 -0400 Subject: [ABE.pm] see you wednesday! In-Reply-To: <20080331011000.GA24573@knight.local> References: <20080331011000.GA24573@knight.local> Message-ID: <47F3E935.6020703@gmail.com> Im stuck at work, I may or may not make it. Ted Ricardo SIGNES wrote: > I'll see you all (right?) on Wednesday at the Bethlehem library, at 18:00. > > That's the main branch (Church St.). See http://www.bapl.org > > We're in the Tondebayashi room. > > -- "Whenever you talk, I think of fishing lures until the noise stops." -- Dilbert's Pointy-haired Boss From faber at linuxnj.com Thu Apr 3 17:39:26 2008 From: faber at linuxnj.com (Faber J. Fedor) Date: Thu, 3 Apr 2008 20:39:26 -0400 Subject: [ABE.pm] mapping with an enclosure Message-ID: <20080404003926.GA7420@neptune.faber.nom> I'm reading in a CSV file line by line. I need to trim leading and trailing whitespace out of each comma-delimited field. So I figured I'd use map an enclosure like so: my @data = split(/,/, $_); map { $_ => s/^\s+//; $_ => s/\s+$//; } @data; ($sku,$warehouse,$quantity,$row,$product_type,$stack_location,$price) = @data ; Two things I don't understand: 1) why is map editing my array in place? It's supposed to return an array. The array it does return has extra empty data elements in between each original element. 2. Why do I get a "Useless use of a variable in void context at at_test.pl line 19." (line 19 being the line map is on)? Is there a better way of stripping the data? -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. From fiedlert at gmail.com Fri Apr 4 02:44:59 2008 From: fiedlert at gmail.com (Ted Fiedler) Date: Fri, 4 Apr 2008 05:44:59 -0400 Subject: [ABE.pm] mapping with an enclosure In-Reply-To: <20080404003926.GA7420@neptune.faber.nom> References: <20080404003926.GA7420@neptune.faber.nom> Message-ID: <814422ce0804040244p38cf21c6wbe52d1a0aaf46fa0@mail.gmail.com> Couldnt you do something like for (@data) { $_ =~ s/\s+/g; } or my @newdata; for (@data) { s/\s+/g; push @newdata, $_; } I haven't tested, but both should work. How was the tech meeting on Wednesday? $Work is usurping all my time :( Ted On Thu, Apr 3, 2008 at 8:39 PM, Faber J. Fedor wrote: > > I'm reading in a CSV file line by line. I need to trim leading and > trailing whitespace out of each comma-delimited field. So I figured I'd > use map an enclosure like so: > > my @data = split(/,/, $_); > > map { $_ => s/^\s+//; > $_ => s/\s+$//; > } @data; > > ($sku,$warehouse,$quantity,$row,$product_type,$stack_location,$price) > = @data ; > > > Two things I don't understand: > > 1) why is map editing my array in place? It's supposed to return an > array. The array it does return has extra empty data elements in > between each original element. > > 2. Why do I get a "Useless use of a variable in void context at > at_test.pl line 19." (line 19 being the line map is on)? > > Is there a better way of stripping the data? > > > > -- > > Regards, > > Faber Fedor > President > Linux New Jersey, Inc. > 908-320-0357 > 800-706-0701 > > http://www.linuxnj.com > > > > > -- > This message has been scanned for viruses and > dangerous content by MailScanner, and is > believed to be clean. > > _______________________________________________ > ABE-pm mailing list > ABE-pm at pm.org > http://mail.pm.org/mailman/listinfo/abe-pm > -- When I do good, I feel good; when I do bad, I feel bad, and that is my religion. - Abraham Lincoln -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/abe-pm/attachments/20080404/25aff2ee/attachment.html From faber at linuxnj.com Fri Apr 4 06:16:45 2008 From: faber at linuxnj.com (Faber J. Fedor) Date: Fri, 4 Apr 2008 09:16:45 -0400 Subject: [ABE.pm] mapping with an enclosure In-Reply-To: <814422ce0804040244p38cf21c6wbe52d1a0aaf46fa0@mail.gmail.com> References: <20080404003926.GA7420@neptune.faber.nom> <814422ce0804040244p38cf21c6wbe52d1a0aaf46fa0@mail.gmail.com> Message-ID: <20080404131645.GA4571@neptune.faber.nom> On 04/04/08 05:44 -0400, Ted Fiedler wrote: > Couldnt you do something like > > for (@data) > { > $_ =~ s/\s+/g; Shouldn't that read 's/\s+//g' ? > } I ended up doing this: map { s/^\s+//; s/\s+$//; $_ } @data; which gets rid of the warning but it still edits @data in place. :-? > How was the tech meeting on Wednesday? $Work is usurping all my time :( Pretty good. rjbs went over his slides on various topics (that he and I had discussed a month earlier) like his IM assistant, POE, hivemind, language interfaces and the like. -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. From perl.abe at rjbs.manxome.org Fri Apr 4 13:43:11 2008 From: perl.abe at rjbs.manxome.org (Ricardo SIGNES) Date: Fri, 4 Apr 2008 22:43:11 +0200 Subject: [ABE.pm] mapping with an enclosure In-Reply-To: <20080404003926.GA7420@neptune.faber.nom> References: <20080404003926.GA7420@neptune.faber.nom> Message-ID: <20080404204311.GA4549@knight.local> * "Faber J. Fedor" [2008-04-04T02:39:26] > I'm reading in a CSV file line by line. I need to trim leading and > trailing whitespace out of each comma-delimited field. So I figured I'd > use map an enclosure like so: The following code contains no closures: > my @data = split(/,/, $_); > > map { $_ => s/^\s+//; > $_ => s/\s+$//; > } @data; > > ($sku,$warehouse,$quantity,$row,$product_type,$stack_location,$price) > = @data ; You should use Text::CSV_XS. > Two things I don't understand: > > 1) why is map editing my array in place? It's supposed to return an > array. The array it does return has extra empty data elements in > between each original element. When you map, $_ is made an alias to the original value for each value in the given list. Altering $_ will alter the list. To avoid that, you need to copy the variable. How do you know ANYTHING about the alias it returns? You're not assigning the result of map to anything. > 2. Why do I get a "Useless use of a variable in void context at > at_test.pl line 19." (line 19 being the line map is on)? You probably thought you wanted to write: my @new_data = map { $_ =~ s/^\s+//; $_ =~ s/\s+$//; } @data That would be wrong. Even if not, you used => instead of =~, so it complained because that doesn't do anything meaningful. You meant, maybe: my @new_data = map { my $str = $_; $str =~ s/^\s+//; $str =~ s/\s+//; $str } @data; If you don't need to leave @data intact as originally read: s/^\s+//, s/\s+$// for @data; or s/(?:^\s+|\s+$)// for @data; -- rjbs From faber at linuxnj.com Mon Apr 7 08:26:17 2008 From: faber at linuxnj.com (Faber J. Fedor) Date: Mon, 7 Apr 2008 11:26:17 -0400 Subject: [ABE.pm] OT: "Halting State" by Charles Stross Message-ID: <20080407152617.GA17897@neptune.faber.nom> Guys, I just spent the weekend nursing a cold and reading "Halting State" by Charles Stross. Given this crowd, I would recommend that y'all read the book. It's a blast! It takes place in the near future and has some pretty reasonable extrapolations of technology (and politics). It's starts off with a bank robbery inside of a MMORPG that turns out to have real world/infowar implications. I really liked the technical explanations; one chapter on how security is handled in an MMORPG made me think of somethings to ask a potential client when we meet later this week. It has an interesting writing style as well. Each chapter is written from the POV of the character who is mentioned in the chapter title; a chapter about Elaine will read "You roll out of bed..." and in a chapter about Jack, it'll read "You reach for your keyboard...". It may sound confusing, but it's not. Check it out. I think you'll like it. Now, if you will excuse me, I'm going to go look for an ARG [http://en.wikipedia.org/wiki/Alternate_reality_game]. -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. From perl.abe at rjbs.manxome.org Mon Apr 7 10:26:30 2008 From: perl.abe at rjbs.manxome.org (Ricardo SIGNES) Date: Mon, 7 Apr 2008 19:26:30 +0200 Subject: [ABE.pm] OT: "Halting State" by Charles Stross In-Reply-To: <20080407152617.GA17897@neptune.faber.nom> References: <20080407152617.GA17897@neptune.faber.nom> Message-ID: <20080407172630.GB4968@knight.local> * "Faber J. Fedor" [2008-04-07T17:26:17] > It has an interesting writing style as well. Each chapter is written > from the POV of the character who is mentioned in the chapter > title; a chapter about Elaine will read "You roll out of bed..." and in > a chapter about Jack, it'll read "You reach for your keyboard...". It > may sound confusing, but it's not. Er, that isn't POV, that's... second person narrative? That's... well, that's just weird. I like Charlie Stross, though, so... I will put it on the list. Weird. -- rjbs From faber at linuxnj.com Mon Apr 7 10:36:32 2008 From: faber at linuxnj.com (Faber J. Fedor) Date: Mon, 7 Apr 2008 13:36:32 -0400 Subject: [ABE.pm] OT: "Halting State" by Charles Stross In-Reply-To: <20080407172630.GB4968@knight.local> References: <20080407152617.GA17897@neptune.faber.nom> <20080407172630.GB4968@knight.local> Message-ID: <20080407173632.GA18336@neptune.faber.nom> On 07/04/08 19:26 +0200, Ricardo SIGNES wrote: > * "Faber J. Fedor" [2008-04-07T17:26:17] > > It has an interesting writing style as well. Each chapter is written > > from the POV of the character who is mentioned in the chapter > > title; a chapter about Elaine will read "You roll out of bed..." and in > > a chapter about Jack, it'll read "You reach for your keyboard...". It > > may sound confusing, but it's not. > > Er, that isn't POV, that's... second person narrative? Not all of us were English majors. :-) But yeah, it's an homage to some games called 'Adventure'. > That's... well, that's just weird. I actually enjoyed it. Granted, a few times I had to recheck the chapter title to remind myself who "you" was, but I liked the feel it gave to the narrative. > I like Charlie Stross, though, so... I will put it on the list. I'm going to check out more of his work because of this book. -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. From waltman at pobox.com Mon Apr 7 11:23:09 2008 From: waltman at pobox.com (Walt Mankowski) Date: Mon, 7 Apr 2008 14:23:09 -0400 Subject: [ABE.pm] OT: "Halting State" by Charles Stross In-Reply-To: <20080407173632.GA18336@neptune.faber.nom> References: <20080407152617.GA17897@neptune.faber.nom> <20080407172630.GB4968@knight.local> <20080407173632.GA18336@neptune.faber.nom> Message-ID: <20080407182309.GF12137@mawode.com> On Mon, Apr 07, 2008 at 01:36:32PM -0400, Faber J. Fedor wrote: > On 07/04/08 19:26 +0200, Ricardo SIGNES wrote: > > * "Faber J. Fedor" [2008-04-07T17:26:17] > > > It has an interesting writing style as well. Each chapter is written > > > from the POV of the character who is mentioned in the chapter > > > title; a chapter about Elaine will read "You roll out of bed..." and in > > > a chapter about Jack, it'll read "You reach for your keyboard...". It > > > may sound confusing, but it's not. > > > > Er, that isn't POV, that's... second person narrative? > > Not all of us were English majors. :-) > > But yeah, it's an homage to some games called 'Adventure'. Wow. I can see how that might work for a short story, but I think if I had to read an entire book like that I'd be throwing it across the room. Why do so many science fiction writes choose to be so "creative" in their writing style? I remember reading a novel by L.E. Modesitt Jr. where each chapter was told in the first person from the point of view of one of the five main characters. Only...he wasn't so good at characterization, so it was still hard to tell them all apart. Then there was the novel by C.J, Cherryh which was written in what appeared to be a normal 3rd person omniscient narrator style, only it wasn't. Each chapter was told from the point of view of one of the main characters, some human, some alien. It took me half the book to realize that the narrator also had the same opinions and misconceptions as whichever character was being featured. So if there's a paragraph of background text that says something like "python was used to program the ship's battle computers" this might be a fact, or it might just be what Captain Kirk thinks. We might learn 10 chapters later in a Scotty chapter that the systems were, in fact, written in perl (which would explain a lot, if you think about it). It's fine that they can have different ideas of what's going on, but I don't think it's too much to ask that the reader should be able to judge fact from opinion. It's my humble opinion that there are far more good ideas than good novels in the world of science fiction. I really wish more authors would concentrate on mastering the basics of good writing style before they decide to start breaking all the rules. > > > That's... well, that's just weird. > > I actually enjoyed it. Granted, a few times I had to recheck the > chapter title to remind myself who "you" was, but I liked the feel it > gave to the narrative. > > > I like Charlie Stross, though, so... I will put it on the list. > > I'm going to check out more of his work because of this book. Singularity Sky is wonderful. Its sequel, Iron Sunrise, is less wonderful, but still a lot better than most of the stuff out there. Walt From faber at linuxnj.com Mon Apr 7 12:07:35 2008 From: faber at linuxnj.com (Faber J. Fedor) Date: Mon, 7 Apr 2008 15:07:35 -0400 Subject: [ABE.pm] OT: "Halting State" by Charles Stross In-Reply-To: <20080407182309.GF12137@mawode.com> References: <20080407152617.GA17897@neptune.faber.nom> <20080407172630.GB4968@knight.local> <20080407173632.GA18336@neptune.faber.nom> <20080407182309.GF12137@mawode.com> Message-ID: <20080407190735.GB18540@neptune.faber.nom> On 07/04/08 14:23 -0400, Walt Mankowski wrote: > On Mon, Apr 07, 2008 at 01:36:32PM -0400, Faber J. Fedor wrote: > > On 07/04/08 19:26 +0200, Ricardo SIGNES wrote: > > > Er, that isn't POV, that's... second person narrative? > > > > But yeah, it's an homage to some games called 'Adventure'. > > Wow. I can see how that might work for a short story, but I think if > I had to read an entire book like that I'd be throwing it across the > room. It worked quite well, IMO. I especially like how it let you get into the character's head, especially the geek's. You want a book to throw across the room? "Midnight's Children" by Salman Rushdie. He does stuff to the English language that irritates the eff out of me! And that book is considered one of the Great Books of the 20th century! -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.