Content server: Fix blank username causing error on startup

Fixes #1215893 [attempted to start server and recieved an error](https://bugs.launchpad.net/calibre/+bug/1215893)
newdb: Fix dump and restore on non-ascii locales

Fix a bug in the new backend that broke the Check Library function on computers
with non-English locales. Fixes #1215819 [version 1.0 vérification de la bibliothèque](https://bugs.launchpad.net/calibre/+bug/1215819)

Upstream bug: https://code.google.com/p/apsw/issues/detail?id=142
Fix (I think) for bug #1215885 - refresh rows when convert finishes so composites can update.
Merge branch 'kovidgoyal/master'
Update formats composite column in GUI when conversion finishes

Ensure that the Formats custom column (if present) is updated when a new
format is created as a result of a conversion. Fixes #1215885 [calibre 0.9: strange display behavior for formats](https://bugs.launchpad.net/calibre/+bug/1215885)

Merge branch 'master' of https://github.com/cbhaley/calibre
pep8
dump and restore: retry after some time if rename fails
Increase the max sleep time
OEB Reader: Properly serialize OPF using utf-8 when reading metadata

HTML Input: Handle malformed OPF files when converting.  Fixes #1215924 [Mobipocket conversion fail with error TypeError: Invalid input object: NoneType](https://bugs.launchpad.net/calibre/+bug/1215924)

When reading metadata from OPF files during conversion, the OPF was
serialized in ascii with no encoding declaration which could break for
some bad OPF files.
Details on how to add formats to an existing book
PocketBook driver: Scan for books files in the entire device not just in the 'books' folder
newdb: Allow sorting on ids

Fix regression that broke calibredb catalog when sorting on the id
field. Fixes #1216090 [calibredb catalog fails on sort_key - KeyError: 'id'](https://bugs.launchpad.net/calibre/+bug/1216090)
newdb: Handle damaged one-one text tables

Ignore text records in the database that are damaged, instead of erroring
out. Lets the rest of the data be used. Fixes #1215981 [calibre 1.0 can't find database](https://bugs.launchpad.net/calibre/+bug/1215981)
Replace instead of ignoring
Use pysqlite for db re-init as apsw cannot discard problem statements

Also move the atomic_rename retry logic into atomic_rename itself,
making it simpler.
Fix duplicated sections in PDF user manual

Fixes #1215799 [double-sized calibre manual in pdf version](https://bugs.launchpad.net/calibre/+bug/1215799)
VL tabs: Change name of all books tab when hidden VL is activated

Virtual Library tabs: If the user activates a hidden tab via the Virtual
Library button, change the name of the All Books tab to reflect the
hidden virtual library. Fixes #1216174 [Wrong VL tab activitad when the right one is hidden](https://bugs.launchpad.net/calibre/+bug/1216174)
pep8
newdb: Fix tweak to sort dates by visible fields not being respected
newdb: Fix bools_are_tristate preference not being respected when sorting