devinrkennedy


Rendering LaTeX into Inkscape

Posted in latex, inkscape, linux by Devin on November 11th, 2007

I first saw Julien Vitard’s EQTeXSVG Inkscape extension over a year ago, and it’s never worked on my installation. But I’ve been using Inkscape for mathematical figures and plots lately, and the lack of a LaTeX extension was really bothering me. So I sat down this evening and figured out why EQTeXSVG doesn’t work for me.

The first problem was that pstoedit version 3.44, which is in the latest Ubuntu release, doesn’t work with the latest release of ghostscript when using the plot-svg output format — it just hangs indefinitely. Luckily, this is fixed in the latest release of pstoedit, so I built new packages: pstoedit_3.45-1_i386.deb, libpstoedit0c2a_3.45-1_i386.deb, libpstoedit-dev_3.45-1_i386.deb.

But there’s also a small bug in the EQTeXSVG extension itself when it’s run on unix systems: it tries to execute rmdir on a non-empty system directory. You can patch this up in the python file of the extension itself pretty easily; I changed the clean function to read like this:

        def clean():
            os.remove(latex_file)
            os.remove(aux_file)
            os.remove(log_file)
            os.remove(ps_file)
            os.remove(dvi_file)
            os.remove(svg_file)
            os_name = os.name
            if os_name != 'nt':
                os.remove(out_file)
                os.rmdir(base_dir)
            else:
                os.remove(out_file)
                os.remove(svg_file)

I may have had to install a couple of stray packages along the way, but those are the tricky parts! I will follow up with Debian and Julien Vitard tomorrow.

accessing the LG VX8600 over bluetooth

Posted in linux, howto by Devin on August 16th, 2007

I was combing through old robot parts today when I ran across something that I at first thought was a USB flash disk. Then I turned it over and realized it had an antenna, and I thought maybe it was a wireless adapter. But there was only one way to find out for sure:

devin@polyphemus:~$ lsusb
Bus 005 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000
Bus 001 Device 003: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

A bluetooth adapter! I didn’t know a thing about bluetooth support in linux, but a couple of hours of tinkering got me up and running. So here’s an explanation of how I synced up with my LG VX8600 phone using a bluetooth adapter on Ubuntu Gutsy. I’ll include my mistakes so others can benefit.

First off, I installed some packages.
sudo apt-get install bluetooth bluez-gnome gnome-vfs-obexftp

I hate it when people tell me to install a bunch of packages without explaining what they do, so here’s a brief overview. Bluez is the official Linux Bluetooth protocol stack, and its functionality is split into several packages in Ubuntu. The bluetooth package pulls in the utilities, like hcitool and rfcomm (more about these later). The bluez-gnome package provides a nice program called bluetooth-properties for managing your bluetooth configuration, as well as a snazzy applet for the Notification Area. It also provides a protocol analyzer, but I haven’t figured out how to use it yet. Lastly, gnome-vfs-obexftp provides a Gnome VFS backend to access files on devices over bluetooth using OBEX, which has become a standard protocol for sending stuff between devices.

My next step was to set my phone into discovery visible mode. This particular phone reverts to invisible mode after one minute, so I jumped straight to a terminal to see if I could find it:
devin@polyphemus:~$ hcitool scan
Scanning ...
00:19:A1:E0:35:35 LG VX8600

Cool! But I wasn’t seeing any bluetooth applet popping up in the Notification Area, so I logged out of my session and logged back in, which brought it up. I think it may also have been sufficient to do an /etc/init.d/bluetooth start, but I’m not certain. At any rate, I took the logical next step: I tried to connect to my computer using my phone. It worked better than expected: the phone asked me to key in a PIN number, so I made one up. Then a notification bubble appeared on the computer asking me to enter the PIN, so I clicked it and entered the same number. And they were paired successfully!

A very slick pairing notification pops up.   And an authentication request.

By right clicking on the bluetooth icon in the Notification Area, I was able to bring up the Browse Devices window (shown below) and click “Connect.” This caused an “authentication requested” dialog to come up on the phone, which I approved.

bluetooth-applet’s Browse Devices window

The applet then spawned an instance of Nautilus that was pointed at my phone! I was very excited.

Viewing my phone over the OBEX protocol

All of my pictures were there, and my videos. I copied a MIDI file to the MySounds directory to see if it’d show up as a ring tone, but it didn’t. This was pretty disappointing: what good is connecting to your phone if you can’t change anything fun? Luckily, some people who are far more industrious than I have addressed this problem with an awesome program called bitpim. There’s an Ubuntu package by the same name, so I installed it.

I fired it up and tried to connect to my phone, but I ran into a dead end here when it listed the bluetooth adapter under “ports not available”:

bitpim displays “ports not available”

I tried all sorts of things to get it to access the port. Using chmod to add write access to /dev/bus/usb/002/001 did nothing. So I tried using strace to figure out what the problem was. These are the relevant lines from the output:
open("/dev/bus/usb/001/002", O_RDWR) = 12
close(11) = 0
ioctl(12, USBDEVFS_SETCONFIGURATION, 0xbff25bd4) = -1 EBUSY (Device or resource busy)
ioctl(12, USBDEVFS_CLAIMINTERFACE, 0xbff25bd4) = -1 EBUSY (Device or resource busy)

The ioctls were reporting that it was busy. By this point, I’d already killed all of the other processes that might have been accessing the bluetooth device, so I turned to Google. After probably ten minutes of looking, I stumbled across this post in bart’s blog, which clued me in to rfcomm, which creates a device node and connects it to a bluetooth device. Based on his instructions and the short shell script he presents, it was a cinch to get the phone ready for bitpim:
$ MAC=00:19:A1:E0:35:35
$ sudo hcitool cc $MAC && sudo hcitool auth $MAC
$ sudo rfcomm connect 0 $MAC 16
Connected /dev/rfcomm0 to 00:19:A1:E0:35:35 on channel 16
Press CTRL-C for hangup

After this, I was able to connect to my phone in bitpim without any trouble and sync all of my contacts, calendar events, ringtones, and such. And since bitpim lets me view my phone’s filesystem directly, I can do all sorts of fun things. This page is particularly thorough in enumerating tips and tricks for the VX8600.

nvidia upgrade woes

Posted in troubleshooting by Devin on August 15th, 2007

I’ve decided to start posting small Linux problems and resolutions as I encounter them. With any luck, people googling their error messages will stumble upon my solutions!

I ran into problems updating to nvidia’s 100.14.11 drivers. I found this puzzling tidbit in dmesg:
[ 35.168000] NVRM: failed to copy vbios to system memory.
[ 35.168000] NVRM: RmInitAdapter failed! (0x30:0xffffffff:846)
[ 35.168000] NVRM: rm_init_adapter(0) failed

The solution was to remove NVreg_VbiosFromROM=1 from the module parameters for nvidia (in Ubuntu, check /etc/modprobe.d/options). I can’t remember whether it was there initially or if I changed it at some point, but for whatever reason, it breaks the new drivers on my machine. For reference, this is my card:
devin@polyphemus:~$ lspci | grep nV
01:00.0 VGA compatible controller: nVidia Corporation NV43 [GeForce Go 6200 TurboCache] (rev a1)

sunset at waverly beach

Posted in Uncategorized by Devin on July 15th, 2007


sunset at waverly beach, originally uploaded by devinrkennedy.

I wanted to catch the sunset the other night, so I grabbed my camera and headed off in search of a good view. Running up and down hills, cursing power lines and wishing I lived in one of those big lake houses, I eventually found my way to Waverly Beach Park.

It was easy to stitch together my shots into a panorama with the help of hugin. It piped my images through autopano-sift (SIFT is one of my favorite computer vision acronyms; RANSAC is another) and nona, and I had it output the results as multiple, cropped TIFFs, which I then piped through enblend.

One word of advice: if you’re using enblend and you notice that you’re getting some obvious seams, especially when your overlaps are narrow, using the –fine-mask option may help a bit.

Also, I’m not sure what the status of the autopano-sift package on Ubuntu is right now, but I had to manually set AUTOPANO_PATH=/usr/lib/autopano-sift in /usr/bin/autopano-complete, due to some filename discrepancies in the package. EDIT: bug has been fixed in the latest release of the package in Gutsy; see here.

A reason to be ­

Posted in the internet is ugly by Devin on April 9th, 2007

Reading is hard. Over the years, we’ve developed quite a few tricks to make it easier for our eyes to scan across text. I’m not an expert, but I do know the basics, and they’re very easy to take for granted in the world of electronic typesetting.

But the web is full of poorly-displayed text — bad typefaces, long lines that stretch across the screen, awkward formatting oversights, and the like. As much as I’d like to blame the problems on sloppy web design (of which I am often guilty) or ignorance, when I started looking at line-breaking yesterday, I was unpleasantly surprised.

In 1997 (that’s 10 years ago), when the HTML 4.0 specification was written, the authors made a provision for breaking words at the end of a line. Although they did not require that browsers determine where line-breaking hyphens should fall, they did provide a soft hyphen character that could specify this information explicitly:

9.3.3 Hyphenation

In HTML, there are two types of hyphens: the plain hyphen and the soft
hyphen. The plain hyphen should be interpreted by a user agent as just
another character. The soft hyphen tells the user agent where a line
break can occur.

Those browsers that interpret soft hyphens must observe the following
semantics: If a line is broken at a soft hyphen, a hyphen character
must be displayed at the end of the first line. If a line is not
broken at a soft hyphen, the user agent must not display a hyphen
character. For operations such as searching and sorting, the soft
hyphen should always be ignored.

In HTML, the plain hyphen is represented by the “-” character (-
or -). The soft hyphen is represented by the character entity
reference ­ (­ or ­)

Fast forward 10 years to 2007. Even though it’s not technically required by the specification, most browsers do interpret soft hyphens, using them to break lines at ideal locations, which improves readability significantly. For example, here’s how IE displays text with soft hyphens:

IE's correct soft hyphen rendering.

But Firefox doesn’t support this: it simply treats soft hyphens as though they’re not there at all. Sure, it’s a semantically correct interpretation of the specification, but it’s annoying. As it turns out, this bug has been open in Mozilla’s bug-tracking system since 1999, and it won’t be fixed until Firefox 3.

So while it’s great to tout Firefox as being a “standards-compliant” alternative to IE, we must remember that there’s more to being a good browser than simply complying with the standards.

First Post

Posted in Uncategorized by Devin on April 9th, 2007

I’m up and running! I’ve made some customizations to Ian Main’s Green Marinée theme (which, according to my girlfriend, make the theme considerably more boring). I haven’t packaged them up neatly, but they are, of course, available upon request. Oh, and it’s horribly broken on IE (surprise).