Most-used modules in one-liners

% perl -ne'next unless /^perl/; 
while (/ -[Mm](\w+(?:::\w+)*)(?:\b|=)/g) { $mods{$1}++ } 
END { for (sort {$mods{$b}<=>$mods{$a}} keys %mods) { 
    print "$mods{$_}\t$_\n";
}}'  ~/.bash_history

Here are mine (top 20 on my laptop):

Fighting a 30-year-old software bug

Er, an earlier version of this said the software bug was 20 years old. It's 30! Thanks, Sidhekin

Today, in reading some data, I processed 36,916 potential dates. Two of those 36,916 failed to validate. I wasn't terribly concerned as these dates come from client-supplied data and this data is often, um, surprising. However, when I inspected the raw data, it turns out that those dates were January 1st, 2011 and January 1st, 2007. I had a bug in software I wrote about a month ago, but it turns out that this bug is actually 30 years old.

For anyone who doesn't really understand the software ecosystem, this may sound mystifying, but it makes sense. Because of a decision taken a long time ago to make another company money, my $client lost money in paying me to fix a bug that one company accidentally introduced and another company deliberately introduced. But to explain it I need to talk about a third company that introduced a feature that eventually became a bug, and a few other historical tidbits that nonetheless contributed to the obscure bug I fixed today.

Parsing JSON with a single regex

For my presentation to the Houston Perl mongers tonight, I'm talking about Randal Schwartz's regex to parse JSON.

eBooks ... for Science!

I slid into the world of eBooks when a half-price Nook sale collided with O'Reilly's
Day against DRM half-price sale. It was the Perfect Storm that this tight-fisted Luddite needed to take the plunge. I set myself a budget and just as I'd picked out all the books that I allowed myself, O'Reilly decided I'd bought enough to merit a 60% discount, so more books had to be bought. One must stick to the budget!

PubMed is experimenting with ePub formats and they are much easier to read than the customary PDF's, but waiting for everything to be converted (or just trying to find one) would try the patience of even Vladimir.

I have a suggestion for someone with more Impatience than me. (I started this post 5 months ago). Have a look at LaTeXML and then think that with many of the papers submitted in LaTeX and a tool that converts to XML, you're halfway to reading all your latest science down the coffee shop.

Scalar::Util::looks_like_number

I had a recent discussion with a Data::Dump::Color user about formatting ints/floats/stringy numbers differently. So here's a short summary of how core module function Scalar::Util's looks_like_number() can be used to detect the different data types:

Another great podcast

I've recommended Disastercast here before, and I know that some of you have since subscribed. However, for those that haven't, episode 13 is worth listening to. It is about safety issues arising from software, in particular looking at the Therac-25, a medical device which which, because of race conditions, killed people.

Finding Your Google Code SVN Password

(Hopefully this post will become outdated soon...)

Google Code can use SVN (among others) for version control, even generating a password for you. Which is all well and good but currently you cannot see where to find that password from the home page:
        https://code.google.com/
To get your Google Code SVN password, you need to get to your Profile -- one way is to go to:
        https://code.google.com/hosting/
then follow along to Profile -> Settings -> GoogleCode.com Password , where you can get or refresh your Google Code SVN password. 'Nuff said.

UAV::Pilot v0.6 Released

UAV::Pilot version 0.6 is now on CPAN. Lots of little changes this time. The big thing is an API change, where Control::ARDrone and Driver::ARDrone were instead named ARDrone::Control and ARDrone::Driver, respectively. This keeps everything related to a single type of UAV under one namespace directory, which I think will be nicer going forward as I implement other UAV systems.

[More on my blog]

Backing up private data securely

My situation: work on PC at the office, on laptop elsewhere. All of data already in git repositories--well almost, photos and videos are currently out, due to their size. I use SSD on both computers, and my partitions are encrypted.

Some of the data are public, like open source Perl projects. Some work-related, where we have our company git repos. And some private, like personal notes, addressbook, agendas/todos, ledger files, etc.

Since I've read that SSDs usually die without any warning, I am quite paranoid and install post-commit hook to backup data after each commit (however, when the lag due to backup is becoming annoying, I disable it momentarily).

For public repos, I've got it covered. There are services like github, bitbucket, or whatever which you can just push your work to.

Perl TV

The other day I was idly browsing Perl-related videos on YouTube. I saw quite a few with very low visitor count.

For example, I bumped into a presentation by Brabie about the Eco-System of CPAN Testers. It had less than 20 views!

I find it sad that all the energy Barbie put in preparing and giving the talk at YAPC, where maybe 50-100 people heard it, and all the work the organizers of YAPC put in recording the video and publishing it, and in the end less than 20 people watch it.

So I decided I go forward with my long-time plan and launched the Perl TV.

The idea is to collect interesting Perl-related videos, make them easy to find (e.g. cross linking based on their content, the CPAN modules they cover, etc.), provide a textual description and notes of the video, and promote them.

Velociraptor Perl Nerd Merit Badge

I've updated the Perl Nerd Merit Badge campaign with a candidate design using the velociraptor from Sebastian's perl-raptor repo. If you want a badge, pledge $8 to the campaign.

raptor.png

If you would like to get such a badge but can't use Crowdtilt, let me know how you'd like to pay and I'll reserve a badge for you.

If you're a Perl mongers group who wants to buy several at once, I can make a deal with you to get cheaper shipping to a single address.

HTTP::Tiny::SPDY - A Subclass of HTTP::Tiny with SPDY Support

I have recently returned to working on Arriba, the PSGI-compliant web server with support for the SPDY protocol, modeled on Starman.

I sort of released it (on GitHub only, not on CPAN) back in January, at that time the code was passing the tests in Plack::Test::Suite when running as a regular HTTP/HTTPS server. My next goal, before considering the module ready to be released on CPAN, was to make it pass those tests in SPDY mode. This meant I needed to add support for SPDY to good old LWP::UserAgent, which was used as the HTTP client in Plack tests.

Over the weeks/months that followed, I made a few attemps at tackling this problem, but had a hard time wrapping my head around the architecture of LWP::UserAgent and figuring out a reasonable way to add SPDY into the mix. Having very little time to devote to this project, I didn't get anywhere with it.

Announcing Perl::Critic::Policy::ControlStructures::ProhibitForeachHandle

A couple days ago I uploaded a Perl-Critic policy to find and complain about things like foreach ( <FOO> ) {...}. The problem (or at least potential problem) with this is that it sucks the entire file into memory before performing the first iteration. Which may be what you wanted, but may not be too.

I plan to leave it at a development release for a couple weeks to allow time for comments and so on. You can find it at its CPAN Search page.

Some code ports to Mojolicious, just for fun.

Today is a relatively minor holiday in the US, but I had work off all the same. I found myself experimenting (when I probably should have been working on my YAPC::Brazil talk :-/). Thanks to today’s PerlWeekly (you are a subscriber right??), I found out about an interesting post by Johnny Moreno which creates a tiny json service backend using Perl. Of course it uses CGI.pm to do so, which made me curious what a Mojolcious port would look like.

The Problem With Perl Testing

If there is one thing about testing in Perl which bugs me, it's that most testing in Perl is what cgi-lib.pl is to Plack. The following is mostly a rant and I'm also guilty of many of these sins.

Yes, we have a beautiful testing infrastructure around our tests. For example, if I want to know which operating systems and versions of Perl my Code::CutNPaste module fails on, I just go take a look. Or I can quickly see almost 3,000 passing test reports for aliased (woo hoo!). The Perl community is proud of tools like this and we should be. Just reading about Perl's test-infected culture is fantastic and other language which claim to be test-infected often come in a poor second.

Er, sort of.

TPF Grant Progress Report: October 2013

This past May, The Perl Foundation awarded a grant to fund development of a couple features in Pinto. Pinto is a robust tool for curating a private repository of CPAN modules, so you can build your application with the right modules every time. This is my second progress report on that work.

I want mop rest capability to define fast accessor

In Perl, accessor access is about 30 times slower than direct access. For example,

  # Accessor access
  $obj->title;
 
  # Direct access
  $obj->{title};

"$obj->title" is about 30 times slower than "$obj->{title}". In current perl, we can't replace accessor access with direct access in general way.

but in mop, we can distinguish method and attribute. If so, we may replace accessor access with direct access. I want mop to rest capability to define this fast accessor.

Steven said "$self->title" is overhead, but if fast accessor is implemented, this is no longer overhead, and we can access attribute by unified way without performance overhead.

PDL 2.007 Released!

PDL (“Perl Data Language”) gives standard Perl the ability to compactly store and speedily manipulate the large N-dimensional data arrays which are the bread and butter of scientific computing.

PDL turns Perl into a free, array-oriented, numerical language similar to (but, we believe, better than) such commercial packages as IDL and MatLab. One can write simple perl expressions to manipulate entire numerical arrays all at once. Simple interactive shells, pdl2 and perldl, are provided for use from the command line along with the PDL module for use in Perl scripts.

As a frequent PDL user and occasional contributor, I am happy to pass along this note from Chris Marshall and the whole PDL team. Read the entire release message here.


It is with great pleasure that the PDL development team announces the release of the latest version of the PDL Data Language with 64bit platform support.

This release would not have been possible without the contributions of developersChris Marshall, Craig DeForest, Derek Lamb, Dima Kogan, Rob/Sisyphus, David Mertens, Diab Jerius, William Parker, and Henning Glawe.

A special thanks also to those who helped with bug reports, problem discussions, and, of course, participation in CPAN Testers which has helped to make the best tested PDL release ever!

Enjoy and Happy PDL-ing! The PDL Development Team

Real-Time Web Apps

Real-Time Web Apps :

The slides from my MadMongers Real-Time Web Apps talk are now available online. 

[From my blog.]

a perl5 to perl6 translator

The "perlito" perl5 to perl6 compiler is online at: http://perlcabal.org/~fglock/perlito5to6.html.

It is also available as an irc bot for snippets and as a command line script.

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.