Things you probably didn’t know about Banshee: Part 1

I have been a pretty quiet blogger for the last few months. This is due mostly to the extensive amount of work that has gone into Banshee during this time. After I would reach some milestone where blogging would be appropriate, I’d want to write about it, but just wouldn’t have been able to bring myself to do it. I’m trying to change that now, and as a start, I’ll be writing about new stuff that’s happened in Banshee land in the 0.11.x series.

Scripting Banshee with Boo

Okay, Boo is awesome. During the Mono Summit last November, I wanted a way to be able to work with Banshee’s internal APIs inside of an already running instance. I turned to Boo, and wrote an embedded interpreter which references the loaded Banshee assemblies in the running appliciation domain. It’s called BooBuddy, and I’ll write more about that later. What I’ll share in brevity now is simply that if you’re running Banshee 0.11.2 or later, try pressing CTRL+SHIFT+S and see what happens.

With Boo integrated as an interpreter in Banshee, I decided at the same time it would be a good idea to allow the running of Boo “scripts.” That is, Banshee would load boo files at startup, compile them, and invoke the assembly entry point. Try dropping a .boo file in ~/.gnome2/banshee/scripts and see what happens [1]. In the same location, the .boo files can have normal Banshee plugins coded in them, and they will be compiled and loaded into the normal plugin system. The script’s entry point will be invoked after the script is compiled as well.

This means that it’s possible to write useful snippets of Boo that do cool things against Banshee’s core. Any public API in Banshee is accessible to these Boo scripts, just like plugins. I have been working on adding hooks into useful functionality in core APIs to allow scripts specifically to do extra useful stuff.

Just a few minutes ago, Peter Johanson was crying about spaces in file names that Banshee writes when importing audio CDs, etc. The format of the output path is configurable in the preferences dialog, but it’s very simple. I do not want to expose more complicated formatting options in the UI. I think it’s accepted at this point in time on a UNIX system that ‘File Names Like This.mp3’ are not evil. Now, I wouldn’t name a shell script or a piece of code with that kind of name, but I like my documents and music to have names like that. They look better. I care.

But other people are more hard core traditionalists, and want ‘file_names_like_this.mp3’. What to do? Write a Banshee script, of course. I quickly added a hook to the path formatter, and within seconds, generating those traditional file names with a script like the one that follows was easily possible.

Banshee.Base.FileNamePattern.Filter = { songpath as string |
    songpath.Replace(" ", "_").ToLower()
}

Update: Below is probably a more realistic example, in case you actually want to take advantage of this feature.

Banshee.Base.FileNamePattern.Filter = { songpath as string |
    @/[ ]+/.Replace(@/[^0-9A-Za-z\/ ]+/.Replace(songpath, "" ).ToLower(), "_" )
}

Without the script, for people who like pretty file names:

Unscripted

With the script, for you hard core traditionalists:

Scripted

So, now that this cool functionality has been exposed publicly on the intarweb, I hope we start seeing some cool Banshee scripts starting to float around. You can even post them on the new Banshee Community Forums.

[1] I made a few changes today that allows mixing ‘script’ code and plugins in the same .boo file. Also, before this commit, Banshee looked for an explicit public Main method with no arguments. This meant the script had to provide a def Main(): declaration for anything to happen. With the very latest SVN checkout, no def Main is needed at all, as the Boo compiler will generate an entry point automatically if none is given in code. Assembly.EntryPoint is invoked instead, which is much better than looking for a Main().

I like my pasta with sweat

A few evenings ago I had a strong desire for fettuccine with my some of my awesome alfredo sauce. Nothing fancy, fairly quick, and rather delicious. I thought about it for a few minutes, finishing up some work, trying to find a good pausing place. When I finished, I was filled with much anticipatory joy for the dish. Unfortunately I nearly started breaking things when I saw that my pantry lacked, of all things… pasta. I had a few options: give up, eat something else; go to the store and buy some pasta; or… make some, of course!

I had never made pasta before. I didn’t really know how to other than “add some flour, add some eggs.” So that’s what I did. I started off with way too much flour and not enough egg. Slowly I seemed to balance everything out correctly… my dough was smooth and elastic. I was so worked up in getting the right texture, that I didn’t really think to add anything to it, which I suppose is fine. After about an hour of playing and kneading, and another 40 minutes to let it settle, I had about 5 pounds more than I needed. I broke some off – a workable chunk – and realized that I didn’t have a dough roller. That sucked, but I ended up dismantling a table with a smooth cylindrical leg, which worked fine.

After about 20 minutes of rolling, the dough was flat enough to start cutting. By hand I cut enough fettuccine-esq pieces to satisfy my appetite, and well, tossed the other 5 pounds of dough away – a good learning experience – at least now I know a good ratio. Then after about 10 minutes of boiling, I tossed it with my sauce, and – eugh. It was “okay.” The pasta was way over done and just creepy. But the sauce was good, and I was hungry, so I ate it.

But this experience left me curious. I wanted to make good pasta, and tonight I struck gold. I decided this time to try ravioli – at least it wouldn’t be as annoying to cut by hand. I also decided to play with flavor and color a little too, and strove to be less messy (use a mixing bowl, instead of the counter). What I ended up with was just amazing, and honestly probably one of the very best pasta dishes I have ever had. I guess the whole point of this post is to share my new-found-impromptu ravioli, so here it is:

The Pasta

In a large mixing bowl, mix together very well:

  • 1 1/3 cups flour
  • ~1 teaspoon salt
  • A few good shakes of fresh ground pepper and paprika
  • A small handful of finely chopped fresh spinach

In another bowl, mix:

  • 2 eggs
  • 1 tablespoon olive oil
  • About half of another egg yolk for darker color, save the white for glue later

Then pour the egg into the mixing bowl, and mix, knead, pound, sweat, roll, fold, and stir, dusting with flour as you go. I did this by hand for about 20 minutes non-stop until it was smooth and elastic. Mold a nice ball, dust with flour, and brush on some olive oil. Cover in plastic wrap, and let it sit for about 40 minutes. Move on to the filling.

The Filling

Three words: beef, spinach, cheese. Delightful. Brown some lean ground beef, season lightly. In a mixing bowl, combine one “thing” (tub, maybe a cup, cup and a half) of ricotta cheese, about two cups of mozzarella, and maybe a cup or two of fresh parmesan. Splash in some olive oil, salt, pepper, whatever and mix. Add the ground beef when it’s done, make sure it’s really broken up. Then grab two or three handfuls of fresh spinach, and coarsely chop and add to the beefcheese. Mix it all well.

The Delight

After the dough is ready, roll it out, really thin, and mark the dough in half. Cover one half with a light coating of egg wash (the saved egg white from earlier). On the other half, place generous portions of filling, spaced about 1.5-2 inches apart. Fold the egg-washed side of the dough on top of the filling side, and press into individual raviolis. Cut them out, but leave most of the excess dough on the piece — it’s delicious. Boil them for about 5-6 minutes (FRESH pasta, something I should have thought about with the fettuccine). As soon as you start boiling, begin preparing the plates. I put a light layer of mozzarella and parmesan on the plate with some fresh chopped parsley. When the ravioli is done, place them on the cheese plate, and coat with more cheese, a light coating of olive oil, cracked pepper, and some more parsley. I prepared them large enough that 2-3 pieces is filling and large enough to cover a plate.

EAT. It was amazing.

I wasn’t sure if I should make a sauce or not, but honestly, I didn’t have the timing of the meal down properly to allow for making a sauce without letting something sit when it would be better consumed hot and fresh. But the pasta itself has so much flavor, that a dusting of cheese and oil is all it needs. The filling melts in your mouth. It’s just awesome.

The recipe left me with about 12 pieces of large ravioli. I only cooked and ate three, and am going to see if they keep in the fridge for tomorrow for lunch – just need to boil them. I wish I had taken a picture.

So now I’m thinking…

Dear Lazy Web: I need a pasta machine. I like making pasta now, but spending an hour making the dough, and another thirty minutes rolling it sucks. Any suggestions?

Oh, I’m releasing Banshee 0.11.0 next Monday. MUCH more to come on that, very soon. Readers be warned :-)

More daap-sharp… on Linux

In quick follow up to James’ post about getting daap-sharp working on Windows, I bring you a slightly adjusted version of the same System.Windows.Forms application running under Mono on Linux:

DAAP Browser in SWF

Now for the curious, here’s a zip file (isn’t that the standard “archive” format for winders? I thought I’d keep with the theme :-)) that contains the daap-sharp.dll with Bonjour/mDNSResponder support and browser.exe that is compiled against gmcs/C# 2.0. daap-sharp.dll connects to the same Zeroconf daemon (Bonjour) on both Linux and Windows, no changes necessary due to the Mono.Zeroconf bindings (unless you are running Avahi… just rebuild daap-sharp with Avahi support).

Here’s my slightly tweaked source; only two small changes were necessary to make it build under Mono. I merged all the SWF designer code and cleaned it up a little too. The VS.NET designer thing sure generates some ugly code! SWF makes me proud to develop in GTK ;-).

David on Xgl

Xgl/Compiz offers far more than smooth effects and great graphics far superior to any similar features in other systems, “up and coming” or not. It has the power to make the desktop a much more usable, productive, enlightening, and extensible tool. Hear all about it straight from David in his Novell Open Audio interview.

And when you realize you haven’t yet had enough, check out the plethora of other NOA shows, including my Banshee interview from mid-March. You just can’t get enough of the Illustrious Ted!

Free Airport WiFi?

So apparently RDU now offers free WiFi. Or at least some little food place does (ESSID ‘attwifi’ ). It’s a nice switch from the crappy $8,420/24-hr web-only-must-register WiFi they (and others) had before. There don’t seem to be any port restrictions and the speed and signal strength is great.

What’s interesting is that there is also a ‘tmobile’ ESSID, but I don’t feel like disconnecting to check it out :-D. If I weren’t in such a nice stop right now, I’d move around to see if it was all over. Anyway, thanks RDU!

Spring Cleaning

Lately I had been noticing that my Linode was really slow. I’ve got a fairly decenty setup with 180MB dedicated RAM, but SpamAssassain was making it crawl. Half of my swap was taken up almost immediately on boot. To keep more vital services up, I had taken Postfix down for a few days, so if you sent me any mail to an aaronbock.net/abock.org account, I probably missed it.

Running tail -f /var/log/syslog showed that I was getting hit about 15 times a second from some .ru spammer. I took this as an opportunity to just start over with the linode as it had been untouched in about a year. I noticed that Linode now has a 2.6.16 kernel with TLS support (finally), so I decided to try Hula for mail this time as I am really tired of dealing with Postfix and I hadn’t played with Hula in about 8 months.

All services are back online now, including Banshee SVN, various web sites, and mail. I am running Debian 3.1 (same as last time) with Apache2, MySQL 5, PHP 5.1, and Hula. I was very surprised to see WordPress work with MySQL 5 with only very minimal tweaking. Also, for the first time I decided to just use the Debian unstable packages for everything except Hula and WordPress, and I am very impressed. For the past 4-5 years I had always built my server services stack, but really don’t have time to maintain that anymore.

In the process of all this, I gained about 3GB of disk back by moving things around and merging various disk images, so life should be a little easier. I had been living with about 50MB of free disk for the past 6 months. It was not fun.

And for those who may be considering switching to MySQL 5 with a WordPress 2.0 install, be sure to execute these SQL queries against your migrated WP database:

ALTER TABLE wp_posts MODIFY post_content_filtered TEXT NULL;
ALTER TABLE wp_posts MODIFY pinged TEXT NULL;
ALTER TABLE wp_posts MODIFY to_ping TEXT NULL;

Anyway, Hula is rocking hard. I am a fan. Evolution 2.6 also works great with its integrated Hula client, but I am guessing that it just uses Hula IMAP for mail. Not sure what else this does yet, but I am eager to find out. When I have some more spare time I will get Mono back on the box and play with CalDAV. Wooo.

Changing process name in Mono

Banshee 0.10.5 supports changing the process name from “mono” to “banshee” using the prctl call. This makes “killall banshee” work. While this is nothing to marvel over, I have been a little taken aback by the amount of inquiry over this feature. In the past few days, a large number of people have asked me, “how did you do this.” Here’s a brief description of “how.”

This had been discussed over private email a few months ago, but was recently touched on again as a bug filed against Beagle.

The short answer is, if you want your mono app to be “killall-able,” then do this:

using System.Runtime.InteropServices;
using System.Text;

...

[DllImport ("libc")] // Linux
private static extern int prctl (int option, byte [] arg2, IntPtr arg3, 
    IntPtr arg4, IntPtr arg5);

[DllImport ("libc")] // BSD
private static extern void setproctitle (byte [] fmt, byte [] str_arg);

public static void SetProcessName (string name)
{
    try {
        if (prctl (15 /* PR_SET_NAME */, Encoding.ASCII.GetBytes (name + "\0"), 
            IntPtr.Zero, IntPtr.Zero, IntPtr.Zero) != 0) {
            throw new ApplicationException ("Error setting process name: " + 
                Mono.Unix.Native.Stdlib.GetLastError ());
        }
    } catch (EntryPointNotFoundException) {
        setproctitle (Encoding.ASCII.GetBytes ("%s\0"), 
            Encoding.ASCII.GetBytes (name + "\0"));
    }
}

...

try {
    SetProcessName ("banshee");
} catch (Exception e) {
    Console.Error.WriteLine ("Failed to set process name: {0}", e.Message);
}

Now “killall banshee” works. Also consider using “exec -a banshee ...” in your Bash wrapper to make process listings look better. There are more details provided in the bug, as well as some implications you should be aware of if you do this with your Mono app.

Code snippet updated on 2007-11-12 to show how to support BSD systems and reflect a known fix for 64 bit systems. The above code is known to be bug free and tested in many production applications.

I am on a quest

A few weeks ago, some friends and I decided to have lunch at Ruby Tuesdays. My mission was clear: conqueror the 1 lb burger. Simple. It was amazing, and I am now on a quest for bigger, badder burgers. Perhaps one day, I will dominate this incredible hunk of heart-attack.

The 1lb RT burger

Earlier this week I was a bit spaztastic, obsessing over including SexyIconEntry as the search widget in Banshee, amazed by how much it had improved over the last few months. While this may happen in a future release, I’m holding off on comitting that patch as I really don’t want to make libsexy a dep right now. However, in the process I decided to write GAPI-based C# bindings to libsexy, which are now available in the libsexy-mono module Christian’s SVN repo.

Banshee with libsexy's SexyIconEntry

Jon has been doing some really cool work with a new Banshee source plugin. I’m sure there will be more on this later :-). Also, Fredrik has been hacking on Jon’s SharpMusique to create a Banshee plugin (SharpMusique is an iTms client, and allows purchasing music using your Apple account from the iTunes Music Store). He committed a first pass of the integration plugin (svn co svn://abock.org/trunk/banshee-itunes-plugin), for anyone who wishes to test. At the moment there is no menu integration, and you can only purchase one track at a time, and if you’ve used iTunes 6, your account is flagged, and will not allow purchases (yet). Nonetheless, this is an excellent start :-D

Banshee iTms Plugin

Also last week, I discovered X-Moto and have a new addiction to add to my collection.

X-Moto is super

That is all.

Earthstink Highspeed Offline

Today I drew the line. And then scribbled all over it. And then I drew a straighter line, and I like that line.

Warning: what follows is mostly rant material, but if you’re thinking about switching ISPs, you might want to read :-)

The 1.5 Mbps DSL line that I have is amazingly awful. It’s constantly going up and down. PPPoE is the culprit. Instead of fixing problems however, Earthlink instead blames my Smoothwall. This is not new. Today’s record of service was the worst in a long time: every ten to twenty minutes the connection would be dropped and it would not come back for about five minutes. This went on for about twelve hours.

$ ping -i 5 google.com
...
64 bytes from 64.233.187.99: icmp_seq=1626 ttl=246 time=51.4 ms

Lucklily, it’s been roughly 2.5 hours since it last went down. Let’s see if I can make it through this post.

Committed to solving the problem, this evening I called Earthlink to switch from their DSL service to their cable service. They were offering the same thing Time Warner Cable (TWC) was offering: $30/mo for 6 months and $45/mo after that. I figured the switch would be pretty simple: keep the same account, just move to a different kind of line. At most it should take under a week for “the guy” to give me a cable modem. Aside from wanting a more reliable connection, upgrading to a 5.0Mbps line would be nice – and the uplink would also rock a lot more. Man, I was wrong!

Before calling however, I looked over their services page. The current DSL bill from them is about $50/mo for 1.5 Mbps. However, they now advertise a 1.5 Mbps DSL line for $40/mo and a 3.0 Mbps line for $45/mo. Shows how technology “changes” and they silently keep you locked into a higher rate for a slower connection. That alone should have set off bells in my head. Lovely. Their cable connection was also $45/mo, but 5.0 Mbps. Yes, I think I really want to stick with DSL – I enjoy paying more for less!

So back to the call… we almost had the switch completed, to the point of scheduling a time for the “installer” to drop off the modem, when the representative realizes (after I clearly said I already had DSL service, and had provided verified account information) that I have a DSL account with them (reeeally?), and that before proceeding, they would need to deactivate my DSL. Oh that’s nice! The earliest they could give me cable was around the 30th. I guess I really don’t need any connection for 1.5 weeks. Oh, the dialup should still work though. Glad I have that serial fallback modem.

I proceeded to tell her that I could just as easily call TWC and order their cable Internet service for the same price, and cancel the Earthlink account when the cable was active. She had a very hard time debating this fact, and offered to redirect me to the sales department (I swear that’s where I thought I was). After about 30 minutes of some lovely jazz-flute-over-a-cell-phone (in loud speaker mode, of course), I described the problem. The result: well, there was no result. The only way to activate the cable service was to deactivate the DSL. It’s a technical issue that no one has figured out how to overcome. Riiiighhht.

I let myself calm down a little, and called TWC. My were they friendly! I informed the sales woman that I currently have Earthlink DSL and am interested in switching to TWC Broadband. Immediately I could hear her voice raise an octave, full of excitement. She informed me that because of my current DSL situation, I was eligible for TWC Broadband for $30/mo for 12 months. Awesome. What came next was even better: after processing the order, she asked when I wanted it installed, to which I replied “as early as possible.” How does Friday sound? “Are you kidding me? This Friday? I could kiss you.”

Also, the TWC representative asked me “what Windows do you have?” I said I didn’t have any Windowseses but it didn’t matter. She then clearly explained that as long as the installation technician could verify that an IP address was being assigned, it did not matter. Rock on. I dig no bias.

So good-bye Earthlink, you lose. I sure can’t complain about 5.0 Mbps service for $360/yr. Sure beats $600/yr for 1.5 Mbps. Now let’s break this down a little bit:

Earthlink 1.5 Mbps DSL @ $50/mo = $33.3/1 Mbps/mo
TWC 5.0 Mbps Cable @ $30/mo = $6/1 Mbps/mo

Holy shit.

Now of course, that’s just for the first year. After that:

DSL @ $50/mo = $33.3/1 Mbps/mo
Cable @ $45/mo = $9/1 Mbps/mo

Something tells me that’s still awesome.

Two Ends of the Spectrum

So much has happened in my coffee world since my last post. Thanks to everyone who posted great insight.

Currently, this is my situation: there are two coffee lovers in me. There’s the addict, who must have some form of coffee at relatively regular intervals throughout the day, and then there’s the guy who can relax for a moment to enjoy a really good cup.

I wanted to try a pressure brewer for convenience, but after reading everyone’s comments on the last post, I decided to pull my french press out of storage. After cleaning it out, I went to this nice local coffee place and purchased some Nicaraguan beans, came home, and threw some in the grinder. I then fell in love with the french press :-). The sad thing is that before yesterday, I think I had used it maybe twice. I’ve used it four times since yesterday.

At some point this week I’m going to return the piece of junk Black & Decker HCC100 Pressure Brewer and get the Senseo. It sits on my desk, and is ready to deliver a decent cup of coffee with one press of a button. The HCC100 makes decent coffee, but it has awful reviews and very, very poorly manufactured.

I also had an urge for cinnamon today (and Bulgarian chocolate nut), so I added some [cinnamon] to the grounds in my last “press.” It’s very delightful. I guess the new Folgers cinnamon commercials made me do it.

My conclusion: the pressure brewer delivers “On Demand” coffee services, and the french press relieves you of the guilt of using the pressure brewer. Both actually solve my original problem of coffee being too hot when made by a drip machine, because the water has time to cool with the french press, and the pressure brewer sucks enough to not heat the water up to the same temperature as the drip machine. How neat.