<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Andrea Grandi &#187; HowTo</title>
	<atom:link href="http://www.andreagrandi.it/category/howto/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.andreagrandi.it</link>
	<description>Pensieri, progetti e qualche informazione su di me</description>
	<lastBuildDate>Sun, 05 Sep 2010 18:25:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Writing Python bindings of existing C libraries – (3) – Building and Installing with distutils</title>
		<link>http://www.andreagrandi.it/2009/08/13/writing-python-bindings-of-existing-c-libraries-%e2%80%93-3-%e2%80%93-building-and-installing-with-distutils/</link>
		<comments>http://www.andreagrandi.it/2009/08/13/writing-python-bindings-of-existing-c-libraries-%e2%80%93-3-%e2%80%93-building-and-installing-with-distutils/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 09:39:50 +0000</pubDate>
		<dc:creator>Andrea Grandi</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Igalia]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Maemo (EN)]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[binding]]></category>
		<category><![CDATA[distutils]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[maemo]]></category>
		<category><![CDATA[setup]]></category>

		<guid isPermaLink="false">http://www.andreagrandi.it/?p=315</guid>
		<description><![CDATA[In the last post of this series, we saw how to write a  [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.andreagrandi.it%2F2009%2F08%2F13%2Fwriting-python-bindings-of-existing-c-libraries-%25e2%2580%2593-3-%25e2%2580%2593-building-and-installing-with-distutils%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.andreagrandi.it%2F2009%2F08%2F13%2Fwriting-python-bindings-of-existing-c-libraries-%25e2%2580%2593-3-%25e2%2580%2593-building-and-installing-with-distutils%2F&amp;source=andreagrandi&amp;style=normal&amp;service=is.gd" height="61" width="50" /><br />
			</a>
		</div>
<p>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.</p>
<p>In Python we can use a library called <strong>distutils</strong> that let us to automatize the building and installing process. I'll use the <strong>foo</strong> source code to create the package, so it will be easier to understand.</p>
<h2>Using distutils</h2>
<p>All we have to do is to write a <strong>setup.py</strong> file similar to this one:</p>
<pre class="brush: python;">
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])
</pre>
<p>As you can see, we have to first import needed modules with: <strong>from distutils.core import setup, Extension</strong><br />
then we create an entry for each module we have (in this case just one, "foomodule"). We then call the <strong>setup()</strong> method passing it all the parameters and our <strong>setup.py</strong> is complete.</p>
<h2>Building and installing</h2>
<p>To test it we can try to build the package in this way:</p>
<p><code>python2.5 setup.py build</code></p>
<p>if we want to install the module in our system:</p>
<p><code>python2.5 setup.py install</code></p>
<h2>References</h2>
<ul>
<li>Official Python documentation: <a href="http://docs.python.org/extending/building.html">http://docs.python.org/extending/building.html</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.andreagrandi.it/2009/08/13/writing-python-bindings-of-existing-c-libraries-%e2%80%93-3-%e2%80%93-building-and-installing-with-distutils/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Making Maemo email client usable with GMail</title>
		<link>http://www.andreagrandi.it/2009/08/08/making-maemo-email-client-usable-with-gmail/</link>
		<comments>http://www.andreagrandi.it/2009/08/08/making-maemo-email-client-usable-with-gmail/#comments</comments>
		<pubDate>Sat, 08 Aug 2009 12:34:44 +0000</pubDate>
		<dc:creator>Andrea Grandi</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Igalia]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Maemo (EN)]]></category>
		<category><![CDATA[client]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[gmail]]></category>
		<category><![CDATA[maemo]]></category>
		<category><![CDATA[modest]]></category>
		<category><![CDATA[recent]]></category>

		<guid isPermaLink="false">http://www.andreagrandi.it/?p=309</guid>
		<description><![CDATA[I must admit, I wasn't using Maemo email client, becaus [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.andreagrandi.it%2F2009%2F08%2F08%2Fmaking-maemo-email-client-usable-with-gmail%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.andreagrandi.it%2F2009%2F08%2F08%2Fmaking-maemo-email-client-usable-with-gmail%2F&amp;source=andreagrandi&amp;style=normal&amp;service=is.gd" height="61" width="50" /><br />
			</a>
		</div>
<p>I must admit, I wasn't using Maemo email client, because I did find it was simply unusable, at least with my GMail account.</p>
<p>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.</p>
<p>Yesterday I knew about "<strong>recent mode</strong>" support in <strong>POP3</strong>, a functionality that <strong>GMail</strong> supports too. This mode allow you to download<strong> only last 30 days</strong> messages (in my case, no more than 1000)  so the client can manage them without any problem.</p>
<p>All you have to do to enable this mode is put the "<strong>recent:</strong>" string before the username. For example: if your username is "username@gmail.com" you have to write "<strong>recent:username@gmail.com</strong>". Important: this mode only works with POP3, not with IMAP.</p>
<p>To conclude, let me say <strong>thank you</strong> to the kind guy who let me discover this mode. Thank you <a href="http://blogs.igalia.com/svillar/"><strong>Sergio</strong></a>! Now there is another thing I can do with my tablet!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.andreagrandi.it/2009/08/08/making-maemo-email-client-usable-with-gmail/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Writing Python bindings of existing C libraries – (2) – A simple example of binding</title>
		<link>http://www.andreagrandi.it/2009/08/06/writing-python-bindings-of-existing-c-libraries-%e2%80%93-2-%e2%80%93-a-simple-example-of-binding/</link>
		<comments>http://www.andreagrandi.it/2009/08/06/writing-python-bindings-of-existing-c-libraries-%e2%80%93-2-%e2%80%93-a-simple-example-of-binding/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 14:44:21 +0000</pubDate>
		<dc:creator>Andrea Grandi</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Igalia]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Maemo (EN)]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[binding]]></category>
		<category><![CDATA[maemo]]></category>

		<guid isPermaLink="false">http://www.andreagrandi.it/?p=301</guid>
		<description><![CDATA[Introduction
As I promised in the preceding post, I'll [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.andreagrandi.it%2F2009%2F08%2F06%2Fwriting-python-bindings-of-existing-c-libraries-%25e2%2580%2593-2-%25e2%2580%2593-a-simple-example-of-binding%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.andreagrandi.it%2F2009%2F08%2F06%2Fwriting-python-bindings-of-existing-c-libraries-%25e2%2580%2593-2-%25e2%2580%2593-a-simple-example-of-binding%2F&amp;source=andreagrandi&amp;style=normal&amp;service=is.gd" height="61" width="50" /><br />
			</a>
		</div>
<h2>Introduction</h2>
<p>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.</p>
<h2>Source Code</h2>
<pre class="brush: cpp;">
#include &lt;Python.h&gt;

static PyObject *foo_add(PyObject *self, PyObject *args)
{
	int a;
	int b;

	if (!PyArg_ParseTuple(args, &quot;ii&quot;, &amp;a, &amp;b))
	{
		return NULL;
	}

	return Py_BuildValue(&quot;i&quot;, a + b);
}

static PyMethodDef foo_methods[] = {
	    { &quot;add&quot;, (PyCFunction)foo_add, METH_VARARGS, NULL },
	    { NULL, NULL, 0, NULL }
};

PyMODINIT_FUNC initfoo()
{
	    Py_InitModule3(&quot;foo&quot;, foo_methods, &quot;My first extension module.&quot;);
}
</pre>
<h2>How it works</h2>
<p>First of all we have to include <strong>Python.h</strong> 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:</p>
<p><code>sudo apt-get install python2.5-dev</code></p>
<p>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 <strong>foo_add</strong> where "<em>foo</em>" is the name of the module and "<em>add</em>" the name of the method. Every method is declared as <strong>static PyObject</strong>. 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.</p>
<p>In the second part we have something like a dictionary, defined as static <strong>PyMethodDef</strong> 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:</p>
<p><code>{"add", (PyCFunction)foo_add, METH_VARARGS, NULL}</code></p>
<p>where "<em>add</em>" is the name of the method we want to be visible in our module, <em>(PyCFunction)foo_add</em> 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).</p>
<p>Third part allows us to register the defined method/s and the module:</p>
<p><code>Py_InitModule3("foo", foo_methods, "My first extension module.");</code></p>
<h3>Parsing Parameters</h3>
<p>The <strong>PyArg_ParseTuple</strong> function extracts arguments from the <strong>PyObject</strong> passed as parameter to the current method and follows almost the sscanf syntax to parse parameters (in this case we had <em>"ii"</em> for two integers). You can fin the complete reference here: <a href="http://docs.python.org/c-api/arg.html">http://docs.python.org/c-api/arg.html</a></p>
<h2>Building and installing</h2>
<p>To build the module, we have to be in the source directory and execute this command:</p>
<p><code>gcc -shared -I/usr/include/python2.5 foo.c -o foo.so</code></p>
<p>then we've to copy the generated module to the python's modules directory:</p>
<p><code>cp foo.so /usr/lib/python2.5/site-packages/</code></p>
<h2>Testing our module</h2>
<p>Testing the module is really easy. We've to start a python shell or create a python script with the following source code:</p>
<pre class="brush: python;">
import foo
print foo.add(2, 3)
</pre>
<p>if all is working fine, the printed result should be <strong>5</strong></p>
<h2>References</h2>
<ul>
<li><a href="http://docs.python.org/extending/extending.html">http://docs.python.org/extending/extending.html</a></li>
<li><a href="http://www.wrox.com/WileyCDA/WroxTitle/productCd-0764596543.html">http://www.wrox.com/WileyCDA/WroxTitle/productCd-0764596543.html</a></li>
</ul>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 399px; width: 1px; height: 1px;">python2.5-dev</div>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 399px; width: 1px; height: 1px;">python2.5-dev</div>
]]></content:encoded>
			<wfw:commentRss>http://www.andreagrandi.it/2009/08/06/writing-python-bindings-of-existing-c-libraries-%e2%80%93-2-%e2%80%93-a-simple-example-of-binding/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Writing Python bindings of existing C libraries &#8211; (1) &#8211; Introduction</title>
		<link>http://www.andreagrandi.it/2009/08/03/writing-python-bindings-of-existing-c-libraries-1-introduction/</link>
		<comments>http://www.andreagrandi.it/2009/08/03/writing-python-bindings-of-existing-c-libraries-1-introduction/#comments</comments>
		<pubDate>Mon, 03 Aug 2009 09:04:35 +0000</pubDate>
		<dc:creator>Andrea Grandi</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Igalia]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Maemo (EN)]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[bindings]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[libraries]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[maemo]]></category>
		<category><![CDATA[pymaemo]]></category>

		<guid isPermaLink="false">http://www.andreagrandi.it/?p=298</guid>
		<description><![CDATA[This summer I'm having the pleasure of working in Igali [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.andreagrandi.it%2F2009%2F08%2F03%2Fwriting-python-bindings-of-existing-c-libraries-1-introduction%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.andreagrandi.it%2F2009%2F08%2F03%2Fwriting-python-bindings-of-existing-c-libraries-1-introduction%2F&amp;source=andreagrandi&amp;style=normal&amp;service=is.gd" height="61" width="50" /><br />
			</a>
		</div>
<p>This summer I'm having the pleasure of working in <a href="http://www.igalia.com"><strong>Igalia</strong></a> (a spanish free software company) for a couple of months and they assigned me to an interesting project: developing <strong> Python bindings</strong> for <strong>MAFW</strong> library (a <strong>Maemo</strong> multimedia library that will be used in <strong>Fremantle</strong> release).</p>
<p>Having the opportunity to work both with <strong>C</strong> (yes, Python bindings are almost C code) and <strong>Python</strong> (it's a good practice to write unittest of all implemented methods) it's a good way to improve my knowledges in both languages and since I wasn't able to find much documentation about these kind of things, I'm going to share my own experiences.</p>
<p><strong>What is a Binding?</strong></p>
<p>A binding is a Python module, written in C language, that allows Python developers to call functions from existing C libraries from their python applications. It's just like a "<em>bridge</em>" from C world to Python one.</p>
<p><strong>Why writing bindings?</strong></p>
<p>There are a couple of reasons to write python bindings instead of writing a library in python language from scratch.</p>
<p>First of all I don't think is good duplicating code, so if a library already exists and it's written in C, why writing it again in another language? There's no reason. A lot of code already exist in C world and all we have to do is to create a bridge with python world.</p>
<p>Another good reason, in particular when a C library doesn't exist yet, is the fact that python code is slower than C code for some tasks (for example multimedia codecs). In these cases is good to implement the core library in C language and then create a python binding for it.</p>
<p><strong>Coming next</strong></p>
<p>As the title of this post says, this is only an introduction to the subjects I'm going to write about. If you have any particular request about any argument you would like to read, please feel free to leave me a comment. Next posts will talk about these things:</p>
<ul>
<li><strong>A simple example of binding:</strong> I'll write a simple library in C language and I'll show how to create the relative python binding, providing complete source code and an example for python developers.</li>
<li><strong>Building and installing python bindings with distutils:</strong> I'll explain how to use <strong>distutils</strong> to build and install the binding (using the well know method "python setup.py install").</li>
<li><strong>Defining new types:</strong> this post will be about how to write new types in C language and being able to use them from python code.</li>
<li><strong>Using codegen to write bindings:</strong> I'll explain how to use <strong>codegen</strong> utils to automate lot of tasks, to generate the most part of binding code and how to customize the generated code using overrides.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.andreagrandi.it/2009/08/03/writing-python-bindings-of-existing-c-libraries-1-introduction/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ridimensionare immagini automaticamente con un batch e ImageMagick</title>
		<link>http://www.andreagrandi.it/2009/07/05/ridimensionare-immagini-automaticamente-con-un-batch-e-imagemagick/</link>
		<comments>http://www.andreagrandi.it/2009/07/05/ridimensionare-immagini-automaticamente-con-un-batch-e-imagemagick/#comments</comments>
		<pubDate>Sun, 05 Jul 2009 16:56:16 +0000</pubDate>
		<dc:creator>Andrea Grandi</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[batch]]></category>
		<category><![CDATA[foto]]></category>
		<category><![CDATA[fotoritocco]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[imagemagick]]></category>
		<category><![CDATA[immagini]]></category>
		<category><![CDATA[magick]]></category>
		<category><![CDATA[ridimensionare]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://www.andreagrandi.it/?p=285</guid>
		<description><![CDATA[Spesso capita di dover compiere azioni noiose e ripetit [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.andreagrandi.it%2F2009%2F07%2F05%2Fridimensionare-immagini-automaticamente-con-un-batch-e-imagemagick%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.andreagrandi.it%2F2009%2F07%2F05%2Fridimensionare-immagini-automaticamente-con-un-batch-e-imagemagick%2F&amp;source=andreagrandi&amp;style=normal&amp;service=is.gd" height="61" width="50" /><br />
			</a>
		</div>
<p>Spesso capita di dover compiere azioni noiose e ripetitive su delle immagini, come ad esempio ridimensionarle o salvarle in formati diversi da quello originale. Queste operazioni possono richiedere moltissimo tempo, soprattutto se abbiamo a che fare con una grande quantità di immagini.</p>
<p>Per chi usa <strong>Linux</strong> è disponibile però l'utility <strong>ImageMagick</strong>, che unita ad un pizzico di script in <strong>bash</strong> ci permette di risolvere agevolmente il problema.</p>
<p>Per prima cosa è necessario installare il tool sulla propria distribuzione. Su <strong>Ubuntu</strong> (o in qualsiasi altra distribuzione basata su Debian) procedere nella seguente maniera:</p>
<p><code>sudo apt-get install imagemagick</code></p>
<p>A questo punto basta posizionarsi nella cartella dove si trovano le immagini (vi consiglio di crearvi una copia a parte delle immagini da modificare, visto che lo script andra' a lavorare direttamente su quelle originali) ed eseguire un comando come questo:</p>
<p><code>find ./ -iname '*.JPG' -exec convert '{}' -resize '1024' '{}' \;</code></p>
<p>Questo comando convertirà tutte le immagini .JPG che trova in un formato di 1024 pixel di larghezza, mantenendo ovviamente le proporzioni dell'immagine originale.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.andreagrandi.it/2009/07/05/ridimensionare-immagini-automaticamente-con-un-batch-e-imagemagick/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Risolvere il crash all&#8217;avvio di Songbird su Ubuntu</title>
		<link>http://www.andreagrandi.it/2009/06/24/risolvere-il-crash-allavvio-di-songbird-su-ubuntu/</link>
		<comments>http://www.andreagrandi.it/2009/06/24/risolvere-il-crash-allavvio-di-songbird-su-ubuntu/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 15:00:36 +0000</pubDate>
		<dc:creator>Andrea Grandi</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[crash]]></category>
		<category><![CDATA[libvisual]]></category>
		<category><![CDATA[nvidia]]></category>
		<category><![CDATA[songbird]]></category>

		<guid isPermaLink="false">http://www.andreagrandi.it/?p=282</guid>
		<description><![CDATA[Se si prova a far girare la versione di Songbird scaric [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.andreagrandi.it%2F2009%2F06%2F24%2Frisolvere-il-crash-allavvio-di-songbird-su-ubuntu%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.andreagrandi.it%2F2009%2F06%2F24%2Frisolvere-il-crash-allavvio-di-songbird-su-ubuntu%2F&amp;source=andreagrandi&amp;style=normal&amp;service=is.gd" height="61" width="50" /><br />
			</a>
		</div>
<p><strong><strong><img class="alignright size-full wp-image-283" title="songbird_screenshot_0" src="http://www.andreagrandi.it/wp-content/uploads/2009/06/songbird_screenshot_0.jpg" alt="songbird_screenshot_0" width="197" height="136" /></strong></strong>Se si prova a far girare la versione di <strong>Songbird</strong> scaricabile <a href="http://getsongbird.com">dal sito ufficiale</a> su <strong>Ubuntu</strong> (ma il problema sembra riguardare anche altre distribuzioni visto che si tratta di un bug del driver Nvidia) si otterrà quasi sicuramente un crash dell'applicazione stessa.</p>
<p>Per risolvere il problema è sufficiente disinstallare un plugin (<strong>libvisual-0.4-plugins</strong>) utilizzando il seguente comando: <strong>sudo apt-get remove <strong>libvisual-0.4-plugins</strong></strong></p>
<p>Una nota negativa: questo bug è presente fin dalla versione 8.10 di Ubuntu... che aspettano a correggerlo invece di far ricorrere gli utenti a questi trucchetti?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.andreagrandi.it/2009/06/24/risolvere-il-crash-allavvio-di-songbird-su-ubuntu/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Come passare dalla modalità enduser alla modalità developer su Fonera 2</title>
		<link>http://www.andreagrandi.it/2009/05/05/come-passare-dalla-modalita-enduser-alla-modalita-developer-su-fonera-2/</link>
		<comments>http://www.andreagrandi.it/2009/05/05/come-passare-dalla-modalita-enduser-alla-modalita-developer-su-fonera-2/#comments</comments>
		<pubDate>Tue, 05 May 2009 12:10:34 +0000</pubDate>
		<dc:creator>Andrea Grandi</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Recensione]]></category>
		<category><![CDATA[fon]]></category>
		<category><![CDATA[fonera]]></category>
		<category><![CDATA[router]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://www.andreagrandi.it/?p=271</guid>
		<description><![CDATA[Fino ad ora, i possessori di Fonera 2.0 che volevano pa [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.andreagrandi.it%2F2009%2F05%2F05%2Fcome-passare-dalla-modalita-enduser-alla-modalita-developer-su-fonera-2%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.andreagrandi.it%2F2009%2F05%2F05%2Fcome-passare-dalla-modalita-enduser-alla-modalita-developer-su-fonera-2%2F&amp;source=andreagrandi&amp;style=normal&amp;service=is.gd" height="61" width="50" /><br />
			</a>
		</div>
<p>Fino ad ora, i possessori di <a href="http://www.fon.com"><strong>Fonera 2.0</strong></a> che volevano passare alla modalità "<strong>developer</strong>" (e quindi avere anche l'accesso via <strong>SSH</strong>) dovevano flashare la fonera con un'apposita immagine, facendo uso del cavo seriale oppure della procedura con il cavo di rete che utilizza Redboot.</p>
<p>Da oggi è disponibile un nuovo plugin che permette di passare automaticamente alla modalità developer, basta andare (ad esempio) su questa pagina del router: <strong>http://192.168.0.105/luci/fon_devices/fon_plugins</strong></p>
<p>La Fonera passerà a questo punto in modalità developer e dovremo effettuare due reboot affinchè SSH sia attivato. Non dimenticatevi ovviamente di aprire l'accesso SSH nella configurazione del firewall della Fonera. Accedendo via SSH, vi troverete davanti questi messaggi:</p>
<pre class="brush: plain;">andy80@andy80-jaunty:~$ ssh root@192.168.0.105
The authenticity of host '192.168.0.105 (192.168.0.105)' can't be established.
RSA key fingerprint is e5:6e:fc:70:73:44:f6:cd:30:bd:ac:2d:53:d2:ab:a9.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.0.105' (RSA) to the list of known hosts.
root@192.168.0.105's password: 

BusyBox v1.11.1 (2009-04-17 12:45:57 CEST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

                                        __
                                    _.-~  )
                         _..--~~~~,'   ,-/     _
                      .-'. . . .'   ,-','    ,' )
                    ,'. . . _   ,--~,-'__..-'  ,'
                  ,'. . .  (@)' ---~~~~      ,'
                 /. . . . '~~             ,-'
                /. . . . .             ,-'
               ; . . . .  - .        ,'
              : . . . .       _     /
             . . . . .          `-.:
            . . . ./  - .          )
           .  . . |  _____..---.._/ ____ Seal _
     ~---~~~~----~~~~             ~~                

                      Flipper                       

--------  Fonera 2.0 Firmware (v2.2.5.0) -----------
      * Based on OpenWrt - http://openwrt.org
      * Powered by FON - http://www.fon.com
----------------------------------------------------
root@Fonera:~# uname -a
Linux Fonera 2.6.26.2 #9 Tue Apr 21 11:32:31 CEST 2009 mips unknown
root@Fonera:~#</pre>
<p>Cercherò prossimamente, nel caso ci sia interesse, di scrivere qualche post piu' approfondito su questa nuova Fonera, in modo da mostrare le caratteristiche di questo dispositivo.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.andreagrandi.it/2009/05/05/come-passare-dalla-modalita-enduser-alla-modalita-developer-su-fonera-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu 9.04 (Jaunty) su Asus EeePC 901</title>
		<link>http://www.andreagrandi.it/2009/04/26/ubuntu-904-jaunty-su-asus-eeepc-901/</link>
		<comments>http://www.andreagrandi.it/2009/04/26/ubuntu-904-jaunty-su-asus-eeepc-901/#comments</comments>
		<pubDate>Sun, 26 Apr 2009 14:20:43 +0000</pubDate>
		<dc:creator>Andrea Grandi</dc:creator>
				<category><![CDATA[EeePC]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Recensione]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[9.04]]></category>
		<category><![CDATA[901]]></category>
		<category><![CDATA[asus]]></category>
		<category><![CDATA[jaunty]]></category>

		<guid isPermaLink="false">http://www.andreagrandi.it/?p=262</guid>
		<description><![CDATA[Con l'uscita della versione 9.04 di Ubuntu Linux, quest [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.andreagrandi.it%2F2009%2F04%2F26%2Fubuntu-904-jaunty-su-asus-eeepc-901%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.andreagrandi.it%2F2009%2F04%2F26%2Fubuntu-904-jaunty-su-asus-eeepc-901%2F&amp;source=andreagrandi&amp;style=normal&amp;service=is.gd" height="61" width="50" /><br />
			</a>
		</div>
<p><img class="alignright size-full wp-image-126" title="eee-pc-901" src="http://www.andreagrandi.it/wp-content/uploads/2008/10/eee-pc-901.jpg" alt="eee-pc-901" width="202" height="154" />Con l'uscita della versione <strong>9.04</strong> di <a href="http://www.ubuntu.com">Ubuntu Linux</a>, questa distribuzione ha veramente fatto passi da gigante per quanto riguarda il supporto ai <strong>netbook</strong>. Oltre a rilasciare una versione specificatamente pensata per i piccoli device (che integra di default l'interfaccia <a href="http://www.canonical.com/projects/ubuntu/unr"><strong>Notebook Remix</strong></a>), sono stati inclusi nel kernel tutti i moduli necessari a far funzionare le periferiche di questi device.</p>
<p>Per installare Ubuntu sull'EeePC dobbiamo per prima cosa procurarci la ISO dell'ultima versione e poi utilizzare una delle seguenti utility per preparare una chiavetta USB (da almeno 1 Gb) che ci permetterà di effettuare l'installazione: <strong>USB Startup Disk Creator</strong>, disponibile a partire dalle ultime versioni di Ubuntu (si trova in System--&gt;Administration) oppure <strong>Unetbootin</strong>, che potete trovare a questo indirizzo: <a href="http://unetbootin.sourceforge.net/">http://unetbootin.sourceforge.net/</a></p>
<p>Nel caso vogliate installare la versione NBR (Notebook Remix) di Ubuntu, che viene distribuita in formato .img dovete invece attenervi alle istruzioni che trovate su questa pagina: <a href="https://help.ubuntu.com/community/Installation/FromImgFiles">https://help.ubuntu.com/community/Installation/FromImgFiles</a></p>
<p>Una volta preparata la chiavetta USB (o in alternativa va bene anche una memoria di tipo SD) dovrete utilizzarla per fare il boot (vi ricordo che per fare il boot da USB dovete <strong>premere ESC</strong> nei primi secondi di accensione dell'EeePC) e procedere all'installazione come se fosse un normale PC. Se posso darvi un consiglio su come partizionare, vi suggerisco di utilizzare il disco da <strong>4 Gb</strong> per la root <strong>/</strong> e quello da <strong>16 Gb</strong> (o 12 Gb a seconda dei modelli) per la <strong>/home</strong>.</p>
<p>Completata l'installazione, al riavvio dell'EeePC avrete una piacevole sorpresa: tutte le periferiche saranno perfettamente riconosciute! Questo dimostra l'ottimo lavoro che è stato fatto per supportare questa fascia di dispositivi. E' necessaria tuttavia qualche altra piccola ottimizzazione per poter sfruttare al 100% il nostro netbook.</p>
<p>Per prima cosa vi consiglio di installare <a href="http://www.informatik.uni-bremen.de/~elmurato/EeePC/Jaunty_Eeeasy-Scripts.tar.gz">gli script</a> di <strong>elmurato</strong> che vi permetteranno di utilizzare correttamente tutti i tasti funzione (Fn+Fx). Perchè possano funzionare dovrete anche installare sia un pacchetto presente nella Ubuntu, sia uno incluso nel tar.gz, seguendo le seguenti istruzioni:</p>
<p><code>sudo apt-get install dkms<br />
sudo apt-get remove --purge nvidia-common<br />
tar xzvf Jaunty_Eeeasy-Scripts.tar.gz<br />
cd Jaunty_Eeeasy-Scripts<br />
sudo dpkg --install asus-eee-dkms_3.0_all.deb<br />
sudo ./eeeasy-scripts.sh</code></p>
<p>A questo punto non vi resta che riavviare il vostro EeePC e l'installazione sarà completata. Se vogliamo essere precisi, ci sono ancora un paio di piccole cose da migliorare. Noterete infatti che il tasto per abilitare/disabilitare il <strong>bluetooth</strong> non funziona correttamente. Si tratta di un bug del kernel <strong>2.6.28</strong> che viene fortunatamente risolto con la versione <strong>2.6.29</strong> di cui <strong>elmurato</strong> fornisce i pacchetti .deb già compilati: <a href="http://www.informatik.uni-bremen.de/~elmurato/EeePC/">http://www.informatik.uni-bremen.de/~elmurato/EeePC/</a> (dovrete installare <strong>linux-headers-*</strong> e <strong>linux-image-*</strong> ).</p>
<p>La versione 2.6.29 del kernel include anche una versione aggiornata del modulo che fa funzionare la scheda <strong>wireless</strong>, permettendoci di avere un <strong>segnale piu' stabile</strong>.</p>
<p>Consiglio infine di aggiungere la seguente stringa in fondo al file <strong>/etc/modprobe.d/options</strong> (createlo se non esistesse): <strong>options psmouse proto=imps<br />
</strong>questa opzione fa in modo che il touchpad funzioni meglio rispetto a come viene configurato di default.<strong><br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.andreagrandi.it/2009/04/26/ubuntu-904-jaunty-su-asus-eeepc-901/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Dropbox: 2Gb di disco online che si integrano con Windows, OSX e Linux</title>
		<link>http://www.andreagrandi.it/2009/03/29/dropbox-2gb-di-disco-online-che-si-integrano-con-windows-osx-e-linux/</link>
		<comments>http://www.andreagrandi.it/2009/03/29/dropbox-2gb-di-disco-online-che-si-integrano-con-windows-osx-e-linux/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 13:59:59 +0000</pubDate>
		<dc:creator>Andrea Grandi</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Recensione]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.andreagrandi.it/?p=253</guid>
		<description><![CDATA[Da tempo stavo cercando un servizio che mi offrisse un  [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.andreagrandi.it%2F2009%2F03%2F29%2Fdropbox-2gb-di-disco-online-che-si-integrano-con-windows-osx-e-linux%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.andreagrandi.it%2F2009%2F03%2F29%2Fdropbox-2gb-di-disco-online-che-si-integrano-con-windows-osx-e-linux%2F&amp;source=andreagrandi&amp;style=normal&amp;service=is.gd" height="61" width="50" /><br />
			</a>
		</div>
<p><img class="alignright size-full wp-image-254" title="dropbox_logo" src="http://www.andreagrandi.it/wp-content/uploads/2009/03/dropbox_logo.png" alt="dropbox_logo" width="65" height="54" />Da tempo stavo cercando un servizio che mi offrisse un piccolo spazio online, sempre accessibile ed utilizzabile come una chiavetta USB, per poterci mettere i miei dati ed averli sempre disponibili ovunque andassi. In questi giorni, dopo aver sentito parlare molto bene di <a href="https://www.getdropbox.com/referrals/NTgzNTM0MTk"><strong>Dropbox</strong></a> da parte di un amico, mi sono deciso a provarlo.</p>
<p>Dropbox offre <strong>2 Gb</strong> (espandibili fino a <strong>5 Gb</strong> invitando altre persone ad usare il servizio) di spazio gratuito, da utilizzare come disco personale. La cosa interessante è che non si tratta di una semplice cartella tipo FTP, ma tramite il loro client si integra perfettamente nel sistema operativo che stiamo utilizzando (<strong>Windows</strong>, <strong>OSX</strong> o <strong>Linux</strong>) e si occupa automaticamente di sincronizzare online le modifiche che facciamo ai file locali. I nostri file infatti si trovano sia sul nostro disco locale, sia in copia sul nostro spazio online.</p>
<p>Se ad esempio abbiamo installato il client sul nostro PC fisso e lavoriamo a dei file, questi vengono automaticamente sincronizzati online. Immaginiamo adesso di installare il client anche sul nostro portatile, non appena accediamo ad Internet i file verranno automaticamente sincronizzati, quasi in tempo reale.</p>
<p>Tra le altre funzionalità che il servizio offre, c'è anche quella di poter creare in automatico delle gallerie fotografiche. E' sufficiente creare una sotto cartella dentro la cartella Photos predefinita ed in automatico verrà creata la fotogallery.</p>
<p>Per quanto riguarda la sicurezza dei nostri file, quello che mettiamo su Dropbox rimane accessibile solo a noi, fatta eccezione per quello che viene messo nella sotto cartella Public. Il trasferimento dei file dal nostro PC allo spazio online inoltre avviene in modo cifrato. Nessuno però ci garantisce che i nostri documenti, uan volta sui server di Dropbox, non vengano sbirciati da qualcuno... il mio consiglio quindi è quello di crearsi una ulteriore sotto cartella, magari chiamandola Secure, e metterci dentro un file di <a href="http://www.truecrypt.org/"><strong>Truecrypt</strong></a> sul quale andremo a montare la nostra cartella cifrata. In questo modo il file di Truecrypt sara' sincronizzato online, ma il suo contenuto sara' inaccessibile a chiunque, eccetto noi.</p>
<p>Un'ulteriore doverosa precisazione: il client che installiamo sul nostro PC non è opensource. A parte questo piccolo difetto, il servizio è veramente valido! Per chi avesse bisogno di maggiore spazio, esiste anche una versione a pagamento del servizio, dove per 10$/mese vengono messi a disposizione 50 Gb di spazio.</p>
<p>Chi volesse provare il servizio, puo' iscriversi utilizzando questo link: <a href="https://www.getdropbox.com/referrals/NTgzNTM0MTk">https://www.getdropbox.com/referrals/NTgzNTM0MTk</a></p>
<p>In questo modo sia voi che io guadagneremo <strong>+250 Mb</strong> di spazio da aggiungersi ai 2 Gb che vengono dati di base.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.andreagrandi.it/2009/03/29/dropbox-2gb-di-disco-online-che-si-integrano-con-windows-osx-e-linux/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Develop a GPS-aware application for the Nokia N810</title>
		<link>http://www.andreagrandi.it/2009/02/24/develop-a-gps-aware-application-for-the-nokia-n810/</link>
		<comments>http://www.andreagrandi.it/2009/02/24/develop-a-gps-aware-application-for-the-nokia-n810/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 14:51:33 +0000</pubDate>
		<dc:creator>Andrea Grandi</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Maemo (EN)]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[gps]]></category>
		<category><![CDATA[SDK]]></category>

		<guid isPermaLink="false">http://www.andreagrandi.it/?p=236</guid>
		<description><![CDATA[Paul Ferrill has written a serie of three articles abou [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.andreagrandi.it%2F2009%2F02%2F24%2Fdevelop-a-gps-aware-application-for-the-nokia-n810%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.andreagrandi.it%2F2009%2F02%2F24%2Fdevelop-a-gps-aware-application-for-the-nokia-n810%2F&amp;source=andreagrandi&amp;style=normal&amp;service=is.gd" height="61" width="50" /><br />
			</a>
		</div>
<p><strong>Paul Ferrill</strong> has written a serie of three articles about writing a GPS-aware application for the Nokia N810, using the Maemo SDK, Eclipse and PluThon plugin.</p>
<p>Here is the complete serie:</p>
<ul>
<li><a href="http://www.ibm.com/developerworks/linux/library/l-gps-nokia1/index.html?S_TACT=105AGX03&amp;S_CMP=EDU">Develop a GPS-aware application for the Nokia N810, Part 1: Development environment:</a> Learn how to configure a development environment targeted at the Nokia             N810 Internet Tablet, including setting up Eclipse on a target development             machine for the Python language.</li>
<li><a href="http://www.ibm.com/developerworks/linux/library/l-gps-nokia2/index.html?S_TACT=105AGX03&amp;S_CMP=EDU">Develop a GPS-aware application for the Nokia N810, Part 2: Consider your options:</a> Discover the details of code design, library selection, unit testing, and             user interface choices that make the most sense for you.<a href="http://www.ibm.com/developerworks/linux/library/l-gps-nokia2/index.html?S_TACT=105AGX03&amp;S_CMP=EDU"> </a></li>
<li><a href="http://www.ibm.com/developerworks/linux/library/l-gps-nokia3/index.html?S_TACT=105AGX03&amp;S_CMP=EDU">Develop a GPS-aware application for the Nokia N810, Part 3: Finish the job</a>: In this last of three installments,      you'll put the final touches to the GPS trip tracker and      get it ready for release.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.andreagrandi.it/2009/02/24/develop-a-gps-aware-application-for-the-nokia-n810/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
