Reading is something I’ve enjoyed doing since I was a boy. It is not something that I’ve done consistently along my life, but those periods when I read the least were (usually) not particularly good ones and I didn’t read mostly because I just couldn’t find the time to do it.
Sure, I’ve always had a pile of books on my nightstand from which I would, on those occasions, pick one and start to have a go at it, until I fell asleep within a couple of minutes. At most.
Reading in bed, whenever I’m overly tired, just doesn’t work.
These last few years have been one of those spells when I hardly picked up a book. I didn’t stop buying them, though, I just stopped reading them, which had the effect of turning the to-read pile into a to-read shelve and then two to-read shelves.
In all honesty, I must say that I didn’t completely stop reading, I just stopped reading anything that was not technical and directly related to work. (One of the biggest advantages of being an engineer is that you never really stop reading and learning.)
This state of affairs lasted until a few months ago, when I decided to effect a few changes in my life which indirectly contributed to me having time to read again. Specifically, I started taking the train to work. Which turned a two to three hour daily drive into a 2 and a half daily commute.
So now I find myself reading again and, as I was discussing with a friend a few days ago, it feels like I got re-acquainted with a long-lost, but dear friend of mine. One which I’d missed so much!
The pile of books I have on the shelves is rather diversified and so far I’ve delved with much gusto into such topics as finance, historical fiction, randomicity ad uncertainty, pop anthropology, neuroscience, ancient treatises on the Bushido and Zen, science fiction, architecture and design…
I dourly missed my story telling friends and, thankfully, the pile of new stuff is still pretty big (and I still want to re-read lots of stuff,) so even if I were to stop buying new books now, I’d still be settled for a long time to come.
This is a plugin that I concocted for enabling the usage of the Disqus on a Blosxom site.
It is perfectly possible to add this functionality just by tweaking the flavour templates, of course, but this makes it easier to use and also makes it possible to port existing sites to Blosxom and easily maintain the comments that may already exist.
It also allows for the individual turning on or off of feedback on a per-story basis.
I’ll probably add a zipped file with the plugin somewhere on the site, but for now the code is displayed right here on this page.
# Blosxom Plugin: disqus
# Author: Nuno Nunes <http://nunonunes.org/>
# Version: v0.01 2010-01-05
# Documentation: See the relevant sections of this file or type: perldoc disqus
package disqus;
# --- Configurable variables -------------------
#
# What is your username on Disqus (the one that should appear
# on the javascript section of the HTML pages)?
$disqus_username = 'nunonunes' unless defined $disqus_username;
#
# Message to display if feedback (comments and trackbacks) is not allowed
# on a story.
$feedback_not_allowed_message = 'Feedback has been disabled for this page'
unless defined $feedback_not_allowed_message;
#
# ---------------------------------------------
# Use $disqus::comments and $disqus::comment_count in your story template.
# Use $disqus::footer in your footer template.
use vars qw{ $footer $comments $comment_count };
sub start {
1;
}
sub story {
my ($pkg, $path, $filename, $story_ref, $title_ref, $body_ref) = @_;
my $feedback_allowed = 1;
$feedback_allowed = 0
if (defined $meta::allowfeedback && $meta::allowfeedback =~ /^n/i);
if ($pagetype::pagetype eq 'story') {
$comment_count ="";
if ($feedback_allowed) {
$comments = <<COMMENTS_THREAD;
<div id="disqus_thread"></div>
<script type="text/javascript" src="http://disqus.com/forums/$disqus_username/embed.js"></script>
<noscript><a href="http://disqus.com/forums/$disqus_username/?url=ref">View the discussion thread.</a></noscript>
COMMENTS_THREAD
}
else {
$comments = $feedback_not_allowed_message;
}
}
else {
$comments = "";
$comment_count = "";
if ($feedback_allowed) {
$comment_count = "$permalink::story#disqus_thread";
}
};
1;
}
sub foot {
my ($pkg, $dir, $head_ref) = @_;
$footer = <<FOOTER_END;
<script type="text/javascript">
//<![CDATA[
(function() {
var links = document.getElementsByTagName('a');
var query = '?';
for(var i = 0; i < links.length; i++) {
if(links[i].href.indexOf('#disqus_thread') >= 0) {
query += 'url' + i + '=' + encodeURIComponent(links[i].href) + '&';
}
}
document.write('<script charset="utf-8" type="text/javascript" src="http://disqus.com/forums/$disqus_username/get_num_replies.js' + query + '"></' + 'script>');
})();
//]]>
</script>
FOOTER_END
if ($pagetype::pagetype eq 'story') {
$footer = "";
}
1;
}
1;
=head1 NAME
Blosxom Plug-in: disqus
=head1 SYNOPSIS
Integrates the comment and trackback service provided by Disqus
(http://disqus.com/) into blosxom.
Requires the permalink and pagetype plugins and knows how to work with the meta
plugin if it is installed.
=head1 INSTALLATION
Fill in the configurable variables according to the instructions and
put the file in your plugin directory (just like any other plugin).
If you whish to use the meta plugin together with this one make sure
that the it is run before this one (renaming meta to 00meta and this
one to 99disqus does the trick --read the bloxsom plugin documentation
if you require further assistance).
You need to have the permalink plugin installed for this one to work and it must
run before this one does. You can use the same scheme as defined for the meta
plugin to that effect.
You also need to have the pagetype plugin installed and have it run before
this one, just like the permalink plugin above.
=head1 CONFIGURATION
Fill in the variables in the Configurable varables section of this file
according with the descriptions (which should hopefully be self-explanatory)
and if you have any doubts check out the usage section bellow.
=head1 USAGE
After having set up an account on Disqus and filled in all the variables to
be configured at the top of this plugin, just put the $disqus::footer in your
foot flavour template, near the end.
Then, on your story flavour template, drop the $disqus::comment_count and
$disqus::comments variables wherever you want them to appear and that's it!
Feedback (both comments and trackbacks) is enabled by default for all stories.
Should you wish to control this behaviour, you can do so on a story-by-story
basis using the meta plugin and assigning the meta-variable
meta-allowfeedback as exemplified below:
----------
My great story's name
meta-allowfeedback: no
This is a really interesting story...
----------
Any value you assign to this variable starting with the letter n turns it off
and anything else (including not setting the variable at all) turns it on.
=head1 BUGS
Bug reports and comments may be sent to nuno@nunonunes.org.
=head1 CHANGELOG
2011-03-21 - Fixed some typos and bugs that were helpfully pointed out by
Christian G. Warden.
2010-01-05 - First implementation.
=head1 AUTHOR
Nuno Nunes <http://nunonunes.org/>
=head1 LICENSE
This Disqus Plug-in
Copyright 2010, Nuno Nunes
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
This post is just a quick heads-up (and a test actually) for the fact that I’ve switched the comment-handling system on this site again.
This time not because of spam, but because my previous “provider” —Haloscan— is going for a paid service and I’ve always used it for free and I can’t even remotely begin to justify paying for this functionality on this site. There are other reasons for switching, but this was the one that made me jump to attention and just do it.
Therefore, as you may notice, this site’s comments are now handled by the Disqus system.
Due to the nature of the writing here (more of a record of my findings, thoughts, etc,) I’m not overly concerned with losing the old comments with this transition (after all I have gone down this road before and I could never bring the previous comments along on the two or three migrations that this site has undergone anyway), but I will in time look into the possibility of importing the old comments into the new system.
That is all, the irregular programming will now continue as scheduled.