Hello World!

There’s nothing like starting a new year with a new job.

This is officially Day One on the job (I’m counting yesterday as Day Zero) as Yorba’s production engineer. I wear quite a few hats here: I sit on the front line of support and testing and also take care of the website, office matters and systems.

I am also the self-appointed director of happy hour.

I’ve known Adam for several years and it’s been very exciting to watch from the sidelines and see how Yorba has gone on build the most widely used photo manager on Ubuntu. It’s a real pleasure to be a part of the team and help contribute to these awesome products and the free desktop.

A little about me:

I’m a general purpose nerd. I’m an avid board game fan, I love pinball, can’t get enough of BSG and can solder a mean joint. San Francisco truly is a paradise for us geeks!

I dig communities. I’ve managed developer relations for software companies for the past several years and am BIG on making sure you guys and gals are having a good time with our products (or at least letting me know where it hurts).

So don’t be a stranger! I look forward to getting to know some of you, our users, in the coming weeks.

 

Posted in Yorba | 5 Comments

Shotwell 0.11.6 Released!

Yorba has just released Shotwell 0.11.6, a bug-fix release of our popular GNOME-based photo manager. This release fixes a critical bug in which adding or modifying tags in the single-photo view could result in the loss of tag data. We recommend that all users upgrade.

Download a source tarball from the Shotwell home page at:
http://www.yorba.org/shotwell/

Or grab a binary for Ubuntu Natty at Yorba’s Launchpad PPA:
https://launchpad.net/~yorba/+archive/ppa

Ubuntu Oneiric ships with Shotwell 0.11.x pre-installed. Oneiric users will be upgraded to Shotwell 0.11.6 automatically as part of their regular software update cycle.

Posted in Announcements, Shotwell | 20 Comments

A few of my favorite Vala things: interfaces

In my prior post on Vala’s language features, I discussed enums and how I appreciated Vala’s implementation of them.  I feel that Vala’s enums straddle an interesting line of utility and pragmatism.  It took me a while to learn about their features, partially because documentation has been sparse (but is getting better) and partially because as a C / C++ / Java programmer, I’d had hammered into me a set of expectations about enums that Vala didn’t quite adhere to.  (I had a similar learning curve, for many of the same reasons, about Vala’s lock keyword.)

Learning interface in Vala was a similar experience.  Consider the Java Language Specification’s opening statement about interfaces, which Vala’s interfaces look to be a descendant of:

An interface declaration introduces a new reference type whose members are classes, interfaces, constants and abstract methods. This type has no implementation, but otherwise unrelated classes can implement it by providing implementations for its abstract methods.

Compare to this statement in the C# Programmer’s Guide:

Interfaces consist of methods, properties, events, indexers, or any combination of those four member types. An interface cannot contain constants, fields, operators, instance constructors, destructors, or types. It cannot contain static members. Interfaces members are automatically public, and they cannot include any access modifiers. … The interface itself provides no functionality that a class or struct can inherit in the way that base class functionality can be inherited.

What’s interesting about Java and C# interfaces is what they can’t provide: implementation.  Interfaces are often touted as a sane solution to the problems surrounding multiple inheritance, but it always struck me as odd (and a bit of a blind-spot on the part of their boosters) that interfaces provide no reusable code.  After all, isn’t that the name of the game?  Especially for a technique that’s replacing a form of inheritance, which is all about reusable code?

(I have a pet theory that if one was to study the history of the development of software development technologies — languages, tools, paradigms, all of it — it’s primarily a history of reusable code.  How much money and manpower has been dumped into this holiest of Holy Grails: write once, debug a bit more, reuse a billion times.)

Like enum and lock, Vala offers an interesting interpretation of interface with a couple of surprises.  I’m not sure how much of it is due to the mechanics of GTypeInterface, Vala’s influences from Eiffel, or simply a reflection of Jürg’s vision, but it’s cool all the same.

Let’s start with a simple Vala interface that looks familiar to any Java or C# programmer:

interface Agreeable {
    public abstract bool concur();
}

In-the-know Java programmers will say that the public and abstract keywords are allowed but not required; in C#, they’re simply not allowed.  But in Vala, neither are optional:

interface Agreeable {
    bool concur();
}

produces this compiler output:

error: Non-abstract, non-extern methods must have bodies

That seems to suggest that non-abstract, non-extern methods in interfaces can have bodies (“must implies can”, kind of a programmer’s variant of Kant’s argument from morality).

And sure enough, this will compile:

interface Agreeable {
    public bool concur() {
        return true;
    }
}

What’s going on here?  Simple: reusable code.

Vala interfaces are much more than hollow declarations of required methods.  Interfaces are full-fledged members of the object hierarchy, able to provide code to inheriting classes.  The reason an interface is not an abstract class is that an interface has no storage of its own, including a vtable.  Only when an interface is bound to a class (abstract or concrete) is storage allocated and a vtable is declared.  In other words, while the above is legal, this is not:

interface Agreeable {
    bool yep = true;

    public bool concur() {
        return yep;
    }
}

gets you this:

error: Interfaces may not have instance fields

Bingo.  That boolean is a member instance, which requires instance storage, which an interface does not have by itself.

So what good is allowing an interface to provide reusable code if it has no fields of its own?  There’s a number of patterns of use, in particular Facade-style methods.  For example, an interface could declare a handful of abstract primitive methods and offer a helper method that uses them in concert according to contract:

interface Agreeable {
    public abstract bool concur(int i);

    public abstract string explanation(bool concurred);

    public void process(int i) {
        if (concur(i))
            stdout.printf("Accepted: %d %s\n", i, explanation(true));
        else
            stdout.printf("Not accepted: %d %s\n", i, explanation(false));
    }
}

class OnlyOdds : Agreeable {
    public bool concur(int i) {
        return (i & 0x01) == 0x01;
    }

    public string explanation(bool concurred) {
        return concurred ? "is odd" : "is not odd";
    }
 }

class OnlyMultiplesOfTen : Agreeable {
    public bool concur(int i) {
        return (i % 10) == 0;
    }

    public string explanation(bool concurred) {
        return concurred ? "is a multiple of ten" : "is not a multiple of ten";
    }
}

First, note that the implementations of concur() and explanation() in the classes don’t use the override keyword even though you must use the abstract keyword in the interface.  I’m not sure of the reasoning, but so it goes.

Also know that virtual methods, signals, and virtual signals have their own peculiarities with interfaces.  I’ll deal with them in another post.

So, a pretty contrived and very silly example, but notice how process() understands Agreeable’s interface and contract and hides those details behind a single method call.  This is useful.

Going back to those language specifications earlier, remember that Java and C#’s interfaces cannot contain static methods.  In Vala they can:

interface Agreeable {
/* ... */
    public static void process_many(Agreeable[] list, int i) {
        foreach (Agreeable a in list)
            a.process(i);
    }
}

This allows for binding aggregator-style code with the interface itself, rather than building utility namespaces or classes.  Again, this is useful.

However, if the following code is written:

Agreeable[] list = new Agreeable[2];
list[0] = new OnlyOdds();
list[1] = new OnlyMultiplesOfTen();

Agreeable.process_many(list, 10);

you get this compiler error:

error: missing class prerequisite for interface `Agreeable',
add GLib.Object to interface declaration if unsure

What’s this about?

It’s due to another freedom in Vala that is lacking in Java and C#.  Vala classes don’t have to descend from a single master class (i.e. Object).  Unlike the other two languages, if a Vala class is declared without a parent, there is no implicit parent; Vala registers the class with GType as a fundamental type.  If you don’t know what that means, read this.  You probably still won’t know that that means, however.

Because Agreeable is declared without a prerequisite class, Vala can’t produce the appropriate code to store it in a tangible data structure, in this case, an array.  (Update: As Luca Bruno explains in the comments, this is because of Vala’s memory management features.)  This solves the problem:

interface Agreeable : Object {

What this means is that any class that implements Agreeable must descend from Object (i.e. GObject), meaning we need to change two other lines in the code:

class OnlyOdds : Object, Agreeable {

class OnlyMultiplesOfTen : Object, Agreeable {

Although Agreeable now looks to descend from Object, it does not.  It merely requires an implementing class to descend from Object.  (A subtle difference.)  Interfaces can also require other interfaces, and like classes, it can require any number of them:

interface Agreeable : Object, Insultable, Laughable {

Like requiring Object, this means that any class implementing Agreeable must also implement the other interfaces listed (Insultable, Laughable).  This does not mean that Agreeable must implement those interfaces’ abstract methods.  In fact, it can’t, one place where code reuse can’t occur.

Prerequisites also mean that Agreeable’s code can rely on those interfaces in its own code, and therefore can do things like this:

interface Agreeable : Object, Insultable, Laughable {
/* ... */
    public void punish(int i) {
        if (concur(i))
            laugh_at();
        else
            insult();
    }
}

… where laugh_at() is an abstract member of Laughable, insult() is an abstract member of Insultable, and of course concur() is its own abstract member.  In other words, because Agreeable knows it’s also Insultable and Laughable, it can treat itself as one of them.

It’s easy to go crazy with interfaces, prerequisites, and helper methods, but most great languages have their danger zones of excess and abuse — features that are the hammer that makes everything look like a nail.  Still, I think code reuse is the most important goal of any programming technology — language, tool, or paradigm — and I’m glad Vala has given it some thought in terms of interface.

Posted in Hacking | Tagged , , | 15 Comments

Help test Shotwell with the daily build PPA

Great news for folks helping test Shotwell on Ubuntu 11.10 (Oneiric) — we have a daily build PPA for you!

WARNING: Shotwell daily builds are for testing purposes only. We highly recommend that you only manage your important photos with a release build.  Please backup your ~/.shotwell folder and your Pictures folder before installing and testing with this pre-release version of Shotwell.

Okay, you read that warning, right?  Great! The PPA address is: ppa:yorba/daily-builds

If you find any issues in testing, please report them here. For more details on providing the best possible bug report see our FAQ.

Posted in Shotwell | Tagged , , , | Leave a comment

Shotwell 0.11.5 Released!

Yorba has just released Shotwell 0.11.5, a bug-fix release of our popular GNOME-based photo manager. This release fixes an issue in which Shotwell could crash when using the “Import from F-Spot” feature for the subset of users who continued to experience this problem after the 0.11.4 upgrade. We recommend that all users upgrade.

Download a source tarball from the Shotwell home page at:
http://www.yorba.org/shotwell/

Or grab a binary for Ubuntu Natty or Oneiric at Yorba’s Launchpad PPA:
https://launchpad.net/~yorba/+archive/ppa

 

Posted in Announcements, Shotwell | 4 Comments

Shotwell 0.11.4 released!

Yorba has just released Shotwell 0.11.4, a bug-fix release of our popular GNOME-based photo manager. This release fixes two critical issues present in all previous versions of Shotwell 0.11.x that could cause Shotwell to crash when using the “Import from F-Spot” feature. We recommend that all users upgrade.

Download a source tarball from the Shotwell home page at:
http://www.yorba.org/shotwell/

Or grab a binary for Ubuntu Natty at Yorba’s Launchpad PPA:
https://launchpad.net/~yorba/+archive/ppa

Posted in Announcements, Shotwell | 5 Comments

Shotwell 0.11.3 released!

Yorba has just released Shotwell 0.11.3, a bug-fix release of our popular GNOME-based photo manager. We recommend that all users upgrade. This releases fixes two critical bugs, including:

  • Shotwell could crash at the end of photo imports where one or more files failed to import correctly
  • Showell crashed when a new tag containing a slash (“/”) character was created by context-clicking on the “Tags” item in the sidebar and choosing “New”

and improves error reporting in the publishing system.

Download a source tarball from the Shotwell home page at:
http://www.yorba.org/shotwell/

Binaries for Ubuntu Natty will soon be available at Yorba’s Launchpad PPA:
https://launchpad.net/~yorba/+archive/ppa

Posted in Announcements, Shotwell | Leave a comment

Continuing adventures of the Travelling Gnome

For the past month the Yorba offices were home to a strange two-faced creature.  As of today, the little guy left our offices to embark on the next stage of his journey around the world.

Here’s some vacation photos of the Travelling Gnome’s stay here in San Francisco.

Taking in the view at Dolores Park

Checking out the cable cars

Visiting the historic Mission San Francisco de Asís

Counting sheep

Enjoying a latte

At a San Francisco GNOME hacker meetup

For more on the Travelling Gnome, visit his website.

Posted in GNOME, Yorba | Tagged , | Leave a comment

PirateBox at Yorba

The strangest item on my desk — at the moment — is a PirateBox.

What is a PirateBox, you may ask?  At first glance it appears to be a Jolly Roger lunch box plugged into the wall.

But it’s more than that; it’s a wifi network for sharing files locally. All you have to do is point your wifi-enabled device at the “PirateBox” network, open a browser and try to load any page. You’ll be directed to a list of files to download and given the opportunity to upload your own.

At the moment, it’s filled with an assortment of video game music, an important textfile about Pascal, and a free album by gangsta nerd rap superstar ytcracker.

It’s all anonymous, at least as anonymous as any unsecured wifi network can be. The device isn’t connected to the internet so you have to be in (or very close to) our office to use it.

I built the box using an router capable of running open source firmware, following directions on the official PirateBox wiki. The storage is all on a cheap USB thumb drive.  Everything was installed and assembled at our local hackerspace, just around the corner from the office.

As far as hobby electronics projects go this one is pretty simple to do, relatively cheap (less than $150 USD) and occasionally exciting as unexpected new files show up.

Posted in Hacking | Tagged , | 2 Comments

The “I use Shotwell as a photo manager” Flickr pool

One tangible reward with writing software is to see your hard work put to practical use.  A great place to see Shotwell put to work by “average” users is at the “I use Shotwell as a photo manager” Flickr photostream.  I put quotes around “average” because these photos were not produced by average users in any way — whether or not they’re sophisticated computer users, they certainly have an above-average command of light and lens.  The next time someone says open-source software hasn’t produced anything useful for the “average” user, send them to this Flickr group’s page.

Browse the entire collection when you get a chance, there are some great ones.  I’ve embedded below a few that caught my eye, but there’s plenty more to admire in the almost 400 photos (and counting) in the pool. I can’t say with any certainty how involved Shotwell was in the process of producing these fantastic images, but I like to believe it was more than a little…

Misty Morning

DSC_8460

Qui disait que les yeux étaient les fenêtres de l'âme?

We're gonna need a bigger boat

Nets,sun and bird.

blind

Mountain Stream, waterfall

Rosemajella Fishing Boat (Rathlin Island)

Blue tit

The Morning Mist

Happy worker

Posted in Shotwell | Tagged | 1 Comment