MySQL update/write query analysis (query profiling)

Do you have a slow MySQL update/insert/delete query?

Obviously, for ‘SELECT’ queries you can prepend the query with “EXPLAIN ” – however that doesn’t work for the other query types (UPDATE/INSERT/DELETE).

So, one solution which may explain why the query is slow is to turn on MySQL’s profiling functionality, like in the following example :
Continue reading “MySQL update/write query analysis (query profiling)”

Migrating an ext3 filesystem to ext4 (Debian Squeeze)

Interestingly (well, perhaps not really) this is very easy.

In my case, I’m hoping that the migration will lead to faster fsck times (currently it’s taking about an hour, which is somewhat excessive, each time the server crashes for whatever reason).

In my case, the filesystem is /dev/md0 and mounted at /home – change the bits below as appropriate.
Continue reading “Migrating an ext3 filesystem to ext4 (Debian Squeeze)”

Debian Squeeze (NFS broken with backports kernel)

Our office server has been running the Squeeze-Backports kernel for some time – without issue – until today. Amongst the things it ‘should’ do, is act as an NFS server for the office computers (giving us a common /home directory).

Every so often, NFS breaks for some reason. Perhaps in some way, the NFS server feels a need to keep a hold over me.
Continue reading “Debian Squeeze (NFS broken with backports kernel)”

Wanted: Developer with interesting skills…. oh, and it’s for the minimum wage… (Is this a joke?)

Recently on the Twitter the following (attached) image came up – presumably legit, of a job advert. Highlights below. It’s almost like someone cut and pasted two job postings together. The phone number does appear to be legit … so perhaps the advert itself is?

Continue reading “Wanted: Developer with interesting skills…. oh, and it’s for the minimum wage… (Is this a joke?)”

Weird Akismet behaviour with WordPress (incorrect spam identification)

One of my customers uses Akismet to protect his various blogs from the masses of spam.

Oddly torwards the end of last week, Akismet started to identify everything as spam, with no error message being returned on check of spam, and the admin dashboard showing the api key/akismet were happy.

I initially thought that perhaps Akismet was just having a bad day, and the problem would go away in a few hours/days time – but this hasn’t been the case. So today, I added in a WordPress plugin to debug the HTTP calls to Akismet to see if that would help identify the problem.

 

add_action( 'http_api_debug', '_custom_http_api_debug', 10, 5 );

function _custom_http_api_debug( $response, $type, $class, $args, $url ) {    
    error_log( 'Request URL: ' . var_export( $url, true ) );
    error_log( 'Request Args: ' . var_export( $args, true ) );
    error_log( 'Request Response : ' . var_export( $response, true ) );
}

 

i.e. for a message which was known to be spam :

However, what gave me an idea that something was amiss is that if an administrator attempted to mark an incorrectly tagged comment as ham, the following was seen –

  • Post to http://xxxxx.rest.akismet.com/1.1/submit-ham
  • Response body of ‘Invalid Key’
Normally when submitting ham to the above URL you’d see a response like :
However wordpress was not displaying an error message to the administrator.
Changing the Akismet API keys involved on the sites appeared to fix the problem(s).

 

Rubbish CV from recruitment company (rant/moan)

Today I received a programmer’s CV from a random recruiter…

Under experience, the most recent entry has a URL provided which points to a login form.  From which I can tell nothing. So, that’s pointless/useless and illustrates nothing.

The second entry under experience points to a Zend framework based site – “I have designed and developed xxxxxxxx.co.uk. It is a website designed to enable small scale producers to sell directly to the public. The website uses ZF / MySQL / Javascript / jQuery / Ajax and CSS/CSS3”.

Well, he’s scored OK on buzzword bingo from the above.

*Clicks on link*.

*Oh, WTF?*

The site turns out to be :

  • Frames based
  • Contain no real content (clicking on links calls a ‘submitForm(“rah”)’ JS function…. )
  • Be missing error handling (e.g. trying http://sillysite/rah/rah/rah/rah -> PHP exception trace)
  • Clearly based on a quick start tutorial (view -> source etc) due to commented out code embedded within
  • Contain horrible Javascript (worse than mine) (clearly this guy doesn’t actually know how to use jQuery)

From the domain name I can at least discover who the CV belongs to; that seems to be the only benefit of it. But now I know to avoid him.

Oh, and did I mention how under ‘Main Skills’ Dropbox is listed.

So, no, sorry… I don’t think I’ll consider hiring you for ~30k+.

Stupid NFS (Debian Squeeze / Ubuntu Precise)

NFS really can be a major PITA. Our office network has been breaking all day.

This seemed to coincide with moving more of our computers to gigabit ethernet (removing the 100mbit CISCO 7960 phones which their network had been daisy-chained through – and seemed to cause intermittent packet loss)

Here are some tips for others unfortunate enough to use it with Debian Squeeze or Ubuntu Precise (12.04 LTS).

  1. On Ubuntu NFS clients, you’ll probably want to use proto=tcp and specify a clientaddr=in the mount options (see the below fstab example). This is especially true if you’ve not got entries for the clients within your local DNS server. If you see ‘clientaddr=0.0.0.0’ and DNS resolution for your clients isn’t working, NFS will not work.
  2. Don’t try using the nfs-kernel-server from squeeze-backports – as for some reason this causes portmap to be uninstalled, which (in my case) stops NIS from working.
  3. Ensure you increase the number of NFS server processes – see /etc/default/nfs-kernel-server (on the server node).
orange:/home /home nfs4 defaults,noatime,proto=tcp,clientaddr=172.30.33.250 0 0