NSLU2, Grilo and UPnP in Ubuntu’s GNOME

Going quickly to the “ham”, if you are running Ubuntu Precise on your machine and want to have Grilo support including its UPnP plugin in totem and rhythmbox just add Grilo Team‘s PPA:

~#  sudo add-apt-repository ppa:grilo-team/ppa

Then, pull down the latest list of software including the PPA you just added:

~#  sudo apt-get update 

Install the needed packages and upgrate any old one:

~#  sudo apt-get install totem rhythmbox grilo-plugins-0.1
~#  sudo apt-get upgrade

That’s it! Enjoy your Grilo powered totem and rhythmbox!

Now, the long boring story 😉

Last weekend I found some time to resurrect my dear NSLU2 which passed away some months ago when its attached USB hard drive started failing. I have reports from several USB hard drives dying while being attached to a NSLU2 so I may have to take a look to that at some point, but that would be in another moment.

Thanks to good Martin Michlmayr I only had to follow quickly his installation guide and I could have the Debian Squeeze firmware image he provides running smoothly in a matter of minutes.

Afterwards, I followed the counsels of Juan and Mario to tweak my Slug.

The customization to highlight was adding a MediaTomb server since one of the main features that I wanted to add to my Slug was the possibility of serving audio and video through UPnP.

Everything seemed in place but, when I checked in my desktop running Ubuntu Precise how to access my music from rhythmbox and my videos from totem I had a sad surprise. None of them have UPnP support and, what is worse, none of them have Grilo support out of the box in Precise. And I say worse because, among other plugins, Grilo already provides UPnP support and AFAIK, totem and rhythmbox have upstream Grilo plugins for quite some time already.

So, what was the problem? Why weren’t they in Precise?

Well, in the case of rhythmbox it seems just a small mistake in the debian packaging, as it is pointed in this report in Launchpad’s bug 973295. Astonishingly, it has not yet been fixed!

Hence, I downloaded the sources for the precise-proposed rhythmbox’s package and I did the proper changes and uploaded it to the Grilo Team PPA.

Rhythmbox and Grilo 0.1

“Rhythmbox and Grilo 0.1”

In the case of totem what happened was that Grilo’s plugin was removed as for the version that was packaged for Precise, in the road to add a new and better plugin for Grilo 0.2. Which is what it is in totem upstream nowadays.

Therefore, I re-took the old patch for totem’s Grilo 0.1 plugin in GNOME’s bug 628648, downloaded the sources for the precise-proposed totem’s package, patched and uploaded it to the Grilo Team PPA.

Totem and Grilo 0.1

“Totem and Grilo 0.1”

In the path for all these changes I joint the Grilo Team at gitorious and made also some changes to its packaging.

Now I can enjoy my UPnP served music and videos from my favorite applications in GNOME!!!

Hopefully, for the next Ubuntu’s release we will have Grilo 0.2 already integrated and totem will come with its plugin out of the box. By now, rhythmbox’s Grilo plugin has yet not been migrated.

Grilo 0.2 is a great library for accessing the media content from several resources. Juan, the Grilo master, has been working in Igalia writing a new, clean, easily extendable and powerful API that is ready for use and which keeps enhancing everyday. However, Grilo’s adoption is coming surprisingly slow. Out of GNOME other projects have shown quite some interest as it was the case of Media Explorer, but in GNOME I only know of its support by the 0.2 version in totem. Anyone willing to bring the power of Grilo to Music, rhythmbox, banshee and the like? 😀

Update: It seems I rushed too much since Jonathan Matthew migrated rhythmbox Grilo plugin to 0.2 pretty recently. Thanks Matthew!

Tasting some more Spain at GUADEC

GUADEC’s core days finished on Sunday. Some people departed then but still quite a lot of hackers have stayed for the three days of BoF, workshops and hacking.

If you are one of those, you may have already taken a good taste of what Galicia and Coruña can offer.

Therefore, I’m posting this entry to suggest a new option for the ones wanting to try new things from the vast offer os Spanish products.

Coruña is holding these days one of its most important annual festivals and because of that other regions of Spain have set a small town representing them and their typical food and products in the city center. This town has been placed in the “Jardines de Méndez Núñez” (Méndez Núñez’s gardens):


Ver mapa más grande

Castilla y León, Asturias, Castilla la Mancha, Cantabria, Andalucía y Aragón are the Spanish regions that have an own “house” in this town, although there are several other regions missing.

In their houses you will be able to find good food, usually as tapas, and good drinks. The price rates are a little bit higher than in the local “tapas” places but quite cheap nevertheless.

You are welcome to visit them and try some products, like morcilla (black pudding), from my own region: León.

Regional Houses in A Coruña

“Certamen de casas regionales”, by Septem Trionis

GUADEC 2012 T-Shirts and other [d|r]usty artwork

Let’s go quickly to the important stuff: I’ve been helping the great team that is organizing GUADEC 2012 in A Coruña. I cannot count myself among this amazing group of people since I’ve scarcely devoted any time to the tasks they needed from me but this is the result out of it, in the shape of a t-shirt 🙂

GUADEC 2012 Attendant T-Shirt

I cannot get all the credit of it, I was basing the final design on the previous work done by William Carlson and some drafts done by Alba Castro. You can find all the material in this public git repository hosted at Igalia.

Also, I did a small variation for the t-shirts of the staff, which will be red. This is back of the female’s version:

GUADEC 2012 Staff T-Shirt

Doing artwork for GNOME events is no new thing for me. I’ve been regularly doing some stuff for them. Some just for Igalia, my company, but also some other for the event itself.

2010

Last thing I designed before 2012 were the t-shirts (again) for the GUADEC-ES 2010 that took place also in Coruña. I got inspired that year by the soccer world cup that would be won by Spain (yeah!!!). Here you can see the 3 versions, starting by the Brazil one:

GUADEC-ES 2010 Brazil T-Shirt FrontGUADEC-ES 2010 Brazil T-Shirt Back

Denmark:

GUADEC-ES 2010 Denmark T-Shirt FrontGUADEC-ES 2010 Denmark T-Shirt Back

And a female’s version:

GUADEC-ES 2010 Female T-Shirt FrontGUADEC-ES 2010 Female T-Shirt Back

This last model is the one that holds the final sorting of the back logos that was printed for all the t-shirts. Actually, Xulia Barros, from FreeWear did a small modification to the final design leaving some space among the lines for the “7” in the back.

Again, you can find all the material in this public git repository hosted at Igalia.

2006

Even before 2010 I found myself tangled with The Gimp, Sodipodi and Inkscape, later. In 2006 I did a small design for that year’s GUADEC-ES which consisted on the header:

GUADEC-ES 2006 Header

and foot of its webpage:

GUADEC-ES 2006 Foot

The lady was inspired on Pasiphaë who has a sculpture in Vilanova’s see shore while the sea tide was inspired by The Great Wave off Kanagawa.

You can find all the material in this public git repository hosted at Igalia.

And finally getting to the end … or maybe better the beginning.

2005

In 2005 Coruña was hosting for the first of several times the GUADEC-ES. For that event I did most of the artwork that was used. Web page, printed banners, badges, talks’ book, but one of the things that I was most proud of was the animated banners that were featuring for some time in Barrapunto, the Spanish version of Slashdot:

GUADEC-ES 2005 Banner Animation

And I learn to do it the hard way. You cannot imagine how difficult was by the time to do a GIF animation with The GIMP!

Also, that year was a great one for the t-shirts. Most of the attendants liked them and we had them in several colors: red, green, blue, orange and, as always (or almost 😉 ), black. I think that was once in a lifetime for a hacker’s conference 😀

GUADEC-ES 2005 T-Shirt

Even, with Chema‘s help, the master of organizing events, I was experimenting with some sketches done directly in the sand, from which I got inspired to do the rest of the material:

GNOME in the sand

Of course, you can find all the material in this public git repository hosted at Igalia.

BTW, if you have been able to read this boring post until here, you are my hero 😀

GUADEC is at home … and I’m abroad

Or kind of … because unlike you may guess from the title, I’m actually attending mighty GUADEC 2012

Attending GUADEC 2012 badge

I’ve attended GUADEC 2006 in Vilanova i la Geltru, GUADEC 2007 in Birmingham, GUADEC 2008 in Istanbul and the Desktop Summit in Gran Canaria as a guest in all of them.

Finally, this year the event comes home but, funnily enough, I moved to Helsinki some months ago so I’m again a visitor. Now in A Coruña 🙂

Honestly, I can’t wait to attend some of the talks and meet again the GNOME folks. Also, my mates Igalians are featuring quite some talks in the program meanwhile Igalia itself has been doing quite an effort to host some of the hackfests and meetings that are happening during these days.

And not only that!. As I was saying, I’m a visitor again so I only have pending to thank Igalia again for sponsoring my trip!

Igalia

Extending the life of your N8x0: Second update for Automatic Skype Launcher

Back again with a new release, the 0.0.3, of Applications Fullscreener and Automatic Skype Launcher.

Just download and install them in your N8x0 for making it become a good 24/7 Skype phone. For more information about the goals and features of this project you can check the previous post Extending the life of your N8x0: Automatic Skype Launcher.

Skype Tango Icon

I took the chance to update also the artwork used in these two applications. First thing, I created a Tango-ized version of the Skype logo.

Then, I used the previous magnificent art works from Andreas Nilsson and Jakub Steiner to create the new icons, and these are the result:

Applications Fullscreener Icon Applications Fullscreener Debian Package Icon Applications Fullscreener Icon Applications Fullscreener Settings Icon

Anyway, going to the actual changes.

The most important change for Applications Fullscreener is:

  • There was a second bash helper to launch a certain application and send the fullscreen key event some time afterwards. It was not fully featured but now it is.

You can, also, check the complete ChangeLog for Applications Fullscreener.

The most important changes for Automatic Skype Launcher are:

  • The Automatic Skype Launcher service was not stopping when uninstalled. Now this is corrected.
  • The init service was not starting correctly in some scenarios due to some uninitialized variables. This has been corrected.
  • In the previous version, I added an alarm triggered by the alarmd daemon to restart Skype (and the service). This was not working always. Now, killing Skype is forced.

You can, also, check the complete ChangeLog for Automatic Skype Launcher.

That’s it. Comments and patches are welcomed!

Extending the life of your N8x0: Update for Automatic Skype Launcher

I’ve just released the 0.0.2 version of Applications Fullscreener and Automatic Skype Launcher.

As I was already commenting in my previous post Extending the life of your N8x0: Automatic Skype Launcher, just download them and install them in your N8x0 for making it become a good 24/7 Skype phone.

The most important change for Applications Fullscreener is:

  • I’ve added a helper to launch a certain application and send the fullscreen key event some time afterwards.
    This is specially useful for launching an application through the DSME watchdog daemon in Maemo4.x. Using this helper as a wrapper, the application will receive the fullscreen event some time after being launched while the watchdog keeps track of the helper. In this case, if either the helper or the application dies, both die and, hence, the DSME will relaunch them both.

You can, also, check the complete ChangeLog for Applications Fullscreener.

The most important changes for Automatic Skype Launcher are:

  • I’ve added a Control Panel plugin for setting several behaviors of the application: starting an init service, using a watchdog for keeping it alive, trying to fullscreen Skype after launching it as a service and the time at which the service will be restarted, if so.

Automatic Skype Launcher Control Panel plugin snapshot

  • I’ve added a Home Desktop applet for making it easier to launch manually Skype, not having to get into the applications menu.

Automatic Skype Launcher Home Desktop applet snapshot

  • The Automatic Skype Launcher service was not stopping when the N8x0 was turned off while charging. Now this is corrected.
  • In the previous version, I added a cron.daily script to restart Skype (and the service). Actually, the N8x0 doesn’t have a cron daemon, by default. This is now corrected through the usage of an alarm triggered by the alarmd daemon.

You can, also, check the complete ChangeLog for Automatic Skype Launcher.

That’s it. Comments and patches are welcomed!

Extending the life of your N8x0: Automatic Skype Launcher

Leading quickly to the “ham”, just install Applications Fullscreener and Automatic Skype Launcher in your N8x0 and turn it into a Skype phone. Now, the long explanation 🙂

After working in Maemo and MeeGo for the last 5 years I’ve become the proud owner of a N810, a N900, a N950 (by now) and a N9. Obviosly, my old and beloved first maemo device, the N810, has been pushed into the background.

Thinking about how to still keep doing a good use of it, came to my mind the idea of turning it into a Skype phone. Nokia’s hardware is superb and the sound quality of the N810 makes it a good choice for this.

Still, I didn’t need another Skype phone myself but my parents, who have a lot of troubles for making use of Skype’s software in the computer, were the perfect candidates. Also, placing the N810 24/7 online side by side to their land line phone would let them receive and check at any moment for the availability of their regular Skype contacts. That’s it, my oldest’s brother family, who lives in Germany, and myself, who have already spent the last year and half in Finland and will be there, at least, for another six months.

Therefore, I copied all the remaining data out of the N810, cleaned the internal MMC and re-flashed the device with the latest available image and the needed flasher. Afterwards, and for having an easy way for maintaining the device, I upgraded to the OS2008 Feature upgrade and installed Skype, openssh and x11vnc packages. Also, I set the “Red Pill” mode in the Application Manager and added the following repositories:

~# cat /etc/apt/sources.list.d/hildon-application-manager.list
deb http://repository.maemo.org/extras-devel/ diablo free non-free
deb http://repository.maemo.org/ diablo/tools free
deb http://catalogue.tableteer.nokia.com/certified/ diablo user
deb http://catalogue.tableteer.nokia.com/non-certified/ diablo user
deb http://catalogue.tableteer.nokia.com/updates/diablo-2/ ./

In addition, after being able to ssh into the device, I installed the screen package.

Then, I set the connection manager to be connected to my parents WiFi automatically, without energy saving, with the smallest searching intervals, in case it would lose connection, and with unlimited inactivity time.

I modified the display settings for having the bright level, the bright timeout and the timeout for turning it off to the maximum, unchecked the option for blocking the display and keyboard on turning the display off, and set the display to not being permanently on ever. In the LEDs settings I left everything checked but when the device is on.

Because of the possibility of connecting with a bluetooth headset, I also set the bluetooth to be always on and visible.

Finally, I launched Skype and configured a new account for my parents.

The only thing left was to be able to launch Skype automatically at boot time and in fullscreen mode. As I said before, my parents are not really skilled on technology or gadgets use so the simplest approach would be to have a fully working Skype client just after booting and with no more distractions that the contacts list and the button for calling.

Automatic Skype Launcher Icon

I’ve developed the package skype-autolauncher for this task. This package would launch Skype automatically on boot time through a init script. Yes, I know it is not the cleanest way but it just works™ and other strategies are not much cleaner. The init script makes use of dsmetool to monitor the Skype instance so, if it crashes, or is closed by mistake, the application is relaunched. Also, this package adds a cron.daily task which will restart the service so it will also shut down and re-launch Skype for having fresh memory and a healthier running environment.

Automatic Skype Launcher’s code is kept in gitorious. For downloading the code, just type in a terminal:

$ git clone https://git.gitorious.org/skype-autolauncher/skype-autolauncher.git

Applications Fullscreener Icon

For the matter of automatically turning the launched Skype instance into fullscreen mode, I’ve also developed the package apps-fullscreener. This package sends a fake fullscreen hard key event to a XWindow by its process name.

Applications Fullscreener’s code is also kept in gitorious. For downloading the code, just type in a terminal:

$ git clone https://git.gitorious.org/apps-fullscreener/apps-fullscreener.git

That’s it. Comments and patches are welcomed!

Taking back the old scrollbars in Ubuntu

Today I couldn’t take it any more and I had to do it …

I’m a Thinkpad Lenovo X61s owner with which I don’t use nor miss a mouse thanks to the awesome TrackPoint included. Because of that, the new Ubuntu’s scrollbars are, from the user interactivity point of view, just not usable.

Leading quickly to the “ham” 🙂 , disabling them is just a matter of writing in a console:

$ sudo echo "export LIBOVERLAY_SCROLLBAR=0" > /etc/X11/Xsession.d/80overlayscrollbars

and reboot.

I’m not saying that the new scrollbars aren’t an enhancement. They allow a better usage of the display but, from the functional point of view, they only work as positioning indicator. They will tell you the progress in the scrollable window but, necessarily, you will need a wheel in your mouse or a way to emulate it. If you often have to grab the scrollbar, from a functional point of view, they are just a failure.

Hence, you will miss in Ubuntu a way to tune on or off its usage without having to use these kind of “hacks“.

Of course, another alternative would have been “to emulate” the mouse wheel through the middle button. I my case, this is not an option since last time I walked this path I decided to have a better “select and paste” experience with this button rather than use it as modifier for the vertical/horizontal scrolling.

Anyway, if you want to use the middle button this way, you had to do some changes to the “XOrg” config file before. Now, you just have to install the “gpointing-device-settings” package:

$ sudo aptitude install gpointing-device-settings

and select the proper options after launching its UI from “System -> Preferences -> Pointing devices“.

This and many other tricks can be found at ThinkWiki.

Who knows, maybe, in some time, I will change my mind and retake this functionality (and the new Ubuntu scrollbars) …

QUrl (mis)usage: appendix, avoid automatic cast from QString

As I was introducing in the former entry QUrl (mis)usage, the direct creation of a QUrl from a QString should be avoided in any software that is not trying to smartly guess what a user input should lead to.

So, going directly to the ham, to avoid mistakes due to automatic conversions from QString to QUrl, I encourage the usage of the QT_NO_URL_CAST_FROM_STRING macro. The only thing you have to do is adding a line to your qmake project file like this:

# Avoid automatic casts from QString to QUrl. Dangerous!!!
DEFINES += QT_NO_URL_CAST_FROM_STRING

Or add it directly to the compilation line, like this

g++ ... -DQT_NO_URL_CAST_FROM_STRING ...

As I was pointing in my previous post, the usage of QUrl::fromLocalFile(QString) and QUrl::fromEncoded(QByteArray, QUrl::StrictMode) is recommended when dealing with QString and QUrl, but committing mistakes is a human condition so it is pretty easy to end passing a QString as a parameter to some API expecting a QUrl, or assigning a QString to a QUrl with the “=” operator through the C++ automatic cast mechanism which is implemented in the QUrl class. That’s why forbidding these automatic casts in our code is of such importantance.

QUrl (mis)usage

Lately, I’ve been developing some software which makes an intensive usage of QUrls as resource locators for local files. Nothing wrong here. QUrl is a powerful way of sharing the locations of those in an universal way. The problem is when you construct those QUrls from QStrings and you actually forget that QUrls are meant for much more than representing local file locations.

Authority chunks on an URL

Authority chunks on an URL

At the moment of writing this, QUrl documentation, although quite complete, could be much more explanatory. For example, it says that the recommended way for creating a QUrl from a QString is:


* When creating an URL QString from a QByteArray or a char*,
always use QString::fromUtf8().
* Favor the use of QUrl::fromEncoded() and QUrl::toEncoded()
instead of QUrl(string) and QUrl::toString() when converting
QUrl to/from string.

But this is explained in the documentation for QUrl::fromUserInput(), instead of in the Detailed Description [ 1 ].

What is important from this explanation is that it is not a matter of favor the use of QUrl::from/toEncoded() over QUrl::(from)toString() but, I would say, a must if you don’t want to end up with bogus corner cases.

Why would this happen? Well, as I was saying, QUrl is meant for much more than universally representing the location of a file so, here go the big tips:

  1. If you want to get the QUrl from a local file represented with a QString, use always QUrl::fromLocalFile ( const QString & localFile ) . Don’t use QUrl::QUrl ( const QString & url ) if you don’t want to end up with some problems. In the same way, get the path to the local file always with QUrl::toLocalFile().
  2. If you want to get a QUrl from a QString representing an URL, be sure that the QString is actually representing a percent encoded URL, as it should to be a valid URL, and always use QUrl::fromEncoded ( const QByteArray & input, ParsingMode parsingMode ), with QUrl::StrictMode as the QUrl::ParsingMode.
  3. If you want to get a QString representation of an URL from a QUrl use always QUrl::toEncoded ().

Bogus examples for each case:

Local file

/mypath/my#file.jpg

Correct:

QUrl myUrl = QUrl::fromLocalFile("/mypath/my#file.jpg")

Incorrect:

QUrl myUrl = QUrl("file:///mypath/my#file.jpg")

The problem here is the way QUrl will treat the “#” character in the second example. It will think, as it actually doesn’t have a way of guessing, that the character is delimiting the fragment part of the URL.

Fragment part on an URL

Fragment part on an URL

As a result, calling to:

myUrl.toLocalFile()

in the first case will result to:

/mypath/my#file.jpg

while in the second will be:

/mypath/my

Parsing mode

/mypath/my#file.jpg

(encoded) url representation:

file:///mypath/my%23file.jpg

Correct:

QUrl myUrl = QUrl::fromEncoded("file:///mypath/my%23file.jpg", QUrl::StrictMode)

Incorrect:

QUrl myUrl = QUrl::fromEncoded("file:///mypath/my%23file.jpg")

The problem here is the way QUrl will treat the “%23” encoding in the second example. Although it is not explicitly explained in the documentation [ 2 ], QUrl will use QUrl::TolerantMode as ParsingMode by default. Therefore, it will think that the input comes from an ignorant user which was actually trying to pass “file:///mypath/my#file.jpg”. Again, it will understand after converting back “%23” to “#”, that the character is delimiting the fragment part of the URL.

As a result, calling to:

myUrl.toLocalFile()

in the first case will result to:

/mypath/my#file.jpg

while in the second will be:

/mypath/my

Encoded usage

/mypath/my#file.jpg

(encoded) url representation:

file:///mypath/my%23file.jpg

(unencoded and wrong) url representation:

file:///mypath/my#file.jpg

Correct:

QUrl myUrl = QUrl::fromEncoded("file:///mypath/my%23file.jpg", QUrl::StrictMode)

Incorrect:

QUrl myUrl = QUrl("file:///mypath/my#file.jpg")

Here, we have another incarnation of the very same problem than the two examples above. QUrl will think, again, as it actually doesn’t have a way of guessing, that the character is delimiting the fragment part of the URL.

As a result, calling to:

myUrl.toLocalFile()

in the first case will result to:

/mypath/my#file.jpg

while in the second will be:

/mypath/my

Corollary:

The default behavior of QUrl is to provide an easy handling of URLs to the user of our programs, the end user, but not the user of QUrl, the developers. I find this quite awkward but, still, it is a decision of Qt people and, as developers, we only have to take this into account when writing our code.

These bogus URLs, which are to be corrected with the usage of the QUrl::TolerantMode ParsingMode, usually come from a text entry box “à là” browser location bar, but this use case is, actually, not so common when talking from the developer’s point of view. When dealing with URLs in our code we have to take into account what an URL is and how it should be formatted/encoded to be valid. Therefore, if I’m receiving a wrongly encoded URL I should go to the source code providing this URL and fix the problem there rather than trying to smartly guess which should be the proper URL. For example, in my software currently in development we use Tracker and I rely on it to feed my code with properly formatted URLs. If for some reason Tracker gives me a wrongly encoded one, the place for solving it is, actually, Tracker, and not my software. I should not and must not interpret what Tracker may have wanted to pass me, but open a bug in its bugzilla and provide as accurate information as I can to help them solve this issue.

Just so my friend Iván Frade doesn’t kill me, make notice that Tracker is, so far, perfectly dealing with URLs 🙂