Hiring for Framework Knowledge Makes Good Business Sense

Chris Hardin asks How many frameworks do I need to know and concludes that a rudimentary understanding of a framework plus google is all you need.

Sure it’s all you need, but you can always become better.

Take the Perl POE event framework for example. It is fairly easy to cobble together a basic POE server based on the examples in a few hours or maybe less. But it takes a few months to fully get to grips with how sessions, wheels and components hang together to the point of developing your own wheels. If your team uses POE extensively, why not short-cut that time and hire someone who knows it already?

If you manage to hire an expert or core developer, you might even learn something you didn’t know already.

Posted in Programming | Tagged | Leave a comment

First Thoughts on Twitter

Yellow-rumped Warbler

I’ve finally succumbed to getting a twitter account.

I’ve discovered that even though I haven’t had anything to tweet about, it is more useful than I expected. I’m following a handful of WordPress and Perl folks and the WordPress guys keep flagging up relevant links that I hadn’t come across previously.

However, I don’t get new links from the Perl folks I’m following. I think this is because the Perl community is more organised and already publish most of their content on Planet Ironman or PerlSphere. I’m subscribed to both.

Or it could be that I’m not following the right people. Does anyone have any suggestions for Perl twitterers I can follow? Thanks.


Yellow-rumped Warbler by Mike Baird

Posted in Blogs | Tagged , | Leave a comment

WordPress Statistics Plugins

I’m always in the market for a really good WordPress statistics plugin. WordPress.com stats is not a million miles away from what I want. The standard view shows number of visitors per pages today and yesterday as well as how visitors arrived at the site through referrers or search engine queries.

The only other thing I’m interested in, is how long people are spending on my blog. Knowing what proportion of my visits are 30 seconds or less indicates how many people did not find what they were looking for.

I also don’t want to send my stats to an external site, which rules out WordPress.com stats and Google Analytics. That just leaves around 200 statistics plugins to check out.

Choosing A Statistics Plugin

I did a number of searches along the lines of best wordpress statistics plugins. Most of the results were fairly old articles, but this post by Frances Comugnai was relatively recent and comprehensive.

WordPress.org has a list of statistics plugins, ordered by last updated date so you can avoid getting stuck with an unmaintained plugin.

I tried a few plugins.

WassUp, which is mentioned a lot in Google searches didn’t provide the information outlined above, which is what I was interested in.

kStats Reloaded and nStatistics were closer to what I wanted, but the last updated date is fairly long ago.

Slim Stat Dashboard

Currently, WP SlimStat is the primary plugin I’m using. It lists most of the information outlined above, although not quite in the format I’m after. I’ve got high hopes for it though – there is an API you can use to generate your own custom reports.

I’m also running StatSurfer which I prefer for at a glance reports. I’d probably choose to use this over SlimStat on a less actively used website. If I can figure out how to get SlimStat to generate the reports I want though, I’ll disable this as it must be expensive to have the same data captured twice.

StatSurfer Details Page

Finally I’m running Piwik which captures the most comprehensive information. It even has the elusive how long did a visitor stay information. Most of my visitors stay between 0 and 30 seconds :-(

For the future, I’d like to consolidate this to a single plugin. SlimStat has the best balance between useful information captured, and being able to quickly see everything I’m interested in. But Piwik stores more information.

Posted in WordPress | Tagged , , , | Leave a comment

Another Thing Perl and PHP have in Common…

…is that a lot of ignorant people think that they both suck.

Do any other Perlers get annoyed when someone who clearly has no idea of the awesome power of Perl claims "Perl sucks" ?

It’s just me then.

Of course, a significant difference between the two is that no-one thinks that PHP is dead (just sayin’)


sucking sweets by Ross Elliott

Posted in Perl | Tagged , , | 2 Comments

Other Languages Have Libraries Too

Ashley Pond V.does not know PHP:

“WordPress had to cover dozens or even hundreds of pieces (feeds, site map, remote content fetching, sessions, SSL, revisions, Ajax backend, logging, caching, email) I didn’t have to think about beyond configuration settings and a little glue.”

I found this quite amusing. I know the CPAN is great. It may even be significantly better than the other dynamic language library repositories, but does anyone really think that other languages don’t have libraries?

PHP Libraries

I know virtually nothing about PHP, but I do know it has a library repository called PEAR. I had a quick look through a few of the libraries mentioned.

(what does Ajax backend even mean?)

Even implementing an RSS feed, which doesn’t have a specific PEAR library looks like a couple of minutes work.

Let’s not kid ourselves that anything on the CPAN makes implementing WordPress even 20% easier in Perl than in PHP. There is still scope for improving support for more complex web apps however.

A Classic Blunder

Never fight a land war in Asia
- Vizzini

In three weeks I had threaded, automated-spam-proof comments (without any admin intervention), XSS-proof pages, revision history, trees of posts with arbitrary templates, and lots more.

The blunder here is thinking that the 10% of functionality that you are interested in is the same 10% as everyone else.

In three weeks I could easily write a basic blog engine with all the features mentioned using just CGI.pm, DBI.pm and the Template Toolkit1. It wouldn’t be WordPress though. And neither is the code running sedition.com. I mean come on Ashley. You don’t even have pretty permalinks.


1. Base PHP comes with all of these pieces built-in

Books by tvol

Posted in Perl, WordPress | 2 Comments

Why Work on Melody?

melody

One of the comments on my Choosing a Blogging Engine post mentions Melody, a community fork of the Movable Type content management system which is written in Perl.

Which leads me to the question in the title.

Whenever I hear about people writing yet another blogging engine in Perl, Python or Ruby it brings to mind a quote from Terry Chay:

"Ruby is really good at what it does. The problem is, for what Ruby does really well, I can download WordPress. [Ruby is] really good at building those apps that have already been built before. PHP is good at finding out what the next WordPress is."

That is a great quote, at least for the PHP faithful. Great, and wrong. PHP, Perl, Ruby and Python are approximately as good as each other for "finding out what the next [great Web Application] is". Ruby can’t be that good at building WordPress clones either. If it was, then where are they all?

However, there is an important point in there. Why work on a Perl blogging engine when "I can download WordPress" ?

Instead, let’s spend our time making Perl a better platform for developing the next great web application.

Posted in Perl, WordPress | Tagged , , | Leave a comment

Why I am not a Hybrid Core User

steel girder framework

A few weeks ago, Justin Tadlock released the latest version of his excellent hybrid theme framework – Hybrid Core 1.0. I have used hybrid child themes on a number of websites with good reason.

  • Justin’s code is clean and easy to follow
  • the theme is extremely flexible
  • the support Justin provides for just $25/year is amazing

A philosophical difference about the_excerpt

Update for clarity: Prototype is the only parent theme currently available that uses Hybrid Core. Therefore if I won’t use Prototype, I won’t be using Hybrid Core.

In prototype 0.1, the main posts page, home.php, uses the_excerpt rather than the_content.

$ grep -l the_excerpt *.php
archive.php
home.php
loop-meta.php
search.php

$ grep -l the_content *.php
attachment.php
index.php
page.php
page-template-archives.php
page-template-bookmarks.php
post.php
singular.php

I think that is the wrong default.

If I want to deliberately choose an excerpt for a post, I can do that by putting in the <!—more—> slug. If the theme defaults to the_excerpt, it is overriding my choice.

More than two years ago, Justin gave a correct solution to defaulting a theme to use excerpts – add a filter to the_content. Then I will be able to remove it easily without patching the framework directly.

Sure I can add a filter to go from excerpt back to content, but that just feels wrong.


framework by kaz k

Posted in WordPress | Tagged , | 4 Comments

Choosing a Blogging Engine

train engine

As I am primarily a Perl programmer, the clear and obvious choice was WordPress. I didn’t even consider looking at any of the alternatives available.

If it’s good enough for him…

Perl luminary, Dave Cross, had some comments on why he chose WordPress. Some of them are more than a little strange; he mentions that neither his OS, nor his web browser are written in Perl1.

However his key point, that WordPress has an enormous and productive community, is well made. To implement a blog with similar functionality would take significantly longer with anything else.


1. This argument does not stand up to much scrutiny. There are no viable Perl web browsers or operating systems whereas there are Perl blogging engines.

Engine by Slideshow Bruce

Posted in WordPress | 12 Comments

Improving Database Column Insertion With Thing At Point

I can make ido-insert-database-column even more useful by having it complete some text that I have already typed into the buffer. This is trivial using thing-at-point.

The closest thing that matches a database column name is a filename.

(defun ido-insert-database-column ()
  (interactive)
  (let ((bounds (bounds-of-thing-at-point 'filename))
        (input (thing-at-point 'filename))
        selection)
    (setq selection (ido-completing-read "DB Column: " database-columns nil t input))
    (when (> (length input) 0)
      (delete-region (car bounds) (cdr bounds)))
    (insert selection)))
Posted in Emacs | Leave a comment

Choosing Database Columns Using Ido Mode

ido database columns screenshot

For my final riff on extracting the data dictionary using Perl DBI, I’ll demonstrate using ido mode to quickly choose and insert a database column. This was inspired by a Stuart Halloway video which shows that ido mode is useful whenever you need to choose between a list of things.

ido mode provides a mechanism for quickly whittling a list down. When you enter id, for example, it displays only the fields containing id. Then you can press C-[SPACE] which retains the filtered list. You can then apply another filter. E.g. entering com will filter out just comment_ID, comment_id and comment_post_ID as in the screenshot above.

My previous script, gives me a list of database columns. I need to tweak it slightly to output a sexpr.

my %columns;

my $noPrefix = @$tables == 1;
foreach my $table (@$tables) {
    my $columns = getColumns($dbh, $cache, $table);
    if (defined($args{sexpr})) {
        foreach (@$columns) {
            $columns{$_} = 1;
        }
    } else {
        print join("\n", map { ($noPrefix ? '' : "$table." ) . $_ }
                         @$columns), "\n\n";
    }
}

if (defined($args{sexpr})) {
    print "(", join(" ", sort keys %columns), ")\n";
}
$ ./db-info.pl -all -sexpr > ~/.database-columns.el

I read the configuration file into emacs and provide an interactive method, ido-insert-database-column, for choosing the column.

(require 'ido)

(ido-mode t)
(setq ido-enable-flex-matching t)

(defvar database-columns nil)

(defun load-database-columns ()
  (with-temp-buffer
    (insert-file-contents-literally "~/.database-columns.el")
    (setq database-columns
          (mapcar #'symbol-name (read (current-buffer))))))

(unless database-columns (load-database-columns))

(defun ido-insert-database-column ()
  (interactive)
  (insert (ido-completing-read "DB Column: " database-columns nil t)))

(provide 'database-columns)

I’ll use this all the time in Sql mode so it makes sense to make a shortcut in sql-mode-map.

(define-key sql-mode-map (kbd "C-c C-f") 'ido-insert-database-column)

If you liked this post, subscribe now

Posted in Emacs, Perl | Tagged , | 2 Comments