AJAX in Components in Joomla

During a conversation at JUG London I was asked about the easy of building AJAX into a component and was asked whether the right way to do it was via com_ajax.

Retrieving a database query in Joomla

Something that was mentioned several times at Joomla Day UK 2013 was the desire to be able to dump out the database query in a format that you can copy and paste straight into phpMyAdmin (or similar). In fact such a function already exists in the Joomla Database library called replacePrefix. This is about how to use it.