Installing yaz for PHP on Ubuntu

Numerous sites on the internet have answered the basic question of “how do I install yaz for PHP on Ubuntu”. Which basically boils down to:

sudo apt-get install yaz
sudo apt-get install pecl
sudo pecl install yaz

Then add the following line to /etc/php5/apache2/php.ini:

extension=yaz.so

Sadly, the pecl install will fail with the error:

checking for yaz-config... NONE
configure: error: YAZ not found (missing NONE)
ERROR: `/tmp/pear/temp/yaz/configure --with-yaz' failed

All the search results for this error solve it by downloading the yaz source code and compiling and installing it outside the package manager, which is non-ideal.

The missing piece is that yaz-config is included with the libyaz4-dev package:

sudo apt-get install libyaz4-dev

Interestingly, this yaz install blog post does explicitly calls out the need for the -dev packages, but doesn’t include the error when you don’t have it. Hopefully this blog post will tie the two bits together for future people perplexed by this.

Decreasing bitmap resolution when exporting PDFs in Inkscape

When exporting a document with bitmap images in it, Inkscape won’t downsample them to a lower resolution, despite the “Resolution for rasterization (dpi)” setting in the PDF export dialog. That export dialog setting only applies to bitmaps that have had filters applied against them. See bug 246677.

4 years ago I figured out how to work around this and today I had to relearn it. So as to not repeat this in another 4 years, I’m documenting this here for posterity.

The workaround is to apply an identity filter to each bitmap before saving it. An identity filter is one that doesn’t do anything, but because it is a filter it forces Inkscape to do the downsampling upon export. Because an identity filter doesn’t actually do anything, there isn’t one available in the Filters menu, but we can create one.

To create a reusable identity filter:

  1. Open a new Inkscape file
  2. From the Filters menu, select Filter Editor…
  3. In the Filter Editor pane, click the New button. This will add the filter “filter1” to the Filter list
  4. Double click “filter1” and rename it “Identity”
  5. To the right of the Add Effect: button there is a drop-down. Change it to Color Matrix, and hit the Add Effect: button
  6. Save the document as “Identity filter.svg”
  7. Now put the file where Inkscape can find it:
    • Linux/OS X: ~/.config/inkscape/filters
    • Windows XP: C:\Documents and Settings\[USERNAME]\Application Data\Inkscape\filters
    • Windows Vista and later: C:\Users\[USERNAME]\AppData\Roaming\Inkscape\filters
  8. The ‘filters’ directory may not exist, in which case just create it.
  9. Close and restart Inkscape
  10. This should add the Personal submenu under the Filters menu which should include our Identity filter.

To use the identity filter:

  1. In your Inkscape file, select the bitmaps you want to downsample. Be sure not to select any vector images or text since you don’t want to rasterize that.
  2. From the Filters menu, select Personal > Identity
  3. Now when you save the document as a PDF, adjust the “Resolution for rasterization (dpi)” setting. 90 is a decent number for documents that are being viewed on a computer screen. 150 is probably the smallest you want to go for anything that is being printed.

O_SYNC, where has thy FILE_SYNC gone?

This morning I came across an interesting difference between RHEL 5 and RHEL 6 (and of course their CentOS brethren).

In the RHEL 5 kernel, when an application writes to a file opened with O_SYNC over NFS, those writes come across the wire as FILE_SYNC writes — ie: stable.

In the RHEL 6 kernel, when an application writes to a file opened with O_SYNC over NFS, those writes come across as UNSTABLE immediately followed by a COMMIT. To get the writes to come across the wire as FILE_SYNC, you have to use the O_DIRECT flag (either by itself or in addition to the O_SYNC flag).

This is a rather significant change and has storage-system impacts. Good for both users and implementers to be aware of.

Update: According to this kernel bug the RHEL 6 behavior listed above happens in kernels 2.6.32 to 2.6.38-rc3. Presumably it is fixed (ie: reverted to the RHEL 5 behavior) after 2.6.38-rc3, although I don’t know if its been picked up in the RHEL kernel.

Evolution of Gnome 3 to a flavor of Cinnamon

I want to be on a more recent version of Linux on my desktop here at the office. My Fedora 14 install is getting long in the tooth — particularly in Evolution. In fact, running a more recent version of Evolution is one of my primary reasons of wanting to upgrade: I’m hoping they’ve polished the Exchange integration a bit more.

The problem with Fedora 15 and 16 is the introduction of Gnome 3 and the Gnome Shell, where the Gnome developers decided to dumb-down the shell even further than they did back in Gnome 2. I don’t want it. Lots of people don’t want it.

But that’s ok, because it’s Linux (unlike Microsoft users who are stuck with whatever Redmond gives them — better hope you like Metro!). Cinnamon offers all of the great infrastructure that Gnome 3 provides with the Gnome 2-like interface that people actually like.

So off I go installing Fedora 16 within a VM only to discover that Gnome 3 requires hardware acceleration and VMware doesn’t support hardware acceleration for Linux guests. This means I can’t test out Cinnamon, or even Gnome 3, in a VM before jumping ship.

And so this endeavor comes to a close almost before it got started. With luck maybe VM will start supporting 3D acceleration in Linux sometime soon ’cause I want to play with Gnome 3 and Cinnamon before taking the plunge.

Amazon MP3 Downloader for Fedora 14? Nah, go clamz

I remember futzing for hours a year ago trying to get the Amazon MP3 Downloader (amazonmp3) working on my Fedora 12 (or 13?) instance. I eventually got it working but it’s a pain because the Fedora 11 binary Amazon provides requires a libboost version that isn’t provided with modern Fedora releases.

Now, however, there’s an opensource implementation: clamz. It’s available in most repositories (Fedora 14 for instance). Opening an .amz file will start clamz and download the music to $HOMEDIR/Music by default (you can customize this and more by editing $HOMEDIR/.clamz/config). In other words: it just works.

Getting seahorse to recognize existing SSH keys

I had a doozie of a time getting seahorse (aka: Gnome’s “Passwords and Encryption Keys” program) to recognize my personal SSH keys. The start of the problem was that I’d SSHd my private key (id_rsa) over to the box, but not the public key (id_rsa.pub) which seahorse needs. Not a problem, ssh-keygen -e convienently outputted the public key to the screen which I shoved into id_rsa.pub. The problem was that the key was in the wrong format for seahorse. It looked like this

---- BEGIN SSH2 PUBLIC KEY ----
Comment: "2048-bit RSA, converted by cpeel from "
AAAAB3NzaC1yc2EAAAABIwAAAQEApTseuoEnUBPIQSLWjOnXY6m4idRLJ+WE49/ov0VA5/
S8+fRHosP7WrBnrja8GLqd9jiG3HOSoFT4BgQ1kBJvyKLg88Kyt5V83dmhWhr2TzWHVeo7
gtOmN0pNT7Xl3dxChLvM1LoAolif9PXLTs81CFwUTCWd+DPMa4SX7Ti8MUscy6YNkyB74A
lsbLM/0JEvBSZd+72ZJlG1laKlt8adcp2EXngnqQn0r9d5ws5kF1J3BbkKtKClssuBSsFR
Bckn7xlnXlO8o6lsq/j9cwpGYAoVy+gE/ZaVNUwG4wvZ9hlqY1sWqo9r9R9KjyVkIdXq0V
IxYCudxLYyEtf30pKrGw==
---- END SSH2 PUBLIC KEY ----

instead of looking like

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEApTseuoEnUBPIQSLWjOnXY6m4idRLJ+WE49/ov0VA5/S8+fRHosP7WrBnrja8GLqd9jiG3HOSoFT4BgQ1kBJvyKLg88Kyt5V83dmhWhr2TzWHVeo7gtOmN0pNT7Xl3dxChLvM1LoAolif9PXLTs81CFwUTCWd+DPMa4SX7Ti8MUscy6YNkyB74AlsbLM/0JEvBSZd+72ZJlG1laKlt8adcp2EXngnqQn0r9d5ws5kF1J3BbkKtKClssuBSsFRBckn7xlnXlO8o6lsq/j9cwpGYAoVy+gE/ZaVNUwG4wvZ9hlqY1sWqo9r9R9KjyVkIdXq0VIxYCudxLYyEtf30pKrGw== cpeel

(that’s all suppose to be on one line).

A simple massaging and seahorse was happy with it.

Accessing shared music from Fedora on iTunes

At work, I have my music collection on my Fedora desktop. At times I’ve wanted to access this library on my Mac Book Air but have been unable to do so given they are on two separate subnets (and DAAP is a broadcast protocol). The solution was Network Beacon.

In short:

  1. Ensure your DAAP server is accessible. For Rythmbox, enable/configure the DAAP Music Sharing plugin (be sure to click the ‘Share my music’ checkbox for the plugin).
  2. Make sure port 3689 is open on your Linux firewall if necessary.
  3. On the Mac, download and install Network Beacon and configure a new beacon thusly:
    1. Beacon Enabled: Yes
    2. Service Name: [string of your choice]
    3. Service Type: _daap._tcp
    4. Port Number: 3689
    5. Enable Host Proxy: Yes
    6. Host Name: [full hostname]
    7. IP Address: [duh]
  4. Now you should be able to open iTunes and see the DAAP share appear in the SHARED section. Note that Network Beacon must remain running for iTunes to see the remote share.

Note that if the machines were on the same subnet you should be able to skip Network Beacon entirely and just enable the DAAP Music Sharing and punch the hole through the Linux firewall.