Saturday, February 28, 2015

Compiling VTK 5.8.0 on Windows 64 with Visual Studio 2013

This is a quick post to cover the steps necessary to compile VTK 5.8.0, the most stable VTK 5 version in my experience, on Windows x64 with VS 2013 (to support Windows 8.1). The information is on the internet but scattered about so I thought I'd collect it just in case its useful for someone.

EDIT: Note that VTK 5.8.0 builds out of the box on Ubuntu 16.04 still, if you ensure that you uncomment the line with the define for GLX_GLXEXT_LEGACY in the Rendering/vtkXOpenGLRenderWindow.cxx file.

There are a few things that are incompatible with the new compiler. Firstly, the vtkOStreamWrapper error. This is covered in great detail here. Basically replace the offending line with:
//VTKOSTREAM_OPERATOR(ostream&);
vtkOStreamWrapper& vtkOStreamWrapper::operator << (ostream& a) {
    this->ostr << (void *)&a;
    return *this;
}
Then there are the ifstream->read() errors. Replace the
if ( this->IFile->read(result, 80) == 0)
with the
if ( this->IFile->read(result, 80).fail())
Lastly, there are the make_pair errors, solved here. You need to replace the
this->Map->insert(vtkstd::make_pair< vtkVariant, vtkVariant >(from, to));
with
this->Map->insert(vtkstd::make_pair(fromto)); // Addendum
in the vtkMapArrayValues.cxx file. You might need to add the include:
#ifdef _WINDOWS
  #include  // Addendum for vs11 to find 'greater'
#endif
to vtkAdjacencyMatrixToEdgeTable.cxx. I also had to add the above include and 
#include 
to vtkAdjacencyMatrixToEdgeTable.cxx, vtkNormalizeMatrixVectors.cxx, vtkPairwiseExtractHistogram2D.cxx, vtkParallelCoordinatesRepresentation.cxx, vtkChartXY.cxx, vtkControlPointsItem.cxx, to get rid of std max and min errors, 

HTHCheers Shakes - L3mming

Thursday, February 12, 2015

HP 4000b Bluetooth Mouse and Ubuntu

This quick post cover howto get the HP 4000b Bluetooth mouse working flawlessly with Ubuntu 14.10 + (and maybe even older versions). These bluetooth mice are useful for ultra-portable devices that have no or few USB ports, like my Dell XPS 13, keeping the port free for other uses.

The HP 4000b mouse is an affordable bluetooth mouse that does work out of the box with Ubuntu but drops out after use for a few minutes or so. This post covers the solution to this problem that worked for me, and this post helpful for TLP users.

In summary, add the following to your rc.local file (the one I used was /etc/rc.local):
# Prevents the Bluetooth USB card from getting reset which disconnects the mouse
BTUSB_DEV="8087:07dc"
BTUSB_BINDING="$(lsusb -d "$BTUSB_DEV" |
    cut -f 1 -d : |
    sed -e 's,Bus ,,' -e 's, Device ,/,' |
    xargs -I {} udevadm info -q path -n /dev/bus/usb/{} |
    xargs basename)"


echo "Disabling autosuspend for Bluetooth USB Soundcard: $BTUSB_BINDING..."
echo -1 > "/sys/bus/usb/devices/$BTUSB_BINDING/power/autosuspend_delay_ms"
And in the TLP config (/etc/default/tlp), add the USB_BLACKLIST="8087:07da". The ID for my device was 8087:07dc as in the rc.local file. These IDs need to match and can be found using lsusb.

HTH
Cheers Shakes - L3mming