<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>Yet Another Boring Web</title>
        <link>https://aj.garcialagar.es</link>
        <description>RSS feed forYet Another Boring Web</description>
        <atom:link href="https://aj.garcialagar.es/rss.xml" rel="self" type="application/rss+xml" />            <item>
                <title>What is wrong with CSV in PHP</title>
                <description><![CDATA[<p>The PHP implementation of CSV functions has some little gotchas related to the escape character that can lead you to unexpected results if you exchange CSV data with applications not written in PHP.</p>

<h2>RFC 4180: Common Format and MIME Type for Comma-Separated Values (CSV) Files</h2>

<p>To illustrate the issue, I've created a simple <a href="https://goo.gl/j50MKc">Google Spreadsheet</a> document with a single field filled with the following text <code>"Hello\", World!</code>.</p>

<p>If you <a href="https://goo.gl/H4ni63">download</a> it as CSV, the Google servers will generate a file that adheres to the <a href="https://www.ietf.org/rfc/rfc4180.txt">RFC 4180</a> Common Format and MIME Type for Comma-Separated Values (CSV) Files.</p>

<p>Now, to read it with the PHP <a href="http://php.net/manual/en/function.fgetcsv.php"><code>fgetcsv</code></a> function, we must use a double-quote (<code>“</code>) as the escape character because the RFC states that:</p>

<blockquote>
  <p>If double-quotes are used to enclose fields, then a double-quote appearing inside a field must be escaped by preceding it with another double quote.</p>
</blockquote>

<p>So let's try this code snippet:</p>

<pre><code class="php">&lt;?php
$fp = fopen('https://goo.gl/H4ni63', 'r');
echo fgets($fp, 4096).PHP_EOL;
$fp = fopen('https://goo.gl/H4ni63', 'r');
echo fgetcsv($fp, 0, ',', '"', '"')[0].PHP_EOL;
</code></pre>

<p>Output:</p>

<pre><code class="bash">"""Hello\"", World!"
"Hello\", World!
</code></pre>

<p>The first line is the raw content of the CSV file; and the second one, the parsed data, so everything works as expected.</p>

<h2>The problem: Trying to write standard CSV files with PHP</h2>

<p>Now, let's make the opposite operation, to write the extracted data back to CSV format. Remember that we must use a double-quote as escape character, but here comes the first problem. The <code>$escape_char</code> parameter in <a href="http://php.net/manual/en/function.fputcsv.php"><code>fputcsv</code></a> was added in PHP 5.5.4, so we have two options:</p>

<h3>PHP &lt;5.5.4</h3>

<pre><code class="php">&lt;?php
$fp = tmpfile();
fputcsv($fp, array('"Hello\", World!'), ',', '"');
rewind($fp);
echo fgets($fp, 4096);
rewind($fp);
$row = fgetcsv($fp, 0, ',', '"', '"');
echo $row[0].PHP_EOL;
echo $row[1].PHP_EOL;
</code></pre>

<p>Output:</p>

<pre><code>"""Hello\", World!"
"Hello\
 World!"
</code></pre>

<p>You can see that the first double-quote is escaped with a double-quote, but the second one is escaped with a backslash (<code>\</code>), and reading it back will generate a row with two fields. WTF!</p>

<h3>PHP >=5.5.4</h3>

<pre><code class="php">&lt;?php
$fp = tmpfile();
fputcsv($fp, array('"Hello\", World!'), ',', '"', '"');
rewind($fp);
echo fgets($fp, 4096);
rewind($fp);
$row = fgetcsv($fp, 0, ',', '"', '"');
echo $row[0].PHP_EOL;
echo $row[1].PHP_EOL;
</code></pre>

<p>Output:</p>

<pre><code>""Hello\", World!"
Hello\"
 World!"
</code></pre>

<p>The result is even worse, the second double-quote is escaped again with a backslash (<code>\</code>), but the first one is not escaped at all, and reading it back will generate a row with two fields again. WTF<sup>2</sup>!</p>

<p>This problem is a known issue, reported in the <a href="https://bugs.php.net/bug.php?id=50686">50686</a> PHP bug, that is marked as <em>Wont fix</em> by the language developers.</p>

<h2>My proposed solution: Writing standard CSV files with AjglCsvRfc</h2>

<p>As I needed a workaround for it, I’ve written a small PHP library that provides an alternative implementation for all CSV related functions to write CSV files that can be safely exchanged with applications written in other programming languages.</p>

<table>
<thead>
<tr>
  <th>Native</th>
  <th>Alternative</th>
</tr>
</thead>
<tbody>
<tr>
  <td><code>fgetcsv</code></td>
  <td><code>Ajgl\Csv\Rfc\fgetcsv</code></td>
</tr>
<tr>
  <td><code>fputcsv</code></td>
  <td><code>Ajgl\Csv\Rfc\fputcsv</code></td>
</tr>
<tr>
  <td><code>str_getcsv</code></td>
  <td><code>Ajgl\Csv\Rfc\str_getcsv</code></td>
</tr>
<tr>
  <td><code>SplFileObject::fgetcsv</code></td>
  <td><code>Ajgl\Csv\Rfc\Spl\SplFileObject::fgetcsv</code></td>
</tr>
<tr>
  <td><code>SplFileObject::fputcsv</code></td>
  <td><code>Ajgl\Csv\Rfc\Spl\SplFileObject::fputcsv</code></td>
</tr>
<tr>
  <td><code>SplFileObject::setCsvControl</code></td>
  <td><code>Ajgl\Csv\Rfc\Spl\SplFileObject::setCsvControl</code></td>
</tr>
</tbody>
</table>

<p>You can install this library with composer:</p>

<pre><code class="bash">$ composer require ajgl/csv-rfc
</code></pre>

<p>Now the following code snippet will finally print a well escaped CSV string where both double-quote charaters are successfully escaped following the RFC statement, and when read it back will generate a row with a single field:</p>

<pre><code class="php">&lt;?php
require __DIR__.'/vendor/autoload.php';
use Ajgl\Csv\Rfc;
$fp = tmpfile();
Rfc\fputcsv($fp, array('"Hello\", World!'), ',', '"');
rewind($fp);
echo fgets($fp, 4096);
rewind($fp);
$row = Rfc\fgetcsv($fp, 0, ',', '"', '"');
echo $row[0].PHP_EOL;
</code></pre>

<p>Output:</p>

<pre><code>"""Hello\"", World!"
"Hello\", World!
</code></pre>

<p>I recommend you to read the README file, and to pay attention to the <a href="https://github.com/ajgarlag/AjglCsvRfc#end-of-line-eol">End-Of-Line</a> section.</p>

<p>If you find this library useful, please drop a ★ in the <a href="https://github.com/ajgarlag/AjglCsvRfc">GitHub repository page</a> and/or the <a href="https://packagist.org/packages/ajgl/csv-rfc">Packagist package page</a>.</p>
]]></description>
                <link>https://aj.garcialagar.es/blog/2016/04/04/what-is-wrong-with-csv-in-php</link>
                <pubDate>Mon, 04 Apr 2016 18:11:23 +0000</pubDate>
                <guid>https://aj.garcialagar.es/blog/2016/04/04/what-is-wrong-with-csv-in-php</guid>
            </item>            <item>
                <title>How to set breakpoints in Twig</title>
                <description><![CDATA[<p>After last <a href="http://phpmad.org" title="PHP Madrid User Group">PHPMad</a> meetup, I was talking with other two group members about our daily work with the <a href="http://www.symfony.com">Syfmony</a> framework and the Symfony Ecosystem. One of them told me that he loves Twig but sometimes he would like to set a breakpoint in a <a href="http://twig.sensiolabs.org">Twig</a> template to debug generated code and the variables passed to the template.</p>

<p>Last week I had some time to investigate this and found a simple way to accomplish this creating a <strong>Twig Extension</strong> with a new <strong>breakpoint</strong> function. This new function will detect if the <strong>XDebug</strong> extension is installed and then it will the <strong>xdebug_break</strong> function to stop the debug sessión.</p>

<p>I've created a <a href="https://getcomposer.org">Composer</a> package called <a href="https://packagist.org/packages/ajgl/breakpoint-twig-extension"><strong>ajgl/breakpoint-twig-extension</strong></a> that you can install with:</p>

<pre><code class="bash">$ composer require ajgl/breakpoint-twig-extension
</code></pre>

<p>Once installed and configured, the new funcion can be called inside your twig template:</p>

<pre><code class="twig">&lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;
  &lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;title&gt;title&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;{{ breakpoint()}}
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>Remember that you must register the extension within the twig environment with</p>

<pre><code class="php">/* @var $twig Twig_Environment */
$twig-&gt;addExtension(new Ajgl\Twig\Extension\BreakpointExtension());
</code></pre>

<p>If you are writing a Symfony Application, you can use the provided bundle (included with the package) which will register the extension automatically:</p>

<pre><code class="php">// app/AppKernel.php
use Ajgl\Twig\Extension\SymfonyBundle\AjglBreakpointTwigExtensionBundle();

if (in_array($this-&gt;getEnvironment(), array('dev', 'test'), true)) {
    $bundles[] = new AjglBreakpointTwigExtensionBundle();
}
</code></pre>

<h3>Extra tip for Netbeans users</h3>

<p>If you are using Netbeans IDE and want to debug the PHP code generated by twig in an standard Symfony app, you must uncheck the <strong>Ignore &#8220;app/cache&#8221; Directory</strong> inside the <em>Frameworks/Symfony2</em> category in the <em>Project Properties</em> window.</p>
]]></description>
                <link>https://aj.garcialagar.es/blog/2013/12/03/how-to-set-breakpoints-in-twig</link>
                <pubDate>Tue, 03 Dec 2013 09:30:25 +0000</pubDate>
                <guid>https://aj.garcialagar.es/blog/2013/12/03/how-to-set-breakpoints-in-twig</guid>
            </item>            <item>
                <title>Debugging Symfony with Xdebug</title>
                <description><![CDATA[<p>Some months ago, I wrote a post in Spanish about debugging Symfony apps with Xdebug with the hope that I would translate it to English soon. Well, not as soon as I wished,but here is it.</p>

<p>Whe I started to work with the Symfony standard distribution, 18 months ago (I used to work with Zend Framework 1 before), I didn’t understand the event controlled execution flow (beside other dark magics inside the framework), so the first thing I tried was to debug a full request with the help of Xdebug.</p>

<p>The problem was that, although I set the breakpoints in every interesting line of code, these breakpoints were completely ignored. The reason, easy to understand now than I know it, was that the files with the breakpoints were never executed. They were being cached to another location to accelerate the framework and this location was hidden for mi IDE.</p>

<p>To simplify my debugging work of the hidden corners of the framework, without the need of setting breakpoints it those cache files, the solution was to skip the cache files with a comment to the <strong>$kernel->loadClassCache();</strong> inside the <strong>web/app_dev.php</strong> file. But I wanted to avoid the cache only when the Xdebug session was running, so I wrote a little conditional expression to detect it.</p>

<p>Here is the snippet that helped me a lot to understand how Symfony works:</p>

<pre><code class="php">//This check tries to detect a Xdebug session to prevent the load of class cache
if (
    !extension_loaded('xdebug') ||
    (
        !isset($_REQUEST['XDEBUG_SESSION_START']) &amp;&amp;
        !isset($_COOKIE['XDEBUG_SESSION']) &amp;&amp;
        ini_get('xdebug.remote_autostart') == false
    )
) {
    $kernel-&gt;loadClassCache();
}
</code></pre>
]]></description>
                <link>https://aj.garcialagar.es/blog/2013/11/15/debugging-symfony-with-xdebug</link>
                <pubDate>Fri, 15 Nov 2013 20:54:12 +0000</pubDate>
                <guid>https://aj.garcialagar.es/blog/2013/11/15/debugging-symfony-with-xdebug</guid>
            </item>            <item>
                <title>Debug de Symfony con Xdebug</title>
                <description><![CDATA[<p>Hace algunas semanas asistí en <a href="http://twitter.com/search?q=%23desymfony">#desymfony</a>  2013, la <a href="http://desymfony.com">conferencia española de Symfony</a>, a una charla de <a href="http://twitter.com/carlos_granados">@carlos_granados</a> titulada &#8220;<a href="http://es.slideshare.net/carlosgranados/por-que-symfony2-es-tan-rpido"><em>Por qué Symfony2 es tan rápido</em></a>&#8221; en la que Carlos nos explicó algunos de los mecanismos internos utilizados por Symfony para acelerar la respuesta a las peticiones HTTP.</p>

<p>Uno de estos mecanismos consiste en copiar en un solo fichero un conjunto de clases que serán, presumiblemente, utilizadas en todas las peticiones al servidor, de modo que con una sola llamada al sistema de ficheros se tienen disponibles todas estas clases, reduciendo así los tiempos de carga de los ficheros. Es un mecanismo sencillo, fácilmente comprensible cuando se conoce, pero puede suponer un quebradero de cabeza si no sabes que existe.</p>

<p>Cuando empecé a enredar con la distribución estándar de Symfony, hace más o menos un año (hasta entonces había trabajado con Zend Framework 1) me costaba entender el mecanismo de control de la ejecución por medio de eventos (además de otras muchas cosas mágicas y oscuras que sucedían dentro del <em>framework</em>), por lo que mi primera reacción fue seguir la ejecución de una petición paso a paso con ayuda de Xdebug.</p>

<p>El problema que me encontré era que aunque yo ponía los puntos de interrupción en las líneas de código que me interesaban, estos puntos de interrupción nunca detenían la ejecución del <em>script</em>. La razón, sencilla ahora, era que los ficheros en los que yo ponía esos puntos de interrupción nunca se ejecutaban, sino que lo que se ejecutaban eran las copias de esas clases desde los ficheros en los que estaban <em>cacheadas</em> y que permanecían, por defecto, ocultos en mi IDE.</p>

<p>Para simplificar la labor de depurar los recónditos rincones del <em>framework</em> sin necesidad de poner los puntos de interrupción en estos ficheros de caché, la solución era evitar la carga de los mismos comentando la llamada <strong>$kernel->loadClassCache()</strong>; dentro del fichero <strong>web/app_dev.php</strong> pero como no quería que esto sucediera siempre, en lugar de comentar esa línea de código, utilicé un pequeño condicional que detecta cuando está activa la sesión de depuración de Xdebug para evitar la carga de este cache.</p>

<p>Aquí está ese pequeño trozo de código que tantas veces me ha ayudado:</p>

<pre><code class="php">//This check tries to detect a Xdebug session to prevent the load of class cache
if (
    !extension_loaded('xdebug') ||
    (
        !isset($_REQUEST['XDEBUG_SESSION_START']) &amp;&amp;
        !isset($_COOKIE['XDEBUG_SESSION']) &amp;&amp;
        ini_get('xdebug.remote_autostart') == false
    )
) {
    $kernel-&gt;loadClassCache();
}
</code></pre>
]]></description>
                <link>https://aj.garcialagar.es/blog/2013/07/12/debug-de-symfony-con-xdebug</link>
                <pubDate>Fri, 12 Jul 2013 20:41:50 +0000</pubDate>
                <guid>https://aj.garcialagar.es/blog/2013/07/12/debug-de-symfony-con-xdebug</guid>
            </item>            <item>
                <title>Reboot complete</title>
                <description><![CDATA[<pre><code class="bash">e2fsck 1.42.5 (29-Jul-2012)
/dev/sda1: clean, 218999/7397376 files, 12969219/29578240 blocks
</code></pre>

<p>It looks that the reboot announced about one year ago is complete now. The filesystem checks was so slowly 😉</p>

<p>It's time to blog again.</p>
]]></description>
                <link>https://aj.garcialagar.es/blog/2013/07/04/reboot-complete</link>
                <pubDate>Thu, 04 Jul 2013 17:59:04 +0000</pubDate>
                <guid>https://aj.garcialagar.es/blog/2013/07/04/reboot-complete</guid>
            </item>            <item>
                <title>Reboot</title>
                <description><![CDATA[<p>More than one year ago I wrote my last post, now I'm here again trying to reboot the blog.</p>

<p>In these months several I started several projects and most of them are already dead, so I won't write about them. But one of these projects is still alive, and I think it will be a long term project.</p>

<p>It's my other blog <a href="http://tresiyo.com/blog">TRESiYO</a> where I write with a friend <a href="http://twitter.com/nono_martin">@nono_martin</a> about architecture (about buildings, not computers). It's written in Spanish, but we have a widget to translate it with the help of Google Translate, so you can read it in something that seems to be English.</p>

<p>I hope to write something interesting here soon.</p>
]]></description>
                <link>https://aj.garcialagar.es/blog/2012/06/21/reboot</link>
                <pubDate>Thu, 21 Jun 2012 20:27:35 +0000</pubDate>
                <guid>https://aj.garcialagar.es/blog/2012/06/21/reboot</guid>
            </item>            <item>
                <title>Mi manifiesto</title>
                <description><![CDATA[<p>Creo que el movimiento social que está teniendo lugar en España durante estos días protagonizado por una multitud de personas con intereses, ideario y opiniones diversas es lo mejor que le ha sucedido a la sociedad española en muchos años de democracia.</p>

<p>Creo también que es necesario que de este movimiento pudieran surgir propuestas concretas que puedan aglutinar el mayor consenso y que permitan medir la consecución de objetivos.</p>

<p>De acuerdo con esto creo necesario aportar una propuesta de mí­nimos que permitiera a la ciudadaní­a recuperar la confianza en la representación que de ella hacen los distintos cargos públicos. Este es la mí­a:</p>

<blockquote>
  <ul>
  <li>Considero la democracia representativa es el menos malo de los sistemas de gobierno.</li>
  <li>Es evidente que la clase política se ha distanciado de la ciudadaní­a pasando a constituirse en una casta privilegiada que no nos representa.</li>
  <li>Reclamo una Ley que suponga la igualdad del valor de los votos de todos los ciudadanos.</li>
  <li>Reclamo una Ley que imponga las listas abiertas que nos permita elegir a las personas y no a los partidos polí­ticos que han de representarnos.</li>
  <li>Reclamo una Ley que invalide la disciplina de voto en nuestros parlamentos para que no se diluya la acción individualizada de nuestros representantes, e impida así­ poner los intereses de un partido polí­tico por encima de los de los ciudadanos.</li>
  <li>Reclamo una Ley que exija a nuestros representantes una acción polí­tica y de gobierno honesta y que conlleve penas ejemplares ante delitos cometidos por cualquier cargo público.</li>
  <li>Reclamo una Ley que permita a los ciudadanos conocer, valorar y sancionar con total transparencia las acciones de nuestros representantes.</li>
  <li>Reclamo una clara y ní­tida separación de los Poderes del Estado.</li>
  <li>En definitiva propongo que nuestros parlamentarios, jueces y gobernantes sean verdaderos representantes de los ciudadanos, no de los partidos polí­ticos. Una vez elegidos les corresponderí­a a ellos continuar la tarea de elaborar y desarrollar nuevas propuestas con la confianza de contar ahora sí con el apoyo de la ciudadanía.</li>
  </ul>
</blockquote>
]]></description>
                <link>https://aj.garcialagar.es/blog/2011/05/20/mi-manifiesto</link>
                <pubDate>Fri, 20 May 2011 20:05:50 +0000</pubDate>
                <guid>https://aj.garcialagar.es/blog/2011/05/20/mi-manifiesto</guid>
            </item>            <item>
                <title>Winner</title>
                <description><![CDATA[<p>AJ 1 &#8211; PFC 0</p>

<p>AJ wins!</p>
]]></description>
                <link>https://aj.garcialagar.es/blog/2011/04/01/winner</link>
                <pubDate>Fri, 01 Apr 2011 13:47:35 +0000</pubDate>
                <guid>https://aj.garcialagar.es/blog/2011/04/01/winner</guid>
            </item>            <item>
                <title>La alternativa a la #leysinde</title>
                <description><![CDATA[<p>Como ciudadano y usuario de internet, vengo siguiendo con sumo interés todo lo relacionado con la mal llamada <a href="http://twitter.com/search?q=%23leysinde">#leysinde</a>; pensando si escribir algo a respecto, pero nunca lo hago por dos razones:</p>

<ul>
<li>No hay un solo argumento que yo pueda aportar que no haya sido expuesto ya por el conjunto de ciudadanos que desde sus posiciones más o menos relevantes son capaces de dar mayor difusión pública a los mismos que este pobre bloguero frustrado.</li>
<li>Procrastinación crónica</li>
</ul>

<p>Dejando de lado el segundo argumento, respecto al primero quiero aclarar que aunque mis opiniones respecto a la <a href="http://twitter.com/search?q=%23leysinde">#leysinde</a> puedan coincidir en algún momento con las expresadas por <a href="http://twitter.com/dbravo">@dbravo</a>, <a href="http://twitter.com/jdelacueva">@jdelacueva</a>, <a href="http://twitter.com/edans">@edans</a>, <a href="http://twitter.com/iescolar">@iescolar</a>, <a href="http://twitter.com/julioalonso">@julioalonso</a>, <a href="http://twitter.com/adelgado">@adelgado</a>, y otros muchos, ellos no me representan.</p>

<p>Ayer, me acosté leyendo en twitter el revuelo levantado por la filtración que recibía la <a href="http://twitter.com/cadenasercom">@cadenasercom</a> y que quisieron contrastar respecto a un supuesto texto consensuado por <a href="http://twitter.com/alexdelaiglesia">@alexdelaiglesia</a> y los internautas. Mi primera reacción fue: ¡coño, otra vez hablan de los internautas y a mi no me ha llamado nadie!</p>

<p>Luego, leyendo las explicaciones que unos y otros dan al asunto me sorprendo con las <a href="http://www.twitlonger.com/show/8a28bv">declaraciones</a> de <a href="http://twitter.com/alexdelaiglesia">@alexdelaiglesia</a> en la que señala que:</p>

<blockquote>
  <p>&#8230; En primer lugar, como sabéis, celebramos una reunión con todos los que se ofrecieron a participar en un debate en el que Pedro Pérez, presidente de FAPAE (asociación de productores españoles) y yo mismo, fuimos a escuchar. Sólo a escuchar. Aprendimos muchas cosas, &#8230;</p>
  
  <p>&#8230; El plazo de entrega de enmiendas acababa el lunes. Di curso a la propuesta, como era mi obligación. Recibo otra llamada: La reunión de David con el resto de internautas no pudo llevarse a efecto, por las razones que ellos mismos han explicado, con todo su derecho. Quiero dejar claro que no hay manipulaciones, ni secretos. Aqui nadie quiere maquillar la ley de economí­a sostenible, ni nada parecido. Esto se ha interpretado mal. &#8230;</p>
</blockquote>

<p>De este pequño extracto (leedlo completo para que no sea descontextualizado) me sorprenden tres cosas:</p>

<ul>
<li>Que se diga que el debate fue con TODOS los que se ofrecieron a participar, así­ que desde aquí­ me ofrezco a participar en el próximo.</li>
<li>Que <a href="http://twitter.com/alexdelaiglesia">@alexdelaiglesia</a> sea capaz de dar curso a una propuesta hasta llegar al Senado es una buena muestra de como esta ley ha sido desarrollada por y para defender los intereses de las industrias. Es el representante de la industria el que decide si dar curso o no a la propuesta. Que el Director de la Academia de Cine sea el intermediario entre el Senado o el Ministerio y los internautas me parece lo más parecido a un <a href="http://es.wikipedia.org/wiki/Ataque_Man-in-the-middle">ataque Man In The Middle</a>.</li>
<li>Que diga que nadie quiere maquillar la ley de economía sostenible, cuando lo que se propone es presentar un texto que pueda parecer surgido de un acuerdo con los internautas, cuando vuelvo a repetir: ¡coño, otra vez hablan de los internautas y a mi no me ha llamado nadie!</li>
</ul>

<p>Por todo ello le envío un tweet (indignado y en caliente) a <a href="http://twitter.com/alexdelaiglesia">@alexdelaiglesia</a> en el que le digo:</p>

<blockquote>
  <p><a href="http://twitter.com/alexdelaiglesia">@alexdelaiglesia</a> tu no eres nadie para negociar nada que ataña a una Ley. Entiendes el concepto de democracia?</p>
</blockquote>

<p>y el me contesta:</p>

<blockquote>
  <p><a href="http://twitter.com/ajgarlag">@ajgarlag</a> yo no hago nada mas que presentar un texto que no es mio a debate. Yo no decido nada.</p>
</blockquote>

<p>Luego, <a href="http://twitter.com/davidmaeztu">@davidmaeztu</a> cuando da <a href="http://derechoynormas.blogspot.com/2011/01/quien-me-mandara-mi.html">su versión</a> de los hechos, aclara que:</p>

<blockquote>
  <p>Él me contestó en su voluntad de recibir lo que se pudiese aportar y darle el trámite oportuno si lo consideraba interesante.</p>
</blockquote>

<p>Siento que todo esto haya acabado así­, creo de verdad que <a href="http://twitter.com/alexdelaiglesia">@alexdelaiglesia</a> tení­a la voluntad de intentar solucionar el entuerto, se ha mostrado siempre dispuesto a dialogar y defender sus puntos de vista públicamente en <a href="http://twitter.com">twitter</a>, pero hay tres errores, a mi juicio, muy graves en su forma de actuar:</p>

<ol>
<li>Convertirse en la persona que decide si una propuesta es lo suficentemente interesante para hacerla llegar o no a instancias polí­ticas, a las que tiene acceso desde su posición como representante de parte. Insisto en la idea de que no se puede ser juez y parte.</li>
<li>Intentar después de tanto y tanto como ha debatido en público, presentar un texto fruto del trabajo de UNA sola persona y que todo ello se haga de forma <span style="text-decoration: line-through;">secreta</span> discreta.</li>
<li>No entender, a pesar de que afirma que en esa reunión en la academia aprendió mucho, que un enlace al contenido de un tercero NUNCA Y BAJO NINGUNA CIRCUNSTANCIA es un delito.</li>
</ol>

<p>Pero este último lo dejo para otro post.</p>
]]></description>
                <link>https://aj.garcialagar.es/blog/2011/01/12/la-alternativa-a-la-leysinde</link>
                <pubDate>Wed, 12 Jan 2011 12:10:54 +0000</pubDate>
                <guid>https://aj.garcialagar.es/blog/2011/01/12/la-alternativa-a-la-leysinde</guid>
            </item>            <item>
                <title>From lenny to squeeze.</title>
                <description><![CDATA[<p>I'm back again and I'm here to stay (that's my hope).</p>

<p>Finally I've decide to upgrade this server from Debian Lenny to Squeeze in order to test the upgrade process before the final Debian 6.0 release. Well it worked like a charm with absolutly no problem during the process.</p>

<p>As a side effect for this update, the WordPress version was upgraded too, so now I'm running WordPress 3.0.2 and I could finally install the WPTouch</p>

<p>plugin. I've also installed the official WordPress App from the iTunes App Store so I can post from everywhere everytime. Now I have no excuses to leave this boring blog alone.</p>

<p>Well, that's all folks.</p>
]]></description>
                <link>https://aj.garcialagar.es/blog/2010/12/18/from-lenny-to-squeeze</link>
                <pubDate>Sat, 18 Dec 2010 09:39:14 +0000</pubDate>
                <guid>https://aj.garcialagar.es/blog/2010/12/18/from-lenny-to-squeeze</guid>
            </item>            <item>
                <title>Back to blog</title>
                <description><![CDATA[<p>Long time since my last post, but as you can see at the @NET block at the sidebar, I'm still alive.</p>

<p>These past months I've been very busy at work with the <a href="http://papi.redires.es" title="In Spanish (Point of Access for Information Providers)">PAPI</a>: the SSO software provided by <a href="http://rediris.es">RedIRIS</a> which is being used by some of our clients to provide their users an ubiquitous access to remote electronic resources protected by IP.</p>

<p>My other work as teacher of <strong>Web Languages and Technologies</strong> at the <a href="http://www.arquigrafia.es">III Master in Digital and Multimedia Communication of the Architectural Project</a> at the <a href="http://aq.upm.es">ETSAM</a> (High Technical School of Architecture of Madrid) went very well. Although it has been my first time as teacher, I collaborated some years ago with <a href="http://ocw.upm.es/mecanica-de-medios-continuos-y-teoria-de-estructuras/practica-en-proyecto-de-estructuras-de-hormigon/autores">Jesús Rodríguez Santiago</a> teaching <a href="http://ocw.upm.es/mecanica-de-medios-continuos-y-teoria-de-estructuras/practica-en-proyecto-de-estructuras-de-hormigon"><strong>Design of building concrete structure</strong></a>. Working with him I learned a lot and this has been very helpful this year.</p>

<p>On the other hand, my Thesis (<em>I feel this is not the perfect translation to describe the final project to finish the college</em>) went not so well, because I have not spent all the necessary time to work on it. But after vacations, I'll make an extra effort to finish it.</p>

<p>Well, this is a little summary of the last months. I'll try to write soon something interesting not about me, but about PHP and Continous Integration.</p>
]]></description>
                <link>https://aj.garcialagar.es/blog/2010/08/06/back-to-blog</link>
                <pubDate>Fri, 06 Aug 2010 11:18:31 +0000</pubDate>
                <guid>https://aj.garcialagar.es/blog/2010/08/06/back-to-blog</guid>
            </item>            <item>
                <title>Virtualization with KVM and Debian Lenny</title>
                <description><![CDATA[<p>Some weeks ago I've started to work with virtualized machines, and as an old Linux user, I've choosen <a href="http://www.linux-kvm.org" target="_blank">KVM</a> as virtualization infrastructure. KVM is part of the Linux kernel since the 2.6.20 version and <a href="http://www.debian.org" target="_blank">Debian</a> <a href="www.debian.org/releases/lenny/" target="_blank">Lenny 5.0</a> was released with the 2.6.26 kernel version. But in order to work with KVM we need a CPU processor with virtualization support, so the first step is to check if our CPU has it. You have to execute:</p>

<pre><code class="bash">egrep '(vmx|svm)' --color=always /proc/cpuinfo
</code></pre>

<p>Now you should see a colored flag for each processor core. If you see it, you can go ahead with the following steps.</p>

<p>Although we don't need any extra repository, I've decide to use the <a href="http://www.backports.org" target="_blank"><a target="_blank" rel="nofollow" href="http://backports.org" >backports.org</a></a> semi-official repository to take advantage of the more recent software releases. To enable it, type the following commands:</p>

<pre><code class="bash">echo "deb http://www.backports.org/debian lenny-backports main contrib non-free" \
&gt; /etc/apt/sources.list.d/backports.list &amp;&amp; \
wget -O - http://backports.org/debian/archive.key | apt-key add - &amp;&amp; \
aptitude update
</code></pre>

<p>Now, we have to install the required packages:</p>

<pre><code class="bash">aptitude install -t lenny-backports kvm virtinst libvirt-bin
</code></pre>

<p>Finally we must prepare the network to allow the virtual machine to connect with the world. The Debian <a href="http://packages.debian.org/lenny/libvirt-bin" target="_blank">libvirt-bin</a> package comes with a preconfigured private network (192.168.122.0/24) with a DHCP server managed with <a href="http://packages.debian.org/lenny/dnsmasq" target="_blank">dnsmasq</a>. This network is called <em>default</em> and if we need some virtual machine to start automatically after the host reboot, we have to start this network automatically too. We can do it with <strong><em>virsh</em></strong>, a Swiss knife command to manage our virtual machines with the help of <a href="http://libvirt.org" target="_blank"><strong><em>libvirt</em></strong></a>.</p>

<pre>virsh net-start default && virsh net-autostart default</pre>

<p>Ok, we're ready to install our new virtual machine with the help of the <strong><em>virt-inst</em></strong> command. We will install a virtual machine named <em>vmguest</em>, with <em>512Mb</em> or ram, running <em>linux</em> (<em>Debian Lenny</em>) using <em>kvm</em> as virtualization infrastructure. The disk will be allocated onto the host filesystem in a raw disk image (<em>/opt/vmguest-root.disk</em>) with a size of <em>20G</em> and using <em>virtio</em> as the block device driver. The virtual machine will be connected to the <em>default</em> network with a <em>virtio</em> network card. The virtual machine will start a <em>VNC</em> server to allow you to connect to the screen and will disable the connection to the virtual machine serial console. Finally the default keymap will be <em>es</em> and the installer will be downloaded from an external <em>location</em> instead of using a cdrom image.</p>

<pre><code class="bash">virt-install --name=vmguest \
--ram 512 \
--os-type linux --os-variant debianlenny \
--virt-type kvm \
--disk path=/opt/vmguest-root.disk,bus=virtio,size=20 \
-w network=default,model=virtio \
--vnc \
--noautoconsole \
--keymap es \
--location http://ftp.debian.org/debian/dists/lenny/main/installer-amd64
</code></pre>

<p>Now we have to connect to the virtual machine session in order to complete the installation. To do it I usually use <strong><em>virt-viewer</em></strong> through an ssh tunnel to connect to the host machine (remember to install it if you need it). To do it type:</p>

<pre><code class="bash">virt-viewer -c qemu+ssh://root@host.machine/system vmguest
</code></pre>

<p>If you are directly connected to the host machine, you have to type as root:</p>

<pre>virt-viewer -c qemu:///system vmguest</pre>

<p>Ok, that's all. You ready to install your new Debian Lenny onto the virtual machine. Once installed, the virtual machines will be managed with the <strong><em>virsh</em></strong> command&#8230; but it will be on another host.</p>

<p><strong>Edited:</strong> For this first post about KVM I think it's a better idea to save the disk onto the host filesystem, although I prefer LVM, because the file based disk image does not need any previous setup.</p>

<p><strong>Edited 2:</strong> This post was written when the libvirt backport version was 0.6.5-3. I you have any problem with the latest backport packages you can download the old ones from <a href="http://snapshot.debian.org/package/libvirt/0.6.5-3~bpo50%2B1/" target="_blank"><a target="_blank" rel="nofollow" href="http://snapshot.debian.org/package/libvirt/0.6.5-3~bpo50%2B1/" >snapshot.debian.org/package/libvirt/0.6.5-3~bpo50%2B1/</a></a></p>
]]></description>
                <link>https://aj.garcialagar.es/blog/2010/01/17/virtualization-with-kvm-and-debian-lenny</link>
                <pubDate>Sun, 17 Jan 2010 14:04:00 +0000</pubDate>
                <guid>https://aj.garcialagar.es/blog/2010/01/17/virtualization-with-kvm-and-debian-lenny</guid>
            </item>            <item>
                <title>Manifiesto &#8220;En defensa de los derechos fundamentales en internet&#8221;</title>
                <description><![CDATA[<p>Ante la inclusión en el Anteproyecto de Ley de Economía sostenible de modificaciones legislativas que afectan al libre ejercicio de las libertades de expresión, información y el derecho de acceso a la cultura a través de Internet, los periodistas, <em>bloggers</em>, usuarios, profesionales y creadores de Internet manifestamos nuestra firme oposición al proyecto, y declaramos que:</p>

<ol>
<li>Los derechos de autor no pueden situarse por encima de los derechos fundamentales de los ciudadanos, como el derecho a la privacidad, a la seguridad, a la presunción de inocencia, a la tutela judicial efectiva y a la libertad de expresión.</li>
<li>La suspensión de derechos fundamentales es y debe seguir siendo competencia exclusiva del poder judicial. Ni un cierre sin sentencia. Este anteproyecto, en contra de lo establecido en el artículo 20.5 de la Constitución, pone en manos de un órgano no judicial -un organismo dependiente del ministerio de Cultura-, la potestad de impedir a los ciudadanos españoles el acceso a cualquier página web.</li>
<li>La nueva legislación creará inseguridad jurídica en todo el sector tecnológico español, perjudicando uno de los pocos campos de desarrollo y futuro de nuestra economía, entorpeciendo la creación de empresas, introduciendo trabas a la libre competencia y ralentizando su proyección internacional.</li>
<li>La nueva legislación propuesta amenaza a los nuevos creadores y entorpece la creación cultural. Con Internet y los sucesivos avances tecnológicos se ha democratizado extraordinariamente la creación y emisión de contenidos de todo tipo, que ya no provienen prevalentemente de las industrias culturales tradicionales, sino de multitud de fuentes diferentes.</li>
<li>Los autores, como todos los trabajadores, tienen derecho a vivir de su trabajo con nuevas ideas creativas, modelos de negocio y actividades asociadas a sus creaciones. Intentar sostener con cambios legislativos a una industria obsoleta que no sabe adaptarse a este nuevo entorno no es ni justo ni realista. Si su modelo de negocio se basaba en el control de las copias de las obras y en Internet no es posible sin vulnerar derechos fundamentales, deberían buscar otro modelo.</li>
<li>Consideramos que las industrias culturales necesitan para sobrevivir alternativas modernas, eficaces, creíbles y asequibles y que se adecuen a los nuevos usos sociales, en lugar de limitaciones tan desproporcionadas como ineficaces para el fin que dicen perseguir.</li>
<li>Internet debe funcionar de forma libre y sin interferencias políticas auspiciadas por sectores que pretenden perpetuar obsoletos modelos de negocio e imposibilitar que el saber humano siga siendo libre.</li>
<li>Exigimos que el Gobierno garantice por ley la neutralidad de la Red en España, ante cualquier presión que pueda producirse, como marco para el desarrollo de una economía sostenible y realista de cara al futuro.</li>
<li>Proponemos una verdadera reforma del derecho de propiedad intelectual orientada a su fin: devolver a la sociedad el conocimiento, promover el dominio público y limitar los abusos de las entidades gestoras.</li>
<li>En democracia las leyes y sus modificaciones deben aprobarse tras el oportuno debate público y habiendo consultado previamente a todas las partes implicadas. No es de recibo que se realicen cambios legislativos que afectan a derechos fundamentales en una ley no orgánica y que versa sobre otra materia.</li>
</ol>
]]></description>
                <link>https://aj.garcialagar.es/blog/2009/12/02/manifiesto-8220en-defensa-de-los-derechos-fundamentales-en-internet8221</link>
                <pubDate>Wed, 02 Dec 2009 12:43:59 +0000</pubDate>
                <guid>https://aj.garcialagar.es/blog/2009/12/02/manifiesto-8220en-defensa-de-los-derechos-fundamentales-en-internet8221</guid>
            </item>            <item>
                <title>Manifesto on the rights of Internet users</title>
                <description><![CDATA[<p>A group of journalists, bloggers, professionals and creators want to express their firm opposition to the inclusion in a Draft Law of some changes to Spanish laws restricting the freedoms of expression, information and access to culture on the Internet. We also declare that:</p>

<ol>
<li>Copyright should not be placed above citizens' fundamental rights to privacy, security, presumption of innocence, effective judicial protection and freedom of expression.</li>
<li>Suspension of fundamental rights is and must remain an exclusive competence of judges. This blueprint, contrary to the provisions of Article 20.5 of the Spanish Constitution, places in the hands of the executive the power to keep Spanish citizens from accessing certain websites.</li>
<li>The proposed laws would create legal uncertainty across Spanish IT companies, damaging one of the few areas of development and future of our economy, hindering the creation of startups, introducing barriers to competition and slowing down its international projection.</li>
<li>The proposed laws threaten creativity and hinder cultural development. The Internet and new technologies have democratized the creation and publication of all types of content, which no longer depends on an old small industry but on multiple and different sources.</li>
<li>Authors, like all workers, are entitled to live out of their creative ideas, business models and activities linked to their creations. Trying to hold an obsolete industry with legislative changes is neither fair nor realistic. If their business model was based on controlling copies of any creation and this is not possible any more on the Internet, they should look for a new business model.</li>
<li>We believe that cultural industries need modern, effective, credible and affordable alternatives to survive. They also need to adapt to new social practices.</li>
<li>The Internet should be free and not have any interference from groups that seek to perpetuate obsolete business models and stop the free flow of human knowledge.</li>
<li>We ask the Government to guarantee net neutrality in Spain, as it will act as a framework in which a sustainable economy may develop.</li>
<li>We propose a real reform of intellectual property rights in order to ensure a society of knowledge, promote the public domain and limit abuses from copyright organizations.</li>
<li>In a democracy, laws and their amendments should only be adopted after a timely public debate and consultation with all involved parties. Legislative changes affecting fundamental rights can only be made in a Constitutional law.</li>
</ol>

<p>Translation from <a href="http://www.boingboing.net/2009/12/02/spanish-activists-is.html"><a target="_blank" rel="nofollow" href="http://boingboing.net" >boingboing.net</a></a></p>
]]></description>
                <link>https://aj.garcialagar.es/blog/2009/12/02/manifesto-on-the-rights-of-internet-users</link>
                <pubDate>Wed, 02 Dec 2009 12:39:12 +0000</pubDate>
                <guid>https://aj.garcialagar.es/blog/2009/12/02/manifesto-on-the-rights-of-internet-users</guid>
            </item>            <item>
                <title>I've bought a game</title>
                <description><![CDATA[<p>Yes, I know, this shouldn't be in the news. A lot of people buy games everyday, but this time it was different. I was able to decide the right price for the game.<img class="alignright" style="float: right;" src="http://i0.wp.com/2dboy.com/blog/wp-content/uploads/2009/10/WoG_happybday1.jpg?resize=484%2C244" alt="" data-recalc-dims="1" /></p>

<p>It's a great initiative from a small company called <a href="http://2dboy.com">2DBOY</a>.</p>

<p>The story is that one year ago, a this company released a simple but addictive game called <a href="http://www.worldofgoo.com">World of Goo</a>. It was released for two platforms: Microsoft Windows and WiiWare. After a while, it was released for Linux and Mac OS X too.</p>

<p>I read a lot about it at several videogame sites, and everyone told that it was a great game. As the game was released without any DRM protection, I could download it with the help of the bitorrent protocol.</p>

<p>I tried it and enjoyed it a lot, although couldn't finish it because not having too much time to play, but I never paid for this game. Yes, I was a pirate.</p>

<p>Yesterday, I've read the company had started an original experiment called: <a href="http://2dboy.com/2009/10/13/happy-birthday-world-of-goo/"><strong>Pay what you want</strong></a>. So I thought: it's time to pay for the game, and finish it.</p>

<p>After paying what I wanted through the PayPal service, I was able to download the game, and not for just one platform, so I downloaded the Windows installer and the Linux .deb package.</p>

<p>I think this is a great initiative! I recommend you to buy this game. You cannot argue that it's too expensive and I sure it's very very funny!</p>

<p>Hurry, the experiment finish at October 25!!</p>

<p><strong>Update:</strong> If you like the soundtrack, you can download it for free at <a href="http://kylegabler.com/WorldOfGooSoundtrack/">kylegabler.com/WorldOfGooSoundtrack</a></p>
]]></description>
                <link>https://aj.garcialagar.es/blog/2009/10/22/ive-bought-a-game</link>
                <pubDate>Thu, 22 Oct 2009 19:43:55 +0000</pubDate>
                <guid>https://aj.garcialagar.es/blog/2009/10/22/ive-bought-a-game</guid>
            </item>            <item>
                <title>Inglorious basterds</title>
                <description><![CDATA[<p><img src="http://static1.squarespace.com/static/550db867e4b051bbaff5260a/553afc3ee4b0f281a4ea06f8/553afe0fe4b09e094f86db6d/1429929487543/inglourious_var.jpg?format=500w" alt="Buy this poster at tsout.com" /></p>

<p>Ayer estuve viendo la Última de Quentin Tarantino: <em>Malditos bastardos</em> (aunque no la vi en versión original, me encata el título en inglés: <em>Inglourious Basterds</em>).</p>

<p>No soy yo un especialista en cine, por lo que no esperéis una sesuda crítica sobre la película; además son fan confeso de Tarantino desde que me encontré, casi por casualidad con <em>Pulp Fiction</em>, por lo que mi opinión está más que condicionada.</p>

<p>Podemos decir que en general me gustó y me entretuvo, que son dos cosas que no siempre ocurren de forma simultánea. El guión, sin ser brillante, sigue teniendo alguno de esos diálogos geniales de Tarantino que son para mí el verdadero valor de su cine, destacando sobre los demás la interpretación de los mismos hecha por Christoph Waltz en su papel del Coronel Hans Landa <em>el Cazajudíos</em>.</p>

<p>Una vez más, la película se estructura en capítulos, pero me sorprendió que todos fuesen narrados de forma lineal. También me encantó la presentación del personaje del Sargento Hugo Stiglitz, y en general de todo el grupo de los bastardos, que tienen cara de cualquier cosa menos de despiadados asesinos.</p>

<p>Como siempre, Tarantino mezcla la violencia (y algo de gore), con toques de humor (negro en ocasiones) de forma que el resultado final es una película siempre entretenida, que creo que es para él el principal objetivo de su cine.</p>

<p>Además, vuelve a dejar patente su pasión por su trabajo, y por la historia del cine, con continuos guiños a la misma y haciendo que la trama principal gire en torno a una sala de proyección.</p>

<p>Bueno, hasta aquí mi primera <em>crítica</em> de cine. Como habéis leíedo, sin <em>spoilers</em>. Intentaré hacer esto con las pelis que estén aún en cartelera cuando hable de ellas.</p>

<p>Por cierto, para los aficionados a Tarantino:</p>

<blockquote>
  <p><a href="http://www.20minutos.es/noticia/532024/0/tarantino/kill/bill/">La novia volverá a luchar</a></p>
</blockquote>
]]></description>
                <link>https://aj.garcialagar.es/blog/2009/10/07/inglorious-basterds</link>
                <pubDate>Wed, 07 Oct 2009 13:08:53 +0000</pubDate>
                <guid>https://aj.garcialagar.es/blog/2009/10/07/inglorious-basterds</guid>
            </item>            <item>
                <title>Dojo, JsonRestStore and transaction referencing</title>
                <description><![CDATA[<p>Last weeks I need to work with a tree structure. Since I'm using <a href="http://framework.zend.com">Zend Framework</a>, I decided to use the <a href="http://www.dojotoolkit.org/">Dojo Toolkit</a> to make it.</p>

<p>After a review of the consistent <a href="http://api.dojotoolkit.org/jsdoc/1.3.2/dojo.data.api"><a target="_blank" rel="nofollow" href="http://dojo.data." >dojo.data.</a>api</a>, I was very impressed because it allow you to reuse your widget with different data stores (XML, JSON, etc.).</p>

<p>I decide to use the Zend_Rest component developed by <a href="http://framework.zend.com/wiki/display/~lcrouch">Luke Crouch</a> at the server side to make a RESTful web service, and <a href="http://api.dojotoolkit.org/jsdoc/1.3.2/dojox.data.JsonRestStore"><a target="_blank" rel="nofollow" href="http://dojox.data." >dojox.data.</a>JsonRestStore</a> at the client side to communicate with this service.</p>

<p>The setup of the <a href="http://api.dojotoolkit.org/jsdoc/1.3.2/dijit.Tree">tree widget</a> is trivial following the dojo documentation:</p>

<pre><code class="javascript">var store = new dojox.data.JsonRestStore({target: "http://example.org/restfulservice");
var model = new dijit.tree.TreeStoreModel({store: store, query:{id:"one"}});
var tree = new dijit.Tree({model: model}, "treeDivId");
</code></pre>

<h3>How the JsonRestStore works.</h3>

<p>The JsonRestStore object support transactions, so you can create and modify several nodes and then call the <strong><a target="_blank" rel="nofollow" href="http://tree.save" >tree.save</a>()</strong> method which fires two request for each dirty node:</p>

<ol>
<li>A POST request to <em><a target="_blank" rel="nofollow" href="http://example.org/restfulservice" >example.org/restfulservice</a></em> to create the new node.</li>
<li>A PUT request to <em><a target="_blank" rel="nofollow" href="http://example.org/restfultservice/parentId" >example.org/restfultservice/parentId</a></em> to update the children attribute at the parent node.</li>
</ol>

<p>The widget works like a charm, but I found a problem when I try to add a child to a recently created node.</p>

<h3>An example.</h3>

<p>Suppose we have a tree like this (<em>id:label</em>):</p>

<pre><code>1:root
  6:one
    12:one.one
    15:one.two
      23:one.two.one
  9:two
</code></pre>

<p>You add a child to <em>12:one.one</em> but you does not call the <strong>tree.save()</strong> method. Dojo assigns internally an auto-generated identifier to this node and the tree looks like this:</p>

<pre><code>1:root
  6:one
    12:one.one
      fooID:one.one.one
    15:one.two
      23:one.two.one
  9:two
</code></pre>

<p>Now you add a child to this node:</p>

<pre><code>1:root
  6:one
    12:one.one
       fooID:one.one.one
         barID:one.one.one.one
    15:one.two
       23:one.two.one
  9:two
</code></pre>

<p>Finally, you call <strong>tree.save()</strong> method and these requests are fired:</p>

<ol>
<li>A POST request to <em>http://example.org/restfulservice</em> to save <em>one.one.one</em> (Suppose the server creates it with 25 as identifier)</li>
<li>A PUT request to <em>http://example.org/restfulservice/12</em> to update <em>one.one</em> children</li>
<li>A POST request to <em>http://example.org/restfulservice</em> to save <em>one.one.one.one</em></li>
<li>A PUT request to <em>http://example.org/restfulservice/fooID</em> to update <em>one.one.one</em> children</li>
</ol>

<h3>The problem.</h3>

<p>The problem is that when the fourth request is sent to the server, the node has not been updated by the result of the first one, so it does not have the identifier assigned by the server (<em>25</em>), but the assigned by dojo at the client side (<em>fooID</em>) which is not going to be recognized by the server, so <strong>how can the server know which node to update?</strong></p>

<h3>The solution.</h3>

<p>Well, the solution is very simple and you can find it at the <a href="http://www.sitepen.com/blog/2009/01/26/new-in-jsonreststore-13-dates-deleting-conflict-handling-and-more/">sitepen blog</a>:</p>

<blockquote>
  <p>JsonRestStore 1.3 solves this problem borrowing a referencing technique from <a href="http://www.ietf.org/rfc/rfc2387.txt">RFC 2387 (multipart/related)</a>. When new items are created, the POST request will include a Content-ID header indicating a temporary id for the item. Other items being committed in the same transaction can then refer to the item by the <code>cid:</code> protocol with JSON referencing.</p>
</blockquote>

<p>The server should save a temporary array which matches the temporary identifier assigned by dojo with the server one, so when a PUT request is sent to update a node, the server should look at this array for the client identifier and locate the real identifier of the node supposed to be updated.</p>

<p>I've checked that these requests are sent in synchronous mode, so the PUT request for a node is never sent before the POST request that creates it.</p>

<p>Simple, don't you think?</p>
]]></description>
                <link>https://aj.garcialagar.es/blog/2009/09/29/dojo-jsonreststore-and-transaction-referencing</link>
                <pubDate>Tue, 29 Sep 2009 19:16:10 +0000</pubDate>
                <guid>https://aj.garcialagar.es/blog/2009/09/29/dojo-jsonreststore-and-transaction-referencing</guid>
            </item>            <item>
                <title>Clases en Arquigrafía</title>
                <description><![CDATA[<p>Ayer terminé la primera asignatura de las dos que, junto con <a href="http://www.it.uc3m.es/vlc">Vicente Luque</a> y Pablo Palacios, voy a impartir en el <strong>III Máster en Comunicación Digital y Multimedia del Proyecto de Arquitectura</strong> de la <strong>Universidad Politécnica de Madrid</strong>. <a href="http://www.arquigrafia.es">Máster de Arquigrafía</a> para los amigos.</p>

<p>La experiencia ha sido satisfactoria, al menos para mí­ (habrí­a que preguntarles a los alumnos si opinan lo mismo). Esta primera asignatura ha sido <em>TECNOLOGÍAS DE LA INFORMACIÓN Y LA COMUNICACIÓN</em>. Un buen nombre con un contenido poco definido en principio.</p>

<p>Al final hemos visto un poco de todo, desde lo básico de qué es Internet, como usar un buscador, etc. hasta una introducción en la Web 2.0 como una red enfocada al usuario, en la que son éstos los que aportan una parte importante de los contenidos con una pequeña revisión de las licencias CC para tomar conciencia de nuestros derechos como creadores de recursos.</p>

<p>En realidad, nada nuevo para los que trabajamos en este medio, pero creo que ha sido muy esclarecedor para los alumnos (me suena raro llamarles así, en realidad para mí son mis compañeros puesto que muchos están en PFC como yo).</p>

<p>Como ejercicio práctico hemos pedido que cada uno realice un blog, y participe en un wiki. Aparte, les hemos recomendado el uso de <a href="http://delicious.com/ajgarlag">delicious</a> para sus marcadores, y veremos a ver si alguno se anima al <a href="http://twitter.com/ajgarlag">microblogging</a>.</p>

<p>Yo también voy a intentar hacer la práctica del blog, y confío en que este no se extinga como otros intentos anteriores.</p>

<p>La pena no poder haber visto algo de Linux, a ver si alguien se animaba con ello, pero confío en que alguno más intrépido se lance.</p>
]]></description>
                <link>https://aj.garcialagar.es/blog/2009/09/23/clases-en-arquigrafia</link>
                <pubDate>Wed, 23 Sep 2009 12:52:47 +0000</pubDate>
                <guid>https://aj.garcialagar.es/blog/2009/09/23/clases-en-arquigrafia</guid>
            </item>            <item>
                <title>My OpenID provider</title>
                <description><![CDATA[<p>Well, I've reset my digital identity: new <a href="http://twitter.com/ajgarlag">twitter</a> and <a href="http://indenti.ca/ajgarlag">identi.ca</a> usernames, new <a href="http://last.fm/user/ajgarlag">last.fm</a> account, new <a href="http://del.icio.us/ajgarlag">del.icio.us</a> (I prefer the old domain 😊) account, etc.</p>

<p>Some time ago I was looking for an <a href="http://openid.net">OpenID</a> identity, but I've never subscribed any account. With my new personal domain, an idea came to my head: why not install my personal OpenID provider?</p>

<p>I've found several free <a href="http://php.net">PHP</a> implementations, but I wanted the simplest one and finally found it: <a href="http://siege.org/projects/phpMyID">PhpMyId</a>. The installation is very easy, and I love how this little piece of software implements the <a href="http://en.wikipedia.org/wiki/Digest_access_authentication">HTTP Digest access authentication</a>, so you don't have to enable <a href="http://en.wikipedia.org/wiki/Transport_Layer_Security">SSL</a> at the web server.</p>

<p>That's all folks.</p>

<p>My OpenID is <a href="http://aj.garcialagar.es">aj.garcialagar.es</a></p>
]]></description>
                <link>https://aj.garcialagar.es/blog/2009/09/18/my-openid-provider</link>
                <pubDate>Fri, 18 Sep 2009 21:36:01 +0000</pubDate>
                <guid>https://aj.garcialagar.es/blog/2009/09/18/my-openid-provider</guid>
            </item>            <item>
                <title>No comment</title>
                <description><![CDATA[<p>First post, nothing more to say.</p>

<p>Maybe, that this will be under construction for some weeks.</p>
]]></description>
                <link>https://aj.garcialagar.es/blog/2009/09/17/no-comment</link>
                <pubDate>Thu, 17 Sep 2009 16:34:53 +0000</pubDate>
                <guid>https://aj.garcialagar.es/blog/2009/09/17/no-comment</guid>
            </item>    </channel>
</rss>
