Top 10 reasons to hate top 10 lists

  1. They are everywhere and they are annoying. Surely? Surely someone else is annoyed by them? Ahhh lovely internet, 5,140 hits for “top 10 lists suck”.
  2. It’s depressing that humanity’s attention span is now so short that most article writers seem to have to bribe people with the promise of there only being 10 sentences for them to have to read. So much brevity in their writing makes it, well, even more tasteless and trite than normal.
  3. It’s destroying the sexiness of numbers. And numbered lists. <ol> is nearly ruined for me.
  4. They’re nearly always subjective opinions given as the gospel truth, and goodness knows how many impressionable young minds there are out there scurrying around clicking on them. Think of the children, people!
  5. I usually get bored at number 5. This is sad because I only ever bother reading them when I’m bored in the hope that they’ll make me slightly less bored. It’s a sort of sadistic spiral of brief optimism, even briefer interest, a flare of irritation, a moment of distraction where I try to count the typos, and then I sink into an even deeper pit of boredom.
  6. Based on this I’m going to guess that most people don’t bother reading any further than 6.
  7. What do you think it is about cats that makes them like to sit in flower pots?
  8. Cat in pot
  9. Yeah, she’s got the right idea. Find your flowerpot, sit in it, and then don’t move for anyone, that’s my advice to all you avid readers of top 10 lists dissing top 10 lists. And no, there isn’t actually going to be a #10.

The evolution of the painted cat

To paint a cat, you can’t just reproduce its image – for some reason ceramic seems to lack the gravitas of paper. You try to paint a cat realistically and you get something offensive to cats – a generic image that says ‘painted cat’. To paint a cat on ceramics, then, and not insult all felinity, you have to capture its essence. And the essence of a cat is personality.

More prosaically, the other thing to keep in mind when painting a cat on a bowl or a plate or any ceramic item is proportion. It has to really claim the space (if it’s an open surface) or compliment the form (if it’s a closed or cylindrical surface). Because every painted mark is permanent, it’s quite easy to get this part wrong!

Otherwise, all you need is a paintbrush, some oxide or underglaze and a fondness for cats.

Here is where there should be a photo gallery of painted cats, showing a range of more- and less-successful efforts. But all I have to offer are the following two images:

This cat knows how to pose for a photograph, but the photographer has left a lot of white space…

Also, the glaze is too thin, so the end result is a bit watered-down looking. Will have to have another go at this one. It needs to be bolder and the blue needs to be richer to do justice to this noble looking specimen (he looks just like Vladimir Nabokov’s father – I refer only to his expression, of course!).

I like this bowl quite a lot. This cat has found a comfortable spot to curl up, and is trying her best to be inconspicuous, but those stripes are pretty strong! I bet she’s a great mouser.

WordPress 3.3

This blog has recently been updated from WordPress 1.something to 3.3. I’ve got to say, the new WordPress interface really is lovely, makes me realise why so many people complain when they move from WordPress to Joomla or Drupal. Besides looking stylish it’s also very well organised, and I think that being able to install plugins in 1 click is a massive bonus, as is the ‘autosave’ function.

And I’m very impressed by the default 2011 theme which I’m using. I feel a bit uneasy about the MASSIVE amount of whitespace up near the header, plus the huge header image – I guess above-the-fold space no longer is the precious commodity it once was. It’s a responsive design though, so at least it degrades nicely for smaller screens.

To celebrate, here is a  cat attacking a paper bag:

South African Banks & Standard Bank

Dilbert.com

I really miss my bank in the UK. Sure they hassled me about keeping my address up to date and changing my local bank branch, but they were really good at fraud prevention and their services, in retrospect, were fantastic. The interest on my current account might not have been great, but at least it was there.

In South Africa, banks charge you for depositing money in your account and they charge you for withdrawing money from your account. They charge you for leaving money in your account and not doing anything to it and they charge you for telephone banking. They charge you for writing a cheque and they charge you for checking your balance. They charge you for internet banking. They charge you even more if you use an ATM which doesn’t belong to your bank (and honestly, the ATMs are often out of order). They don’t do anything so pernicious as giving you interest for the money you give them (current account) – no, getting your money is them doing you a favour, and they’ll make damn sure they charge you through the nose for it. Continue reading

Underwater pictures with DiCAPac

2010-10-10-P1020600
I’m pretty impressed with the DiCAPac underwater camera case – considering how cheap it is the quality of pictures are great. As the reviews on amazon say, it does take a bit of fiddling to get the lens in the case aligned properly, and some of my pictures ended up having the case lens protector in them – I kinda like the effect though. I experimented a little bit in one of the lakes in the mountain and I’m quite excited about it. I really want to try it snorkelling in sea water now.

Drupal views subqueries

I was using a views_handler_filter in order to add a subquery to a where clause, like so:

/* IN solution */
SELECT DISTINCT(node_revisions.vid) AS vid,
node.nid AS node_nid,
node.type AS node_type,
node.status AS node_status,
FROM node_revisions node_revisions
LEFT JOIN node node ON node_revisions.nid = node.nid
WHERE
node_revisions.vid in
(SELECT MAX(node_revisions.vid) FROM node_revisions GROUP BY node_revisions.nid)

But this is terribly slow. It’s got something to do with using ‘in’. I couldn’t work out how to successfully rewrite the query using ‘exists’, so I rewrote it as a left join like this:


/* LEFT JOIN solution */
SELECT DISTINCT(node_revisions.vid) AS vid,
node.nid AS node_nid,
node.type AS node_type,
node.status AS node_status,
FROM node_revisions node_revisions
LEFT JOIN ( SELECT max(nr.vid) as vid FROM node_revisions nr GROUP BY nr.nid ) nr ON nr.vid = node_revisions.vid
LEFT JOIN node node ON node_revisions.nid = node.nid
WHERE
nr.vid is not null

With the SQL fixed and running smoothly (I am still not sure why using ‘IN’ was such a big issue for mysql), I needed to edit the query somehow, and I wasn’t going to bother doing it with filter handlers. I could have used (http://drupal.org/node/1065554) hook_views_pre_execute(&$view), but I decided to use hook_views_query_alter(), like this:


/**
* Implementation of hook_views_query_alter().
*/
function workflow_views_query_alter(&$view, &$query) {
if($view->name != 'my_content')
return;

$subquery = '(SELECT max(nr.vid) as vid FROM node_revisions nr GROUP BY nr.nid )';
$join = new views_join('node_revisions', 'node_revisions', 'vid', 'vid');
$join->definition = array('table' => $subquery, 'left_field' => 'vid', 'field' => 'vid', 'left_table' => 'node_revisions');
$join->extra_type = 'AND';
$join->table = $subquery;
$join->left_field = 'node_revisions.vid';
$join->field = 'vid';
$join->type = 'LEFT';
$join->adjusted = true;
$query->table_queue['nr'] = array(
'table' => $subquery,
'alias' => 'nr',
'num' => 1,
'join' => $join,
'relationship' => 'node_revisions');
$query->where[2] = array( // Note: do print_r($query) here to find out where to place your where
'clauses' => array('nr.vid is not null'),
'args' => array(),
'type' => 'AND');
}

Drupal menu admin ‘admin/build/menu-customize’ with menu items collapsed

If you’re managing a lot of menu items it can get confusing (in the Drupal 6 interface at least) to see move things around. What would be good is if they were indented or collapsible. There’s a request for it floating about but it doesn’t seem to have generated that much interest. I’ve written a quick javascript solution for it which isn’t all that fast if you have lots of items, but it works for me. Something nicer is probably possible to do with the theme_menu_overview_form (modules/menu/menu.admin.inc), but I haven’t got the time at this point to investigate it further. See this thread http://drupal.org/node/521546#comment-4947478.

You need to add the javascript to your administration theme using the .info file, and substitute your theme name in the code where necessary.


Drupal.behaviors.sanbi_administration = function(context) {
$('#menu-overview tr').click( function() {
$indentationcount = $(this).find('.indentation').length;
if($(this).next().find('.indentation').length > $indentationcount) {
$show = false;
if($(this).hasClass('highlight'))
$show = true;

$(this).toggleClass('highlight');
recursiveHiding($(this).next(), $indentationcount, $show)
}
});

// Walk through table and hide rows which are more greatly indented than the row which was clicked
function recursiveHiding(element, $count, $show) {
if($(element).find('.indentation').length > $count) {
// Remove the highlight class for anything within the hierarchy
$(element).removeClass('highlight');
if($show)
$(element).show();
else
$(element).hide();
if($(element).next().length != 0)
recursiveHiding($(element).next(), $count, $show);
}
}
}

Because I am also adding a lot of custom javascript to certain pages for my administration theme, I actually included it only for the primary links menu like this:


/**
* Implementation of HOOK_preprocess_page().
*/
function mythemename_preprocess_page(&$vars) {
if (module_exists('path')) {
$path = drupal_get_path_alias($_GET['q']);
if($path == 'admin/build/menu-customize/primary-links') {
$vars['scripts'] .= '';
}
}

... Other stuff here...