Friday, February 22, 2008

HP scanjet 4370 on Gutsy Gibbon (Ubuntu 7.10)

Here's how I got our scanner working on Gutsy.

Install sane:
sudo aptitude install sane sane-utils
Then find out where your scanner resides:
You're interested in the series of usb ports that your usb is connected to:
found USB scanner (vendor=0x03f0 [hewlett packard],
product=0x4105 [hp scanjet], chip=rts8822L-01H?) at libusb:007:006
In my case, the scanner is plugged into usb port 007 and subport 006 (I have no idea if that's the proper way to talk about it, but you'll see that it will work to think like that)
Then, you need the driver for your scanner, so go to the sane supported devices page and find your scanner. You access the driver by clicking under the 'Backend' link.
At least in theory, this driver is supposed to be in the sane-backends distribution. I'm not sure where to get it (already come with sane?). Anyway, my device wasn't really recognized when firing up 'xsane' until I downloaded and installed the driver.
Now, we have to set the permissions such that we can access our scanner. Notice that we use the the usb port information gleaned about to accomplish this:
sudo chmod a+rw /proc/bus/usb/007/006
A person is supposed to be able to automate that process, but I haven't figured it out yet. In any case, we can now fire up sane with the command 'xsane' or install 'gimp2.0-quiteinsane' to access from within gimp.

Saturday, February 16, 2008

Using LCD Projectors or monitors with Ubuntu Gutsy Gibbon and Nvidia

Under Edgy and Feisty, you could just restart your machine, hit your [CRT/LCD] (Fn+F8 on my machine) while it was loading and it would automatically do this for you.

Under Gutsy, this will work (may be easier/better ways to do this):

  1. run command 'nvidia-settings' and go to 'X Server Display Configuration'
  2. If you are all plugged in, there should be two grey boxes displayed, one labeled 'LGP' (your LCD screen) and another (mine's labeled 'LG').
  3. Change the resolution of your current display to match what you will be using (most projectors are 1024x768)
  4. Now, click on the LG box. (The way to control which display you are dealing with are clicking and moving those boxes)
  5. You should see a box with a Configuration: Disabled and button [Configure]; click the Configure button.
  6. How Should this display device be configured? Click 'TwinView'
  7. Resolution 'Auto'
  8. Position 'Clones'
  9. Then hit 'Apply'

That's it!

If you want to run this configuration with no setup, then click on the 'Save to X Configuration File' and copy it over your /etc/X11/xorg.conf file whenever you need it (make sure you backup your original xorg.conf file!)

To undo it, click on the Configure button for LG, and click 'Disabled'. Then, change the resolution for your current screen and hit the 'Apply' button.

NOTE: this does not want to work under wmii-ruby because it does not want to respond to the change in resolution from gnome-display-properties.

Friday, February 15, 2008

Gutsy Gibbon broken matplotlib, pylab

Usually, Ubuntu's package management system gets everything right. However, on Gutsy Gibbon when you install the very handy matplotlib it gives you a broken installation. Basically, you'll get some error messages like this:
>>> import pylab
Traceback (most recent call last):
File "", line 1, in ?
File "/usr/lib/python2.4/site-packages/", line 1, in ?
from matplotlib.pylab import *
File "/usr/lib/python2.4/site-packages/matplotlib/", line 199, in ?
import cm
File "/usr/lib/python2.4/site-packages/matplotlib/", line 5, in ?
import colors
File "/usr/lib/python2.4/site-packages/matplotlib/", line 38, in ?
from numerix import array, arange, take, put, Float, Int, putmask, \
File "/usr/lib/python2.4/site-packages/matplotlib/numerix/", line 82, in ?
import numpy
File "/usr/lib/python2.4/site-packages/numpy/", line 43, in ?
import linalg
File "/usr/lib/python2.4/site-packages/numpy/linalg/", line 4, in ?
from linalg import *
File "/usr/lib/python2.4/site-packages/numpy/linalg/", line 25, in ?
from numpy.linalg import lapack_lite
ImportError: /usr/lib/atlas/ undefined symbol: ATL_chemv

So, I think they are trying to allow you to use whatever linear algebra backend you want. A fix (maybe there are better ones) is to install lapack3:
 sudo aptitude install lapack3

Thursday, February 14, 2008

CSS for ruby syntax highlighting

Add this to your css to get ruby code colored nicely.


pre.code {
padding: 1ex 1ex 1ex 1ex;
border: 4px groove #CC0000;
overflow-x: auto;

pre.code span.attribute { color: #009900; }
pre.code span.char { color: #F00; }
pre.code span.class { color: #A020F0; font-weight: bold; }
pre.code span.comment { color: #0000FF; }
pre.code span.constant { color: #008B8B; }
pre.code span.escape { color: #6A5ACD; }
pre.code span.expr { color: #2222CC; }
pre.code { color: #11AA44; }
pre.code span.ident { color: #000000; }
pre.code span.keyword { color: #A52A2A; font-weight: bold; }
pre.code span.method { color: #008B8B; }
pre.code span.module { color: #A020F0; font-weight: bold; }
pre.code span.number { color: #DD00DD; }
pre.code span.punct { color: #6A5ACD; }
pre.code span.regex { color: #DD00DD; }
pre.code span.string { color: #DD00DD; }
pre.code span.symbol { color: #008B8B; }