Category: Blogs etc.

 | Blogs etc. | 0 Comments

Here's the best way to get a random blog entry from the movable type database:


SELECT entry_basename, entry_week_number
FROM `mt_entry` 
WHERE entry_id >= ( 
SELECT FLOOR( MAX( entry_id ) * RAND( ) ) 
FROM `mt_entry` ) 
ORDER BY entry_id
LIMIT 1 ;

 | Blogs etc. | 0 Comments

As you can see I finally found time in the weekend to upgrade my blog to the latest version of Movable Type. I also decided to enable comments again, so feel free to click on the link and leave a message.

I also now automatically redirect the visitor from the old-fashioned blog to this one, so if you try and go to www.kiffinsblog.com you will end up here at www.kiffingish.com/blog. In the meantime I'll gradually migrate the fancy design stuff from the old site over to here in order to make it more personal and Kiffin-like.

Now I have to do my other more important chores for the day: repair the patio sliding door, oil the kitchen faucet, and fix the shower (after two minutes there is no more hot water).

 | Blogs etc. | 0 Comments

On Friday, October 19, 2007 at 14:33:01 (CEST)
the hit-count for Kiffin's Blog is: 300000.

 | Perl | 0 Comments

For many many months now, the random link at the top of this page just below the banner hasn't been working. I decided to fix it once and for all.

First of all I redefined the link to refer to a new CGI script mt_random.pl which I wrote myself using good old Perl. Here is how the new link is defined:

<a href="/cgi-bin/mt_random.pl?blog_id=1" title="Jump to a completely random place on this blog...">Random</a>

Of course the whole random magic of the situation is the Perl script mt_random.pl itself, which looks like this:

#!/usr/bin/perl -w
use DBI;
use CGI;
use strict;

my $q = new CGI;

my $format_url = "http://www.kiffinsblog.com/archives/%d/%0.2d/%s.html";

my $hostname = 'localhost';
my $database_name = 'db_name';
my $user = 'db_usr';
my $password = 'db_password';

my $dsn = "dbi:mysql:database=$database_name;host=$hostname";

my $blog_id = $q->param('blog_id') || 1;

my $dbh = DBI->connect($dsn, $user, $password) or die "Can't connect to $dsn: $DBI::errstr";

my $sql = <<EOF;
SELECT
  entry_basename,
  entry_title,
  date_format( entry_created_on, '%Y' ) AS entry_year,
  date_format( entry_created_on, '%m' ) AS entry_month
FROM
  mt_entry,
  mt_author
WHERE
  entry_blog_id = $blog_id
AND
  entry_status = 2
AND
  author_id = entry_author_id
ORDER BY rand( )
LIMIT 1
EOF

my $sth = $dbh->prepare($sql);
$sth->execute();

my $ref = $sth->fetchrow_hashref;

print $q->redirect(sprintf($format_url, $ref->{entry_year}, $ref->{entry_month}, $ref->{entry_basename}));

You can now try it out yourself by clicking on the link above, and if you cannot find it then clicking here.

Pretty amazingly magical don't you think?

 | Blogs etc. | 0 Comments

Decided to get rid of that boring Les Pays Bas windmill picture on the left margin and replace it with a more appropriate photograph of the wonderful Dutch landscape within a ten minute walk from my house. I feel confident that this is a definite improvement, don't you think?

 | Blogs etc. | 0 Comments

In order to encourage better people leaving comments on my blog, I figured I should try to enable this blog's option to allow mail from anyone.

Unfortunately within a day I received no less than thirty-five spam comments. Now it's back to the original setting where only so-called registered users can leave comments, sorry.

This should not be a problem for those really keen on adding comments now and then, as all you have to do is click on the sign-in link.

 | Blogs etc. | 0 Comments | 0 TrackBacks

I never believed it would ever be possible until much to my pleasant surprise I received the following email notification from my blog server:

On Monday, October 16, 2006 at 13:09:30 (CEST)
the hit-count for Kiffin's Blog is: 100000.

Please note that this value only includes 'unique' visitors to my blog, thus not including repeat offenders he keep on coming back for more.

Not bad after all these years of blogging, I would say.

 | Blogs etc. | 0 Comments | 0 TrackBacks

On Monday, August 28, 2006 at 02:20:22 (CEST)
the hit-count for Kiffin's Blog is: 90000.

Only ten thousand to go.

 | Blogs etc. | 0 Comments | 0 TrackBacks

Successfully upgraded my blog to Movable Type 3.31 without a single hitch.

Was a little worried and postponed it several weeks just in case, but now I am glad I installed the newest version.

 | Blogs etc. | 0 Comments | 0 TrackBacks

While waiting for the train to arrive, I was gazing off into the nothingness in front of me and all of a sudden a great idea for a blog entry popped into my mind. Oh I cannot wait to write that in my blog.

Since it was such a really compelling concept, I figured that there would be no reason to write it down since I would not could not forget it no way.

Unfortunately, that was yesterday and now I cannot remember what it was anymore, kind of like a recent dream which just after you awake slowly but surely fades away forever, particles of sand rushing between your fingers.

Oh well, better luck next time.

Recent Assets