Finishing Off that Bug in djangocms-picture (part trois)

In the prior episode of this story, I had written a test to detect the bug I want to fix. The djangocms-picture plugin includes errant whitespace inside of HTML anchor tags, which renders as annoying blue underlines next to the images.

I had also discovered why my test didn’t fail as it should have, because Django’s assertHTMLEqual() doesn’t detect all semantically significant whitespace differences. I’m sure it seemed a good idea at the time. But sorry, that’s not working for me.

Fortunately, it’s not that difficult to redesign assertHTMLEqual(). Continue reading

Posted in website revamp | Tagged , , , | Leave a comment

Still Fixing that Bug in djangocms-picture (part deux)

Last time, I began fixing a fairly simply space-within-anchor-tags bug in djangocms-picture.

I’m using this exercise as an opportunity to (a) try out a disciplined development process in the context of a Django application and (b) dig into the Django and Django CMS APIs.

This involves writing a failing test against the existing plugin rendering code, seeing it fail, fixing the bug, and then seeing the test pass.

My experience so far with this framework has not been as stellar as I had originally thought it would be. Continue reading

Posted in website revamp | Tagged , , , | Leave a comment

Fix that Bug in djangocms-picture

I mentioned a couple fundamental issues off the bat with my website revamp using Django CMS.

I’m in the process of revamping my hub site, www.JTimothyKing.com. I had created a barebones site: only a single page of content, two columns (using djangocms-column), and a row of social-media icons (using djangocms-picture). I only made minimal changes to get it “good enough for now.”

There were still a couple unresolved issues, even before any serious theming, one of which was that the social-media icons are rendering with small, blue underlines in between. Before theming the site, I’d like to deal with this irksome quirk.

But oh! I thought, This also presents a perfect opportunity to apply my standard dev process to a Django project! Let’s go! Continue reading

Posted in website revamp | Tagged , , , | Leave a comment

Website Revamp to Django CMS

It was long past time to redo my hub site, www.JTimothyKing.com. It had been running Drupal for far too long. I won’t tell you what version. Suffice it to say that the version had been unsupported for quite some time before I finally decommissioned it.

Rather than upgrade to a new version of Drupal, I chose to revamp the site and move to Django CMS. Continue reading

Posted in website revamp | Tagged , , , | Leave a comment

How to Cheep in Many Programming Languages (not a tutorial, but a spiritual journey)

I have a small problem.

The first part of the problem is that I’ve been a Perl developer for the past decade—

That came out wrong. Let me start again.

I have a small problem.

The first part of the problem is that I’ve been enjoying Modern Perl for the past decade while not learning any other programming languages. Don’t get me wrong: I love Perl, and I love programming, and I love learning new things. But since 2006, I’ve mostly been focusing on personal growth. Continue reading

Posted in Uncategorized | Tagged , | 1 Comment

The Most Powerful Programming Paradigm in the World?

Cornell Facebook Camp Hackathon
Photo by Benjamin Golub

I’m not a hackathon kinda guy. I don’t get off on solving hard or novel problems. I don’t believe in contests. I’m not particularly energized by the idea that a whole bunch of us are trying to solve the same problem at once— I do believe in community, and I appreciate being able to interact with other developers, but on a different level than just getting into the same (virtual or physical) room together, eyes to the computer screen.

So why then did I participate in the Dallas/Fort Worth Perl Mongers
Winter 2013 Hackathon? Continue reading

Posted in Uncategorized | Tagged , , , , , | 1 Comment

Mopping up with Perl

30 Ways to Shock Yourself #2,
photo by Bre Pettis,
from the book Elektroschutz in 132 Bildern

I ported my DFW.pm Hackathon entry to the latest Perl dev release (5.19.9), the one with built-in sub signatures.

I had originally designed it using the latest p5-mop and Алексей Капранов’s (Alexei Kapranov’s) signatures package. (I thought this was more in the spirit of mop than Sub::Signatures.) And that worked fairly well, with only a few glitches, and only a few complaints. But since sub signatures are now available (Yay!) in core (No hiding how I feel about that, eh?), it seemed a good time to bring the experiment fully into the present.

And here are some discoveries from my experiences with Perl mop+signatures. Continue reading

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

Benchmarking Perl 6: How Ready for Prime Time Is It?

Racing at the 2009 Camel Cup in Alice Springs, Australia
Photo © 2009 Toby Hudson CC BY-SA

Here are the slides from the talk I gave at this month’s Boston Perl Mongers meeting, this past Tuesday: Benchmarking Perl 6: How Ready for Prime Time Is It?

The talk examines:

  • Perl 6’s suitability for “production.” (Your definition may vary.)
  • Experiences of the state and stability of Rakudo.
  • Benchmarks of my favorite P6 features.
  • Lines of P6 code from everyday life.
  • Some comparisons of P6 with P5.

-TimK

P.S. There’s a lot of the story that you miss when you can’t hear the talk. I may be able to post an audio recording and/or a YouTube video with the audio combined with some version of the slides: still looking into these. Unfortunately, I didn’t have time to set up a proper screencast during the talk, so I’m putting together these productions after the fact. And I’m sure there’s a lesson somewhere in there on the efficiency of good planning in design. 🙂

P.P.S. I collected my data using Geoff Broadwell’s (japhb) per6-bench benchmarking framework. (You can catch the code I used in my GitHub fork of perl6-bench.) I also highly recommend his YAPC::NA 2013 talk.

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

More Simple Stats with Perl 6

Last time, a time long, long ago, in a universe far, far away, I left you with the following Perl 6 code (or something like it). This code reads in a series of book heights and displays the number of books of each height (in order from shortest to tallest).

my %num_of_height;
for lines() {
    if m/^ \s* (\d+[\.\d+]?) [\s* x \s* (\d+)]? \s* $/ {
        my $height = +$0;
        my $num = +($1 || 1);
        %num_of_height{$height} += $num;
    } elsif ! m/^\s*$/ {
        note "Invalid line ignored: $_";
    }
}

#| unique book heights seen, in order from shortest to tallest
my @heights = sort { $^a <=> $^b }, keys %num_of_height;

say "Histogram data:";
for @heights -> $height {
    my $num = %num_of_height{$height};
    say "$height x $num";
}

As you may recall, this little bit of somewhat less-than-useful P6 script was inspired by a homework assignment in my daughter’s high-school statistics course. While she manually counted up the heights of the books we measured, in order to draw a histogram of the data, I wrote a Perl script to do the same counting.

Since then, for kicks, I’ve also hacked together about 50 lines of code to display an actual histogram of these data, with horizontal bars of *****. I’m not going to go into that code here, because I did not write it at the time, but if you want, you can check it out on Github.

However, I did discover how succinctly Perl 6 could answer the other questions from the assignment. Continue reading

Posted in Uncategorized | Tagged , , | 4 Comments

Reason #2 Why We Write Unit Tests

Seen on DamnLOL

Ninety-nine little bugs in the code,
Ninety-nine little bugs!
You take one down, patch it around,
A hundred and seventeen bugs in the code!

(See also Twelve Benefits of Writing Unit Tests First.)

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