72bb
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- generator="wordpress/2.0.5" -->
<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/"
	>

<channel>
	<title>Syntax Error</title>
	<link>http://www.syntaxerror.es</link>
	<description></description>
	<pubDate>Thu, 12 Feb 2009 09:38:23 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.5</generator>
	<language>en</language>
			<item>
		<title>[Mac] Teclas rápidas (shortcuts) para el terminal</title>
		<link>http://www.syntaxerror.es/2009/02/12/mac-teclas-rapidas-shortcuts-para-el-terminal/</link>
		<comments>http://www.syntaxerror.es/2009/02/12/mac-teclas-rapidas-shortcuts-para-el-terminal/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 09:38:23 +0000</pubDate>
		<dc:creator>Xavi</dc:creator>
		
		<category>Sistemas</category>

		<category>Mac</category>
<category>Mac</category><category>shortcuts</category><category>Sistemas</category><category>terminal</category>
		<guid isPermaLink="false">http://www.syntaxerror.es/2009/02/12/mac-teclas-rapidas-shortcuts-para-el-terminal/</guid>
		<description><![CDATA[Acostumbrado al terminal de Linux, al pasar a Mac (si, un MacBook de 13&#8243;) me encontré que el terminal no me aceptaba los shortcuts usuales para ir al principio de la línea, al final, moverse por palabras&#8230; total, un coñazo. Hasta que se me han hinchado las narices y me ha dado por buscarlo (debía [...]]]></description>
			<content:encoded><![CDATA[<p><img id="image203" src="http://www.syntaxerror.es/wp-content/uploads/2009/02/terminal.miniatura.jpg" alt="Terminal de Mac OS X" style="float:left;" />Acostumbrado al terminal de Linux, al pasar a Mac (si, un MacBook de 13&#8243;) me encontré que el terminal no me aceptaba los shortcuts usuales para ir al principio de la línea, al final, moverse por palabras&#8230; total, un coñazo. Hasta que se me han hinchado las narices y me ha dado por buscarlo (debía ser lo primero, si, pero me he vuelto de un vago&#8230;).</p>
<p>A continuación cuelgo una tabla con los shortcuts más usuales. Porqué los variarán tanto de los shortcuts del entorno gráfico? </p>
<p><a id="more-204"></a></p>
<table width="450" cellpadding="5" cellspacing="0" border="1">
<tr>
<td>Ctrl + A</td>
<td>Va al principio de la línea que estás escribiendo actualmente</td>
</tr>
<tr>
<td>Ctrl + E</td>
<td>Va al final de la línea que estás escribiendo actualmente</td>
</tr>
<tr>
<td nowrap="nowrap">Ctrl + L</td>
<td>Limpia la pantalla, similar al comando <em>clear</em></td>
</tr>
<tr>
<td>Ctrl + U</td>
<td>Limpia la línea anterior a la posición del cursor. Si estás al final de la línea, limpia la línea entera.</td>
</tr>
<tr>
<td>Ctrl + H</td>
<td>Lo mismo que <em>backspace</em> o tecla de retroceso</td>
</tr>
<tr>
<td>Ctrl + R</td>
<td>Busca en el historial de comandos usados en el pasado</td>
</tr>
<tr>
<td>Ctrl + C</td>
<td>Mata cualquier cosa que se esté ejecutando en primer plano en ése terminal</td>
</tr>
<tr>
<td>Ctrl + D</td>
<td>Sale del terminal actual</td>
</tr>
<tr>
<td>Ctrl + Z</td>
<td>Pone lo que se esté corriendo en un proceso en segundo plano suspendido. <em>fg</em> lo restaura.</td>
</tr>
<tr>
<td>Ctrl + W</td>
<td>Borra la palabra anterior al cursor</td>
</tr>
<tr>
<td>Ctrl + K</td>
<td>Limpia la línia siguiente al cursor</td>
</tr>
<tr>
<td>Ctrl + T</td>
<td>Intercambia entre ellos los dos carácteres anteriores a la posición del cursor</td>
</tr>
<tr>
<td>Esc + T</td>
<td>Intercambia entre ellas las dos palabras anteriores a la posición del cursor</td>
</tr>
</table>
<p>Visto en <a href="http://osxdaily.com/2006/12/19/command-line-keyboard-shortcuts-for-mac-os-x/" target="_blank">OSXDaily</a>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.syntaxerror.es/2009/02/12/mac-teclas-rapidas-shortcuts-para-el-terminal/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Asus eeePC 701 + Ubuntu eee: No se puede ajustar el volumen [solucionado]</title>
		<link>http://www.syntaxerror.es/2008/10/14/asus-eeepc-701-ubuntu-eee-no-se-puede-ajustar-el-volumen-solucionado/</link>
		<comments>http://www.syntaxerror.es/2008/10/14/asus-eeepc-701-ubuntu-eee-no-se-puede-ajustar-el-volumen-solucionado/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 06:32:43 +0000</pubDate>
		<dc:creator>Xavi</dc:creator>
		
		<category>Sistemas</category>

		<category>Linux</category>
<category>eeePC</category><category>Linux</category><category>Sistemas</category><category>Ubuntu</category>
		<guid isPermaLink="false">http://www.syntaxerror.es/2008/10/14/asus-eeepc-701-ubuntu-eee-no-se-puede-ajustar-el-volumen-solucionado/</guid>
		<description><![CDATA[Hace una semana instalé Ubuntu Eee en mi Asus eeePC 701. El cambio vino por la nueva generación de distribuciones Linux orientadas a estos preciosos netbooks, más ligeras, sin demasiadas parafarnalias gráficas, y con la promesa de que funcionaría out-of-the-box.
Pues bién, todo funcionó a la perfección, sin ningún problema aparente, hasta que quise hacer una [...]]]></description>
			<content:encoded><![CDATA[<p><img id="image201" src="http://www.syntaxerror.es/wp-content/uploads/2008/10/ubuntu-cristal.miniatura.jpg" alt="Ubuntu" style="float:left" />Hace una semana instalé <a href="http://www.ubuntu-eee.com/" target="_blank">Ubuntu Eee</a> en <a href="http://www.syntaxerror.es/2008/05/29/asus-eeepc-eeexubuntu/">mi Asus eeePC 701</a>. El cambio vino por la nueva generación de distribuciones Linux orientadas a estos preciosos netbooks, más ligeras, sin demasiadas parafarnalias gráficas, y con la promesa de que funcionaría <em>out-of-the-box</em>.</p>
<p>Pues bién, todo funcionó a la perfección, sin ningún problema aparente, hasta que quise hacer una videoconferencia y me di cuenta que el volumen de los altavoces estaba al máximo y no se podía bajar. Los botones de acceso rápido se activaban pero el volumen no bajaba.</p>
<p>Aquí traigo la solución.</p>
<p><a id="more-200"></a></p>
<p>Ciertamente es un bug registrado en <a href="https://bugs.launchpad.net/ubuntu-eee/+bug/244059/comments/5" target="_blank">launchpad</a>, y la solución la he encontrado en la wiki de <a href="http://www.ubuntu-eee.com/wiki/index.php5?title=Fix:_volume_control" target="_blank">Ubuntu eee</a>:</p>
<p>Debemos añadir la siguiente línea al final del archivo <em>/etc/modprobe.d/alsa-base</em>:</p>
<blockquote><p>
options snd-hda-intel model=3stack-dig
</p></blockquote>
<p>Seguidamente ejecutamos los siguientes dos comandos:</p>
<blockquote><p>
sudo alsa force-unload<br />
sudo modprobe snd-hda-intel
</p></blockquote>
<p>Con ello tendremos configurada la solución para la siguiente sesión, y habremos solucionado el problema para la sesión actual.</p>
<p>Salu10</p>
]]></content:encoded>
			<wfw:commentRss>http://www.syntaxerror.es/2008/10/14/asus-eeepc-701-ubuntu-eee-no-se-puede-ajustar-el-volumen-solucionado/feed/</wfw:commentRss>
		</item>
		<item>
		<title>CSS: DIV Contenedor de DIVs con Float: IE &#038; FF</title>
		<link>http://www.syntaxerror.es/2008/10/08/css-div-contenedor-de-divs-con-float-ie-ff/</link>
		<comments>http://www.syntaxerror.es/2008/10/08/css-div-contenedor-de-divs-con-float-ie-ff/#comments</comments>
		<pubDate>Wed, 08 Oct 2008 11:40:35 +0000</pubDate>
		<dc:creator>Xavi</dc:creator>
		
		<category>Html</category>

		<category>ProgramaciÃ³n</category>
<category></category>
		<guid isPermaLink="false">http://www.syntaxerror.es/2008/10/08/css-div-contenedor-de-divs-con-float-ie-ff/</guid>
		<description><![CDATA[Con este nombre críptico se esconde uno de mis quebraderos de cabeza que estoy teniendo para maquetar de forma que Internet Explorer 6, 7 y Firefox trabajen de la misma forma.
Imaginemos que tenemos un div que contiene un par de divs con float:left. El problema que nos aparece es que el fondo gris no se [...]]]></description>
			<content:encoded><![CDATA[<p>Con este nombre críptico se esconde uno de mis quebraderos de cabeza que estoy teniendo para <strong>maquetar de forma que Internet Explorer 6, 7 y Firefox trabajen de la misma forma</strong>.</p>
<p>Imaginemos que tenemos un <em>div</em> que contiene un par de <em>div</em>s con <em>float:left</em>. El problema que nos aparece es que el fondo gris no se estira para recoger los elementos que contiene, ya que los <em>div</em>s internos son flotantes. </p>
<div class="igBar"><span id="lhtml-6"><a href="#" onclick="javascript:showPlainTxt('html-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-6">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">"background-color: grey;"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">"float: left;"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"images/avatar.jpg"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">"float: left;"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; Nombre del Usuario</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Como corregimos ésto? Bién, he dado con la solución!<br />
<strong>Editado</strong>: Gracias a los comentarios, ahora la solución es mejor!</p>
<p><a id="more-199"></a></p>
<p><strong>La forma común</strong></p>
<p>Hasta ahora lo que venía haciendo con Firefox era agregar un elemento <em>HTML</em> justo después del último elemento <em>div</em> interno, antes de cerrar el <em>div</em> contenedor, con un <em>clear:both</em>. La teoría es fácil y funciona: El <em>clear:both</em> se encarga de limpiar de elementos a derecha e izquierda para que el contenedor sepa hasta dónde llega él mismo.</p>
<div class="igBar"><span id="lhtml-7"><a href="#" onclick="javascript:showPlainTxt('html-7'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-7">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">"background-color: grey;"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">"float: left;"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"images/avatar.jpg"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">"float: left;"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; Nombre del Usuario</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000; font-weight: bold;">&lt;br</span></a> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">"clear: both;"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Pero en Internet Explorer 6 y 7 ésto no funciona. El navegador lee el <em>BR</em> pero parece que el <em>clear:both</em> no se aplica. La única forma que encontré era poner dos veces el <em>BR</em>. Así parece que sí que funciona pero por contra nos hace dos saltos de línea, con lo que si teníamos la maquetación cuadrada con tamaños y posiciones, veremos como se descolocan con el nuevo espacio inferior.</p>
<p><strong>La nueva solución</strong></p>
<p>Rebuscando por internet he encontrado la solución que plantean en <a href="http://www.quirksmode.org/css/clearing.html" target="_blank">Quircksmode</a>. Se trata de usar la instrucción <em>overflow</em> junto con un <em>width</em>. El primero soluciona el problema en Internet Explorer 7 y el segundo es para que internamente se llame al <em>hasLayout</em> de Internet Explorer 6:</p>
<div class="igBar"><span id="lhtml-8"><a href="#" onclick="javascript:showPlainTxt('html-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-8">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">"background-color: grey; overflow: hidden;width: 100%;"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">"float: left;"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"images/avatar.jpg"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">"float: left;"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; Nombre del Usuario</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>El problema aquí es el <em>width</em>, porque el resto de navegadores también lo entienden y lo aplican, desmontando la maquetación que teníamos (por ejemplo, un <em>padding</em>).</p>
<p>Entonces, pensando un poco, necesitamos una instrucción que sólo funcione para Internet Explorer 6 y que active su <em>hasLayout</em>... y aquí entra otro truco que he visto en <a href="http://www.positioniseverything.net/easyclearing.html" target="_blank">PositionisEverithing</a>, que aunque su método no me gusta nada, usa la instrucción <em>zoom</em> para activar el <em>hasLayout</em>.</p>
<p>Así que la forma que he visto que funciona en los tres navegadores es una fusión de las 3 soluciones: Por un lado mantenemos el <em>BR</em> con el <em>clear:both</em> y además añadimos al <em>DIV</em> contenedor un par de instrucciones <em>CSS</em> para que en los otros navegadores funcione, dejándolo de la siguiente manera:</p>
<div class="igBar"><span id="lhtml-9"><a href="#" onclick="javascript:showPlainTxt('html-9'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-9">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">"background-color: grey; overflow: hidden;zoom:1;"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">"float: left;"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"images/avatar.jpg"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">"float: left;"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; Nombre del Usuario</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000; font-weight: bold;">&lt;br</span></a> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">"clear: both;"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Editado</strong>: He probado la soluciónes de los comentarios y la fórmula que funciona en los tres casos es la siguiente: <strong>Añadir al contenedor el binomio <em>overflow</em> y <em>zoom</em> sin el salto de línea con <em>clear:both</em></strong>.</p>
<div class="igBar"><span id="lhtml-10"><a href="#" onclick="javascript:showPlainTxt('html-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-10">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">"background-color: grey; overflow: hidden;zoom:1;"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">"float: left;"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"images/avatar.jpg"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">"float: left;"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; Nombre del Usuario</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Ala, problema resuelto. Y si estáis cuadrando maquetación entre navegadores... paciencia!</p>
<p>Salu10
</p>

32e1
]]></content:encoded>
			<wfw:commentRss>http://www.syntaxerror.es/2008/10/08/css-div-contenedor-de-divs-con-float-ie-ff/feed/</wfw:commentRss>
		</item>
		<item>
		<title>[Hostgator] Errores 404 extraños - solucionado</title>
		<link>http://www.syntaxerror.es/2008/09/25/hostgator-errores-404-extranos-solucionado/</link>
		<comments>http://www.syntaxerror.es/2008/09/25/hostgator-errores-404-extranos-solucionado/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 09:28:52 +0000</pubDate>
		<dc:creator>Xavi</dc:creator>
		
		<category>Sistemas</category>

		<category>Linux</category>

		<category>Hosting</category>

		<category>WordPress</category>
<category>hostgator</category><category>Hosting</category><category>Linux</category><category>permisos</category><category>Sistemas</category><category>WordPress</category>
		<guid isPermaLink="false">http://www.syntaxerror.es/2008/09/25/hostgator-errores-404-extranos-solucionado/</guid>
		<description><![CDATA[Hacía un tiempo que tenía un fallo en varios Wordpress que tengo alojados en Hostgator. El primero era que el editor visual para escribir artículos fallaba, le habían desaparecido la barra de botones. El segundo ha sido hoy, dónde los archivos PHP que llamo por AJAX (básicamente mi plugin para la galería de fotos) mostraba [...]]]></description>
			<content:encoded><![CDATA[<p><img id="image197" src="http://www.syntaxerror.es/wp-content/uploads/2008/09/candado-master-lock.miniatura.jpg" alt="Seguridad" style="float:left;" />Hacía un tiempo que tenía un fallo en varios Wordpress que tengo alojados en <a href="http://www.hostgator.com/" target="_blank">Hostgator</a>. El primero era que <strong>el editor visual para escribir artículos fallaba</strong>, le habían <strong>desaparecido la barra de botones</strong>. El segundo ha sido hoy, dónde <strong>los archivos PHP que llamo por AJAX</strong> (básicamente mi <a href="http://www.syntaxerror.es/proyectos/wp-minigallery/">plugin para la galería de fotos</a>) <strong>mostraba HTTP Error</strong>.</p>
<p>Analizando el problema descubrí que ambos fallos estaban relacionados, ya que se recibía un error 404 en todos ellos. En el AJAX fué fácil: el <a href="https://addons.mozilla.org/es-ES/firefox/addon/1843" target="_blank">firebug</a> me lo ha dicho a la primera, pero el fallo del editor WYSIWYG era más complejo, aunque el firebug, con su herramienta para visualizar los JS cargados, me mostraba que el PHP que escupe el JS a cargar (<em>wp-includes/js/tinymce/tiny_mce_gzip.php</em>) devolvía un 404 con la plantilla de Wordpress (osea, un HTML).</p>
<p>Al final la cosa ha sido tan "fácil" como setar correctamente los permisos de mis archivos y directorios del Hosting.</p>
<p>Los permisos que deben tener son los siguientes:</p>
<blockquote>
<ul>
<li>Todos los directorios del hosting: <strong>chmod 755</strong></li>
<li>Todos los archivos del hosting: <strong>chmod 644</strong></li>
<li>El directorio <em>public_html</em>: <strong>chmod 750</strong></li>
<li>Todos los archivos y directorios: <strong>propietario debe ser el usuario de la cuenta</strong></li>
</ul>
</blockquote>
<p>Espero que ésto ayude a los que también tienen el mismo problema.</p>
<p>Según los del servicio de soporte de Hostgator, ésto ha sido por culpa de subir archivos desde Windows (Â¿?).</p>
<p>Salu10.
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.syntaxerror.es/2008/09/25/hostgator-errores-404-extranos-solucionado/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Saltando de PHP a Ruby on Rails</title>
		<link>http://www.syntaxerror.es/2008/09/24/saltando-de-php-a-ruby-on-rails/</link>
		<comments>http://www.syntaxerror.es/2008/09/24/saltando-de-php-a-ruby-on-rails/#comments</comments>
		<pubDate>Wed, 24 Sep 2008 10:11:34 +0000</pubDate>
		<dc:creator>Xavi</dc:creator>
		
		<category>ProgramaciÃ³n</category>

		<category>Ruby on Rails</category>
<category></category>
		<guid isPermaLink="false">http://www.syntaxerror.es/2008/09/24/saltando-de-php-a-ruby-on-rails/</guid>
		<description><![CDATA[Ha pasado mucho tiempo desde el último post, lo sé, y tiene un porqué: acabo de dar el salto a Ruby on Rails.
Â¿Cómo? Â¿Y porqué? Si justamente ahora empezaba a ser senior en PHP!
Habéis probado Ruby? Habéis jugado con lo que permite este lenguaje de objetos?
Ya desde que Bruno, un amigo motero y programador, me [...]]]></description>
			<content:encoded><![CDATA[<p><img id="image196" src="http://www.syntaxerror.es/wp-content/uploads/2008/09/ruby_on_rails_logo.miniatura.jpg" alt="Ruby on Rails" style="float:left" />Ha pasado mucho tiempo desde el último post, lo sé, y tiene un porqué: acabo de dar el salto a Ruby on Rails.</p>
<p>Â¿Cómo? Â¿Y porqué? Si justamente ahora empezaba a ser senior en PHP!<br />
Habéis probado Ruby? Habéis jugado con lo que permite este lenguaje de objetos?</p>
<p>Ya desde que Bruno, un amigo motero y programador, me convenciese para que le echara un vistazo me gustó, pero claro, es "un lenguaje nuevo" y "aún le falta mucho" y "no tengo tiempo para jugar". Luego conocí a los creadores de <a href="http://www.moterus.es" target="_blank">moterus.es</a>, red social al estilo <a href="http://www.facebook.com">facebook</a> pero enfocada a moteros, escrita también en Ruby on Rails. Salimos varias veces en moto y en las paradas... bueno... somos unos frikis y nos gusta programar, hablamos y hablamos hasta que un día de principios de agosto me hicieron una propuesta formal: asumiendo que empezaba de cero con Rails, me querían en el equipo.</p>
<p>Yo estaba en plena fase de salida de producción del nuevo front y back de Privalia. Como buen profesional debía quedarme hasta el final así que la entrada la haría a principios de setiembre. Me tiré todo el agosto haciendo más horas que un reloj en Privalia y en los pocos ratos libres que me quedaron estuve estudiando Ruby on Rails. Con la coña casi no he tenido vacaciones pero ha valido la pena. Ya estoy metido de lleno. </p>
<p>Éste ha sido el motivo de mi larga ausencia. Con ello he caído de los rankings y <a href="http://www.syntaxerror.es">Syntax Error</a> a vuelto a ser un blog del montón (si es que nunca a pasado de aquí). Y para intentar remediarlo, aquí vengo con este post, en el que voy a intentar juntar la información y documentación que he usado para ponerme manos a la obra.</p>
<p><a id="more-195"></a></p>
<p><strong>Qué es Ruby on Rails?</strong></p>
<p>Ruby on Rails no es sólo un lenguaje, es un conjunto de un lenguaje (Ruby) sobre el que trabaja un framework (Rails). En comparación con PHP, Ruby sería el lenguaje como lo es PHP, y Rails sería la arquitectura que se levanta encima como lo podría ser el framework Zend. </p>
<p><strong>En qué se diferencian Ruby y PHP?</strong></p>
<p>La diferencia principal es la potencia. Si PHP es un lenguaje procedural (basado en funciones) al que paulatinamente le han dado soporte y potencia con la orientación a objetos, Ruby ya es de por si un lenguaje dónde absolutamente todo es un objeto, con lo que las posibilidades son casi infinitas. Gracias a éso, aparece una nueva diferencia a nivel de concepto: en PHP lo usual es tener algo (un string, un integer, un objeto) que pasas a una función o método para que haga el trabajo y te devuelve el resultado (otro integer, otro string, otro objeto). El Ruby lo usual es que el propio objeto (porque todo es un objeto) lleve los métodos con los que trabajar. </p>
<p><strong>Pero PHP ya tiene soporte de objetos!</strong></p>
<p>Si, y no va nada mal cuando te acostumbras a usarlo. En Atrapalo usábamos un framework propio que hacía un uso intensivo de los objetos. En Privalia el framework usado era Zend y en muchos aspechos se optimizaba el uso de los objetos. Pero hay conceptos que el PHP no tiene, como los <em>code blocks</em> de Ruby (snippets de código que puedes adjuntar a un método) o redeclarar una clase para agregarle funcionalidad (éso en PHP produce un <em>Fatal Error</em>), de forma que puedes hacer que una clase abra a otra y le agregue un par de métodos nuevos.</p>
<p><strong>No me estás diciendo nada nuevo</strong></p>
<p>Hay dos tipos de programadores: los reacios a los cambios y los que les gusta aprender. Si eres uno de los reacios tranquilo, PHP seguirá evolucionando y tendrás mayores opciones con las que jugar. Siempre lo ha hecho. Si eres uno de los segundos encontrarás una potencia de lenguaje sorprendente con la que el concepto de aplicación la enfocas desde otros puntos de vista, como plugins a un core principal, módulos atómicos que se interrelacionan entre ellos...</p>
<p><strong>Vale, quiero empezar con algo</strong></p>
<p>Primero de todo debo decir las versiones que actualmente se están moviendo en RoR.</p>
<blockquote><p>
Versión de Ruby: 1.8.6<br />
Versión de Rails: 2.1.1</p>
</blockquote>
<p>Sería interesante que instalaras un entorno para las pruebas que quieras hacer mientras lees los manuales. La instalación básica es muy fácil. Todas las instalaciones de RoR que he hecho (incluso en mi eeePC) han sido usando este pequeño y efectivo tutorial: <a href="http://agileweb.wordpress.com/2008/07/18/how-to-install-rails-21-on-ubuntu-in-5-steps/" target="_blank">How to install Rails 2.1 on Ubuntu in 5 steps</a>, aunque voy a poner las pasos rápidamente a continuación:</p>
<p>1.- Instalar ruby</p>
<blockquote><p>
sudo apt-get install ruby rdoc irb ruby1.8-dev rubygems libopenssl-ruby
</p></blockquote>
<p>2.- Actualizar el gestor de paquetes Gem a la última versión</p>
<blockquote><p>
sudo gem update --system
</p></blockquote>
<p>3.- Eliminar la versión antígua de Gem</p>
<blockquote><p>
sudo apt-get remove rubygems
</p></blockquote>
<p>4.- Creamos un enlace para que los programas que busquen el Gem eliminado ejecuten el Gem nuevo</p>
<blockquote><p>
sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
</p></blockquote>
<p>5.- Instalar Rails</p>
<blockquote><p>
sudo gem install rails
</p></blockquote>
<p>Además, lo suyo es ejecutar Ruby on Rails sobre MySQL, así que deberíamos instalar el servidor MySQL con la librería de Ruby correspondiente:</p>
<blockquote><p>
sudo apt-get install mysql-server libmysql-ruby
</p></blockquote>
<p>Una vez se tiene el entorno montado simplemente es cuestión de seguir algun manual. Qué manuales deberíamos seguir? Bueno, aquí la cosa depende de los gustos de cada uno. Voy a dar una lista de manuales que valdria la pena seguir desde mi punto de vesita.</p>
<ul>
<li><a href="http://www.amazon.com/Programming-Ruby-Pragmatic-Programmers-Second/dp/0974514055" target="_blank">Pargmatic Bookshelf - Programming Ruby (2nd edition)</a>. Ideal para aprender el lenguaje Ruby. No se toca nada de Rails. Genial para coger base en el lenguaje</li>
<li><a href="http://www.amazon.com/Rails-Way-Addison-Wesley-Professional-Ruby/dp/0321445619" target="_blank">The Rails Way</a>. Enseña la forma de trabajade Rails, explicando las capas de abstracción que Rails usa. Según mis compañeros de moterus.es, "indispensable"</li>
<li><a href="http://www.amazon.com/Rails-PHP-Developers-Pragmatic-Programmers/dp/1934356042" target="_blank">Rails for PHP developers</a>. Genial libro dónde da por supuesto que sabemos programar en PHP, usando ésto para enseñarnos Rails. Se avanza muy rápido, y no sustituye los dos anteriores.</li>
</ul>
<p>He puesto lo enlaces de Amazon para tener claro qué libros son, pero supongo que no tendréis problemas para encontrar sus versiones en PDF por internet <img src='http://www.syntaxerror.es/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><strong>Qué otros recursos son interesantes?</strong></p>
<p><a href="http://www.moterus.es/usuarios/isaac"  target="_blank">Isaac</a> y <a href="http://www.moterus.es/usuarios/francesc"  target="_blank">Francesc</a> me pasaron un listado de enlaces interesantes. Simplemente los voy a reproducir aquí:</p>
<ul>
<li><a href="http://api.rubyonrails.org" target="_blank">http://api.rubyonrails.org</a>: Toda la API de Rails</li>
<li><a href="http://www.ruby-doc.org/" target="_blank">http://www.ruby-doc.org/</a>: Documentación de Ruby</li>
<li><a href="http://railscasts.com/" target="_blank">http://railscasts.com/</a>: Imprescindible para iniciarse en las best-practices</li>
<li><a href="http://buildingwebapps.com/site/home" target="_blank">http://buildingwebapps.com/site/home</a>: Lleno de artículos, podcast interesantes</li>
<li><a href="http://www.ruby-forum.com/" target="_blank">http://www.ruby-forum.com/</a>: Foro de Ruby</li>
<li><a href="http://www.railsenvy.com/" target="_blank">http://www.railsenvy.com/</a>: Podcast semanal, algo más avanzado</li>
<li><a href="http://www.caboo.se/" target="_blank">http://www.caboo.se/</a>: Buena calidad de artículos</li>
</ul>
<p>A medida  que vaya aprendiendo más sobre este entorno escribiré más. Ahora en <a href="http://www.syntaxerror.es">SyntaxError</a> tenemos un nuevo tag <strong>Ruby on Rails</strong> <img src='http://www.syntaxerror.es/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Salu10.
</p>

2136
]]></content:encoded>
			<wfw:commentRss>http://www.syntaxerror.es/2008/09/24/saltando-de-php-a-ruby-on-rails/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PHP: Comprimir la salida del servidor para ahorrar ancho de banda</title>
		<link>http://www.syntaxerror.es/2008/07/23/php-comprimir-la-salida-del-servidor-para-ahorrar-ancho-de-banda/</link>
		<comments>http://www.syntaxerror.es/2008/07/23/php-comprimir-la-salida-del-servidor-para-ahorrar-ancho-de-banda/#comments</comments>
		<pubDate>Wed, 23 Jul 2008 10:22:43 +0000</pubDate>
		<dc:creator>Xavi</dc:creator>
		
		<category>ProgramaciÃ³n</category>

		<category>PHP</category>
<category></category>
		<guid isPermaLink="false">http://www.syntaxerror.es/2008/07/23/php-comprimir-la-salida-del-servidor-para-ahorrar-ancho-de-banda/</guid>
		<description><![CDATA[En un proyecto en el que estoy trabajando actualmente se requiere generar un XML con datos tratados, para que un código Javascript monte un grid a modo de Excel online. 
El problema viene cuando la cantidad de registros se vuelve grande... En unas pruebas con registros de producción nos encontramos que el grid se demoraba [...]]]></description>
			<content:encoded><![CDATA[<p><img id="image194" src="http://www.syntaxerror.es/wp-content/uploads/2008/07/zlib_screen.miniatura.PNG" alt="zlib" style="float:left;" />En un proyecto en el que estoy trabajando actualmente se requiere generar un <em>XML</em> con datos tratados, para que un código <em>Javascript</em> monte un <a href="http://www.treegrid.com/TreeGrid5_6/Html/EJSTreeGrid.html#Home" target="_blank">grid</a> a modo de <em>Excel online</em>. </p>
<p>El problema viene cuando la cantidad de registros se vuelve grande... En unas pruebas con registros de producción nos encontramos que el <em>grid </em>se demoraba mucho en mostrarse... Pusimos algunas alertas y llegamos a la conclusión que de 20 segundos que tardaba en montarse el <em>grid</em>, sólo 5 correspondían a la generación del <em>XML</em> y el resto era tráfico de red y proceso <em>javascript</em>.</p>
<p>Pero cuánto pesa el <em>XML</em>? Un mega y medio de <em>XML</em>? Y cómo lo hacemos más pequeño para generar menos tráfico y ganar tiempo? Comprimiendo el <em>XML</em> de salida...</p>
<p><a id="more-192"></a></p>
<p><strong>Â¿De qué se trata?</strong></p>
<p>Los datos que se encargan de montar una página web son básicamente imágenes y diferentes tipos de datos en texto plano. Las imágenes habitualmente ya vienen comprimidas (<em>JPG</em>, <em>PNG</em>, <em>GIF</em>,...), pero el texto plano (<em>HTML</em>, <em>XML</em>, <em>CSS</em>, ...) es altamente comprimible... Simplemente es código <em>ASCII</em> que se repite y repite en el mismo archivo. Si enviamos el texto plano comprimido estamos enviando realmente menos datos por la red, consiguiendo que la totalidad de los datos llegue antes al navegador, quien descomprime los datos y obtiene el código <em>HTML</em>, <em>XML</em>, <em>CSS</em> o lo que sea como si se hubiese enviado así directamente.</p>
<p><strong>Â¿Y los navegadors lo soportan?</strong></p>
<p>Casi la totalidad de navegadores actuales soportan la compressión de datos <em>HTTP</em>. De hecho, desde 1998 los navegadores han ido soportando el protocolo <em>HTTP 1.1</em>, que esencialmente indica que el navegador soporta "content encoding".</p>
<p>Internet Explorer soporta compresión <em>HTTP</em> desde la versión 4 (teniendo que activar <em>HTTP 1.1</em> en sus propiedades) aunque las versiones para <em>Mac 4.5/5</em> no lo soportan. Netscape lo soporta desde la versión 4 aunque da bastantes fallos. Su versión 4.5 empieza a ser más interesante y la 6 funciona ya plenamente. Opera soporta la compresión desde su versión 5. Firefox desde su versión 1.</p>
<p>Para asegurarte que tu navegador soporta compresión puedes usar el test <a href="http://www.schroepl.net/cgi-bin/http_trace.pl" target="_blank">HTTP trace</a>. Si aparece una línea dentro del cuadro "<em>HTTP request received from browser</em>" con un texto similar al siguiente es que sí que lo soporta:</p>
<blockquote><p>
ACCEPT_ENCODING: gzip,deflate
</p></blockquote>
<p>Â¿Cómo implementarlo?</p>
<p>Se puede hacer de 3 formas:</p>
<ol>
<li>Activar a nivel TOTAL del ámbito del php del servidor (editar <em>php.ini</em>)</li>
<li>Activar a nivel LOCAL para un sólo site de todo el ámbito del PHP (<em>.htaccess</em>)</li>
<li>Activar a nivel de SCRIPT (un sólo archivo<em>.php</em>)</li>
</ol>
<p><strong>1.- TOTAL</strong></p>
<ol>
<li>Editar el <em>php.ini</em> de apache<br />
<blockquote><p>$ vim /etc/php5/apache2/php.ini</p></blockquote>
</li>
<li>Cambiar el valor de los parámetros siguientes:<br />
<blockquote><p>zlib.output_compression = On<br />
		zlib.output_compression_level = 7</p></blockquote>
</li>
<li>Guardar y salir</li>
<li>Reiniciar apache<br />
<blockquote><p>$ /etc/init.d/apache2 restart</p></blockquote>
</li>
</ol>
<p><strong>2.- LOCAL</strong></p>
<ol>
<li>Editar o crear el archivo <em>.htaccess</em> en el directorio del sitio a aplicar<br />
<blockquote><p>$ vim /var/www/misitio/.htaccess</p></blockquote>
</li>
<li>Insertar las siguientes líneas:<br />
<blockquote><p>php_flag zlib.output_compression on<br />
		php_value zlib.output_compression_level 7</p></blockquote>
</li>
<li>Guardar y salir (no es necesario reiniciar)</li>
</ol>
<p><strong>3.- SCRIPT</strong><br />
Hay dos formas de hacerlo:</p>
<ol>
<li>Insertar al inicio del <em>script</em> la siguiente línea<br />
<blockquote><p>ini_set('zlib.output_compression', 'On');</p></blockquote>
<p>	NOTA: Según el <a href="http://es.php.net/manual/es/ref.zlib.php#82310" target="_blank">comentario en <em>php.net</em></a> esta forma no funciona.<br />
		Personalmente yo no lo he probado.</li>
<li>Insertar al inicio del <em>script</em> la siguiente línea<br />
<blockquote><p>ob_start("ob_gzhandler");</p></blockquote>
<p>	NOTA: Sin haber activado el <em>zlib</em> desde <em>php.ini</em>, al ejecutar ésta línea me causaba un error.</li>
</ol>
<p><strong>Niveles de compresión:</strong></p>
<p>Van de 0 a 9 indicando de menos a más compresión respectivamente. A menos compresión más rápido es y menos <em>CPU</em> consume, pero menos comprime. A más compresión se tarda más en comprimir y consume más <em>CPU</em>, pero la compresión es mejor. Establecer el valor a -1 hace que se deje a elección del propio <em>PHP</em> el nivel de compresión (generalmente 6).</p>
<p><strong>Â¿Cómo saber si está funcionando?</strong></p>
<p>Se pueden usar herramientas de testeo como <a href="http://www.port80software.com/support/p80tools" target="_blank">HTTP Analysis Tools</a>. Para este caso, probar la primera herramienta "<em>Compression Check</em>"</p>
<p><strong>Experiencia personal</strong></p>
<p>En el proyecto que he descrito, el <em>XML</em> medio pesaba sobre 1,5 MB. Al comprimir la salida se queda en unos 35 KB, una muy buena mejora. La solución que tomé fué aplicar la compresión a todo el site setando los parámetros directamente en el <em>php.ini</em>. La generación del <em>XML</em> sigue tardando lo mismo pero el tiempo total para tener el XML listo en el navegador descendió de 25 segundos a unos 10 segundos... una muy buena mejora <img src='http://www.syntaxerror.es/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Luego, quise hacer lo mismo en este blog. Como está alojado en un servidor compartido no tengo acceso al <em>php.ini</em>, así que probé de hacer el setado por <em>.htaccess</em>, pero obtuve siempre un <em>error 500</em>. La única forma de hacerlo funcionar fué editar el archivo <em>index.php</em> y colocar en la primera línea el <em>ob_start("ob_gzhandler")</em>. La compresión funcionó y los registros mejoraron, pero la experiencia del usuario empeora debido a que el el navegador no renderiza hasta que no le han llegado todos los datos... y cómo hay algunos scripts de publicidad que se llaman y demoran todo el conjunto, la web se queda unos segundos (que se hacen eternos) en blanco. Así que lo quité dejándolo sin comprimir. Así, almenos, el usuario ve que se le va renderizando la web sobre la marcha y no tiene la sensación de que el sitio está colgado.</p>
<p><strong>Más información:</strong></p>
<ul>
<li><a href="http://es.php.net/manual/es/ref.zlib.php" target="_blank">http://es.php.net/manual/es/ref.zlib.php</a></li>
<li><a href="http://www.pmichaud.com/wiki/Cookbook/OutputCompression"  target="_blank">http://www.pmichaud.com/wiki/Cookbook/OutputCompression</a>
</ul>

3f78
]]></content:encoded>
			<wfw:commentRss>http://www.syntaxerror.es/2008/07/23/php-comprimir-la-salida-del-servidor-para-ahorrar-ancho-de-banda/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Autonombrado Ordenado: Ordenar y renombrar masivamente fotos, para Windows</title>
		<link>http://www.syntaxerror.es/2008/06/20/autonombrado-ordenado-ordenar-y-renombrar-masivamente-fotos-para-windows/</link>
		<comments>http://www.syntaxerror.es/2008/06/20/autonombrado-ordenado-ordenar-y-renombrar-masivamente-fotos-para-windows/#comments</comments>
		<pubDate>Fri, 20 Jun 2008 08:27:34 +0000</pubDate>
		<dc:creator>Xavi</dc:creator>
		
		<category>ProgramaciÃ³n</category>

		<category>Herramientas</category>

		<category>Windows</category>
<category></category>
		<guid isPermaLink="false">http://www.syntaxerror.es/2008/06/20/autonombrado-ordenado-ordenar-y-renombrar-masivamente-fotos-para-windows/</guid>
		<description><![CDATA[Una de mis otras aficiones es la fotografía. Supongo que viendo mis proyectos de scripts y demás se nota un claro enfoque en hacerme la vida algo más fácil a la hora de organizar y publicar mis fotos.
Uno de los problemas más habituales aparece cuando tengo muchas fotos de varias cámaras tomadas del mismo viaje. [...]]]></description>
			<content:encoded><![CDATA[<p><img id="image190" src="http://www.syntaxerror.es/wp-content/uploads/2008/06/autonombrado1.miniatura.jpg" alt="Autonombrado Ordenado" style="float:left;" />Una de mis otras aficiones es la fotografía. Supongo que viendo <a href="http://www.syntaxerror.es/proyectos/">mis proyectos</a> de scripts y demás se nota un claro enfoque en hacerme la vida algo más fácil a la hora de organizar y publicar mis fotos.</p>
<p>Uno de los problemas más habituales aparece cuando tengo muchas fotos de varias cámaras tomadas del mismo viaje. Al juntar las fotos y tratar de verlas me encuentro en que (obviamente) es casi imposible verlas respetando un órden cronológico. <em>Windows</em> permite ordenar por fecha de captura y luego visualizarlas correctamente, pero a la hora de hacer un redimensionado masivo se pierde la información de la ordenación y del <em>EXIF </em>(dónde se guarda la fecha de captura).</p>
<p>El sencillo programa que presento aquí recoge todas las fotos de una carpeta, las ordena por fecha de captura, y las renombra con un nombre general dado y un número de foto para hacerlas consecutivas. Así, una vez realizado el proceso podremos usar cualquier programa de tratamiento masivo, aunque pierda la información <em>EXIF</em>, porque ya las tendremos en el orden correcto.</p>
<p>Para más información y descargas del programa, visitad la página del proyecto: <a href="http://www.syntaxerror.es/proyectos/autonombrado-ordenado/"><strong>Autonombrado Ordenado</strong></a> <strong>v1.0</strong>, dónde también se encuentra el <strong>código fuente</strong> para <em>Visual Basic 2005</em>.
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.syntaxerror.es/2008/06/20/autonombrado-ordenado-ordenar-y-renombrar-masivamente-fotos-para-windows/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Descargar webs con wget</title>
		<link>http://www.syntaxerror.es/2008/06/01/descargar-webs-con-wget/</link>
		<comments>http://www.syntaxerror.es/2008/06/01/descargar-webs-con-wget/#comments</comments>
		<pubDate>Sun, 01 Jun 2008 10:36:04 +0000</pubDate>
		<dc:creator>Xavi</dc:creator>
		
		<category>Linux</category>

		<category>Apuntes</category>
<category>Apuntes</category><category>Linux</category>
		<guid isPermaLink="false">http://www.syntaxerror.es/2008/06/01/descargar-webs-con-wget/</guid>
		<description><![CDATA[El comando wget en linux sirve para descargar cualquier cosa de un sitio web, desde páginas HTML a documentos PDF o imágenes, siempre que estén disponibles desde una URL.
El comando básico es

wget http://www.dominio.com/ruta/al/archivo

Recomiendo leerse la documentación del comando wget, pues tiene una inmensa cantidad de parámetros que permiten especificar exactamente qué y cómo queremos realizar [...]]]></description>
			<content:encoded><![CDATA[<p>El comando <strong>wget</strong> en linux sirve para descargar cualquier cosa de un sitio web, desde páginas HTML a documentos PDF o imágenes, siempre que estén disponibles desde una URL.</p>
<p>El comando básico es</p>
<blockquote><p>
wget http://www.dominio.com/ruta/al/archivo
</p></blockquote>
<p>Recomiendo leerse la <a href="http://linuxreviews.org/man/wget/" target="_blank">documentación del comando <strong>wget</strong></a>, pues tiene una inmensa cantidad de parámetros que permiten especificar exactamente qué y cómo queremos realizar la descarga.</p>
<p>Por ejemplo, para descargar sólo las imágenes (parámetro -A) de una página dada (-r realiza un parseo de la página descargada en busca de URLs a analizar, estilo recursivo), teniendo en cuenta que no baje elementos ya descargados anteriormente (-nc), asegurándonos que sólo será recursivo hacia los hijos y no hacia el padre (-np), escribiríamos el siguiente comando:</p>
<blockquote><p>
wget -r -A=,"jpg","JPG","gif","GIF","wmv","WMV" -nc -np http://www.dominio.com/ruta/al/archivo
</p></blockquote>
<p>Salu10</p>
]]></content:encoded>
			<wfw:commentRss>http://www.syntaxerror.es/2008/06/01/descargar-webs-con-wget/feed/</wfw:commentRss>
		</item>
		<item>
		<title>ASUS eeePC &#038; eeeXubuntu</title>
		<link>http://www.syntaxerror.es/2008/05/29/asus-eeepc-eeexubuntu/</link>
		<comments>http://www.syntaxerror.es/2008/05/29/asus-eeepc-eeexubuntu/#comments</comments>
		<pubDate>Thu, 29 May 2008 06:29:09 +0000</pubDate>
		<dc:creator>Xavi</dc:creator>
		
		<category>Sistemas</category>

		<category>Linux</category>
<category>eeePC</category><category>eeeXubuntu</category><category>Linux</category><category>Sistemas</category>
		<guid isPermaLink="false">http://www.syntaxerror.es/2008/05/29/asus-eeepc-eeexubuntu/</guid>
		<description><![CDATA[Mucho tiempo desde el último post... Los proyectos del trabajo me gastan las neuronas, y además mi pequeño nuevo juguete me roba el resto de mi tiempo libre: un ASUS eeePC 701 negro (8GB SSD / 1GB RAM).
Con éste, empiezo un nuevo tag donde loguear los cambios que le doy a la pequeña maravilla. Hoy [...]]]></description>
			<content:encoded><![CDATA[<p><img id="image184" src="http://www.syntaxerror.es/wp-content/uploads/2008/05/asus-eeepc-black.miniatura.jpg" alt="ASUS eeePC" style="float:left;" />Mucho tiempo desde el último post... Los proyectos del trabajo me gastan las neuronas, y además mi pequeño nuevo juguete me roba el resto de mi tiempo libre: un <a href="http://eeepc.asus.com/global/700.htm" target="_blank">ASUS eeePC 701 negro (8GB SSD / 1GB RAM)</a>.</p>
<p>Con éste, empiezo un nuevo tag donde loguear los cambios que le doy a la pequeña maravilla. Hoy toca, para empezar, una introducción y una puesta al día del "proyecto".</p>
<p><a id="more-186"></a></p>
<p>No me voy a liar a explicar las bondades técnicas del ASUS eeePC. Si lees este blog seguro que ya sabes de que se trata, y no porque lo haya dicho yo <img src='http://www.syntaxerror.es/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Para empezar, el sistema operativo que lleva de fábrica es una derivación de <a href="http://www.xandros.com/" target="_blank">Xandros</a>, que viene a ser un fork de Debian. A nivel gráfico, al iniciarlo, arranca el gestor de ventanas <a href="http://es.wikipedia.org/wiki/IceWM" target="_blank">IceWM</a> al que llaman Easy Mode. </p>
<p><img id="image185" src="http://www.syntaxerror.es/wp-content/uploads/2008/05/screen-en.gif" alt="eeePC iceWM Easy Mode" /></p>
<p>La verdad es que es una presentación que funciona de maravilla, muy liviana, arrancando en unos 20 segundos, y con todo lo necesario listo para usar (Firefox, Open Office, Pidgin, Skype, Thunderbird, ...). Mi experiencia ha sido irme de viaje con el bicho de serie y no necesitar nada más.</p>
<p>Mediante <a href="http://forum.eeeuser.com/viewtopic.php?id=1083" target="_blank">un sencillo hack</a> podemos activar lo que llaman Advanced Mode, un KDE en toda regla (los pasos 1, 2 y 3 se pueden obviar, pues tenemos la consola presionando Ctr + Alt + T).</p>
<p>Sin embargo, a causa de haber importado el bicho desde Taiwan, el teclado vino en taiwanés, con el mapa de carácteres opcional al inglés. Instalar los locale's y cambiar el mapa de carácteres al castellano fué fácil, pero por alguna razón no logré que las teclas muertas (por ejemplo los acentos) me funcionaran. Me peleé durante un par de semanas hasta que opté por sustituir el sistema operativo por la distribución eeeXubuntu.</p>
<p><strong>Copia de seguridad del eeePC</strong></p>
<p>Antes de instalar nada, qué es lo que se debe hacer siempre? Copias de Seguridad! Y cómo hacemos una copia de seguridad de nuestro eeePC? Pues arrancando el eeePc con una LiveCD de cualquier distribución linux podemos tirar de la instrucción <a href="http://www.hmug.org/man/1/dd.php" target="_blank">dd</a>.</p>
<p>1.- Conectamos un disco USB que tenga suficiente espacio libre para alojar nuestro disco duro.<br />
2.- Asumiendo que nuestro disco duro está en <em>hdc</em> y que la unidad USB está en <em>sdb</em> (y la partición deseada está montada en <em>/mnt/sdb1</em>), abriremos una terminal con <em>Ctr  + Alt + T</em>:</p>
<blockquote><p>
dd if=/dev/hdc of=/mnt/sdb1/backup_eeepc.img
</p></blockquote>
<p>3.- El proceso tardará un buen rato, sin que veamos ninguna actividad a parte de las luces de los discos a tope.</p>
<p>Si en algún momento queremos restaurar la copia de seguridad, sólo tendremos que repetir el proceso pero variando el sentido del flujo de datos:</p>
<blockquote><p>
dd if=/mnt/sdb1/backup_eeepc.img of=/dev/hdc
</p></blockquote>
<p>Es importante remarcar que el trabajo se debe hacer desde otro sistema operativo, arrancando desde el USB o desde un CD externo, pues si no nos encontraremos que no puede realizar la copia por estar usando los propios archivos que se quieren copiar.</p>
<p><strong>Instalando eeeXubuntu</strong></p>
<p>Instalar <strong>eeeXubuntu</strong> ha sido como una liberación para el pequeño eeePC. Ahora ya si, disponemos de un Linux en toda la regla, con los repositorios de toda la vida, con las posiblidades de siempre.</p>
<p>Para la instalación seguí la guia de (para mí) la <a href="http://wiki.eeeuser.com/es:ubuntu:eeexubuntu:home" target="_blank">wiki oficial del eeePC</a>. Básicamente se trata de bajarse la <a href="http://wiki.eeeuser.com/es:ubuntu:eeexubuntu:home#descargalo" target="_blank">ISO de eeeXubuntu 7.10</a> de uno de los mirrors, quemarlo en un CD (<a href="http://wiki.eeeuser.com/es:ubuntu:eeexubuntu:home#instrucciones_detalladas_para_instalar_desde_usb" target="_blank">también para USB</a>) y arrancar el eeePC. Al arrancar el eeePC, presionamos Esc para que se nos muestre el menú de boot, seleccionamos el CD y nos aparecerá la famosa pantalla inicial casi universal en las instalaciones Linux. </p>
<p>La instalación del eeeXubuntu se realiza una vez tenemos iniciado el escritorio de este Live CD, y es la misma que cualquier Ubuntu. Lo único que debemos mantener en mente es que la instalación no está adecuada para nuestra pequeña pantalla. Para poder mover las ventanas presionamos (y mantenemos) Alt y pinchamos (y mantenemos) sobre el fondo de la ventana. Aparece una mano y ya podemos mover la ventana.</p>
<p><strong>Y ahora que?</strong></p>
<p>Una vez instalado, he seguido la mayoría de <a href="http://wiki.eeeuser.com/es:ubuntu:eeexubuntu:customization"  target="_blank">los trucos listados en la misma wiki</a>:</p>
<ul>
<li><a href="http://wiki.eeeuser.com/es:ubuntu:eeexubuntu:customization#suprime_el_cd-rom_de_la_lista_de_origenes_de_paquetes">Suprime el CD-ROM de la lista de orígenes de paquetes</a></li>
<li><a href="http://wiki.eeeuser.com/es:ubuntu:eeexubuntu:customization#gestion_de_energia_-_bateria">Gestión de energía - Batería</a> [Saltado]</li>
<li><a href="http://wiki.eeeuser.com/es:ubuntu:eeexubuntu:customization#montando_unidades_externas_discos_usb_tarjetas_sd_etc">Montando unidades externas (discos USB, tarjetas SD, etc.)</a> [Con la propia instalación de eeeXubuntu ya funcionó y no hizo falta]</li>
<li><a href="http://wiki.eeeuser.com/es:ubuntu:eeexubuntu:customization#aun_menos_i_o_de_disco">Aún menos I/O de disco</a></li>
<li><a href="http://wiki.eeeuser.com/es:ubuntu:eeexubuntu:customization#anade_noatime_en_tu_fstab">Añade noatime en tu fstab</a></li>
<li><a href="http://wiki.eeeuser.com/es:ubuntu:eeexubuntu:customization#usar_disco_en_ram_para_ficheros_temporales">Usar disco en RAM para ficheros temporales</a></li>
<li><a href="http://wiki.eeeuser.com/es:ubuntu:eeexubuntu:customization#habilitar_la_navegacion_por_la_red_de_windows_en_thunar">Habilitar la navegación por la red de Windows en Thunar</a> [No me funcionó]</li>
<li><a href="http://wiki.eeeuser.com/es:ubuntu:eeexubuntu:customization#sonido">Sonido</a> [Con la propia instalación de eeeXubuntu ya funcionó y no hizo falta]</li>
<li><a href="http://wiki.eeeuser.com/es:ubuntu:eeexubuntu:customization#eliminar_el_sonido_durante_el_apagado">Eliminar el sonido durante el apagado</a> [Por defecto no suena <img src='http://www.syntaxerror.es/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ]</li>
<li><a href="http://wiki.eeeuser.com/es:ubuntu:eeexubuntu:customization#renderizado_directo">Renderizado directo</a></li>
<li><a href="http://wiki.eeeuser.com/es:ubuntu:eeexubuntu:customization#camara">Cámara</a></li>
<li><a href="http://wiki.eeeuser.com/es:ubuntu:eeexubuntu:customization#touchpad_trackpad">Touchpad/Trackpad</a> [Saltado]</li>
<li><a href="http://wiki.eeeuser.com/es:ubuntu:eeexubuntu:customization#flash_java_7">Flash &amp; Java 7</a></li>
<li><a href="http://wiki.eeeuser.com/es:ubuntu:eeexubuntu:customization#codecs">Codecs</a></li>
<li><a href="http://wiki.eeeuser.com/es:ubuntu:eeexubuntu:customization#peticion_de_contrasena_de_la_cadena_de_claves_al_hacer_login">Petición de Contraseña de la Cadena de Claves al hacer Login</a></li>
<li><a href="http://wiki.eeeuser.com/es:ubuntu:eeexubuntu:customization#teclas_fn">Teclas Fn</a> [Con la propia instalación de eeeXubuntu ya funcionó y no hizo falta]</li>
<li><a href="http://wiki.eeeuser.com/es:ubuntu:eeexubuntu:customization#haciendo_que_el_osd_funcione">Haciendo que el OSD funcione</a></li>
<li><a href="http://wiki.eeeuser.com/es:ubuntu:eeexubuntu:customization#actualizaciones_de_bios">Actualizaciones de BIOS</a> [Saltado]</li>
<li><a href="http://wiki.eeeuser.com/es:ubuntu:eeexubuntu:customization#activando_el_escritorio_compiz-fusion">Activando el escritorio Compiz-fusion</a></li>
<li><a href="http://wiki.eeeuser.com/es:ubuntu:eeexubuntu:customization#arreglando_el_tema_gdm_para_xubuntu">Arreglando el tema GDM para Xubuntu</a> [Pendiente]</li>
</ul>
<p><strong>Â¿Por qué la versión 7.10 y no la 8.04/8.10?</strong></p>
<p>El proyecto eeeXubuntu se gestó y ha alcanzado la madurez con la versión 7.10. Aunque hay gente trabajando en la nueva versión, podemos leer <a href="http://forum.eeeuser.com/viewtopic.php?id=26429" target="_blank">hilos en el foro de eeeuser</a> (de obligada visita) que a algunos les falla la wireless y la LAN (hablan de que falta el driver), otros con temas de la info de batería... Problemas típicos que se solucionan rápido pero que denotan la (aún) falta de madurez de la versión.</p>
<p><strong>Conclusiones después de un par de semanas de uso</strong></p>
<p>Ya hace unas dos semanas que instalé eeeXubuntu. Mi valoración final es que me alegro de haber cambiado de distribución, aunque si no fuera por los problemas de mapeo del teclado (acentos, sobretodo abiertos) puede que aún siguiera con el pequeño y rápido Xandros. </p>
<p>Pero a nivel de funcionalidad, eeeXubuntu es una distribución entera, con toda la potencia y con algunas adaptaciones de tamaño al eeePC. Arranca en un minuto aprox, controla perfectamente el hardware, entiende correctamente el mapeo de carácteres en castellano, disponibilidad de todos los repositorios... Y hasta el compiz funciona <img src='http://www.syntaxerror.es/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  En fin, una maravilla.
</p>

8026
]]></content:encoded>
			<wfw:commentRss>http://www.syntaxerror.es/2008/05/29/asus-eeepc-eeexubuntu/feed/</wfw:commentRss>
		</item>
		<item>
		<title>MySQL: Problemas con JOINs entre versión 4 y 5</title>
		<link>http://www.syntaxerror.es/2008/04/11/mysql-problemas-con-joins-entre-version-4-y-5/</link>
		<comments>http://www.syntaxerror.es/2008/04/11/mysql-problemas-con-joins-entre-version-4-y-5/#comments</comments>
		<pubDate>Fri, 11 Apr 2008 07:30:02 +0000</pubDate>
		<dc:creator>Xavi</dc:creator>
		
		<category>ProgramaciÃ³n</category>

		<category>SQL</category>
<category></category>
		<guid isPermaLink="false">http://www.syntaxerror.es/2008/04/11/mysql-problemas-con-joins-entre-version-4-y-5/</guid>
		<description><![CDATA[Este artículo puede sonar más bién a una llamada desesperada. Llevo unas semanas (por no decir un par de meses) liado con un proyecto que me consume más de lo que quisiera pero por respeto a la empresa no puedo desvelar casi nada. Y para colofón me aparece este problema que me está llevando de [...]]]></description>
			<content:encoded><![CDATA[<p><img id="image183" src="http://www.syntaxerror.es/wp-content/uploads/2008/04/mysql.miniatura.jpg" alt="MySQL" style="float:left;" />Este artículo puede sonar más bién a una llamada desesperada. Llevo unas semanas (por no decir un par de meses) liado con un proyecto que me consume más de lo que quisiera pero por respeto a la empresa no puedo desvelar casi nada. Y para colofón me aparece este problema que me está llevando de cabeza.</p>
<p>Resulta que tengo una query... sencilla en concepto, un par de joins cruzados... La construyo en local contra MySQL 4 y funciona perfectamente... y al subirla al servidor de producción con MySQL 5 simplemente me devuelve <em>0 rows</em>. Estoy literalmente alucinando.</p>
<p><a id="more-182"></a></p>
<h2>Explicación del escenario</h2>
<p>Se trata de tres tablas con relación N:M, es decir, dos tablas principales y una que las une:</p>
<blockquote><p>
variables<br />
---------<br />
id (pk)<br />
name</p>
<p>var_questions<br />
-------------<br />
id (pk)<br />
id_variable (fk)<br />
id_language (fk)<br />
question</p>
<p>languages<br />
----------<br />
id (pk)<br />
name<br />
enabled
</p></blockquote>
<p>La tabla de variables contiene todas las <em>variables</em> registradas en el programa. La tabla <em>languages</em> contiene todos los idiomas disponibles en el programa. La tabla var_questions relaciona <em>variables</em> con <em>languages</em> y presenta el campo <em>question</em> que viene a ser el <em>texto de la variable en el idioma determinado</em>, es decir, para cada variable e idioma debe haber un texto.</p>
<p>Entonces yo necesito una <em>query</em> <strong>que me saque las inconsistencias</strong> (no las coincidencias), porque se trata de tablas <em>MyISAM</em> y en el proceso de desarrollo se puede haber creado un idioma sin haber generado ningún texto para él y para todas las variables. Mi query debe encontrar "lo que queda suelto".</p>
<h2>La query</h2>
<p>Usando la lógica (la mía, claro...) pensé: teniendo la lista de variables y la lista de idiomas, lo que debe presentar inconsistencias es la tabla intermedia. Entonces, podría hacer una query enlazando las <em>variables</em> con <em>var_questions</em> con un <em>left join</em> i la última con <em>languages</em> con un <em>right join</em>, para encontrar los <em>null</em>s en la tabla intermedia <em>var_questions</em>. Luego le digo en el where que sólo quiero los nulls <em>et violà</em>.</p>
<div class="igBar"><span id="lsql-14"><a href="#" onclick="javascript:showPlainTxt('sql-14'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-14">
<div class="sql">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">SELECT</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #993333; font-weight: bold;">VARIABLES</span>.name&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">AS</span> var_name,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #993333; font-weight: bold;">VARIABLES</span>.id&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">AS</span> var_id,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; var_questions.question&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">AS</span> question,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; languages.name&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">AS</span> lang</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">FROM</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #993333; font-weight: bold;">VARIABLES</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">LEFT</span> <span style="color: #993333; font-weight: bold;">JOIN</span> var_questions <span style="color: #993333; font-weight: bold;">ON</span> <span style="color: #993333; font-weight: bold;">VARIABLES</span>.id = var_questions.id_variable</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">RIGHT</span> <span style="color: #993333; font-weight: bold;">JOIN</span> languages <span style="color: #993333; font-weight: bold;">ON</span> var_questions.id_language = languages.id</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">WHERE</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; var_questions.question <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NULL</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">AND</span> languages.enabled = <span style="color: #cc66cc;color:#800000;">1</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>La ejecuto en MySQL 4 y perfecto. Me saca justamente la información que necesito. Subo la query a producción, con un servidor MySQL 5 y me devuelve (con los mismos datos) <em>0 rows</em>. Y justo ahí empieza mi odisea.</p>
<h2>Investigando</h2>
<p>La verdad es que poco más puedo investigar a parte de lo que haríamos todos: Googlear mucho, buscar problemas de compatibilidad, buscar documentación de JOINs, preguntar a cracks en el tema, dejar <a href="http://www.forosdelweb.com/f86/problema-compatibilidad-joins-mysql4-mysql5-573653/" target="_blank" title="Foros del web: Problema de compatibilidad JOINS MySQL4 - MySQL5?">mensajes en foros</a>, ...</p>
<p>Las versiones con las que juego son, en local, un <strong>MySQL 4.1.22-community-nt</strong> sobre <em>Windows Vista</em>, y en producción un <strong>MySQL 5.0.24a</strong> sobre <em>Linux 2.6.9-023stab046.2-enterprise (Red Hat 3.4.5-2)</em>. </p>
<p>Durante las pruebas he encontrado una query que parece devolver los mismos resultados, pero no me gusta por el simple hecho que usa una <em>CROSS JOIN</em> que no podría explicar exactamente qué hace, pero parece hacer una producto cartesiano de las tablas enlazadas y no acepta un <em>ON</em>:</p>
<div class="igBar"><span id="lsql-15"><a href="#" onclick="javascript:showPlainTxt('sql-15'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-15">
<div class="sql">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">SELECT</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #993333; font-weight: bold;">VARIABLES</span>.name&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">AS</span> var_name,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; var_questions.question&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">AS</span> question,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; languages.name&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">AS</span> lang</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">FROM</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; languages</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">CROSS</span> <span style="color: #993333; font-weight: bold;">JOIN</span> <span style="color: #993333; font-weight: bold;">VARIABLES</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">LEFT</span> <span style="color: #993333; font-weight: bold;">JOIN</span> var_questions <span style="color: #993333; font-weight: bold;">ON</span> var_questions.id_language = languages.id</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">WHERE</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; var_questions.question <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NULL</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">AND</span> languages.enabled = <span style="color: #cc66cc;color:#800000;">1</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h2>Cómo probar?</h2>
<p>Tengo unos datos preparados por si alguien quiere hacer algunas pruebas (que serán agradecidas profundamente):</p>
<div class="igBar"><span id="lsql-16"><a href="#" onclick="javascript:showPlainTxt('sql-16'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-16">
<div class="sql">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`variables`</span> <span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #ff0000;">`id`</span> int<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">11</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">UNSIGNED</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #ff0000;">`name`</span> varchar<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">100</span><span style="color:#006600; font-weight:bold;">&#41;</span> collate latin1_spanish_ci <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">''</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span>&nbsp; <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">`id`</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span> ENGINE=MyISAM <span style="color: #993333; font-weight: bold;">DEFAULT</span> CHARSET=latin1 COLLATE=latin1_spanish_ci;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`languages`</span> <span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #ff0000;">`id`</span> int<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">11</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">UNSIGNED</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #ff0000;">`name`</span> varchar<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">10</span><span style="color:#006600; font-weight:bold;">&#41;</span> collate latin1_spanish_ci <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">''</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #ff0000;">`enabled`</span> tinyint<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'0'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span>&nbsp; <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">`id`</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span> ENGINE=MyISAM <span style="color: #993333; font-weight: bold;">DEFAULT</span> CHARSET=latin1 COLLATE=latin1_spanish_ci;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`var_questions`</span> <span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #ff0000;">`id`</span> int<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">11</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">UNSIGNED</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #ff0000;">`id_variable`</span> int<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">11</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">UNSIGNED</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'0'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #ff0000;">`id_language`</span> int<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">11</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">UNSIGNED</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'0'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #ff0000;">`question`</span> text collate latin1_spanish_ci,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span>&nbsp; <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">`id`</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span> ENGINE=MyISAM <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span>=<span style="color: #cc66cc;color:#800000;">163</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> CHARSET=latin1 COLLATE=latin1_spanish_ci;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #ff0000;">`languages`</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">`id`</span>, <span style="color: #ff0000;">`name`</span>, <span style="color: #ff0000;">`enabled`</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">2</span>, <span style="color: #ff0000;">'es'</span>, <span style="color: #cc66cc;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #ff0000;">`languages`</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">`id`</span>, <span style="color: #ff0000;">`name`</span>, <span style="color: #ff0000;">`enabled`</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">4</span>, <span style="color: #ff0000;">'ca'</span>, <span style="color: #cc66cc;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #ff0000;">`languages`</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">`id`</span>, <span style="color: #ff0000;">`name`</span>, <span style="color: #ff0000;">`enabled`</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">5</span>, <span style="color: #ff0000;">'en'</span>, <span style="color: #cc66cc;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #ff0000;">`variables`</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">`id`</span>, <span style="color: #ff0000;">`name`</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">56</span>, <span style="color: #ff0000;">'var_1'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #ff0000;">`variables`</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">`id`</span>, <span style="color: #ff0000;">`name`</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">60</span>, <span style="color: #ff0000;">'var_2'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #ff0000;">`variables`</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">`id`</span>, <span style="color: #ff0000;">`name`</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">61</span>, <span style="color: #ff0000;">'var_3'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #ff0000;">`var_questions`</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">`id`</span>, <span style="color: #ff0000;">`id_variable`</span>, <span style="color: #ff0000;">`id_language`</span>, <span style="color: #ff0000;">`question`</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">157</span>, <span style="color: #cc66cc;color:#800000;">56</span>, <span style="color: #cc66cc;color:#800000;">2</span>, <span style="color: #ff0000;">'Variable 1'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #ff0000;">`var_questions`</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">`id`</span>, <span style="color: #ff0000;">`id_variable`</span>, <span style="color: #ff0000;">`id_language`</span>, <span style="color: #ff0000;">`question`</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">158</span>, <span style="color: #cc66cc;color:#800000;">60</span>, <span style="color: #cc66cc;color:#800000;">2</span>, <span style="color: #ff0000;">'Variable 2'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #ff0000;">`var_questions`</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">`id`</span>, <span style="color: #ff0000;">`id_variable`</span>, <span style="color: #ff0000;">`id_language`</span>, <span style="color: #ff0000;">`question`</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">159</span>, <span style="color: #cc66cc;color:#800000;">61</span>, <span style="color: #cc66cc;color:#800000;">2</span>, <span style="color: #ff0000;">'Variable 3'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>El resultado correcto debería ser el siguiente:</p>
<table>
<tr>
<td><b>var_name</b></td>
<td><b>var_id</b></td>
<td><b>question</b></td>
<td><b>lang</b></td>
</tr>
<tr>
<td>var_1</td>
<td>56</td>
<td>null</td>
<td>ca</td>
</tr>
<tr>
<td>var_2</td>
<td>60</td>
<td>null</td>
<td>ca</td>
</tr>
<tr>
<td>var_3</td>
<td>61</td>
<td>null</td>
<td>ca</td>
</tr>
</table>
<h2>Colofón</h2>
<p>Vale. No soy capaz de encontrar el problema. Será un problema de algún bug en la versión que uso para producción? Está mal planteada la query? A alguien se le ocurre algo?</p>
<p>Una cervecita para quien dé con la solución <img src='http://www.syntaxerror.es/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Salu10
</p>

b0
]]></content:encoded>
			<wfw:commentRss>http://www.syntaxerror.es/2008/04/11/mysql-problemas-con-joins-entre-version-4-y-5/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

0


