Public Violence^W^WSport

Watching the news this evening we inadvisably didn't skip past the sports news. So we were treated to a montage of so-called sports people punching and elbowing each other on the field.

[[wysiwyg_imageupload:7:]]

The footage was somewhat reminiscent of the CCTV footage that is sometimes shown on the news after there has been a fight or bashing at a pub or club.

A major difference though, is that news of a bashing at a pub or club is usually followed with details of someone being arrested and some time later of them being convicted and going to jail.

fast paging in the real world

Some time ago I attended the "Optimisation by Design" course from Open Query¹. In it, Arjen teaches how writing better queries and schemas can make your database access much faster (and more reliable). One such way of optimising things is by adding appropriate query hints or flags. These hints are magic strings that control how a server executes a query or how it returns results.

An example of such a hint is SQL_CALC_FOUND_ROWS. You use it in a select query with a LIMIT clause. It instructs the server to select a limited numbers of rows, but also to calculate the total number of rows that would have been returned without the limit clause in place. That total number of rows is stored in a session variable, which can be retrieved via SELECT FOUND_ROWS();  That simply reads the variable and clears it on the server, it doesn't actually have to look at any table or index data, so it's very fast.

This is useful when queries are used to generate pages of data where a user can click a specific page number or click previous/next page. In this case you need the total number of rows to determine how many pages you need to generate links for.

The traditional way is to first run a SELECT COUNT(*) query and then select the rows you want, with LIMIT. If you don't use a WHERE clause in your query, this can be pretty fast on MyISAM, as it has a magic variable that contains the number of rows in a table. On InnoDB however, which is my storage engine of choice, there is no such variable and consequently it's not pretty fast.

My Eep

I spent last week in San Francisco, attending DrupalCon. Like many geeks, I prefer to have a laptop with me at conferences, so I can take notes, check email and work on stuff if I need or want to.

My laptop is a rather lovely HP 6730b with a lot of RAM that does a whopping 1680 x 1050 as native resolution. Great for graphics and having lots of terminals open - less great for portability. HP also seems to have taken the 12 cell add-on battery for it off the market, so it only gives me about 2½ to 3 hours of run-time (with wi-fi enabled) as well.

Asus Eeepc 1005PAt DrupalCon I developed netbook envy, so upon arriving home I decided I needed something a lot more portable and with far better battery life.

I did a bit of research and found that all manufacturers offer virtually identically spec'd netbooks that contain an Atom N450, 1GB RAM, 250GB HDD and a 10.1" screen. The only point of difference seems to be the battery size, which ranges from 3 cell to 6 cell Li-ion.

A friend told me he'd just bought an Eeepc 1005P for just over $400, which is actually much cheaper than the competition. Sadly that was with a 10% discount campaign, which is no longer running. Still, the 1005P was at least $30 cheaper than the closest competitor and it does come with a 6 cell battery.

Ada Lovelace Day; Women in technology

I was just asked if I was going to write a blog for Ada Lovelace day this year. And yes, yes I am.

Earlier this year I actually met a bunch of really cool women who work in technology jobs!

In no particular order (apart from alphabetically) I'd like to mention Angela Byron, Liz Henry, Emma Jane Hogbin and Brenda Wallace.

When you meet any of them, buy them a $beverage; they deserve it :-)

Userpoints Evaporate 1.0

Well, I finally got a revision 1.0 out the door for one of my Drupal modules.  A fact I thought I'd celebrate with a blog.

The module with this honour is the most recent one I started, userpoints_evaporate, just over a week ago.

I guess it's a nice example of why open source is cool. Someone on the #drupal-support channel on Freenode asked if anyone knew whether an existing module could do what he wanted, which was essentially use the UserPoints module (which works kind of like karma on Launchpad) to automatically expire a set number of points for all users every hour or day (again, kind of like karma on Launchpad).

linux.conf.au miniconf schedules

In the lead up LCA2010 there was some noise on the mailing list about the miniconf schedules. Specifically about where and how miniconf organisers should (be forced to) publish their schedules.

Jacinta Richardson invested a lot of time and effort in aggregating all all disparate schedules and turning them into a single table on the LCA wiki, which made life easy for most attendees. However, that still leaves the questions of schedule changes and updates.

Simplenews Mass Subscribe

Simplenews is a quick and easy way to set up and manage newsletters on Drupal, but if you add it to a site which already has users, you might want a way to quickly subscribe all your users to your newsletter.

Rather than click through all users and manually subscribe them - which can be a little bit boring if you have thousands of users - you can run a few SQL queries to mass-subscribe everyone in one go.

MySQL > YourSQL

Since I started doing the occasional consulting job for Open Query, I've seen a lot of MySQL servers that have been installed once and then forgotten about. This gave me the idea to do a short presentation about some basic MySQL server configuration. The first go was at DrupalCampMelbourne and I recently tried (and failed) to cram it into a three minute lightning talk slot at the LUV September meeting.

The title of the talk is (now) MySQL > YourSQL. I chose this not because I think that MySQL is better than the $other_database you use or because I may or may not run a newer version of MySQL on better hardware, but because I use InnoDB and not MyISAM as the default table format. More importantly, I do not run the server with the shipped default configuration.

These configuration tips are also included in the MySQL section of Pro Linux System Administration.

Most distributions ship MySQL with a configuration file that sees you running a server optimised for a system with 32MB of RAM. That was great in 1996, but these days your Nike+ shoes have more capacity than that, so it makes sense to optimise the configuration - or at least to make it not suck quite as badly.

I chose InnoDB as the default storage engine not because it gives me a magic increase in performance or transaction support, but due to the  improved reliability that comes from its ability to automatically recover from crashes better than MyISAM does.

All the following settings go in the [mysqld] section of your my.cnf file.

Storage miniconf at linux.conf.au 2010

Since you were going to linux.conf.au 2010 in Wellington, NZ anyway in January of next year, you should submit a proposal to speak at the data storage and retrieval miniconf.

If you have something to say about storage hardware, file systems, raid, lvm, databases or anything else linux or open source and storage related, please submit early and submit often!

The call for proposals is open until September 28.