When trying to start IPython in a virtualenv I kept getting the error
ImportError: No module named _sqlite3
I was using a python executable that I compiled myself, and it took me some time to realize that the compile process could find the sqlite header files but not the library itself. It turned out that on this machine (Ubuntu 11.04) the file libsqlite3.so is in /usr/lib/x86_64-linux-gnu, but python expected it in /usr/lib. Creating a softlink did the trick.
A post in the gentoo forums just helped me realize that blocks with a leading “<“, e.g.
[blocks B ] <dev-libs/libxml2-2.7.7 ("<dev-libs/libxml2-2.7.7" is blocking sys-libs/zlib-1.2.4)
are quite easy to resolve by first upgrading the blocking package to a version newer than the specified one (2.7.7 in this case) and then proceeding with the original merge.
reinhardt@floyd ~ $ emerge -av1 libxml2 && emerge --update world
Writing this post helped me realize that escaping “<” can be important.
Today I tried to look up when exactly I had taken some photographs and discovered I had missed to set the EXIF use flag on my Eee PC. Consequently GIMP and Eye of Gnome had been built without EXIF support. I set the use flag and remerged, discovering in the process that I had not fully grasped the use of –newuse (more later, maybe). A short while later I was happy to find the EXIF data inside the EoG image properties window. But then I found a few pictures without that data. I browsed back and forth a little and found that all the photos in portrait format were missing EXIF. And of course, they would be. I had rotated and re-saved them on this very system with the EXIF unaware Eye of Gnome. Bummer.
I often work remotely on a server with two or more shells running at once. Lately the thought that one ssh connection should be enough for a couple of shells got stuck in my mind. I checked the man page and discovered the ControlPath and ControlMaster parameters. The former specifies the location of a control socket that is used for a shared connection, while the latter determines if the current ssh process should manage the shared connection or just connect to the socket as a slave. Adding the lines
ControlPath ~/.ssh/ssh-%r@%h:%p.sock ControlMaster auto
to your ssh config file (usually ~/.ssh/config) causes a starting ssh process to check the specified location for a socket and, if it exists, connect to it, or if it doesn’t, create a new shared connection including the socket.
NB. If your connection (shared or not) gets stuck when you leave it idle for a while, it could be due to firewall restrictions. Check the ServerAliveInterval parameter.
After setting up internet in our new flat, I wondered why there often was a delay of almost half a minute between entering a web address and firefox starting to load the data. I found out that firefox sent IPv6 DNS queries (type AAAA), which our Alice-DSL router didn’t understand. After 4 tries had timed out, it finally sent an IPv4 query (type A) that succeeded. The solution with the best cost-benefit ratio seemed to be setting
network.dns.disableIPv6 true
in firefox’s about:config. Strangely, though, I found an address of an Alice DNS server (213.191.74.12 or dnsp03.hansenet.de) that didn’t show these problems when setting it manually in /etc/resolv.conf
To concatenate multiple lines of text and separate them by commas, I use this sed script:
sed -n '$!{s/.*/\0,/;H};${H;x;s/\n//gp}'
This way you can e.g. use the output of a ps command as an argument for top to only display java and python processes:
top -p `ps -C python,java -o pid --no-headers | sed -n '$!{s/.*/\0,/;H};${H;x;s/\n//gp}'`
Thanks goes to bakunin, whose script in a thread at unix.com got me started.
Trying to update Open Office on my Eee 1005H running gentoo from 3.1.1 to 3.2.0, I ran into some blocks caused by poppler and related packages. I discovered I had to unmerge the following packages first:
dev-libs/poppler dev-libs/poppler-glib app-text/poppler-utils virtual/poppler virtual/poppler-glib virtual/poppler-utils
Emerge is still running at the moment, but looks like all’s going smoothly now.