simonpena.com Una mezcla heterogénea de tecnología y desvaríos

17Jul/100

JaMp talk at GUADEC-ES

I've just finished writing the slides for the JaMp's talk at the GUADEC-ES :)

Maybe it's still a bit longer than it should, but hey!

So, if you want to know those issues we faced with JaMp (GObject signals, D-Bus -from both C and Python sides-, and some notes about the Maemo port) come visit us to the Computer Science Faculty at A Coruña on 23rd July -next Friday- at 13:00. Grab the program here.

Tagged as: , No Comments
6Jul/100

Another (general) status report

Some quick notes (the list of things which would deserve a full blog entry for themselves just keeps growing...)

  • My manager (I don't like how "boss" sounds) retired last week. Although he visited us a couple of days more to spend some time with us, things will be, at least, different. We'll surely miss him.
  • I started working with Grilo at Igalia, as the practicum work for the Free Software Master. I've been assigned a challenging task: improve the bindings infrastructure. Currently I'm getting familiar with the project, reading the doc and playing with the examples: it looks really interesting!
  • Yesterday I received permissions to upload to extras-devel, so... maevies & butaca-server are available now! Of course, all said warnings about extras-devel still apply. In my case, it's about memory consumption: the backend doesn't free the objects exposed via DBus, so you have to kill it to get that done. It's a small footprint and all that, but it's not nice and of course not the way I want it: having it uploaded to extras will get me motivated to fix it :) (Sure, there will be other issues as well, and I'll set up the bugtracker as soon as possible)
  • I've started with the slides for the JaMp talk at GUADEC-ES. There's still time left, but with these things, you never know...
30Jun/100

Jamp is going to GUADEC-ES!

The application we've been developing at the Desktop & Mobile module in the Master has been accepted for a talk in the GUADEC-ES!

More info on that soon, but you can start by checking the program. Or even better: why don't you register and visit us?

Tagged as: , No Comments
28Jun/100

From Maevies to Butaca: a change for the better

Maevies was born twice. The first one, around the end of October, had a limited lifespan. The second one, a couple of months ago, was much more promising. As I've just told, I'm following the same architectural approach we have for Jamp, the Free Software Master's project. I was progressing fairly well, and feeling close to what I'd call a 0.1 release, I wanted to provide Debian packages. I started packaging the backend: another blog entry could be great to explain how I solved the issues I found, but these two commits should be pretty self-explanatory. The first one provides the Debian package infrastructure, so the binary is created. The second one does the necessary magic to get the service file in the appropriate directory. My sources for this were Vagalume project and this DBus tutorial.

However, I didn't know what to do with the Python part. Ship it together? Separately? How? From what I've seen, Python apps often use distutils for distribution and installation: creating a setup.py for the python part of maevies wasn't hard: with a simple file like this one, all the Python code could be distributed. But I still had to put it in a package... so I decided to stop losing time and do the following:

  • Maevies' backend and frontend will be separated from now on. That makes building Debian packages really easy, and later, will be better for i18n support.
  • Move from Maemo's garage to gitorious. In one of the latests IRC meetings, they talked about shutting down the garage and start providing a migration path. The sooner I do it, the better.

Both the split up and the move to gitorious have an additional benefit: the backend, being perfectly suited for any modern GNU / Linux distro, is now separated and in a more visible site, with the project being called Butaca, and the backend butaca-server. Maevies' UI is what will keep the "Maevies" name, being fully developed in PyGTK, and focusing on Maemo. (A Gnome desktop client should follow soon)

Something really nice about this move is that I'll preserve the git history. Thanks to this Stack Overflow link, nothing will be lost: it explains how to split  (or detach as they say) a directory, with its history, from the whole project.

26Jun/102

Eclipse CDT indexer with autotools

Quick note on Eclipse's CDT indexer: when using it with a C autotools project, it doesn't index headers and symbols with the AM_SILENT_RULES activated.

m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])

Commenting out the line let's Eclipse build its index, and then (it looks like) there's no problem setting it back.

UPDATE: In the project properties, under the C/C++ Build page, unclicking Use default build command and settingthe verbose mode for Make,

make V=1

does the trick, without the need to modify the configure.ac

25Jun/100

Status report on maevies

Quick update on maevies status:

  • Movie posters are fetched from Internet
  • Google movies page is shown when 'now on theaters' is clicked
  • It is possible to search for stingers and extras after / during the credits on WATC (What's after the credits)
  • WATC wiki is shown when a WATC result is clicked

Pictures from this update have been uploaded to maevies' picasa gallery. I'm also working on a debian package: I'll keep you updated :)

Tagged as: , No Comments
1Jun/104

And now, introducing maevies

Back in October, a friend and I started a project targeting Maemo. We had been thinking about programming for maemo for a lot of time (but for Diablo devices), and Fremantle's new UI, so appealing, almost got us buying a N900 (we ended up buying a HTC Tattoo, but that's another story).

At that moment, I was going to the cinema maybe twice a month, and as some of my friends have the (sometimes annoying) habit of waiting after the credits to see if the movie has extra scenes or something, I thought it would be nice if I had an app in my phone which could tell me if it was worth waiting. A nice brainstorm started, and we added showtimes and other movie info to the app, so Maevies -from movies + maemo- was born. After that, it was "just" a matter of researching which web services could provide that info.

We got the backend "working" rather soon. We started using librest and synchronous calls, so the user would be blocked until we got a response from the web services. We wanted to have a basic backend functionality, and quickly focus on the UI but... we stopped there. We met a couple of times to get started with the UI, but didn't get too far.

About a month ago I announced that we were starting the development module in the master and that, after having enjoyed an introduction to python, I was quite convinced to port Maevies to Python. Then, I commented in the same post that I wouldn't port it, but mimic the architecture we're using for the master app: C with GObject for the model, and Python at the view, connected using DBus. Soon I had all the old maevies backend adapted to use GObject, all the librest references removed and replaced with libsoup's, and a basic prototype with PyMaemo, with a fake behaviour like the one I would expect from the actual app.

Today, I can announce a "functional" pre-alpha version of Maevies. I've created a page for it at this blog, and linked it from the maemo garage's one, have taken some screenshots, and pushed the last commits (yeah, I also migrated from subversion to git, now that I'm feeling really comfortable with it).

So what's going on with maevies?

  • About the backend: A movie can be searched in themoviedb.org -getting its basic info- and whatsafterthecredits.com -getting the information about extra scenes. There is also a module which parses Google Movies html, not using GObject yet, but some changes in their API seem to have broken its support.
  • About the user interface: The user can query for a movie using themoviedb service, retrieve a list of results, and display the basic info for the selected movie. (The DBus service must be brought up manually, as I didn't create the .service file to allow DBus doing it). Besides the screenshots below which should give the general idea, there's this screencast. It has, however, a lot of flickering: it's been recorded with the app running under Xephyr, using Istanbul. If you know a better way to record a screencast, please drop me a comment :)

And what are the next steps?

  • Not all the TMDb retrieved data is exported via DBus, nor displayed later on the UI, so that would be a point.
  • It would be nice to display the movie images, also.
  • Bringing the whatsafterthecredits info to the UI would finally add the initially desired functionallity
Maevies -  Welcome window

Welcome Window

Maevies - Search dialog

Search Dialog

Maevies - Search results

Search Results

Maevies - Movie info

Movie Info

Tagged as: , 4 Comments
1May/100

Discovering GObject signals

My first idea about this entry was to write down some things I learnt about GObject signals, while comparing them to what I feel is a close relative: C# events. However, after the first draft I think it's better to focus on GObject now, and leave the comparison for another day. Credit should go to Víctor Jáquez, from Igalia, who explained me those things needed to start off. Don't blame him, however, for the mistakes or misconceptions I may have ;)

There's a design pattern, the Observer pattern, used to allow "subscribers" to track or follow state changes happening on an object, the "subject". In C#, this is implemented via Events, in Java you have the Listeners, and in C, with GObject, you have signals. Going to the GObject implementation details:

enum {
        END_OF_STREAM,
        LAST_SIGNAL
};

static guint
jmp_mplayer_signals[LAST_SIGNAL] = { 0 };

The enum "tags" our signals. In this case, we just have one: END_OF_STREAM. LAST_SIGNAL is a convention: as it is in the last place, it will be always "our last real signal" + 1. And that's used in the next line, when we declare an array storing those signals: it will have "LAST_SIGNAL" size. It doesn't store the signal itself, but its identifier, but we'll see that later.

jmp_mplayer_signals[END_OF_STREAM] =
                g_signal_newv ("end-of-stream",
                                G_TYPE_FROM_CLASS (klass),
                                G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS,
                                NULL,
                                NULL,
                                NULL,
                                g_cclosure_marshal_VOID__VOID,
                                G_TYPE_NONE,
                                0,
                                NULL);

That is how the signal is created. It calls the gobject function g_signal_newv which creates the signal, and stores its identifier in the array position given. But, what means each of the params? Well, to be honest, I don't know too much:

The first one is easy: "end-of-stream" is the signal name. The documentation sets some limitations to the characters it can contain, but that's all.
The second one is "the type this signal pertains to". The macro G_TYPE_FROM_CLASS gets the type from the class structure (klass).
The third one is composed by signal flags. They "specify detail of when the default handler is to be invoked".
I don't know about the next three params: documentation says class_closure, accumulator, and accu_data. As soon as I learn what they do, I'll update this. Setting them to NULL worked fine for my needs.
The fourth one, called c_marshaller, sets the interface for the callbacks listening for our signals. So, in our example, g_cclosure_marshal_VOID__VOID means that we won't require our callback functions to receive arguments. You can find more closures here.
G_TYPE_NONE defines the return type for our callback, so our callback (closure) signature would have this form:

void end_of_stream_callback (JmpMPlayer *self, gpointer user_data);

Our last two params are the length of param types, and an array of param types.

So, what is left? Well, our "subject" still has to notify ("emit", in GObject) his subscribers. And those subscribers need to actually "subscribe" to the signal. Here we go:

switch (GST_MESSAGE_TYPE (message)) {
        case GST_MESSAGE_EOS:
                g_signal_emit (self, jmp_mplayer_signals[END_OF_STREAM], 0);
                break;

g_signal_emit receives an instance the signal is being emitted on, the signal id (which we had previously stored in that array), and a detail. Quoting the documentation,

detail identifies the specific detail of the signal to invoke. A detail is a kind of magic token/argument which is passed around during signal emission and which is used by closures connected to the signal to filter out unwanted signal emissions. In most cases, you can safely set this value to zero. See the section called "The detail argument" for more details about this parameter.

And this closes the circle: subscribing to the signal.

g_signal_connect (jmplayer, "end-of-stream",
                          G_CALLBACK (end_of_stream_callback), loop);

g_signal_connect connects a given callback (G_CALLBACK (end_of_stream_callback), whose signature we saw before), with a signal in an instance (jmplayer), passing arguments (loop)

To write this entry, I've relied on two documents: API Reference's Signals and The GObject messaging system's Signals, and the (yet little) knowledge I acquired during this stage of Jamp implementation (which, itself, required Víctor's help and said documentation). Full code for this example is available at Gitorius, for both the "subject" and the "subscriber".

29Apr/101

Introducing Jamp: a Jamendo client.

This last weekend we had two very interesting sessions in the Destkop and Mobile development module. On Friday,  it was an introduction to Python, followed by a PyGTK app. While the app was very simple, it covered the basics: using containers to add widgets, handling signals, setting callback functions. I liked it so much that I'm seriously considering porting maevies (the maemo app a friend and I are developing, stalled for some months) to PyGTK. After all, all we needed was libRest, and I'm confident that Python has something similar.

But that was on Friday. On Saturday, we started with the first workshop. During the module, we are going to develop a Gnome desktop application, which will be later ported / adapted to Maemo: a Jamendo client called Jamp. The application has ben designed / is being designed with that port in mind, so hopefully we won't need too many changes to achieve it. We've been distributed between three teams: UI with PyGTK, web API connection with libsoup, and multimedia playback, with gstreamer. Wikipedia says

Jamendo is a music platform and community.

All music on Jamendo is free to download and licensed through one of several Creative Commons licenses or the Free Art License, making it legal to copy and share, as well as to modify and make commercial use of for some, depending on the license. Jamendo allows streaming of all of its thousands of albums in either Ogg Vorbis or MP3 format, and downloads through the BitTorrent and eDonkey networks.

So, while we learn, we'll be contributing to a Good Thing™ :) . I'm very motivated about using git, doing a team development, submitting patches, and enjoying such a collaborative environment.

I'll try to keep you updated :)

Tagged as: 1 Comment
12Apr/109

The importance of a good IDE: which one to choose (and why)?

A few months ago, when I was trying to start developing for maemo, I discovered a project called ESbox. ESbox is "an Eclipse Ganymede-based product that helps programmers to develop applications for Maemo platform using Scratchbox Apophis". It launches scratchbox transparently, includes wizards for different types of apps, lets you debug step by step and on device, and also uses C/C++ or Python plugins, so you can refactor code, jump to variable declarations, explore types, autocomplete...

I don't know exactly when it was, but I once came to maemo IRC channel to ask a specific (maybe too specific) question about ESbox. I was surprised that nobody was using it: people there were using nano, vi, Emacs... I asked them about all the features a "full IDE" offers: what about code refactoring? what about autocompletion? debugging? While some said that you can get emacs to auto-complete from a given dictionary, the other questions remained unanswered. In fact, I almost felt like we weren't talking the same language.

Our discussion wasn't constructive at all: I don't know if it was the language barrier, if it was me who said something inappropriate in the beginning, or if I met people too "Taliban". The thing is that I had to listen things like "real programmers know the name of the functions / methods they need: autocompletion is for dumbs". And no, it wasn't a joke like "real programmers develop their own device drivers". So I gave up and left the channel: I assumed that programmers would choose their IDEs according to the kind of development they were doing, so "hobbyists" would use nano, would copy & paste and wouldn't care too much about extras, and "professionals"  would use others, or at least would know and use the extras I wanted. And time went by.

As I was telling you in the last post, this Friday we've got our first session in the Desktop & Mobile development module of the master. After its presentation, we had a brainstorming to choose which app we will be developing during the workshops, and then... we started talking about IDEs. More specifically, Emacs.

That gave me the opportunity to confirm that there really was a difference between professional developers and non-professional, and that my worries were really shared by others. It was a really interesting chat, where we were explained the environment, from the basics (navigation a buffer, open, close, kill and yank...) to more complex things: debugger integration, syntax highlighting modules, autocompletion, macros...

After the session, I now can understand other people not using Eclipse or Netbeans, while still being productive. I'm not going to use Emacs, not yet, as it looked like some of the features that "just work" in Eclipse require some fiddling in Emacs; but at least I know that someone using Emacs and mastering it will be as efficient as an Eclipse user -or even more.

Still, when I think about the things I like to have working in Eclipse, the following comes:

  • Version control: I'd like to be able to check history, undo changes across revisions, commit changes, check "who did what" (blame)
  • Debugging: Set breakpoints, set conditional breakpoints, step by step debugging, variable inspection
  • Syntax highlighting, code folding, autocompletion (preferable if it can include code I've done, not only know APIs), code refactoring (variable names, methods, etc), comment & uncomment.
  • Compilation management: Make integration (or other options like ant or maven for Java). Build automatically, "live" syntax error detection.
  • Bug tracking system integration
  • GUI editor

I know that I can do all of the above using Eclipse, and since this Friday I know that some of them are also possible with Emacs, so now I'd like to have some feedback:

What do you expect in an IDE? Is your list similar to mine? What is your IDE of choice? Which special options of your IDE you use the most? Which options are you most proud of?

Tagged as: , , 9 Comments