May 2010 Archives

Posting to blogger?

Some days are just big buckets of fail. So far I've not been able to get any code to successfully publish anything to blogger.com. I've failed with both Net::Blogger and Atompub and am seriously tempted to just create a bunch of damned HEREDOCs and push them straight to the Google Blogger API.

Didn't we use to own the Web? Or maybe I'm just having a really off day. I've successfully written a custom CMS in just a few hours and I'm stuck on one last, little stumbling block.

Anyone have working code they care to share? I mean real, live working code, not examples. I've seen more failed examples than I care to admit :)

Dates in Latin

I'm getting married on June 20th. Leïla and I chose this date because it's my birthday. It's my birthday because I was born on Dies Martis xx Junius MCMLXVII, as calculated by:

use Roman;
sub latin_date {
    my $datetime = shift;
    my @days     = (
        'Dies Dominica',
        'Dies Lunae',
        'Dies Martis',
        'Dies Mercurii',
        'Dies Iovis',
        'Dies Veneris',
        'Dies Saturni',
        'Dies Dominica',
    );
    my @months = (
        'Januarius', 'Februarius', 'Martius',   'Aprilis',
        'Maius',     'Junius',     'Julius',    'Augustus',
        'September', 'October',    'Novembris', 'December'
    );
    return join ' ' => $days[ $datetime->day_of_week ],
      roman( $datetime->day ), $months[ $datetime->month - 1 ],
      uc( roman( $datetime->year ) );
}

I pulled the Latin information from this page about Roman dates.

Making Test::Harness output a progress bar

I really haven't done a huge amount of work on Test::Harness since it was released as core, so I decided to take a look at how it is now. I was reading a blog post where someone commented that Perl's Test::Class doesn't offer a progress bar and I thought, that should be easy to hack into prove.

Looking for work in London?

Just a quick note: if you can legally work in the UK and you're near London, drop me a line every once in a while if you're looking for work. I'll treat it with confidence. I keep getting contacted by recruiters and sometimes I want to pass leads on to others.

Actually, if you need to be sponsored for a work permit and you're really good at what you do, still let me know. Sometimes the recruiters tell me their company will sponsor permits.

Objects are experts

Note: this is part of an occasional series of posts aimed at newer programmers, or newer Perl programmers. I'm going to talk about what objects are, but even programmers who think they know the answer might benefit from some of this. That includes myself. You might take exception to some of what I write, so feel free to chime in with counter-arguments.

For many older programmers such as myself (I'm 42 as of this writing), their first computer program is often a variant of the following BASIC program:

10 INPUT "What's your name? ", N$
20 PRINT "Hello, "; N$
30 GOTO 10

That's already pretty interesting. In just three lines of code we have some idea about:

  • I/O (input/output)
  • Variables (N$)
  • Data types (the '$' indicates a string variable)
  • Flow control (the GOTO)

That's a pretty heady mix and you can cover a lot of fascinating topics with that. Where you go from there is pretty wide open, but it also tends to express what limitations you'll experience. For example, after BASIC, I went on to 6809 Assembler and then C. What's interesting about the progression from BASIC to Assembler to C is that all of these are procedural languages. If you accept a variant of the Sapir-Whorf Hypothesis, the languages you learn determine (strong variant) or influence (weak variant) how you perceive the world. At least with computer languages, I believe this is true. Heavy exposure to procedural languages can make it difficult to understand object-oriented ones (let's not even go to functional or logic languages, lovely though they are). Thus, we find ourselves having to explain to new programmers what an "object" is.

2010 Perl Survey

Yeah, you've probably already seen this, but in case you haven't, read the Perl survey announcement and take the survey!

What's Test::Class Doing?

So much of software engineering is about complexity management. You find common patterns and abstract them out. You tease apart complex inheritance hierarchies. You decouple unrelated behaviours and find different pieces are simpler as a result.

In the process of this, you might be using Test::Class for your test suite. It's a fantastic module, but even people who've been using it for years can sometimes be surprised by its behaviour. One nifty way of understanding what's going on is to have your common base class tell you more. Here's one simple trick which might surprise you.

Threaded Forum SQL

I previously wrote about threaded forums and threatened to share some code with you. Basically, I want to get this in a single SQL call:

Threaded Forum

Sharding Your Database

Yesterday I was in a class taught by one of the folks at Percona, the MySQL and LAMP stack performance experts (they're the ones behind mysqlperformanceblog.com). Sharding was covered and though I learned a lot, it also reinforced my opinion that this is a dubious technique which fanbois like to reach for waaaaay too soon.

Threaded Forums Made Easy

Not too much about Perl, but just wanted to say that sometimes I have a lovely feeling of accomplishment after struggling to find a good approach. After considering my options about forums, I decided to continue on my own. With the proper tool selection, they're incredibly easy. Below is sample output of my alpha code.

Threaded Forum

A Tiny Affordance

What's wrong with this picture?

use parent qw/DBIx::Class::Core/;

Centralized versus decentralized version control

While this is often a Subversion versus mercurial/git argument, I want to look beyond that. Can anyone offer me any compelling reasons to choose centralized over decentralized version control? I'm not even talking about weighing pros and cons (because if you did, centralized source control would lose badly). I'm just curious about any good, solid reasons to choose a non-decentralized source control system.

Things I Can't Have

Whenever I start on a new team, there's one thing I want and never get. I'm not a betting man, but I've even bet that this thing I want won't happen. I've never lost that bet.

When I started writing the new Test::Harness, I had a .perltidyrc file which, while not perfect, allowed me to easily format my code with the following vim mappings:

nnoremap ,pt  :%!perltidy -q<cr> " only work in 'normal' mode
vnoremap ,pt  :!perltidy -q<cr>  " only work in 'visual' mode

Forum Software

Forum software is frequently awful. In trying to write a minimal version on my own, I've discovered that mine is just as awful, so I'd rather use someone else's awful forum software. I'm sure it will be less awful than mine. Naturally, I'd prefer it to be Perl as I can hack on it if need be.

Unfortunately, this is to be integrated into an existing Catalyst application. Integrating multiple Catalyst applications into a single application isn't an easy task. There's CatalystX::Features, but I've not yet looked at it terri…

About Ovid

user-pic Freelance Perl/Testing/Agile consultant and trainer. See http://www.allaroundtheworld.fr/ for our services. If you have a problem with Perl, we will solve it for you. And don't forget to buy my book! http://www.amazon.com/Beginning-Perl-Curtis-Poe/dp/1118013840/