Giving Lightning Talks

Igalia, Maemo (EN) No Comments »

lightningDuring next Maemo Summit we will have at least 2 hours (one on saturday and another one on sunday) of lightning talks, about 20 talks where people will try to explain or present something in just 5 minutes.

Last year, during Maemo Summit 2008, I did a lightning talk too and I must admit: even if I knew a lot about the subject of my talk and even if I had already done many other talks, I think it wasn't so good as I expected.

This year I've been selected again (more details will follow) to give a 5 minutes talk and with this great news the kind Dave Neary also suggested me a link with an article about some best practices when giving lightning talks. I'll try to resume the most important points, hoping this will be useful for people who is going to give a short presentation at Summit.

Go straight to the point: five minutes finish sooner than you can expect. You have to talk about the main topic of your talk within the two first minutes, else you risk to talk too much about the rest and you couldn't have the time for the most important thing.

Leave details away: people will never remember too many details explained in so little time. It's better to leave them away and put them in a more detailed blog post that you can link within your slides.

Slides: for a five minute talk you can avoid preparing slides, but if this can help you to concentrate on points you have to talk about, please prepare them. Two or three slides can be useful to introduce yourself, to write any reference of what you're talking about many other things. Another important thing, make sure your slides are ready before starting your presentation: people don't want to wait 20-30 seconds it takes to start Open Office or any other similar application.

Consider any eventuality: the presentation file could be damaged (be sure to have a copy of it, better in PDF format), your laptop could have no more battery (make sure you've a copy of your slides in a USB key), aliens could take you away, ecc... (ok, this last eventuality is remote).

Concluding your talk: don't worry if you finish one or two minutes before, people won't bother about it. It's better to finish one minute before than 30 seconds later. If you want to leave an URL where people can find more details, how to contact you, put it in every slide so people will be able to take note of it from the first minute.

I hope to have resumed the most important points of the original article. If you think there are any other important things to say, please leave me a comment and I'll add them. I really hope you will enjoy Maemo Summit and its lightning talks!

Writing Python bindings of existing C libraries – (3) – Building and Installing with distutils

HowTo, Igalia, Linux, Maemo (EN), Programmazione, Python 1 Comment »

In the last post of this series, we saw how to write a simple binding and we finished to build and install it manually. This is of course not a good way to manage the building/installation procedure.

In Python we can use a library called distutils that let us to automatize the building and installing process. I'll use the foo source code to create the package, so it will be easier to understand.

Using distutils

All we have to do is to write a setup.py file similar to this one:

from distutils.core import setup, Extension

foomodule = Extension('foo', sources = ['foo.c'])

setup (name = 'Foo',
       version = '1.0',
       description = 'This is a package for Foo',
       ext_modules = [foomodule])

As you can see, we have to first import needed modules with: from distutils.core import setup, Extension
then we create an entry for each module we have (in this case just one, "foomodule"). We then call the setup() method passing it all the parameters and our setup.py is complete.

Building and installing

To test it we can try to build the package in this way:

python2.5 setup.py build

if we want to install the module in our system:

python2.5 setup.py install

References

PyMaemo (Python for Maemo) second beta release for Fremantle

Igalia, Linux, Maemo (EN), Programmazione, Python 1 Comment »

The PyMaemo team is pleased to announce the second beta release of PyMaemo for Fremantle!

This new release is available through the extras-devel repository, see installation instructions in
http://pymaemo.garage.maemo.org/sdk_installation.html#fremantle

What is it?

Python for Maemo (PyMaemo for short) main objective is to make possible to use Python programming language as the scripting and development language for Maemo Platform, providing a better alternative for fast prototyping and programming in Maemo environment besides the C programming language.

Python is for serious programming and to have fun. Python has a nice syntax, it is easy to learn and powerful enough for a vast range of applications, this is why we choose Python for Maemo.

What has changed?

New packages:

  • python-mafw (0.1-1maemo1)
    • Python bindings for the Media Application Framework [1]
    • Supported API is very basic at the moment, and there are some bugs. Feedback is welcome!
  • python-hildondesktop (0.0.3-1maemo1)
    • Python bindings for the home/status widgets API
  • python-notify (0.1.1-2maemo1)
    • Python bindings for libnotify
  • pyclutter (0.8.0-1maemo2)
    • Python bindings for the Clutter API [2]
    • Experimental package, waiting for developer feedback

Updated packages:

  • gnome-python (2.26.1-1maemo1)
    • major upgrade, matching current Debian testing release;
    • feedback on this is welcome, as it replaces a fairly old version (2.18).
  • pygtk (2.12.1-6maemo7)
    • Enable glade support.
  • python2.5 (2.5.4-1maemo1)
    • Updated to latest upstream 2.5.x release.
    • add support to --install-layout=deb flag.
  • python-central (0.6.11.1maemo1)
    • dependency needed by the new python-setuptools version.
  • python-defaults (2.5.2-3maemo3)
    • Change PREVVER in debian/rules, avoiding old python2.5-minimal versions that had "/usr/bin/python" and thus conflicts with python-minimal.
  • python-hildon (0.9.0-1maemo10)
    • lots of bug fixes
  • python-setuptools (0.6c9-1maemo1)
    • add support to --install-layout=deb flag.

Bugs fixed: MB#4530 [3], MB#4450 [4], MB#4629 [5], MB#4628 [6],
MB#4647 [7], MB#4632 [8],  MB#4646 [9],  MB#4750 [10],  MB#4749 [11],
MB#4791 [12]

Known issues

MB#4782 [13]: osso.Context causes segmentation fault
MB#4821 [14]: Cannot create HildonTouchSelector with single text column
MB#4824 [15]: python-mafw: source_browsing.py example does not work
MB#4839 [16]: python-mafw: mafw.Registry lacks list_plugins() method
MB#4849 [17]: python-mafw: MafwPluginDescriptorPublic structure is missing

We will not migrate to python2.6 in fremantle due to a (unresolved) bug (MB#4734 [18]), where a core SDK package explicitly conflicts with python >= 2.6, preventing any further upgrades from the 2.5.x series.

This release is supposed to be compatible with previous releases. If you have any issues regarding building your Python application on Fremantle, feel free to report it on the pymaemo-developers mailing list [19].

Acknowledgments

Thanks to everybody who helped making this release possible.

Bug reports, as always, should go to our Bugzilla [20]. Use the pymaemo-developers mailing list for help, feedback or suggestions.

References

[1] https://garage.maemo.org/projects/mafw/
[2] http://www.clutter-project.org/
[3] https://bugs.maemo.org/show_bug.cgi?id=4530
[4] https://bugs.maemo.org/show_bug.cgi?id=4450
[5] https://bugs.maemo.org/show_bug.cgi?id=4629
[6] https://bugs.maemo.org/show_bug.cgi?id=4628
[7] https://bugs.maemo.org/show_bug.cgi?id=4647
[8] https://bugs.maemo.org/show_bug.cgi?id=4632
[9] https://bugs.maemo.org/show_bug.cgi?id=4646
[10] https://bugs.maemo.org/show_bug.cgi?id=4750
[11] https://bugs.maemo.org/show_bug.cgi?id=4749
[12] https://bugs.maemo.org/show_bug.cgi?id=4791
[13] https://bugs.maemo.org/show_bug.cgi?id=4782
[14] https://bugs.maemo.org/show_bug.cgi?id=4821
[15] https://bugs.maemo.org/show_bug.cgi?id=4824
[16] https://bugs.maemo.org/show_bug.cgi?id=4839
[17] https://bugs.maemo.org/show_bug.cgi?id=4849
[18] https://bugs.maemo.org/show_bug.cgi?id=4734
[19] https://garage.maemo.org/mailman/listinfo/pymaemo-developers
[20] https://bugs.maemo.org/enter_bug.cgi?product=PyMaemo

Credits

This post was possible thanks to Anderson Lizardo, from PyMaemo team, who posted these informations on pymaemo-developers mailing list.

Making Maemo email client usable with GMail

HowTo, Igalia, Linux, Maemo (EN) 6 Comments »

I must admit, I wasn't using Maemo email client, because I did find it was simply unusable, at least with my GMail account.

I tried both POP3 and IMAP, but having about 25.000+ messages in my account, downloading just the headers was a job that the client simply couldn't manage.

Yesterday I knew about "recent mode" support in POP3, a functionality that GMail supports too. This mode allow you to download only last 30 days messages (in my case, no more than 1000)  so the client can manage them without any problem.

All you have to do to enable this mode is put the "recent:" string before the username. For example: if your username is "username@gmail.com" you have to write "recent:username@gmail.com". Important: this mode only works with POP3, not with IMAP.

To conclude, let me say thank you to the kind guy who let me discover this mode. Thank you Sergio! Now there is another thing I can do with my tablet!

Writing Python bindings of existing C libraries – (2) – A simple example of binding

HowTo, Igalia, Linux, Maemo (EN), Programmazione, Python 2 Comments »

Introduction

As I promised in the preceding post, I'll provide a very easy example of a python binding. Let's suppose we don't want to use the methods included in Python to sum two integer values and we want to do it in C and then call the add method from a python script. I'll write the complete source code first and then I'll explain all the parts of it.

Source Code

#include <Python.h>

static PyObject *foo_add(PyObject *self, PyObject *args) 
{
	int a;
	int b;
	
	if (!PyArg_ParseTuple(args, "ii", &a, &b)) 
	{
		return NULL;
	}
	
	return Py_BuildValue("i", a + b);
}

static PyMethodDef foo_methods[] = {
	    { "add", (PyCFunction)foo_add, METH_VARARGS, NULL },
	    { NULL, NULL, 0, NULL }
};
	    
PyMODINIT_FUNC initfoo() 
{
	    Py_InitModule3("foo", foo_methods, "My first extension module.");
}

How it works

First of all we have to include Python.h in our C file. This allows us to write an extension for Python language. To be able to include this header, we must have the python development packages installed in our system. For example in Debian based distributions we can install them with this command:

sudo apt-get install python2.5-dev

Every module has at least three parts. In the first part we write methods we want to call from the final python module: in this case we have a method called foo_add where "foo" is the name of the module and "add" the name of the method. Every method is declared as static PyObject. The method does anything particular except calling PyArg_ParseTuple to validate the input (we'll discuss this later), adding the two passed numbers and returning the result.

In the second part we have something like a dictionary, defined as static PyMethodDef and called foo_methods (where "foo" again is the name of the module). For each method we want to expose in our python module, we have to add something like this:

{"add", (PyCFunction)foo_add, METH_VARARGS, NULL}

where "add" is the name of the method we want to be visible in our module, (PyCFunction)foo_add is a pointer to our foo_add method, implemented in the C module, METH_VARARGS means that we want to pass some parameters to the function and the last one would be the description of the method (we can leave it NULL if we want).

Third part allows us to register the defined method/s and the module:

Py_InitModule3("foo", foo_methods, "My first extension module.");

Parsing Parameters

The PyArg_ParseTuple function extracts arguments from the PyObject passed as parameter to the current method and follows almost the sscanf syntax to parse parameters (in this case we had "ii" for two integers). You can fin the complete reference here: http://docs.python.org/c-api/arg.html

Building and installing

To build the module, we have to be in the source directory and execute this command:

gcc -shared -I/usr/include/python2.5 foo.c -o foo.so

then we've to copy the generated module to the python's modules directory:

cp foo.so /usr/lib/python2.5/site-packages/

Testing our module

Testing the module is really easy. We've to start a python shell or create a python script with the following source code:

import foo
print foo.add(2, 3)

if all is working fine, the printed result should be 5

References

python2.5-dev
python2.5-dev
WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in

Switch to our mobile site