Testing W3C Standards
Back in February I did a presentation for the Birmingham Perl Mongers, regarding a chunk of code I had been using to test websites. The code was originally based on simple XHTML validation, using the DTD headers found on each page. I then expanded the code to include pattern matching so I could verify key phrases existed in the pages being tested. After the presentation I received several hints and suggestions, which I've now implemented and have set up a GitHub repository.
Intro to Moose talk now open for registration!
Registration for the Intro to Moose training session on Thursday is now available. This is an excellent class if you are just starting out with Moose. It covers the fundamentals well and the exercises are brilliant. It is highly recommended.
The class description is available in the schedule.
A/B Testing and Local Maxima
I recently posted about Failing your way to success with A/B testing and I was pleasantly surprised about the very active feedback.
What I am most afraid of in the kind of A/B testing I've seen is that it seems very prone to getting stuck in local minima. In that image, imagine you're in the place marked with the red arrow. Taking small steps and adjusting for the test result each time, you're never going to reach the optimal place (blue arrow) since once you're in the local minimum, all small steps you can take actually produce a worse result.
Aristotle raised a similar concern and I think it's important enough to address up front.
use strict;
I came across a recently written module by a very smart person who I am friends with, and the module neglected to 'use strict;'
Do you do this? If so, why? Please add your reason in the comments. I'm somewhat flabbergasted that anyone wouldn't use strict in this day and age.
Aspect.pm 1.00 released, and a first look at writing Aspect code
I'm happy to report that version 1.00 of Aspect.pm has been uploaded to CPAN, and so Perl's Aspect-Oriented Programming toolkit is now officially done.
http://svn.ali.as/cpan/releases/Aspect-1.00.tar.gz
The API should remain stable for some time (until the notional 2.00 with it's major rewrite into opcode manipulating XS). Most future changes in the 1.00 series should comprise additions of keywords or features, and code written now should be forward compatible.
But what is Aspect-Oriented Programming, and what it is good for? The standard documentation in AspectJ is full of jargon and most of the code samples are notional at best, and make it hard to connect to any real world situations.
The simplest way to describe the Perl Aspect.pm is that it provides a way of hijacking functions or methods with very little code, and in a very precise and controlled manner.
A note re Set::FA
Hi Folks
OK. I've released Set::FA V 1.00 to CPAN. The code passes the same tests as the previous version, V 0.101.
The docs have been re-written from scratch, for both Set::FA and Set::FA::Element.
There have been many changes due to the fact the code no longer does direct access to an internal hash, but uses getters and setters. I have not changed any of Mark Rogaski's code which implements the logic of the modules, I've only made it work in a new OO environment.
Also, I've dropped support for Log::Agent, and provided a parameter to new() called logger, so you can supply any type of logger, and have the code call
$logger -> log($level => $message)
at various points. All this is documented extensively.
Another new parameter to new() is die_on_loop, so otherwise run-away programs can be self-limiting.
OK - time to put it to work...
The Dancer release that will get you hooked!
I've been waiting for this blog post for a few good months now.
We've finally released Dancer 1.3050 (codename "The Captain Hook Adventure", named after Franck Cuny, who will forever be known as Captain Hook!) which carries our new hook system, written by Franck. Special credit goes to JT Smith who pushed the design and implementation of this system (and had great input and feedback) until it saw sunlight.
So what's the new hook system? Basically Dancer (and Sinatra, and Flask, and others) have a before
and after
modifiers (or sometimes called "filters"), which are basically hooks for running code before and/or after your request has been handled. This is a good place for running checks, auth-related stuff and special logging or whatnot.
While these hooks were very useful for people, they weren't enough. People needed more. For example you might want to override the error handler, or perhaps to add special data before a auto-serialization process. Hell, maybe you want to even create your own hooks! :)
This is now all possible!
You should read more this and even this.
Enjoy!
(and if you see Franck or JT at a conference, feel free to get them a beverage of their choice :)
Room update
We're currently working with the resort to resolve the issue of booking rooms. We've made contact with them and their advice is to call 800-733-3211 to reach in-house reservations or to leave voicemail messages, or email reservation inquiries to reservations@hulsinghotels.com. Further, waiting until next Tuesday when the resort can reassess the inventory might be the best course of action.
Get ready for Aspect-Oriented Programming with Aspect.pm
Around Christmas 2009 I took over Aspect.pm, a first-generation implementation of Aspect-Oriented Programming for Perl based on Hook::Lexwrap
Over the last year and a half I've expanded functionality, cut back dependencies to a minimum, optimised the hell out of it, and written a ton of documentation and a comprehensive test suite.
This second-generation implementation has now reached about as far as I can take it without resorting to exotic XS code to replace some of the exotic Perl code. So after a final 2 week sprint to smooth off some ugly corners, in the next few days I'll finally be releasing version 1.00 of Aspect.pm.
I'll be talking more later about some of the more interesting things you can do with Aspect-Oriented Programming. What I'll also be trying to do is focus on actual useful things, and avoiding as many as possible of the utterly batshit insane things that Aspect.pm lets you do.
Perl 6 IRL (In Real Life)
A couple of weeks ago a ran into a real life situation where Perl 6 was able to greatly simplify my life. I was in the process of importing some Canadian postal codes from a PDF document where the data was presented like this:
A0A-A0R,D13
A1A-A1G,D11
A1H-A1M,D13
A1N,D11
A1S-A8A,D13
B0C-B0E,D11
B0H-B0W,D10
B1A-B2E,D11
B2G-B2H,D10
Each postal code, or postal code range, was tied to a zone. To store this to a database, I wanted to expand out each of these ranges to capture each value. Causing the first line to be represented as:
A0A => D13
A0B => D13
A0C => D13
... some more ...
A0R => D13
Using the Perl 5.12 range operator (..) I thought I could use easily accomplish this goal.
App::PipeFilter 0.001 on its way to CPAN
Thanks, everyone who was interested in App::PipeFilter. Your interest motivated me to clean it up and send the very first release to PAUSE. It'll be on CPAN once your favorite mirror catches up. Check out the snazzy documentation, which consumed most of my time since my last announcement.
Patches and pull requests welcome!
Failing your way to success with A/B Testing
So I've read and very carefully considered the words of Douglas Bowman and his decision to leave Google and much of this was about Google's use of A/B testing ... Google's extensive use of A/B testing. Google engineers clearly valued function over form. He complains about a situation where 41 shades of blue were tested for optimum response (see page 3) and makes it clear that he felt constrained. No matter what he did, how simply he did it, he had to "prove" it worked. He simply wanted to build something beautiful and not worry about extreme micromanagement of every aspect.
I can understand that. Many times I want to just "make stuff happen", secure in the knowledge that I know what I'm doing. I look at how foolishly code is implemented and I think "what our customers really want is X!". And A/B testing shows me, over and over again, that I'm wrong. It's humbling. It's humiliating. And if you really care about being the most effective you can be, you'll love it, but only if your pride can handle being proved wrong on a regular basis.
New release of Autodia - now with Mason support
I've uploaded a new version of autodia to PAUSE and it should be available on CPAN shortly.
Highlights of this release are :
* added Mason handler provided by Peter Franke
* new ASP Handler provided by Dalton Mackie
* improved tests (and made some tests author_only)
* A bunch of minor fixes and barely noticable improvements
French Perl Workshop 2011
FPW2011 will be held in "Cité des Sciences et de l'Industrie" Paris,
France on the 24th and 25th of June.
This will be the 8th conferences organized by the French Mongueurs de Perl.
This event will gather Perl's users from all levels, from the beginner to the expert.
This will be an occasion to meet several famous french Mongers.
Share the informations to your colleagues, to your friends, to your HR department,
if you think they can be interested. We hope to welcome you at the Cité des Sciences.
Information and registration: [http://www.journeesperl.fr/]
Contact: contact-fpw at mongueurs dot net
App::PipeFilters gets multiline parsing and JSON::Path
Tonight I added support for multiline JSON input to all the App::PipeFilter tools. This is great for data sources that are beyond one's control, such as those found on the web. But I haven't found one to use as an example, so you get this instead:
% curl -s 'http://search.twitter.com/search.json?q=pipefilters' |
jpath -o '$..from_user' -o '$..text' |
jmap -i col0 -o from -i col1 -o text |
json2yaml
... produces output like this:
---
from: perlironman
text: "Rocco Caputo (rcaputo): App::PipeFilters - JSON in the Shell http://bit.ly/mGgnOX"
See what I did there with JSON::Path expressions? The jpath filter can extract fields from deep within JSON objects (but jcut will be faster for simple JSON objects).
Here's another example:
WebGUI 8 Status Report
A major milestone in WebGUI 8 development was reached this week: A dry-run of the WebGUI 8 upgrade was successfully run against the plainblack.com database. This means the only thing remaining from releasing an alpha 8.0.0 is updating all the custom code on http://plainblack.com and http://webgui.org. As always, plainblack.com and webgui.org will be the first sites running the latest bleeding-edge version of WebGUI (unless one of you wants to beat me to the punch).
This month, I also gave a presentation to Madison.PM about building applications in WebGUI 8, a quick introduction to Assets and an overview of the most important changes to how they work. The slides are available at http://preaction.github.com/ and the code samples are linked at the end.
On an unrelated topic, I really enjoyed using S5 to build my slides, SHJS to highlight the code inside, and Github Pages to host the whole thing. I plan on doing the same for all my presentations: They look good, readable without a special program, editable without a special program, anyone can fork and update my presentations, and they're served by a nice, fast, free host.
A note re Set::FA::Element
Hi Folks
Mark Rogaski, the author of Set::FA has kindly given me co-maint, so I can make some changes.
This post really concerns Set::FA::Element, which is what I'm using for the unreleased Graph::Easy::Marpa::Lexer module. The latter module is working (at home) on simple graphs.
Firstly, I'd like to add a method to return what's captured. This simplest patch is to change line 102 from:
my $regex = qr{$rule}; # precompile regex
to:
my $regex = qr{($rule)}; # precompile regex
I.e. To add capturing parentheses, and a method called match() to return the value. Since match($string) sets what matched, you can even fool the DFA via this method...
Because there is not currently any such capability, I'd like to think this doesn't affect too many users, if anyone. But if this does concern you, please comment this post.
Solarized syntax highlighting on search.cpan.org
So, remember Mark A. Stratman’s post about syntax highlighting for search.cpan.org?
You may also be familiar with Ethan Schoonover’s excellent Solarized color palette. If not, go take a quick look; there’s some really nice design and attention to detail over there.
Putting these two things together: I’ve assembled two color schemes from the Solarized palette and submitted them to Mark, and then pestered Graham Barr a bit, and now you can select solarized-dark
and solarized-light
from the syntax highlighting drop-down menu.
Comments and pull requests welcome :)
-Steve
App::PipeFilters - JSON in the Shell
I've just put App::PipeFilters on github for review before I inflict them on CPAN.
They're a small set of UNIX command line tools for working with structured data. In particular, JSON objects, one per line. They're compatible with many UNIX command line tools like sort and uniq. From the README:
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.