conroyfilter.module

[[wysiwyg_imageupload:17:]]

Seeing as the Australian governments proposed mandatory internet filter will filter all traffic on port 80, I thought it 

would be helpful to provide a Drupal module that allows you to automagically provide an alternate link to each page on a site.

Your web server should be configured to serve content on a 2nd port, beside port 80, so as to not interfere with browsing requests from users outside of Australia.

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.