Wednesday, August 27, 2014

Automatically mounting an NTFS partition on Linux

This is the fstab line I'm currently using to mount my NTFS partitions on Linux.

1. Copy the blkid of the partition you want to mount:
sudo blkid

2. Add to /etc/fstab:
UUID= /media/ ntfs-3g defaults,windows_names,uid=1000,gid=1000,umask=022,locale=en_US.utf8 0 0

3. Done!

Using a US layout keyboard to type in PT-BR (Portuguese Brazil) in Xubuntu

Since Xubuntu 14, when using the US layout with dead keys, pressing acute accent (') and then c results in ć instead of the expected ç when writing in PT-BR. There are two solutions for this:
1. Use alt-gr + , (which is inconvenient)
2. Do the workaround below

I can't remember who originally wrote this, I believe it was someone in the Ubuntu bug tracker.

"1) Editing the files:

for 64 bits:
sudo gedit /usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules.cache
sudo gedit /usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules.cache

for 32 bits:
sudo gedit /usr/lib/i386-linux-gnu/gtk-2.0/2.10.0/immodules.cache

changing the line

"cedilla" "Cedilla" "gtk20" "/usr/share/locale" "az:ca:co:fr:gv:oc:pt:sq:tr:wa"

to

"cedilla" "Cedilla" "gtk20" "/usr/share/locale" "az:ca:co:fr:gv:oc:pt:sq:tr:wa:en"

2) replacing "ć" to "ç" and "Ć" to "Ç" on /usr/share/X11/locale/en_US.UTF-8/Compose

sudo cp /usr/share/X11/locale/en_US.UTF-8/Compose /usr/share/X11/locale/en_US.UTF-8/Compose.bak
sed 's/ć/ç/g' < /usr/share/X11/locale/en_US.UTF-8/Compose | sed 's/Ć/Ç/g' > Compose
sudo mv Compose /usr/share/X11/locale/en_US.UTF-8/Compose

3) add two lines on /etc/environment

GTK_IM_MODULE=cedilla
QT_IM_MODULE=cedilla

4)restart your computer"

Emscripten: Linking to boost libraries with CMake

On Linux, C++ Boost headers usually reside in /usr/include. However, when letting CMake automatically find those headers for you it ends up including "-i/usr/include" which contains all the system headers.

This results in all sorts of weird compilation errors since the emscripten headers must be used instead of the system headers. The errors are something like "sys/cdefs.h: not found" and "__gnuc_va_list is not valid".

The file "includes_CXX.rsp" in the cmake build directory contains all the includes being passed to the compiler and you can look at it to identify such mistakes.

My present workaround was:
1. Create a boost_includes folder in my home
2. Create a symlink to /usr/include/boost inside the boost_includes folder.
3. Add the environment variable: BOOST_INCLUDEDIR="/home/x/include/boost_includes"

This workaround is useful for any other library you need to link that resides in the system headers folders.