Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Smylers (2592)

+ -

  Comment: Nice, but Name Clash (Score 1) on 2009.11.09 8:08

by Smylers on 2009.11.09 8:08 (#71070)
Attached to: Stupid things to do with vim: run snippets

Hey, that's nifty.

But having ~/bin/eval may get confusing, the name clashing with the buit-in shell command eval. perleval would be less confusing (and a longer name doesn't really matter, since your mapping does the typing for you).

Read More 3 comments
Comments: 3
+ -

  Comment: Ctrl+W _ (Score 1) on 2009.10.27 7:57

by Smylers on 2009.10.27 7:57 (#70986)
Attached to: Switching and resizing windows in vim

The :res command also has a keystroke, Ctrl+W _.

Read More 3 comments
Comments: 3
+ -

  Comment: Unicode (Score 1) on 2009.08.19 6:40

by Smylers on 2009.08.19 6:40 (#70168)
Attached to: Another Data::FormValidator Filter

Actually they were standard Unicode characters. And I wasn't actually trying to find edge cases; I was just aiming for nice typography and stumbled upon the bug by accident!

For the record, I'd like it to be known I wasn't anywhere near Windows! I was actually using Ubuntu Linux running Gnome. Keyboard preferences lets you define a 'compose' key (I chose Caps Lock, cos that isn't something I ever use) then you can type sequences like Compose --- to get an em dash, or Compose "< to get opening curly quotes; the sequences are reasonably mnemonic.

And those are legitimate Unicode characters. Latin-1 doesn't have them, but then Latin-1 is only an 8-bit encoding so doesn't have most characters. Windows CP1252 caused problems by being kind-of like Latin-1, but with additional characters filling in slots Latin-1 left unused; CP1252 text often got mislabelled as Latin-1, messing things up for non-Windows users.

But all the CP1252 characters are in Unicode, and today you're much better off using the Unicode UTF-8 encoding than either Latin-1 or CP1252, especially on the web.

(And apologies for the delayed response; feed backlog built up while away.)

Read More 2 comments
Comments: 2
+ -

  Comment: Either Way Can Be Wrong (Score 1) on 2009.06.08 5:37

by Smylers on 2009.06.08 5:37 (#68993)
Attached to: POSIX and xargs

I used to think that as well (though I'm not sure Posix are necessarily at fault: possibly they just codified what was already a de facto standard).

Then I encountered a situation where I did need the command to run once, even with no arguments. In normal circumstances* the command runs exactly once regardless of the number of arguments, not once per argument, so there's consistency in making this always be once, even with no arguments.

Whichever way they picked was going to be wrong sometimes. What they really should've done was spec an option for picking the ‘other’ behaviour. I'm still inclined to think they picked the wrong default, but so long as I could get both I'm not that bothered.

Gnu's xargs has the -r option, which does what you want. FreeBSD's (and therefore presumably OS X's) doesn't have this option.**

Frustratingly I can't now recall the circumstances in which I wanted the ‘run once anyway’ behaviour; if I remember I'll post a follow-up, since I realize this is much less persuasive without it!

* Non-normal circumstances include having so much input it needs to be split into multiple invocations of the command, or using -n 1 to run the command once per argument.

** FreeBSD's does however have the useful -o option, handy for opening a bunch of files in Vim, which Gnu's is missing.

Read More 3 comments
Comments: 3
+ -

  Comment: Ooops (Score 1) on 2009.05.31 2:02

by Smylers on 2009.05.31 2:02 (#68879)
Attached to: Word ladder

Hmmm, I seem to've got lost somewhere along the way and taken a few detours:


Those Ruby folks can get to pubs a lot quicker than us ...

Read More 10 comments
Comments: 10
+ -

  Comment: Missing Essay (Score 1) on 2009.02.25 3:37

by Smylers on 2009.02.25 3:37 (#67611)
Attached to: Today's Database Nightmare

that essay was in the actual MySQL documentation. And it was removed, of course, once foreign key constraints were added.

The Wayback Machine to the rescue. It's even worse than I remember it:

There are so many problems with foreign key constraints that we don't know where to start:

  • Foreign key constraints make life very complicated ...
Read More 5 comments
Comments: 5
+ -

  Comment: Perl 6 (Score 1) on 2009.02.20 17:06

Out of interest, what's this in Perl 6? I'm guessing it's @list».id.

Read More 2 comments
Comments: 2
+ -

  Comment: Re:Suggested date for 2009's London Perl Workshop (Score 1) on 2009.02.17 11:39

by Smylers on 2009.02.17 11:39 (#67449)
Attached to: Leader

I think I disagree (and I did when Cog first mentioned it). A local Perl workshop is good if it engages local Perl users who aren't otherwise part of the community, those who don't make it to full conferences (or at least haven't done yet).

It's great if those only dabbling with Perl can see a few talks that are pitched at their level. It's splendid if somebody who's never presented at a conference-type-event before feels that it's a sufficiently friendly and low-key environment where they can give it a go.

As such, I reckon it's unhelpful if the usual Perl in-crowd see it as yet another social stop on their world tour, mainly a chance to hang out together. Or even if it could be perceived to be that, such that new attendees feel excluded (even if that isn't the case).

And it can be intimidating if most of the talks are being given by Perl luminaries (especially if they are doing so in English rather than the local language), or even aimed at them. Or if all those in the know are Twittering that trite line about the value of such events being the hallway meetings not the talks, undermining new speakers who've put lots of effort in.

Note none of the above is aimed personally at you (or Cog; and clearly the bit about English versus the local language doesn't apply to London). And there are lots of the Perl cognoscenti are very approachable and inclusive.

But I think they (we?) are the last group of people whose needs should be considered when designing a Perl workshop; we are already pretty well catered for by other events, so let's create workshops for those who aren't (then of course any Perl celebrities whose plans it happens to fit into are most welcome to come and be part of it).

Read More 2 comments
Comments: 2
+ -

  Comment: Re:Your reasoning is flawed (Score 1) on 2009.02.14 3:51

I agree. With such a small set no method is going to take an irritatingly long time. Since you have the program handy could you give it a quick tweak to use a bigger array and re-post the results?

I also agree with autarch that any reads better, as a way of signalling programmer intent. I'd probably use the any from Perl6::Junction rather than List::MoreUtils; any chance you could add that to your testing as well? Thanks!

Read More 6 comments
Comments: 6
+ -

  Comment: -printf (Score 1) on 2009.01.02 7:16

by Smylers on 2009.01.02 7:16 (#66704)
Attached to: List of Directories Containing XML Docs

Gnu Find has a -printf action which you can use to emit just the names of the directories, like this:

find -name '*.xml' -printf '%h\n' | uniq

I don't think it's possible to avoid the uniq though; -prune sounds promising, but isn't quite right to be useful here. So for a directory with lots of XML files in it, once it's found the first one and told you the directory you have to sit there and wait while it tells you again for all the others.

Read More 8 comments
Comments: 8