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
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
9Apr/100

Looking forward (and enjoying it)

This Friday we're starting the Desktop/Mobile module on the Free Software Master. One of the reasons that brought me here was that one: I wanted to jump into GTK and Qt development, learn new programming languages, and, specifically, learn to develop for mobile devices. What I think now, which really gets me motivated, is the idea that considering how much I've enjoyed the previous modules which in advance didn't look so great (to me), this one will be incredible.

But there's also another point: more than a half of the course is over, now. Summarizing, we've gone through Introduction to Libre Software, where we learnt the most important people in this movement, learnt about Business Models or Licensing stuff among other things; Dynamics of Libre Software Communities, where we analyzed and studied several important communities and learnt the process to apply those analysis to other ones; and now, just before Easter Holidays, we've got Systems Integration with Libre Software. In this last module, even if it almost shares the name with a 5º course subject in Ingeniería Informática at UDC, we didn't learn Web Technologies (there's a module for that!): we've done security, systems administration, scripting, servers configuration and management, version control with git...

And, at this point, I'd like to share with you some of the things we've been doing here. Fortunately, my mates and I -as previous editions' students did- are using a subversion repository hosted at Morfeo's Forge, where all the practices and assignments were developed (in the open, as the master's philosophy would suggest), so it's very interesting to share all of this work with anyone interested.

I'm grouping them by subject -I won't link my mates' works, but they can do it in this post's comments-. I'll point out those mistakes I found after I handed out the works, and also all known limitations, some possible improvements or even things which are already outdated. Here it goes:

Introduction to Libre Software:

  • Business Model: I presented a business model focused on service-oriented apps for mobile devices. Accounting numbers aren't that accurate, but sources and references should be very handful just in case you're interested. About the ideas (licensed Creative Commons Attribution Share-Alike unless otherwise stated), I didn't want to reinvent the wheel, but joining and mixing existing technologies so I would get something attractive.
  • Mobile Operating Systems Review: I wanted to give a look at current OSs in mobile devices world, around Christmas 2010. However, less than a month later, Maemo and Moblin merged, Symbian accelerated its transition to Libre Software, Samsung focused more clearly on Bada... Maybe this is the most outdated work, but will be funny to check out after a year time.

Dynamics of Libre Software Communities

  • Eye Of Gnome Mini-Review: This work was intended for training us with the use of Libresoft Tools. Source code repository and mailing list were used, so we could identify the most important contributors to the project.
  • WebKit Project Review: My original idea was quite ambitious, as I wanted to compare WebKit and Gecko, but soon I focused on WebKit. While this work is really interesting, the conclusions I reached are quite biased: my main measure to evaluate code collaboration was the committer id, while WebKit project stores the real author of a commit in the ChangeLog, which I ignored. The good thing here is that, provided that a ChangeLog parser is done, my scripts, tools and procedures can be used to get a very nice report. Besides, being Igalia a company so involved in WebKit development (specially in WebKitGtk+), this work has a lot of potential.

Systems Integration with Libre Software

  • (Bash) Scripting: We went through some common problems in systems' administration: daemons, regular expressions, using find, sed...
  • Perl development: With the "Learning by doing" moto, we got introduced to Perl. It was a brief and interesting tutorial which meant, at least for me, meeting a language with a very bad reputation, but really powerful. I really enjoyed the last two exercises, when we played a while with Last.fm's API.
  • Networking: Some networking stuff. It was nice, as I already knew some things, but haven't heard at all of others. I'd say that, rather than building complex networks and all that, we had to really understand how they work.

Of course, I'm missing lots of things. So if you want further info, you can browse the full repository to get my mates' works or other years', you can check the moodle for the theory, read the planet for other comments... Enjoy, and Happy Hacking!

25Feb/100

Novedades en el blog

Desde hoy por la mañana soporto OpenID en los comentarios, y desde hace casi dos meses está activado el soporte para dispositivos móviles. Respectivamente, se ven así:

Soporte de OpenID en los comentarios

Soporte de OpenID en los comentarios

Y así:

Simonpena.com desde un iPod Touch

Versión móvil del sitio

Espero que os animéis algo más a comentar: si todo está correctamente configurado, los comentarios autenticados con OpenID se aceptan automáticamente.

17Feb/100

FOSDEM 2010 – Parte 2

El domingo empezó a toda prisa: a pesar de que después de cenar el sábado no nos animamos a salir de fiesta de nuevo, el cansancio o la pereza provocó que nos quedásemos dormidos hasta casi las 10, con lo que llegamos al FOSDEM algo tarde. Xulio y yo nos acercamos a ver oFono & Nokia, una charla donde se nos mostraba la potencia del stack de telefonía open source que están desarrollando de modo conjunto Nokia e Intel, y ya a continuación, a las 12, me acerqué a la Keysigning Party. Coincidía con una presentación de Minix por Tanenbaum: sinceramente, pensaba que la Keysigning party sería más breve y podría ver al mito, pero no...

Dos horas estuvimos al fresco firmando claves (de hecho, desde el domingo tengo un goteo constante de firmas en el correo electrónico :P ). Se hizo un poco largo, y el tiempo era demasiado frío para estar tan quietos. Pero me gustó, tanto por exótico como por participar en un evento que ya es todo un clásico.

Luego, comida breve y a ver a Patrick Ohly, hablándome de SyncML (tengo ganas de probarlo de nuevo: lo usé en su día en la N800). Como llegué con algo de margen, vi también la presentación anterior, que trataba de un mecanismo de indexado de datos y metadatos en KDE.

Después, me acerqué a ver a los demás, que estaban en la presentación de Víctor Jáquez acerca de ARM y DSP. Al no estar metido en ese mundo, no la entendí tan bien como otras.

Y ya para finalizar, la entrega de premios y la charla final: cómo realizar tu primera contribución al Kernel Linux. Git, git y más git. La verdad es que me muero de ganas de usarlo :) . Contribuir al Kernel lo sigo viendo igual de lejos, pero oye, nunca se sabe, y ahora sé cómo tendría que hacerlo.

¿El resto? Turismo: la galería de Saint Hubert, la catedral de Santa Gúdula, la Grand Place, el palacio real y el parque... Con los inviernos europeos, lo vimos todo de noche, pero no dejó de ser bonito :)

Tagged as: No Comments