60 PerlMonks - Newest Nodes New nodes appearing on PerlMonks http://perlmonks.org/index.pl?node_id=30175 http://blogs.law.harvard.edu/tech/rss PerlMonks Newest Nodes XML Generator 961 PerlMonks 2016-05-26 00:51:17 rss,clean Wed May 25 14:51:17 2016 30 20160525145117 Wed May 25 14:51:17 2016 http://perlmonks.org/ Anonymous Monk Scope of $/ agarrubio http://perlmonks.org/index.pl?node_id=1164150 Redefining $/ in main program affects subrotines in other modules. How to solve it in main? How to solve it in module? What's the best practice? In this example subroutine will not return the firts l... perlquestion Thu, 26 May 2016 00:31:56 +0000 http://perlmonks.org/index.pl?node_id=1164150 1164150 1164148 2016-05-25 20:31:56 agarrubio DBI Adding Null Bytes to String Stringer http://perlmonks.org/index.pl?node_id=1164141 I've run across a strange bit of behavior within DBI. When I set the 'LongTruncOk' parameter to true for a database handle and retrieve a long string it seems to insert null bytes between each char... perlquestion Wed, 25 May 2016 20:57:13 +0000 http://perlmonks.org/index.pl?node_id=1164141 1164141 1117581 2016-05-25 16:57:13 Stringer Dealing with rectangular images htmanning http://perlmonks.org/index.pl?node_id=1164131 Monks, I have a site that allows clients to upload logos. Using css, we fit the logo into a square container no matter what the size. Anyone with a logo that is square, or slightly rectangular, f... perlquestion Wed, 25 May 2016 19:43:18 +0000 http://perlmonks.org/index.pl?node_id=1164131 1164131 445135 2016-05-25 15:43:18 htmanning Re^3: Dealing with rectangular images RonW http://perlmonks.org/index.pl?node_id=1164152 I'm resizing via css That's generally not a good idea. Images that are too big the for target display area are a waste of resources. High speed connections often aren't.... note Thu, 26 May 2016 00:48:08 +0000 http://perlmonks.org/index.pl?node_id=1164152 1164152 1080444 2016-05-25 20:48:08 RonW Re: Scope of $/ Anonymous Monk http://perlmonks.org/index.pl?node_id=1164151 Its a global variable, so use <a href="http://perldoc.perl.org/functions/local.html">local</a> and set the variable to what you need it to be, as in sub firstline { use autodie qw/ open /; local $/ = "\n"; open my($fh),'... note Thu, 26 May 2016 00:46:45 +0000 http://perlmonks.org/index.pl?node_id=1164151 1164151 961 2016-05-25 20:46:45 Anonymous Monk Re: Dealing with rectangular images mhearse http://perlmonks.org/index.pl?node_id=1164147 Would the diagonal diameter work? #!/usr/bin/env perl use strict; # identify -format "%h:%w" image.png # 774:423 my $width = 423; my $height = 774; my $diag = sqrt( $width**2 + ... note Wed, 25 May 2016 22:45:59 +0000 http://perlmonks.org/index.pl?node_id=1164147 1164147 265997 2016-05-25 18:45:59 mhearse Re: DBI Adding Null Bytes to String afoken http://perlmonks.org/index.pl?node_id=1164146 When I set the 'LongTruncOk' parameter to true for a database handle and retrieve a long string it seems to insert null bytes between each character. For example, a string of '600' comes ... note Wed, 25 May 2016 22:16:16 +0000 http://perlmonks.org/index.pl?node_id=1164146 1164146 747201 2016-05-25 18:16:16 afoken Re: CGI.pm Filter out recurring NULL Bytes afoken http://perlmonks.org/index.pl?node_id=1164145 I started playing around with a filter that can do it. But I'm not sure where would be the best place to implement the filter. Should it do all the names and values of the param's or just ... note Wed, 25 May 2016 21:50:01 +0000 http://perlmonks.org/index.pl?node_id=1164145 1164145 747201 2016-05-25 17:50:01 afoken Re: DBI Adding Null Bytes to String GrandFather http://perlmonks.org/index.pl?node_id=1164144 Can you create a small test script that creates a database, adds a string to it and retrieves the string showing the issue? It is unlikely that LongTruncOk is the root of the problem. LongT... note Wed, 25 May 2016 21:32:50 +0000 http://perlmonks.org/index.pl?node_id=1164144 1164144 461912 2016-05-25 17:32:50 GrandFather Re^4: You're welcome � was Re: -175 := +127 Thank you all! (Updated!Now -152 := +144) Anonymous Monk http://perlmonks.org/index.pl?node_id=1164143 jdporter: It's wasted on the OP, though most of the rest of us appreciate it. So is your mother... note Wed, 25 May 2016 21:27:33 +0000 http://perlmonks.org/index.pl?node_id=1164143 1164143 961 2016-05-25 17:27:33 Anonymous Monk Re^3: Define regex substitution $1,$2,... from a string afoken http://perlmonks.org/index.pl?node_id=1164142 On the other hand, you are right that the evaluated string may expose some risk especially I'm planning to let other people define this regex string from command parameters. S... note Wed, 25 May 2016 21:06:55 +0000 http://perlmonks.org/index.pl?node_id=1164142 1164142 747201 2016-05-25 17:06:55 afoken Re^3: Dealing with rectangular images pryrt http://perlmonks.org/index.pl?node_id=1164140 What are the values of $picwidth and $picheight that do and don't work? When I wrapped it in a loop to try a handful of ratios, I couldn't find any that didn't. That's why &#91;n... note Wed, 25 May 2016 20:57:06 +0000 http://perlmonks.org/index.pl?node_id=1164140 1164140 1158292 2016-05-25 16:57:06 pryrt Re: i2c attached LCD Character Display for a Raspberry Pi jmlynesjr http://perlmonks.org/index.pl?node_id=1164139 <a href="?node=anita2R">anita2R</a> Nice Work! I plan to look at your code in detail to learn something new about the RPI. I have used the chipKIT UNO32 with a Sparkfun I2C backpack. How does the 4/8 bit... note Wed, 25 May 2016 20:48:53 +0000 http://perlmonks.org/index.pl?node_id=1164139 1164139 982107 2016-05-25 16:48:53 jmlynesjr Re^3: You're welcome � was Re: -175 := +127 Thank you all! (Updated!Now -152 := +144) BrowserUk http://perlmonks.org/index.pl?node_id=1164138 As you're the one that started this shit-storm, it's ironic that it should be you; but I grant you your wish -- in your fucking dreams! ... note Wed, 25 May 2016 20:35:28 +0000 http://perlmonks.org/index.pl?node_id=1164138 1164138 171588 2016-05-25 16:35:28 BrowserUk Re^2: Dealing with rectangular images htmanning http://perlmonks.org/index.pl?node_id=1164137 Sorry, maybe I wasn't clear. I'm resizing via css so I'm not worried about that. BUT, I'd like to either use a gray background to letterbox the wide images, or display the image above the title if ... note Wed, 25 May 2016 20:27:23 +0000 http://perlmonks.org/index.pl?node_id=1164137 1164137 445135 2016-05-25 16:27:23 htmanning Re^2: Regex substitute matches second match first? Linicks http://perlmonks.org/index.pl?node_id=1164136 That is good, but as I said only one IP needs to be captured - the maverick in the second lot of &#91;&#93;'s from postfix logs. nick... note Wed, 25 May 2016 20:20:48 +0000 http://perlmonks.org/index.pl?node_id=1164136 1164136 1164101 2016-05-25 16:20:48 Linicks Re: Regex substitute matches second match first? BillKSmith http://perlmonks.org/index.pl?node_id=1164135 It may be easier to search for a match with the module <a href="http://search.cpan.org/perldoc?Regexp%3A%3ACommon%3A%3Anet">Regexp::Common::net</a> rather than eliminating everything else. This would reduce your chance of false matches. ... note Wed, 25 May 2016 20:13:24 +0000 http://perlmonks.org/index.pl?node_id=1164135 1164135 957973 2016-05-25 16:13:24 BillKSmith Re: Dealing with rectangular images $h4X4_&#124;=73}{ http://perlmonks.org/index.pl?node_id=1164134 <a href="http://search.cpan.org/search?mode=module&amp;query=Image%3A%3AExifTool">Image::ExifTool</a> works good. my $file = ''; my $File_Info= ''; use Image::ExifTool 'ImageInfo'; my $exifTool = new Image::ExifTool; $exifTool->Options(Binary => 1, Comp... note Wed, 25 May 2016 20:10:25 +0000 http://perlmonks.org/index.pl?node_id=1164134 1164134 863021 2016-05-25 16:10:25 $h4X4_&#124;=73}{ Re: Dealing with rectangular images Linicks http://perlmonks.org/index.pl?node_id=1164133 This is insane input error: Impose a MAX/MIN HxW upload for images - otherwise you are chasing the moon and some idiot will try to do the worst. Nick... note Wed, 25 May 2016 20:07:43 +0000 http://perlmonks.org/index.pl?node_id=1164133 1164133 1164101 2016-05-25 16:07:43 Linicks Re: -175 := +127 Thank you all! (Updated!Now -152 := +144) eyepopslikeamosquito http://perlmonks.org/index.pl?node_id=1164132 All 10 worst nodes of the week! Congratulations! All 10 worst nodes of the month is harder to achieve. I've only ever seen one monk pull it off (see below). I'm pretty sure all 20 worst nodes of... note Wed, 25 May 2016 19:49:37 +0000 http://perlmonks.org/index.pl?node_id=1164132 1164132 176576 2016-05-25 15:49:37 eyepopslikeamosquito Re^3: You're welcome � was Re: -175 := +127 Thank you all! (Updated!Now -152 := +144) jdporter http://perlmonks.org/index.pl?node_id=1164130 The thoughts you expressed in the original of your comment were thoughts I myself have had recently. Of course, if I were to express them independently, someone would accuse us of being sockpu... note Wed, 25 May 2016 19:35:16 +0000 http://perlmonks.org/index.pl?node_id=1164130 1164130 170442 2016-05-25 15:35:16 jdporter Re^3: You're welcome � was Re: -175 := +127 Thank you all! (Updated!Now -152 := +144) jdporter http://perlmonks.org/index.pl?node_id=1164129 I'm trying to bring a little humour here It's wasted on the OP, though most of the rest of us appreciate it. ... note Wed, 25 May 2016 19:32:54 +0000 http://perlmonks.org/index.pl?node_id=1164129 1164129 170442 2016-05-25 15:32:54 jdporter Re^6: Date/Time Manipulation RobertJ http://perlmonks.org/index.pl?node_id=1164128 Didn't notice the space (it is an actual character). The rest I was able to figure out from O'Reilley and a little Googling. Thanks for reminding me that " " is a character.... note Wed, 25 May 2016 19:22:36 +0000 http://perlmonks.org/index.pl?node_id=1164128 1164128 408583 2016-05-25 15:22:36 RobertJ Re^2: Regex substitute matches second match first? Linicks http://perlmonks.org/index.pl?node_id=1164127 Actually, this has made me think now I understand what is going on. Postfix logs the mavericks between &#91;&#93; brackets. The first set of &#91;&#93; brackets are the session ID. There is only the sess... note Wed, 25 May 2016 19:08:11 +0000 http://perlmonks.org/index.pl?node_id=1164127 1164127 1164101 2016-05-25 15:08:11 Linicks Re^2: Code coverage of forked code mr_mischief http://perlmonks.org/index.pl?node_id=1164126 Thanks for updating everyone on this progress. This is useful information to have. The author of <a href="http://search.cpan.org/perldoc?Devel%3A%3ACover">Devel::Cover</a> has a Github repository for it complete with a bug tracker. I'd... note Wed, 25 May 2016 19:03:55 +0000 http://perlmonks.org/index.pl?node_id=1164126 1164126 62512 2016-05-25 15:03:55 mr_mischief Re^2: You're welcome � was Re: -175 := +127 Thank you all! (Updated!Now -152 := +144) 1nickt http://perlmonks.org/index.pl?node_id=1164125 Update: I withdraw my comment as honestly, it didn't add anything good to the world. The way forward always starts with a minimal tes... note Wed, 25 May 2016 19:01:31 +0000 http://perlmonks.org/index.pl?node_id=1164125 1164125 1130276 2016-05-25 15:01:31 1nickt agarrubio agarrubio http://perlmonks.org/index.pl?node_id=1164148 user Thu, 26 May 2016 00:04:21 +0000 http://perlmonks.org/index.pl?node_id=1164148 1164148 1164148 2016-05-25 20:04:21 agarrubio