My 404s Don't code and drive

About

Helping PCL find Eigen when using Homebrew

Most of the time when compiling a Point Cloud Library application one sometimes gets compile errors like

fatal error: 'Eigen/Core' file not found

For Mac owners using Homebrew this due to there being no Eigen directory in /usr/local/include. Instead one has to some CMake magic to find the directories. It is a bit easier to create a symbolic link in the include directory, like this, for Eigen version 3.2.7,

ln -s /usr/local/Cellar/eigen/3.2.7/include/eigen3/Eigen /usr/local/include/Eigen

Brew Commands for Checking Dependencies

To check which dependencies a particular formula has write

 brew deps opencv
 >> ant atk autoconf automake bison boost...

Here it will show all dependencies recursively.

To check which formulas is dependent on a particular formula

brew uses --installed boost
>> boost-python homebrew/science/pcl homebrew/science/vtk...

Converting a Numpy One-Dimensional Array to Two Dimensions

Lets say we have created a 1-dimensional array in Python using numpy, that is,

import numpy as np
x = np.array([1,2,3])
print x.shape
>> (3,)

This array is one-dimensional and wow we want to convert that array into a two-dimensional object. To do it we can do either

x.shape = (1,-1)

or

x = x.reshape(1,-1)

If we want to transpose it at the same time we just flip -1 and 1,

x = x.reshape(-1,1)

PIP Upgrade all packages command

To upgrade all packages installed via PIP you have to reinstall them. I found a command on Stack Overflow that does this neatly.

pip freeze --local | grep -v '^\-e' | cut -d = -f 1  | xargs -n1 pip install -U

Runtime error when sshing from OSX to Ubuntu

Note to self. When ssh:ing from a Mac to Ubuntu and you get the following error

terminate called after throwing an instance of ‘std::runtime_error’ what(): locale::facet::_S_create_c_locale name not valid Aborted

This means that there is a problem with the character encoding on your Mac terminal or in the communication with the Ubuntu machine. Can’t really figure it out. But what does fix the problem is to edit your .bashrc file and add the following lines at the end

export LC_ALL="en_US.UTF-8"

This sets all locale variables to en_US.UTF-8 and somehow fixes the miscommunication error between the Mac terminal and Ubuntu. No more runtime errors…