Lock the mex file to avoid Matlab crashes.

Commands like "clear all" and "clear function" causes segmentation faults or errors like these (especially after an 'init'):
 libprotobuf ERROR google/protobuf/descriptor_database.cc:57] File already exists in database: caffe/proto/caffe.proto
 libprotobuf FATAL google/protobuf/descriptor.cc:862] CHECK failed: generated_database_->Add(encoded_file_descriptor, size):
 [libprotobuf ERROR google/protobuf/message.cc:333] Type appears to be in generated pool but wasn't registered: caffe.LayerParameter
 Attempt to restart MATLAB?
To avoid these, lock the the mex file.
[pycaffe] use class names of the form Py* instead of Caffe*
[pycaffe] live in caffe namespace instead of opening it
[pycaffe] use a namespace alias instead of using directives for boost::python
[pycaffe] make PyNet a class, not a struct
[pycaffe] make PyBlob a template over Dtype

We will not actually support double nets in Python with this commit, but
this change will be necessary to create layers that embed Python.
[pycaffe] split _caffe into source and header files

This brings pycaffe more in line with usual C++ style, and will allow
the wrapper classes to be used within caffe when embedding Python.
[pycaffe] declare the _caffe module init function
[pycaffe] remove name property from PyBlob and PyLayer

Attaching names to pycaffe Blobs and Layers isn't necessary anymore,
since they are now accessed by name. This change brings PyBlob and
PyLayer closer to their C++ counterparts, and makes it easier to pass
around blobs without knowing their names, e.g., when embedding Python
in a layer.
[pycaffe] expose Blob.Reshape

While this function should never be called in the current interface, it
will be necessary to have when embedding Python.
mnist demo now works with lmdb and leveldb (set parameter in create_mnist.sh), switched around includes
data now written to backend in batches
minor changes to variable names and error messages + set default backed in convert_mnist_data.cpp to lmdb
updated lenet_train_test.prototxt + minor correction to create_mnist.sh
parse_log.sh adapted to new training log format + fixed typos and updated description
Merge pull request #1015 from mohomran/fixing_parse_log_script

fix for tools/extra/parse_log.sh
Merge pull request #1008 from mohomran/mnist_with_lmdb

convert MNIST demo to lmdb, fixes
Merge pull request #1014 from longjon/cleaner-pycaffe

Clean up pycaffe core
include comment on CPU mode fine-tuning for Flickr example
make no GPU error in CPU-only mode a little clearer