fix flaky test EXPECT_EQ code, using EXPECT_FLOAT_NEAR per Jeff
fix flaky math functions, remove unnecessary instantiations.
Merge pull request #1264 from Yangqing/dev

Clean flaky code
Refactored leveldb and lmdb code.
Some tool updates that I forgot.
Some cleanup to make travis happy.
Updated interface to make fewer string copies.
Don't autocommit on close for the databases.  If they were read-only, then they might fail.
data layer test was relying on the autocommit on close db behavior that was recently removed.
Updated cifar10 build script to specify db backend.
Switched create_cifar10.sh output from leveldb to lmdb.
Updated extract_features to take a leveldb/lmdb config option.
Updated Database interface to use custom KV type rather than std::pair.  Removed two buffer copies in dereference operation for DB iterators.
Added a couple of sanity checks to make sure the datum buffer sizes matched what we expected.
Added get interface to Database.  Added test cases for Database.  Fixed a few bugs related to ReadOnly mode in Database in order to pass test cases.
Added some tests for the Database iterator interface.  Updated the post-increment operator so that it forks off a copy of the LevelDB or LMDB iterator/cursor when necessary.  Neither of these APIs allow you to directly copy an iterator or cursor, so I create a new iterator and seek to the key that the previous one was currently on.  This means the pre-increment operator can be much cheaper than the post-increment operator.
Updated Database interface so that rather than CHECKing for certain conditions inside open, put, get, and commit, these functions return a bool indicating whether or not the operation was successful or a failure.  This means the caller is now responsible for error checking.
Updated Database interface to take key and value by const reference for put and key by const reference for put.  Additional copies are made for get and put in the LMDB implementation.
The LevelDB iterator/DB deallocation order bug is pretty much fixed by having each iterator hold a shared pointer to the DB.  I manually specified a deconstructor for the LeveldbState to make it clear what order these two things need to be deallocated in.
Changed Database::buffer_t to Database::key_type and Database::value_type