30/11/2015

apt-get update gets stuck

Just a quick note: apt-get update froze regularly updating my software sources, with the shell output stuck at 100% [Connecting to security.ubuntu.com] or similar.
Apparently, this was caused due to IPv6 being enabled on my system. See this askubuntu discussion.
Fixes (as copied from the link above):
  • edit /etc/gai.conf and uncomment the last line to change the order of precedence to IPv4 first:
    #
    # For sites which prefer IPv4 connections change the last line to
    #
    precedence ::ffff:0:0/96 100
  • Alternative: disable IPv6. Not sure whether that is a good idea, so first try option 1. Anyway, you can reverse this action by deleting the lines added to /etc/sysctl.conf (everything below #disable ipv6).
    echo "#disable ipv6" | sudo tee -a /etc/sysctl.conf
    echo "net.ipv6.conf.all.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
    echo "net.ipv6.conf.default.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
    echo "net.ipv6.conf.lo.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
    sudo sysctl -p
  • Check whether IPv6 is enabled with cat /proc/sys/net/ipv6/conf/all/disable_ipv6, output is 0/1 for enabled/disabled.
  • "Have you tried switching it off and on again?"

27/11/2015

Bunched up fonts in printing (from Okular)

Left side: This is how it looked in Okular. Right side: This is how it was printed. Solution courtesy of  ubuntuforums.org.
Pull up the "Fonts" tab in File->Properties… and look for non-embedded fonts in the document. In this case, Helvetica is substituted wrongly.
Font substitutions are handled in ~/.config/fontconfig/fonts.conf (on (K)ubuntu, that is). I added a new match tag to the end of the file (MS core fonts are installed, so I put in Arial, if not, find a free Helvetica/Grotesk):
 <match target="pattern">
  <test qual="any" name="family"><string>Helvetica</string></test>
  <edit name="family" mode="assign" binding="same"><string>Arial</string></edit>
 </match>
</fontconfig>


Afterwards, I ran fc-cache from a shell and checked whether the substitution was correct:
$ fc-cache 
$ fc-match Helvetica 
Arial.ttf: "Arial" "Normal"

Note: I didn't delve into why the substitution went wrong. Tex Gyre Hero actually seems to be working Helvetica substitute, and the weird bunching showed up all over the printout, not just in the sans serif parts. Whatever, it worked.

14/09/2015

Adding matplotlib to locally installed blender

I had some trouble getting a local blender 2.75 in my home directory to use matplotlib - using the system wide python3.4 for some reason failed, so in the end I just copied over files to the local version until blender stopped complaining.
Required packages for Ubuntu 14.04: python3-pyparsing, python3-dateutil¸ python3-matplotlib, python3-cycler, python3-six. Using the following destination root directory ~/bin/blender/2.75/python/lib, I copied these files and folders:
sourcedestination
/usr/lib/python3/dist-packages/pyparsing.pypython3.4/site-packages/
/usr/lib/python3/dist-packages/dateutilpython3.4/site-packages/
/usr/lib/python3/dist-packages/matplotlibpython3.4/site-packages/
/usr/lib/python3/dist-packages/mpl_toolkitspython3.4/site-packages/
/usr/lib/python3/dist-packages/pylab.pypython3.4/site-packages/
/usr/lib/python3/dist-packages/cycler.pypython3.4/site-packages/
/usr/lib/python3/dist-packages/six.pypython3.4/site-packages/
/usr/lib/python3.4/distutilspython3.4/
A bit ridiculous for just wanting to use their colour maps, but there you go… Note: Still works for blender 2.77/Python 3.5/Kubuntu 16.04. Replace Python3.4 with Python3.5.

26/03/2015

KDE spell check, personal dictionary

I use Kile's automatic spell highlighting a lot. For some reason, it keeps complaining about ubiquitous verbiage like 'advective' or 'metachronal', which made me dig/google for the personal dictionary location.
According to https://forum.kde.org/viewtopic.php?f=20&t=98628, it's text files in the
~/.config/enchant folder, so for each localisation you're using, just edit the word list in e.g. 'en_GB.dic'.
For changes in the list to take effect, switch to a different localisation and back again.

18/03/2015

Tag sorting in Mendeley Desktop

You know what's missing in Mendeley Desktop's table view: customisable column headers. Apparently people have been pining for them since around 2012, and Mendeley claims tags are the future, but tagging support in the desktop app is pretty much nonexistent.

The weird thing is that column customisation is already implemented as an easter egg (see image) via the experimental settings shortcut Ctrl+Shift+D, changing the 'Feature_DocumentsViewHeaderMenu' variable to 'true' and restarting (see this support entry).

11/03/2015

pylibtiff fails on Ubuntu 14.10

I ran into this while setting up trackpy - after installing a recent git clone and trying to import the module in an ipython console, I got the following message:
Failed to find TIFF header file (may be need to run: sudo apt-get install libtiff4-dev)
A bit of a problem, as recent Ubuntus come with libtiff5-dev and it doesn't resolve the issue.
The message is actually libtiff's as can be easily checked with an 'import libtiff' statement.
According to bug discussions on Launchpad and Google Code this is due to Ubuntu providing a pylibtiff that's too old for its libtiff, so it hasn't caught on to version 5 yet.
The quick fix is to get the missing tiff_h_4_0_3.py and saving it in
/usr/lib/python2.7/dist-packages/libtiff/ (sudo that). Haven't put the module through its paces yet, but at least it loads without complaints now.
Also, for recent git versions of trackpy, Ubuntu's python-six is not recent enough (needs to be >=1.8).  Fixable with sudo pip install --upgrade six, if you happen to have pip around.

10/03/2015

In praise of arandr


I really like KDE's visual display settings module, but it lacks a profile saving tool. 
Last Friday I had to give a rather important presentation in an extremely time constrained setting and I had to rely on KDE kind of magically remembering the settings (side by side with the second display/projector on 1024x768) from the speaker ready room after removing the cable. (yay, open source, by the way - Windows and Mac users were fighting aspect ratio and resolution problems left and right…)
Enter arandr to the somewhat belated rescue (in the standard repos). Not quite as pretty as the KDE original, but a very capable xrandr graphical front end that has the capability of saving settings as xrandr shell scripts, e.g. my presentation mode as:
#!/bin/sh
xrandr --output HDMI1 --mode 1024x768 --pos 1920x1080 --rotate normal --output VIRTUAL1 --off --output DP1 --off --output eDP1 --mode 1920x1080 --pos 0x1080 --rotate normal --output VGA1 --off
So next time, I'll just have a nice folder view on my desktop with the PDF right next to the shell script: