Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

jdporter

by jdporter (Chancellor)
on May 30, 2002 at 16:48 UTC ( #170442=user: print w/replies, xml ) Need Help??


Just FYI... I am not the jdporter who is aka boo_radley. (Indeed, he and I have been striving over the "jdporter" alias for many years. :-)


It's hardly debatable that we are indeed both (intolerant and capricious).
These are the consequences of having not rigorously defined policies and rules
and rather letting the community decide for itself what it tolerates or not,
and the makeup of the community being in a constant state of flux over time.

I'm not sure when I joined SiteDocClan, but my first edit to a group wiki was on 2003-08-27.

I'm not sure when I joined pmdev, but my first edit to a group wiki was on 2005-12-28 and I submitted my first patch on 2006-01-26.

I joined gods on 2015-06-21 (in the ineffably resplendent form called erzuuli).


Rooms in my treehouse:
Popular links on homenodes
Tutorials digest
Survey of POOP Modules
Some cb snippets
Bookmarks/miscellany
Restyling PerlMonks
Sitedoclet usage analysis
Scratchpads & Blogs:
pad for admin-related stuff
pad for pmdev-related stuff
pad for other stuff
User Posts
CPAN contribs

Some of my root (and root-like) posts you may find interesting:

PerlMonks/Community/Fun:
PerlMonks for the Absolute Beginner
New Service: Thread Watcher
New Snippets Index
cbshitory
XY Problem
Where should I post Y?
CrazyTachTillyN
Adso.pl
jdporter's place in the name space
test of ancient magic
test this
9
Nodes 1 .. 1000
There is no Perl Illuminati
PerlMonks Memorial Garden

Also check out my Free Nodelet Hacks
Also check out  
Perl/Programming:
(RFC) Arrays: A Tutorial/Reference
Tk Photo Slideshow, with scrolling and scaling
Simple Console Menuing System
Control and Query Win32 Services at the command line
Strategy Handles
Tie::Scalar::Substring
Linked Lists With No Memory Leak
Statistics::SGT
There's Only One Way To Do It
Read and write Windows "shortcut" links
Create and Pop Up Outlook Notes from Perl
IO::MultiHandle - Operate on multiple file handles as one
map-like hash iterator

Here are some links I keep handy in my Free Nodelet:

Free Nodelet Settings
User Settings
Display Settings
Nodelet Settings
log out
PerlMonks statistics
Message Inbox
last hour of cb
Full-Page Chat
Just_Chat
cbhist
cb60
Chatterbox statistics

Monks I've met in meatspace:


PerlMonks Quine:

perl -MLWP::Simple -e "getprint 'http://perlmonks.org/?node_id=170442; +displaytype=displaycode'"


Signature

Previously, I used this:

Between the mind which plans and the hands which build, there must be a mediator... and this mediator must be the heart.
This is a line (my own translation) from the classic movie Metropolis. Incidentally, my homenode pic above is a frame cap from this movie as well.

In the movie, the building of the mega-city Metropolis is likened to the legendary tower of Babel. This was intended as a warning: Knowing the fate which befell Babel, the builders of the present age should take care to avoid the same sins, and thus the same fate. Specifically, the builders of Babel lacked "heart" (a spirit of compassion and a willingness to compromise), and this resulted in a cataclysmic conflict between management and labor.


Most languages are like StackOverflow: I have a question, I want the best answer.
Perl is like PerlMonks: I have a doubt, I want to read an interesting discussion about it that is likely to go on a tangent. q-:

tye, in Re: What is PerlMonks? (why Perl)


A classic gem by eyepopslikeamosquito: I eagerly await the invention of a time machine so I can feast my eyes upon your majestic code. I estimate the probability of you having actually written such code is about the same as the probability of the invention of a time machine that allows us to view it.

<input type=submit value="border-width=d" " />





Posts by jdporter
Error trying to install Image::Magick on Strawberry Perl in Seekers of Perl Wisdom
1 direct reply — Read more / Contribute
by jdporter
on Aug 05, 2012 at 22:45

    I'm trying to install Image::Magick on Strawberry Perl, and getting an error.

    % path PATH=C:\Program Files\ImageMagick-6.7.8-Q16;c:\strawberry\c\bin;C:\str +awberry\perl\bin; . . .
    % perl -v This is perl 5, version 16, subversion 0 (v5.16.0) built for MSWin32-x +64-multi-thread
    % convert -version Version: ImageMagick 6.7.8-7 2012-07-29 Q16 http://www.imagemagick.org Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC Features: OpenMP

    So here we go:

    % cpan install Image::Magick . . . Note (probably harmless): No library found for -lMagickCore Writing Makefile for Image::Magick Writing MYMETA.yml and MYMETA.json CPAN: Module::CoreList loaded ok (v2.66) cp Magick.pm blib\lib\Image\Magick.pm AutoSplitting blib\lib\Image\Magick.pm (blib\lib\auto\Image\Magick) C:\strawberry\perl\bin\perl.exe C:\strawberry\perl\lib\ExtUtils\xsubpp + -typemap C:\strawberry\perl\lib\ExtUtils\typemap -typemap typemap +Magick.xs > Magick.xsc && C:\strawberry\perl\bin\perl.exe -ME xtUtils::Command -e mv -- Magick.xsc Magick.c gcc -c -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -DPERL_TEXTMODE +_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fno-strict-alia +sing -mms-bitfields -s -O2 -DVERSION=\"6.77\" -DXS_VER SION=\"6.77\" "-IC:\strawberry\perl\lib\CORE" -D_LARGE_FILES=1 -DHAV +E_CONFIG_H Magick.c Magick.xs:60:31: fatal error: magick/MagickCore.h: No such file or dir +ectory compilation terminated. dmake.exe: Error code 129, while making 'Magick.o' JCRISTY/PerlMagick-6.77.tar.gz C:\strawberry\c\bin\dmake.exe -- NOT OK Running make test Can't test without successful make Running make install Make had returned bad status, install seems impossible Stopping: 'install' failed for 'Image::Magick'.
    % dir /s /b "c:\Program Files\ImageMagick-6.7.8-Q16\MagickCore.h" c:\Program Files\ImageMagick-6.7.8-Q16\include\magick\MagickCore.h

    So my first thought is, How do I pass the hint to gcc about where to find MagickCore.h?
    But I suspect there's something more fundamentally wrong with my setup.

    In case it helps:

    % gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=c:/strawberry/c/bin/../libexec/gcc/x86_64-w64-ming +w32/4.6.3/lto-wrapper.exe Target: x86_64-w64-mingw32 Configured with: ../../../src/gcc-4.6.3/configure --build=x86_64-w64-m +ingw32 --target=x86_64-w64-mingw32 --enable-languages=c,c++,fortran,o +bjc,obj-c++ --enable-libgomp --enable-lto --enable-bootstrap --enable-checking=release --enable-version-specific-runtime-libs --dis +able-multilib --disable-nls --disable-win32-registry --disable-werror + --with-pkgversion='gcc-4.6.3 release with patches [build 201 20411 by perlmingw.sf.net]' --with-sysroot=/gccbuild/prefix/mingw64 -- +with-gmp=/gccbuild/prefix/mingw64 --with-mpfr=/gccbuild/prefix/mingw6 +4 --with-mpc=/gccbuild/prefix/mingw64 --with-ppl=/gccbuild/pr efix/mingw64 --with-cloog=/gccbuild/prefix/mingw64 --with-bugurl=http: +//mingwfp.znix.com --with-gnu-ld --prefix=/gccbuild/prefix/mingw64 -- +with-local-prefix=/gccbuild/prefix/mingw64 --with-libiconv-pr efix=/gccbuild/prefix/mingw64 Thread model: win32 gcc version 4.6.3 (gcc-4.6.3 release with patches [build 20120411 by p +erlmingw.sf.net])
    I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies.
Proposal: Have Image Macros in Perl Monks Discussion
12 direct replies — Read more / Contribute
by jdporter
on Jul 10, 2012 at 22:30

    So, in my quest to identify ways in which to increase the fun and "value" of PerlMonks, I thought of image macros.

    (Background: Here's the wikipedia article on image macros, though I don't think it describes it clearly.)

    My proposal is simple:

    1. Image macros would be inserted in a post with shortcut-like markup, e.g. [macro://advicedog|use strict and warnings/RTFM] which would result in an image like this.
    2. The available images would be strictly controlled by TPTB (gods, maybe pmdev). The ability to upload an image for the purpose, or to link to an off-site image for the purpose, would be explicitly unpossible. Of course, users would be free to suggest new images via PMD, /msg [pmdev], etc.
    3. Image macros would only work in posts, not in the cb.
    4. There would be a checkbox in one's user settings by which the fuddy-duds could turn off the funk. For them, the above could be rendered as advicedog says: use strict and warnings/RTFM maybe. (I know this example is lame. This kind of cleverness is not my strong suit.)
    5. We could make it so that it would only work if the author of the post was at least a certain level. I'm thinking something relatively low, since the potential for abuse is so small. How about Level 6: Scribe, which currently has no other special powers/privileges?
    6. Update: Additional ideas courtesy of kcott, below.

    7. The images — which would be hosted here on-site, probably — would be limited in size to something reasonable. (200x200?)
    8. You would only be able to insert one per node.
    9. The macro would be rendered with appropriate markup for styling, e.g. <span class="imagemacro advicedog" ... This would enable you to, for example, hide macros altogether, if even the non-image rendering (see #4 above) is too much for you.

    By the way — even if this feature does get approved for the pmdev to-do list, its priority is likely to be pretty low. There are too many other enhancements of much greater impact and benefit to be done yet.

    I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies.
(OT) Your Dream OS in Meditations
16 direct replies — Read more / Contribute
by jdporter
on Apr 12, 2012 at 12:30

    Thinking about various operating systems and what makes them more or less preferable to others. So I'd like to put this question to you: If you could create a new OS with the best aspects of other existing systems — a "love child", if you will — what would it have? What are the things that set your favorite system(s) apart?

    I'm phrasing the survey like this:

    My ideal environment would have:

    • the    (noun)    of Linux,
    • the    (noun)    of Mac, and
    • the    (noun)    of Windows.

    Or:

    My ideal environment would be:

    •    (adjective)    like Linux,
    •    (adjective)    like Mac, and
    •    (adjective)    like Windows.

    Feel free to use other systems (Plan9? VMS?) as you like, though I'm mainly interested in these "big 3".

    For myself, I think my ideal environment would have:

    • the simplicity, power, and FOSSitude of Linux,
    • the sane and elegant UX of Mac, and
    • the ubiquity (with all that entails — well, all the good stuff, anyway) of Windows.

    I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies.
Try DuckDuckGo:// in Perl Monks Discussion
4 direct replies — Read more / Contribute
by jdporter
on Oct 12, 2011 at 09:30

    There is a new shortcut type for searching via the DuckDuckGo search engine. You can write [ddg://...] (which is an alias for the verbose [duckduckgo://...]).

    DuckDuckGo is incredibly powerful, and I'm really excited about it. (It also does All The Right Things with regard to privacy, which is one area where Google is seriously at fault.) Take a look at the goodies, and in particular, the !bang commands. We're in there! (Also, fwiw, DDG is largely written in Perl. :-)

    However, I would caution that currently DDG has a ways to go in terms of forwarding queries to various sites properly. For example, in the case of !perlmonks, the query is passed literally to our Search box, i.e. ?node=query. Which means if there is no node with that exact title, it gets passed through to Super Search, with its default of parsing search terms on space. So a query !perlmonks "author wish" does not DWYM! Quote marks are apparently not parsed specially by DDG when delegating a search to the target site.

    Anyway, please kick the tires of this thing and let me know if you find any other snags. We may be able to forward our findings to the DDG team.

    I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies.
Policy clarification regarding the deletion of user accounts/content in Perl Monks Discussion
1 direct reply — Read more / Contribute
by jdporter
on Jul 13, 2011 at 22:22

    Well lately we've had another case of someone not finding the PerlMonks experience to their liking and wanting to wipe themselves off the site. Since the PerlMonks FAQ did not sufficiently address this scenario, we've written up a new FAQlet in order to explicitly lay it down: How can I wipe every trace of myself from PerlMonks?.

    I figured it was worth bringing this to y'all's attention. :-)

    I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies.
Make readdir stop returning short (8.3) filenames in Seekers of Perl Wisdom
1 direct reply — Read more / Contribute
by jdporter
on Apr 05, 2011 at 10:06

    I'm getting this odd, unheretofore-seen behavior from readdir on Windows 7. It has started returning "short" (8.3) filenames, at least for a directory on a network share. Several of my critical Perl programs are now broken! Any idea how to stop this?

    Some details: I'm running the perl programs on a Windows 7 workstation; the filesystem being read is on a Windows Server 2003 R2 machine. Of possible significance is that we had a power outage last night; my machine survived, but the server may have rebooted.

    I also verified that it is not exhibiting this behavior when reading a directory on the local workstation, only when reading the share on the server.

    MidLifeXis floated the idea that the value of the registry entry HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\FileSystem:Win31FileSystem may have changed. But I checked; it is still zero on all machines involved.

    Thanks in advance...

    Update: It seems I resolved the problem by changing my system's locale to coincide with the language in the filenames. Hrmph. It still seems strange to me, because I've never had this problem before, and I've been doing stuff exactly like this for quite some time.

    Footnote: So it seems I omitted one detail which turned out to be critical: the filenames in question contained characters not valid in the current system locale. Still, I think I would have run into this problem before, as I deal with multiple languages quite a bit and have to switch the system locale rather often.

    I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies.
get string/array slices using cut-like specifications in Cool Uses for Perl
5 direct replies — Read more / Contribute
by jdporter
on Mar 09, 2011 at 22:50

    The other day in the cb kailas asked how to reproduce the following cut command in perl:

    cut -c2-11,12-61,62-63,64-76,90-92 $str
    Well, reproducing cut in perl is actually not quite as trivial as it seems on first look, because cut can take some pretty hairy specifications, such as descending indices, e.g. 12-8,5,4.

    Here's an attempt to do at least part of what cut can do, in a native perly context of extracting either sub-strings or sub-arrays. It can handle any amount of overlapping and descending ranges. However, it does not do argument validation. If you attempt to get string/array elements beyond the range of the input, ugly things may happen.

    The string-oriented solution uses unpack, and makes the optimization of calling unpack only once. The array-oriented solution has to return arrays, and since there's no way (afaik, in perl 5) to get multiple slices of an array, separately, in a single slicing operation, it can't make a similar optimization: it has to get as many distinct slices as there are "ranges" in the spec. Consequently, that solution is more elegant-looking. We could take the same approach for strings, using substr, and it would look about as elegant, but clearly not as optimized.

    Note that indexing starts at 1 in both cases, in accordance with cut.

    { package Cut; sub from_list { my( $spec ) = @_; map [ $_->[1] < $_->[0] ? reverse @_[ $_->[1] .. $_->[0] ] : @_[ $_->[0] .. $_->[1] ] ], map [ /(.*)\s*-\s*(.*)/ ? ( $1, $2 ) : ( $_, $_ ) ], split /\s*,\s*/, $spec; } sub from_string { my( $spec, $input ) = @_; my @spec = map [ /(.*)\s*-\s*(.*)/ ? ( $1, $2 ) : ( $_, $_ ) ], split /\s*,\s*/, $spec; my $ofs=0; my %reverse; my @pat; for ( 0 .. $#spec ) { my( $lo, $hi ) = @{ $spec[$_] }; if ( $hi < $lo ) { $reverse{$_} = 1; ( $lo, $hi ) = ( $hi, $lo ); } my $move = $lo - $ofs - 1; my $len = $hi - $lo + 1; $ofs = $hi; $pat[$_] = ( $move > 0 ? 'x'.$move : $move < 0 ? 'X'.(-$move) : '' ) . 'a'.$len; } my @result = unpack "@pat", $input; $result[$_] = reverse $result[$_] for keys %reverse; @result } } # some test cases: my @a = Cut::from_string( '1,3-4,6-10,12-8,1,1,1', join '', 'a'..'z' ) +; print "'$_'\n" for @a; my @b = Cut::from_list( '1,3-4,6-10,12-8,1,1,1', 'a'..'z' ); print "> @$_\n" for @b;
    I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies.
RFC: Eliminate the "Offer Your Reply" links in Perl Monks Discussion
6 direct replies — Read more / Contribute
by jdporter
on Feb 07, 2011 at 14:01
Not using "non-breaking hyphen" U+8209 in timestamps in Perl Monks Discussion
2 direct replies — Read more / Contribute
by jdporter
on Jan 15, 2011 at 18:52

    For some time now, the monastery has been returning timestrings with the date parts separated by the Unicode "non-breaking hyphen" character, U+8209. I just changed the relevant code (the two places I could find) to use a regular hyphen character, because while the U+8209 character displays just fine in normal HTML text in a browser, it doesn't DWIM in any other context (afaik), of which there are many, including in normal web browsing — For example, when using it in the title attribute of an element, which gets displayed as a Tooltip in some (most?) browsers. (The general principle there is that attribute values are not supposed to be HTML.) (To see this in action, go to the Chatterbox (or last hour of cb) and hover your pointer on the name of a chatterer. The tooltip shows the date/time at which that message was chatted.)

    Please tell me what, if anything, I've broken in exchange for this rather substantial fix.

    What is the sound of Windows? Is it not the sound of a wall upon which people have smashed their heads... all the way through?
Variant of map for special-casing the last item in Cool Uses for Perl
4 direct replies — Read more / Contribute
by jdporter
on Oct 25, 2010 at 10:18

    This is a variant of map which makes it easy to special-case the last item in the list.

    # usage: special_last_map { block } $sentinel_variable, @list_of_value +s; # You should examine the value of the sentinel variable inside your co +de block. # It will be True for the last item in the list; False otherwise. sub special_last_map(&\$@) { my $code = shift; my $is_last_sr = shift; my $n = $#_; map { $$is_last_sr = $_ == $n; local $_ = $_[$_]; &$code } 0 .. $#_ }

    For example, say you're stuffing a list of strings into an html list, and you want to add an attribute to the final <li> element:

    my $is_last; my @list_in_html = special_last_map { my $attr = $is_last ? ' class="last"' : ''; "<li$attr>$_</li>" } $is_last, @list;

    Update: Ok, here's a version which makes checking for first and last items easy; and it uses $a and $b so that you don't have to provide any special variables.

    sub map_with_index(&@) { my $code = shift; my $n = $#_; map { local $a = $_; local $b = $n - $_; local $_ = $_[$_]; &$code } 0 .. $#_ }
    Example:
    print for map_with_index { my $class = ( $a == 0 ? 'first' : '' ) . ( $b == 0 ? 'last' : '' +); my $attr = $class ? qq( class="$class") : ''; "<li$attr>$_</li>\n" } qw( alpha beta gamma delta );
    What is the sound of Windows? Is it not the sound of a wall upon which people have smashed their heads... all the way through?
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (2)
As of 2022-01-21 01:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (57 votes). Check out past polls.

    Notices?