Gnuplot Refences

November 28, 2009 by aslakjohansen

LaTeX References

November 28, 2009 by aslakjohansen

To be updated …

Python References

November 28, 2009 by aslakjohansen

To be updated …

Choosing the right architecture for DEB packages

November 20, 2009 by aslakjohansen

I recently experienced a minor run-in with dpkg-deb. My system tells me, that

$ uname -a
Linux hoazin 2.6.28-16-generic #55-Ubuntu SMP Tue Oct 20 19:48:24 UTC 2009 i686 GNU/Linux

which seems to indicate that the Architecture field of the DEBIAN/control file should read ‘i686‘. Doing this results in the error:

deb Error: Wrong architecture 'i686'

Dismembering official packages reveals ‘i386‘ as the correct value.

Rossum Corporation

November 13, 2009 by aslakjohansen

The way Rossum Corporation describes themselves is quite scary. Could their internship qualifications sound any shadier?

“New for 2008, the Rossum Corporation offers exclusive 5-year paid internships for candidates of superior genetic disposition. Contact a Rossum Human Recruitment office near you for more details.”

Timetraveling with GIT

November 8, 2009 by aslakjohansen

or checking out a specific commit.

First, one has to locate the hash of the commit. This can be done by:

  1. Scanning the log by running “git log” (press q to quit). Look for lines labeled commit.
  2. Scanning the log in giggle. Look for the SHA-line. Example:
    Screenshot of Giggle, click to enlarge

In this case our hash is 7f8d2051582dd030e3c07ded70010af033461e31.

Then, come up with a name for a branch to refer the this specific revision. For this example we will use old-branch.

Last, set up the branch by running:

git checkout -b old-branch 7f8d2051582dd030e3c07ded70010af033461e31

Syntax: The general syntax is: “git checkout -b BRANCHNAME HASH

Making BOINC work under Karmic

November 5, 2009 by aslakjohansen

Since installing Karmic on my laptop, it has consistently failed to connect to the World Community Grid server.

Symptoms: When going the the ‘Messages’ tab of the ‘Advanced View’, one is greeted by lines of the form:

2009-11-05T12:56:47 CET|World Community Grid|Sending scheduler request: Project initialization. Requesting 1 seconds of work, reporting 0 completed tasks
2009-11-05T12:56:50 CET||Project communication failed: attempting access to reference site
2009-11-05T12:56:52 CET|World Community Grid|Scheduler request failed: Peer certificate cannot be authenticated with known CA certificates
2009-11-05T12:56:53 CET||Internet access OK - project servers may be temporarily down.

Solution: After some googling I came across this page, which basically gives a simple workaround:

sudo su
cd /var/lib/boinc-client
mv ca-bundle.crt ca-bundle.crt.backup
wget http://boinc.berkeley.edu/trac/export/16195/trunk/boinc/curl/ca-bundle.crt

I’m not convinced that it will survive an update though.

Measuring the Desktop

November 1, 2009 by aslakjohansen

From time to time one needs to measure stuff on the desktop. You might – for instance – want to know whether some region of an image will fit nicely into some part of a webpage.

In ubuntu (both jaunty and karmic releases) the screenruler application provides an easily available mean to do just that. This application is available through a package of the same name and can be found in the menu under Applications -> Accessories -> Screen Ruler.

Screenshot of two instances of 'screenruler' application

The screenshot above shows two instances of screenruler along with the contextual menu (available through right-click or a menu button which appears when the mouse hovers over the ruler). Through this menu the metric can be changed. The length of the ruler can be changed by pulling in the ends and the orientation can be flipped by middle-clicking.

Sharing a network connection

October 28, 2009 by aslakjohansen

Note: This applies to multiple flavors of Ubuntu; Jaunty as well as Karmic. Also, it might be generic to all distributions based on Network Manager.

At the university we have a eduroam-based wireless network. It has not been very dependable yet; sometimes you can log on, sometimes you cannot. It doesn’t seem to be directly related to signal strength.

It seems that Ubuntu – which uses Network Manager – is quite well suited for this environment. Our setup is based on two laptops; one which can connect to eduroam and one which cannot. These are connected by a standard ethernet cable. The laptop connected to eduroam is then set up to share the connection.

The Guide

First open up the network connections dialog. Do this by right clicking on the Network Manager icon in the notification area and choose ‘Edit Connections …’. In the ‘Wired’ tab, click ‘Add’ to add a new connection. Fill it out like so:

Add connection dialog box

The important parts are

  1. The method. This should be ‘Shared to other computers’.
  2. The unmarking of ‘Connect automatically’. This will make sure other connections (like DHCP) take precedence.

After confirming this dialog (by clicking ‘Apply …’) the list of network connections should look like this:

List of network connections

Thats it! When you whish to share a wireless connection, click on the network manager icon in the notification area and choose ‘Share Connection’ under ‘Wired networks’.

Facebook chat with Empathy under Ubuntu (Karmic)

October 26, 2009 by aslakjohansen

Update: This no longer works for me. I’m getting the feeling that Facebook might be messing around with the protocol …

The solution for Jaunty seems to have degenerated.

I recently installed Karmic (Koala) Beta and decided to give it a try again. For me, installing the pidgin-facebookchat package and following the instructions at the relevant (bottom) part of the official documentations page regarding protocols. The experience is not entirely stable, but for a beta release I guess it’s ok.

Resetting Evolution

October 15, 2009 by aslakjohansen

Not the Darwinian kind, but the mail client. This is useful if you want to move evolution data back and forth between two machines.

A little google-research seems to indicate that Evolution stores its data at several locations:

  • Running processes These may interfere with our work.
    Exit them by running: killall evolution-data-server-2.26 evolution-alarm-notify
    Note that the name of the data server seems to follow the relase of evolution (2.26 in this case).
  • ~/.evolution This is the big one, containing mails and other kind of data.
    Backed up by running: mv ~/.evolution ~/.evolution.bk0
    Note this resets the location.
  • ~/.gconf/apps/evolution Contains GConf data. This is most likely and old format which I have lying around.
    Backed up by running: mv ~/.gconf/apps/evolution ~/.evolution_gconf
    Note this resets the location.
  • gconf2://apps/evolution Contains GConf data, new format.
    I don’t know how to backup this.
    Removed by running[source]: gconftool-2 --recursive-unset /apps/evolution
    Note this resets the location.

When these locations have been cleared, starting evolution will launch a settings importer, which can load settings from a backup. Backups can be created by chosing ‘Backup Settings …’ from the ‘File’ menu.

Note: This process appears to forget all about your signatures. Use other means to back them up if necessary.

Photo trap for Bats

September 19, 2009 by aslakjohansen

Came across an article describing one guys efforts in photographing bats slurping water from a pond while in flight. The pictures are strangely beautiful.

Cloning a VirtualBox Virtual Machine

September 12, 2009 by aslakjohansen

Locating clear guidelines describing the proces of creating a copy of an already existing machine (also known as cloning it) is not an easy task. I gave up when I came across an unofficial guide or two.

In VirtualBox, virtual machine definitions are stored separately from disk images. Cloning the machine can be reduced to the matter of cloning the disk(s) and creating a new machine which uses the cloned disk(s). Since disk images contain a unique identifier (UUID) a simple copy – as performed by the operating system – won’t do. Instead, use the following command:

vboxmanage clonevdi ORIGINAL_IMAGE NEW_IMAGE

The default locating for disk images is ~/.VirtualBox/HardDisks and the files use the .vdi extension.

Example:

$ vboxmanage clonevdi ~/.VirtualBox/HardDisks/Disk.vdi ~/.VirtualBox/HardDisks/DiskClone.vdi
VirtualBox Command Line Management Interface Version 2.1.4_OSE
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'VDI'. UUID: cd4972c2-b57f-4b59-90f3-db151ac131e5
$

Then create a new virtual machine which uses the DiskClone.vdi image.

Adapting a Leica R-mount lens to Nikon F cameras

September 12, 2009 by aslakjohansen

This site sells kits to convert Leica R-Mount lenses to Nikon F mount.

Features (according to site):

  • The procedure is fully reversible.
  • The lens will focus to infinity.
  • Nikon cameras will show focus confirmation light in viewfinder.

It seems like a few Hong Kong based brands are offering alternatives on ebay. Don’t know if they are trustworthy though …

leitax also has kits for other exotic lens/body combinations. Just about any combination of:

  • Lens: Contax Carl Zeiss, Leica R
  • Body: Canon EOS, Minolta/Sony alpha, Nikon F, Pentax, Sigma

9/11, 1973 edition

September 11, 2009 by aslakjohansen

Leica announces M9, X1

September 9, 2009 by aslakjohansen

After a long line of rumors Leica today announced the M9 digital rangefinder camera along with the ‘beginners’ X1. An artful Leica M9 brochure was leaked.

DPReview has a preview of the M9, a brief preview of the X1 and a tour of the Leica Solms Factory. Luminous Landscape also has an article on the X1.

Gizmodo has a well-written article on the event and the phenomenon that is Leica. A quote about the press event:

“I’ll say—I’ve never gotten so many looks of pity for carrying a Sony DSLR as I did at the press event today. No one looked down on me; they just looked … sad.”

The announcement was – for some reason – done as a webcast:

Evolution unable to generate folder list

September 6, 2009 by aslakjohansen

After a system freeze, evolution ceased to be able to generate the folder list for my inbox. The statusbar said Error While Generating message list. Clicking on the message popped up this dialog:

Error dialog

According to this bug report the issue might be linked to evolutions use of SQLite.

In the same bug report it was suggested that the following command might solve the issue.

cd ~/.evolution/mail ; for i in `find . -name folders.db`; do echo "Rebuilding Table $i"; sqlite3 $i "pragma integrity_check;"; done

I didn’t have sqlite3 installed, so I ran sudo apt-get install sqlite3 first. For me this command located a handful of files called folders.db and sqlite3 did find errors in one of them: ~/.evolution/mail/local/folders.db.

To make sure that I had the right file I ran

sqlite3 ~/.evolution/mail/local/folders.db "pragma integrity_check;"

which again presented the errors. In the bug report someone explained that missing folder.db files would be regenerated, so I tried stopping all evolution-related processes (evolution-data-server and evolution-alarm-notify will linger after exitting the main program) and removed the file. I then started evolution and everything came up nicely.

On the inability to create evolution filters after migration

September 5, 2009 by aslakjohansen

I recently moved my evolution setup from one machine to another, in the proces changing my username. Mostly the move was successful, but signatures got cleared and the ability to add filters broke. This post describes a workaround for the latter issue.

Description
First a working evolution setup was backed up (File->Backup Settings …) and restored (File->Restore Backup …) on a different computer as a different user.

After adding a message filter and applying it (Message -> Apply Filters) a warning would pop up (‘asjo’ was my username on the first machine):

Filtering Error

Workaround

Make sure no processes related to evolution are running. Then edit the ~/.evolution/mail/filters.xml file:

  1. Locate the rule in question (enclosed by <rule></rule> tags). It is most likely in the buttom of the file.
  2. Inside it, you will find a <folder/> tag (Assuming your filter is a move-to-folder operation). Mine says <folder uri="email://5/Inbox/tinyos"/>.
  3. Replace the 5 with local@local so that you come up with something similar to <folder uri="email://local@local/Inbox/tinyos"/>.

Then save the file.

Test
In order to test the change, simply start up evolution and try to apply filters as before.

Windows must-haves

September 3, 2009 by aslakjohansen

While fooling around with Windows (XP variant) I found a few missing essentials:

  • For transferring files there is putty (there’s an installer common to almost everything)
  • For calculating checksums (MD5/SHA1) there is HashTab which adds a tab to the file properties dialog box

I intend to update this list as I find additions.

Radeon Mobility 7500 under Jaunty

September 2, 2009 by aslakjohansen

Update 2: On a clean install of Karmic Beta, this was fixed out of the box.

Update: The config below results in some stability issues on my machine. It might be isolated and it might not be. But for me it triggers random restarts once a day or so and a reproducible restart when I try to run

cvs -z3 -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos co -P tinyos-2.x

which really doesn’t make sense. I have reverted to this xorg.conf (which is slow) and hope for the best in Karmic …

Original post:

Since the arrival of Jaunty Jackelope (Ubuntu 9.04) my laptop has performed miserably on the 2D side of things. It’s an IBM ThinkPad T42 2379-R4U. Thats an ATI Radeon Mobility 7500 with 32MB and a 1400×1050 screen.

Today I found this page and as a result my /etc/X11/xorg.conf now contains this device section:

Section "Device"
Identifier "Configured Video Device"
Option "AGPMode" "4"
Option "AGPFastWrite" "True"
Option "EnablePageFlip" "True"
Option "AGPMode" "4"
Option "AGPSize" "64"
Option "RingSize" "8"
Option "BufferSize" "2"
Option "EnableDepthMoves" "true"
Option "RenderAccel" "true"
# Eyecandy Stuff
Option "AccelMethod" "XAA"
Option "EnablePageFlip" "true
Option "DDCMode"
Option "SubPixelOrder" "NONE"
Option "ColorTiling" "false"
Option "MigrationHeuristic" "greedy"
EndSection

This gives me decent, but not great, performance.

Moore’s Law and Digital Photography

August 5, 2009 by aslakjohansen

Luminous Landscape has been running a series of articles on the practical implications of diffraction in relation to subpixel pitch: article 1, article 2 and article 3.

The issue in question is – with the advances in pixel count promised by Moore’s law – when does the megapixel race stop making sense?

Building DEB packages

July 28, 2009 by aslakjohansen

A good starting point is the Debian Binary Package Building HOWTO. The postinst and prerm scripts can be placed in /DEBIAN/ and dpkg-deb will do the right thing when building the package.

The ubuntu wiki also has a nice introduction.

Empathy gives “Network Error”

July 27, 2009 by aslakjohansen

Recently empathy has been giving randomish errors for certain protocols, mostly MSN and Facebook. The message is “Network Error“.

This forum thread hints a solution: Simply run “killall telepathy-butterfly” and restart empathy.

Installing STY files in Ubuntu

July 22, 2009 by aslakjohansen

This article explains how to install a LaTeX style file – as found in CTAN – under Ubuntu.

Of the Science of Gaming

July 17, 2009 by aslakjohansen

Anandtech has an interesting article on how various hard- and software affect the gaming experience.

Human responce is said to be somewhere between 150 and 300 ms. Add to this the time spent within the game engine and logic, the graphics driver and hardware, and the relevant IO devices such as mouse and monitor.

As a result, with the wrong hardware you are – as a gamer – already a big step behind the competition.

Update: See also this story on slashdot. Some of the comments seems to carry insights as well.

Fuck the Foundries

July 16, 2009 by aslakjohansen

First of all, those are not my words.

Recent developments in key web standards have opened up for the use of arbitrary (sort of) fonts, instead of the usual 11 web-safe ones. In an interview, David Berlow – a successfull type designer – seems to indicate that, it is the foundries belief that all existing standards should be changed to make room for some sort of permission table to handle the foundries copyright requirements, hereby rendering all current fonts unlinkable.

Related link.

Facebook chat with Empathy and Ubuntu

June 21, 2009 by aslakjohansen

Update 2: With the forthcomming release of Karmic Koala this guide becomes (more or less) obsolete. This guide deals with the new situation.

Updata 1: This guide no longer seems to work for me.

This article explains how to configure Empathy under Ubuntu (9.04 Jaunty Jackelope) to interface with Facebook Chat.

On the technical side of things, the indea is to use pidgin-facebookchat – a libpurple plugin – through telepathy-haze – a telepathy connection manager based on libpurple – to establish and maintain the connection. The plugin can be used directly with Pidgin for similar results.

First, we need to install the needed packages (I assume that empathy is installed):

sudo apt-get install pidgin-facebookchat telepathy-haze

As described here and here you then need to do some fiddling. This might change in the future. What you need to do is:

cp /usr/share/telepathy/managers/haze.manager /tmp/
wget https://bugs.freedesktop.org/attachment.cgi?id=20810
sudo mv attachment.cgi?id=20810 /usr/share/telepathy/managers/haze.manager
wget https://bugs.freedesktop.org/attachment.cgi?id=20811
sudo mv attachment.cgi?id=20811 /usr/share/mission-control/profiles/bigbrownchunx-facebookim-haze.profile

Note: The two sudo lines will override any existing files. Since the first file should exist prior to the operation, one should make sure that nothing is removed from it during the operation. Do this by comparing /tmp/haze.manager and /usr/share/telepathy/managers/haze.manager. The latter should be the prior plus a section for the bigbrownchunx-facebookim protocol.

Adding bibliography to the table of contents in LaTeX

June 13, 2009 by aslakjohansen

By default LaTeX does not display the bibliography section in the table of contents (TOC). This article describes how to add it.

Seemingly random 403 errors on Apache

May 21, 2009 by aslakjohansen

At some point I realized that apache was giving seemingly random “403 Forbidden” errors. This when under high load and yet, not really high at all. I would be able to trigger it by reloading some page a few times quickly in a row or loading a page with a lot of images.

The problem was mod_evasive, a module designed to protect against DOS attacks. The above usage pattern was being categorised as an attack and rejected. This page explains the details and this page explains how to deal with it in Ubuntu.

I did have to loosen up some settings, namely:

  • DOSPageCount 10 (the number of pageviews allowed within DOSPageInterval secs)
  • DOSSiteCount 10000 (the number of object requests allowed within DOSSiteInterval secs, that is images, stylesheets, javascrip files ...)

Creating a debian/ubuntu meta package

May 11, 2009 by aslakjohansen

This article explains how to create a DEB-style meta package.