Category Archives: Other

Remove OpenDNS from Mint

It turns out that even though the Mint team make better decisions than the Ubuntu team, they’re not perfect. Hidden away in Mint’s network configuration are the OpenDNS servers set up as a fallback in case your usual DNS servers fail.

Unfortunately, this appears to be interacting oddly with Chrome resulting in the fallback servers being used for all requests. This has been causing all sorts of problems for me recently, most notably some very aggressive blocking of sites for no apparent reason (stackoverflow being one example).

Continue reading

Be careful with relative error

When looking at sensor datasheets or similar documents there is a subtlety about relative error that may not be immediately apparent. Relative error is quoted as a percentage of the reading, but in some cases the range of interest to you might be small and have a large offset from zero.

Let’s take an extreme case. Imagine you have a temperature sensor that reads in Kelvin and you are measuring human skin temperature. It’s contrived I know, but bear with me here. In this case, your measurement range of interest is going to be around 300 K to 315 K. Now image you have a sensor with a relative error of 0.5%. Sounds good doesn’t it? Unfortunately that means that at a reading of 305 K (31.85 °C), your error is going to be 1.525 °C. That is slightly over 10% of your range—not so great anymore. Note that I was optimistic with the range size as well (you’re probably not going to be measuring skin temperatures around 40 °C), which makes the error even worse.

How does this translate to a more sensible measurement approach? In most cases you won’t have to worry. Op-amps historically have problems when the inputs have large DC offsets because the difference in the inputs becomes tiny versus the absolute input values. Weighing people is something I’m looking at currently, where a 1% relative error in the scales becomes more like a 2.25% error compared to the useful range. Not a crippling problem, but something to be aware of.

Associating xfig with .fig images

One problem I’ve encountered using Mint (though it’s not actually a Mint issue) is that xfig doesn’t get associated with .fig files. This is compounded by the fact that GNOME 3 (the basis of Cinnamon) always knows better than you, so there is no way to set your own custom file associations—if the application isn’t on the “approved” list it can’t be set.

After some research, I found some useful information and here I’ll describe how to apply it to the xfig situation specifically.

  1. I will assume that xfig is already installed. If not then install it now (sudo apt-get install xfig).
  2. Check that a .desktop file exists to inform the system that xfig is available. To do this run sudo gedit /usr/share/applications/xfig.desktop and check that the file roughly matches the following. If it is empty then insert the following.
    [Desktop Entry]
    Name=Xfig
    Comment=Diagram editor
    Exec=xfig
    Icon=xfig
    Terminal=false
    Type=Application
    Categories=Graphics;
    MimeType=image/x-fig;
  3. Set xfig as the default application for .fig files. Run sudo gedit /usr/share/applications/defaults.list and insert the following anywhere (though locating it with the other “image/...” entries may be sensible).
    image/x-xfig=xfig.desktop
  4. While you’re at it, install gsfonts-x11 then log out and back in. This will avoid issues with Times, Helvetica, and so on in your images.

Subfloat error in LyX

When using subfloats (or subfigures as they are sometimes referred to) in LyX you may come across an error message when exporting telling you that you cannot use spacefactor in vertical mode. The error message isn’t terribly helpful, but the solution is to add makeatletter to the end of your preamble.

Source.

Convert images to video in Linux

On occasion I need to convert a series of images into a movie. For example, I have a data visualiser which generates an image for each timestamp and it nice to be able to use these to view the evolution of the sensed values over time. If you search on this topic then you’ll find a lot of people suggest using ffmpeg with a command line such as the following:

ffmpeg -r 10 -b 1800 -i %03d.jpg test1800.mp4

However, this assumes that all the filenames are sequentially numbered and that there are none missing (it will finish when it reaches the first missing number). I needed something a little more flexible, and eventually found this page which suggests the following:

mencoder "mf://*.jpg" -mf fps=10 -o test.avi -ovc lavc -lavcopts vcodec=msmpeg4v2:vbitrate=800

This will simply read the files in the usual alphabetically sorted order. You can change "mf://*.jpg" to adjust which files it uses, along with tweaking the framerate and bitrate.

Contrary to the note on that page, more recent versions of mencoder support png files as input.

Installing Drupal 7 in Ubuntu

I had occasion to install Drupal 7 on my own Ubuntu server recently. Many of the guides I found went into some quite unecessary steps, involved liberal use of tasksel, or made a variety of assumptions about your environment. In the end, though, I found this guide, which is short, simple, and just worked.

The only addition I required was to run a2enmod rewrite and to edit /etc/apache2/sites-available/drupal to have AllowOverride All in the entry for the /var/www/drupal/ directory.

Job done in almost no time.

Things sent to test Kemp (episode 1)

$ msp430-gcc –target-help | grep 430
  -mcpu=CPU           Select the CPU model: 430, 430x, 430xv2

$ msp430-as –help | grep mcpu
  -mcpu={430,430x,430xv2} select cpu model

$ msp430-gcc -c  -I./../include -I. -Wall -Os -gdwarf-2 ./string/isascii.c -o Build/./isascii.o
/tmp/ccDRG4ve.s: Assembler messages:
/tmp/ccDRG4ve.s:2: Error: unknown cpu `430′

Compilers, how do they work?

Installing Google Chrome on Ubuntu 11.10

When attempting to install Google Chrome on Oneiric, you may encounter an error such as the following in the Ubuntu Software Centre:

Internal Error
The file “google-chrome-stable_current_i386.deb” could not be opened.

Though depending on which installer you’re using, the filename may be different of course. To work around this you can install it manually by running the following commands:

sudo apt-get install libxss1 libcurl3
sudo dpkg -i google-chrome-stable_current_i386.deb

Again, adjust the filename depending on the installer you have.