More libnautilus-pr0n

I made some nice progress on libnautilus-pr0n today. I have it reading the width and height from each image (more or less). I have to see why some images aren’t checked (I suspect my code that detects if a file is an image). I need to make the extension work asyncronously, and have it cache the results so it doesn’t have to re-read the file every time.

libnautilus-pr0n

Kinda cool. It doesn’t sort as perfectly as I’d like. For example, if you were to sort from smallest to largest, an “800×600” image would appear after a “1600×1200” image, because “8” is greater than “1”. I’m not sure if I can take control of that through an extension, so that might require some hacking of Nautilus itself. I could also seperate width and height into their own columns, but I think that would get too messy.

I also started looking at libexif today, so I can add exif columns to nautilus.

libnautilus-pr0n

One of the biggest annoyances I have with Nautilus, and with image viewers/managers in general, is the distinct lack of the ability to sort by image properties such as geometry (width/height), bits per pixel (aka color depth), and aspect ratio.

I started to look at ways I could extend Nautilus to add the features I want and I stumbled across Dave Camp’s blog on Nautilus extensions and providers. As chance would have it, the same night I discovered this Jorge met Dave at Linux World in Boston. Small world.

I grabbed the libnautilus-vcs module from GNOME CVS, which served as a good example of how a Nautilus extension worked, and I now have the functional framework of libnautilus-pr0n (named lovely after the geek term for porn). I want to add a collection of media-related features to Nautilus. The most important feature to me is the ability to sort based on aspect ratio, since I have two wide-screen displays and hunting through unsorted images for ones that will fit a 16:9 display can be a pain. Once I started thinking about it I realized how many other cool things I could add. The ability to sort by color depth (useful for finding black & white photos), perhaps even exif data. Maybe even extend it to audio and video, so you can sort by track length or video dimensions. the possibilities are endless.

Heck, maybe I can even get it included with Nautilus at some point (though I have no idea where to begin with that process).

Here’s a little screenshot of the Visible Columns dialog in Nautilus, with two of my columns included. I still need to write the code to display the data but I have the hooks in place for them.

Mono, DBus, and Hal – Help

Here’s the story. I’m trying to hook into Hal to detect when a device (specifically an iPod) is attached. I can do this in C, Perl, and Python, but I can’t get the C# version to work.

The code should be fairly straightforward. I’m using the definition of HalManager from hal-sharp, which as far as I know is current to the latest Hal spec. DBus 0.23, which is working just fine. My next step is to do some debugging in dbus-sharp and see if I can identify what’s failing and why, but maybe someone has already run into this. I can’t be the only person trying to access the Hal Manager via C#.

The exception:

Unhandled Exception: DBus.DBusException: Disconnected prior to receiving a reply
in <0x0015a> DBus.Message:SendWithReplyAndBlock ()
in <0x0007c> HalManager.Proxy:GetAllDevices ()
in <0x00087> podlet:Main (string[])

The code:

[code]
// Compile with: mcs -target:exe -out:”podlet.exe” -pkg:gtk-sharp -pkg:dbus-sharp ./Main.cs ./AssemblyInfo.cs
using System;
using System.Collections;
using Gtk;
using DBus;

[Interface(“org.freedesktop.Hal.Manager”)]
public class HalManager
{
public delegate void DeviceAddedHandler(string udi);
[Signal]
public event DeviceAddedHandler DeviceAdded;

public delegate void DeviceRemovedHandler(string udi);
[Signal]
public event DeviceRemovedHandler DeviceRemoved;

public delegate void NewCapabilityHandler(string udi, string capability);
[Signal]
public event NewCapabilityHandler NewCapability;

[Method]
public virtual string[] GetAllDevices()
{
return null;
}

[Method]
public virtual bool DeviceExists(string udi)
{
return false;
}

[Method]
public virtual string[] FindDeviceStringMatch(string key, string value)
{
return null;
}

[Method]
public virtual string[] FindDeviceByCapability(string capability)
{
return null;
}
}

class podlet
{
public static void Main(string[] args)
{
Connection connection;
connection = Bus.GetSystemBus();
Service service = Service.Get(connection, “org.freedesktop.Hal”);

HalManager manager = (HalManager)service.GetObject (typeof(HalManager),
“org.freedesktop.Hal.Manager”);

foreach (string device in manager.GetAllDevices()) {
System.Console.WriteLine(device);
}
}
}
[/code]

Advanced Perl DBI

I’ve been doing some bug fixes and performance tuning on some perl modules of mine, mostly related to database access. I stumbled across this presentation from July 2004. If you’re doing any kind of DBI work, check out this presentation. You won’t be sorry.

New Horizons

I feel like I’ve been caught up in a whirlwind these last few days. I met with my two bosses on Friday. They told me they were announcing some major organizational changes on Monday and were giving me a choice: I could either shift into a new role with in a more structured team framework or seek my fortunes elsewhere. I had been expecting something along these lines for a while now. They gave me the weekend to think over my decision.

I really didn’t need a weekend to decide but I used the time to prepare for the biggest leap of faith I’ve had to make. I made some calls, sent some emails and got busy. Dena and I had talked about working for myself for quite a while but making the transition from full-time to self-employment is scary. It’s an entirely new kind of responsibility. It will challenge me in every conceivable way. Despite that I still feel up for the task.

On Monday morning I gave my official notice and started my new life as a freelancer. Oddly enough, I’ve been busier than ever since making the decision — and I’m loving every minute of it.

I realized that life likes to throw curveballs. It’s easy to just wait for the fastball over the plate but sometimes you’ve gotta swing.

/dev/random

Some quick stuff I’ve been meaning to cover:

  • After years of being constantly sick, tired, and irritable, I recently discovered I’m lactose-intolerant. I cut the dairy and within 36 hours I feel like a new man.
  • I’m bouncing between working on EMP and libipod in my free time. EMP takes the priority, but I’d like to have full iPod support ready when EMP 1.0 is done.
  • I’m currently addicted to Battlestar Galactica. I never thought I would get used to a female Starbuck, but she rules.
  • Now that I’m feeling better, I’ve started writing again. Not much, but it’s a start.
  • It’s January and we’re under a thunderstorm warning. What the hell is up with that?

I’m still adjusting to life after discovering my lactose-intolerance. It takes getting used to. I am taking lactaid at meals as-needed and that seems to be working. It’s been so long since I felt healthy. For the first time in recent memory, I’m sleeping straight through the night without tossing and turning. It’s a wonderful feeling.

EMP 0.1.2

EMP 0.1.2 is ready for testing. Grab the fresh tarball here.

Aside from some bug fixes, I rewrote the entire GStreamer backend code, borrowing heavily from Rhythmbox’s player/rb-player-gst.c. It’s my first time using GObjects. I highly recommend this tutorial. It made me realize why using GObjects are important.

If you have any problems building EMP, try this before you file a bug (assuming you’re using Debian):

sudo apt-get install libgstreamer-gconf0.8-dev gstreamer-gconf gstreamer0.8-plugins

For those of you running Fedora Core 3 (thanks to Soko):

yum install gstreamer
yum install gstreamer-plugins
yum install GConf
yum install GConf-devel
yum install gstreamer-devel
yum install gstreamer-plugins-devel

I’m working on creating Debian packages for EMP, possibly for the 0.2 release.

Spamalot

On Wednesday, Dena, Annie and I went downtown to see Monty Python’s Spamalot, the musical version of Monty Python and the Holy Grail.

Starring Hank Azaria, David Hyde Pierce, and Tim Curry, this piece of “musical theatre” is absolutely brilliant. The theatre was packed. The play was funnier than I expected. I don’t think I’ve ever laughed so much or so hard. I even bit the inside of my cheek somehow in the process. The show bills itself as playing “Broadway in Chicago” and indeed their quest is to reach, wait for it, Broadway! But they can’t get to Broadway if they don’t have any Jews. What a dilema!

If you get the chance, go see this show. I suspect it’s going to be one of the hot shows to see when it hits Broadway.

Free iPods

Someone sent me a link to this site offering free ipods. What’s the catch, you ask? Simply complete one of their “offers”, which include things like requesting an AOL CD in the mail or opening a trial membership on some websites (like Ancestry.com). Then send the link to five of your friends. Once your five friends have completed their offers, they will ship you the iPod of your choice. Interesting deal. Sounds like a scam at first, but this same place has been around for a while, giving away various other products to get you to sign up with an advertiser.

With the pay for placement market what it is, it doesn’t surprise me to see an advertiser pay top dollar to this company in order to get a sign-up. Let’s do the math:

If an advertiser pays $50 for a sign-up, and in order to get a free iPod, you and 5 friends must sign-up, that’s $300. What’s a mini-iPod go for these days? About $250. That’s a net profit of $50 per person that they make, and I get a free iPod out of it. Interesting business model. Now let’s see if I can get the last two completions I need to get my silver mini-iPod.

Update:
I’m happy to say that I’ve completed my five offers (but click on the links above to help my wonderful wife Dena get hers. Other people are reporting receiving their iPods and are quite happy with the results.

Update #2:
I found a little package on my front porch after work today.

packing slip
This packing slip sure looks interesting….

Behold!
Behold!

Free iPod

My free iPod has arrived, proof to the naysayers that claimed the FreeIpods.com was a scam.