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

<channel>
	<title>Bj - el blog de un limonero</title>
	<atom:link href="http://www.bujorel.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bujorel.net</link>
	<description>El blog de Bj</description>
	<pubDate>Sun, 07 Sep 2008 19:18:41 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
	<language>en</language>
			<item>
		<title>Nueva actualización de WGA</title>
		<link>http://www.bujorel.net/tutorial/nueva-actualizacion-de-wga/</link>
		<comments>http://www.bujorel.net/tutorial/nueva-actualizacion-de-wga/#comments</comments>
		<pubDate>Sun, 07 Sep 2008 18:52:07 +0000</pubDate>
		<dc:creator>Bj</dc:creator>
		
		<category><![CDATA[Tutorial]]></category>

		<category><![CDATA[wga]]></category>

		<category><![CDATA[windows genuine advantage]]></category>

		<category><![CDATA[windows original]]></category>

		<guid isPermaLink="false">http://www.bujorel.net/?p=81</guid>
		<description><![CDATA[Microsoft ha vuelto a actualizar el sistema WGA sobre el cual escribía hace tiempo aquí.
La nueva versión - 1.8.31.0 es algo mas agresiva ya que entre otras cosas quita el fondo de escritorio, dejándolo en negro. Aunque el usuario establezca un nuevo fondo, cada 60 minutos volverá a negro hasta que la copia de Windows [...]]]></description>
			<content:encoded><![CDATA[<p>Microsoft ha vuelto a actualizar el sistema <strong>WGA</strong> sobre el cual escribía hace tiempo <a href="http://www.bujorel.net/tutorial/programa-de-ventajas-de-windows-original/">aquí</a>.</p>
<p>La nueva versión - <strong>1.8.31.0</strong> es algo mas agresiva ya que entre otras cosas quita el fondo de escritorio, dejándolo en <strong>negro</strong>. Aunque el usuario establezca un nuevo fondo, <strong>cada 60 minutos</strong> volverá a negro hasta que la copia de Windows sea original.</p>
<p><img src='http://www.bujorel.net/wp-content/uploads/2008/09/nuevo_wga.png' alt='Nuevo WGA 1.8' /></p>
<p>También hay una notificación que se queda al lado de la barra de tareas simulando una <a href="http://es.wikipedia.org/wiki/Marca_al_agua">marca al agua</a> (watermark) que no es interactiva.<br />
El aviso parece que siempre está en inglés.</p>
<p>Para validar la copia hay que seguir estos sencillos pasos:</p>
<p>· Descargar <a href="http://www.bujorel.net/proxy/proxy.php?file=Windows.Genuine.Advantage.Validation.v1.8.31.0.rar">este archivo</a> y extraerlo<br />
· Ejecutar <strong>instalar.bat</strong><br />
· Reiniciar el ordenador</p>
<p>Para mas información puede consultar el <a href="http://www.bujorel.net/tutorial/programa-de-ventajas-de-windows-original/">artículo anterior</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bujorel.net/tutorial/nueva-actualizacion-de-wga/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Animator vs Animation</title>
		<link>http://www.bujorel.net/humor/animator-vs-animation/</link>
		<comments>http://www.bujorel.net/humor/animator-vs-animation/#comments</comments>
		<pubDate>Sun, 24 Aug 2008 19:12:20 +0000</pubDate>
		<dc:creator>Bj</dc:creator>
		
		<category><![CDATA[Humor]]></category>

		<category><![CDATA[animator vs animation]]></category>

		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://www.bujorel.net/?p=80</guid>
		<description><![CDATA[Animator vs Animation:

<object	type="application/x-shockwave-flash"
			data="http://www.youtube.com/v/qo1d6ttbAq8"
			width="425"
			height="350">
	<param name="movie" value="http://www.youtube.com/v/qo1d6ttbAq8" />
	<param name=wmode" value="transparent" />
</object>
Animator vs Animation 2:

<object	type="application/x-shockwave-flash"
			data="http://www.youtube.com/v/RTPpbHueNJ4"
			width="425"
			height="350">
	<param name="movie" value="http://www.youtube.com/v/RTPpbHueNJ4" />
	<param name=wmode" value="transparent" />
</object>
]]></description>
			<content:encoded><![CDATA[<p>Animator vs Animation:<br />
<code>
<object	type="application/x-shockwave-flash"
			data="http://www.youtube.com/v/qo1d6ttbAq8"
			width="425"
			height="350">
	<param name="movie" value="http://www.youtube.com/v/qo1d6ttbAq8" />
	<param name=wmode" value="transparent" />
</object></code></p>
<p>Animator vs Animation 2:<br />
<code>
<object	type="application/x-shockwave-flash"
			data="http://www.youtube.com/v/RTPpbHueNJ4"
			width="425"
			height="350">
	<param name="movie" value="http://www.youtube.com/v/RTPpbHueNJ4" />
	<param name=wmode" value="transparent" />
</object></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bujorel.net/humor/animator-vs-animation/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Empezar de nuevo</title>
		<link>http://www.bujorel.net/importante/empezar-de-nuevo/</link>
		<comments>http://www.bujorel.net/importante/empezar-de-nuevo/#comments</comments>
		<pubDate>Mon, 14 Jul 2008 07:06:13 +0000</pubDate>
		<dc:creator>Bj</dc:creator>
		
		<category><![CDATA[Importante]]></category>

		<category><![CDATA[dicho]]></category>

		<category><![CDATA[empezar]]></category>

		<category><![CDATA[intentar]]></category>

		<category><![CDATA[Julio Cortázar]]></category>

		<category><![CDATA[refran]]></category>

		<guid isPermaLink="false">http://www.bujorel.net/?p=78</guid>
		<description><![CDATA[
Nada está perdido si se tiene el valor de proclamar que todo está perdido y hay que empezar de nuevo.
 Julio Cortázar (1914-1984) - Escritor argentino.
]]></description>
			<content:encoded><![CDATA[<blockquote>
<p>Nada está perdido si se tiene el valor de proclamar que todo está perdido y hay que empezar de nuevo.</p></blockquote>
<p> Julio Cortázar (1914-1984) - Escritor argentino.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bujorel.net/importante/empezar-de-nuevo/feed/</wfw:commentRss>
		</item>
		<item>
		<title>[IMG] Sangwali</title>
		<link>http://www.bujorel.net/fotografia/img-sangwali/</link>
		<comments>http://www.bujorel.net/fotografia/img-sangwali/#comments</comments>
		<pubDate>Mon, 23 Jun 2008 13:16:13 +0000</pubDate>
		<dc:creator>Bj</dc:creator>
		
		<category><![CDATA[Fotografía]]></category>

		<category><![CDATA[africa]]></category>

		<category><![CDATA[foto]]></category>

		<category><![CDATA[imagen]]></category>

		<category><![CDATA[namibia]]></category>

		<category><![CDATA[sangwali]]></category>

		<guid isPermaLink="false">http://www.bujorel.net/?p=79</guid>
		<description><![CDATA[Puesta del Sol a las 6 de la tarde en Sangwali, Namibia.

]]></description>
			<content:encoded><![CDATA[<p>Puesta del Sol a las 6 de la tarde en Sangwali, Namibia.</p>
<p><a href='http://www.bujorel.net/wp-content/uploads/2008/06/sangwali_1280.jpg' title='Sangwali Namibia'><img src='http://www.bujorel.net/wp-content/uploads/2008/06/sangwali_500.jpg' alt='Sangwali Namibia' /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bujorel.net/fotografia/img-sangwali/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Mac vs. PC vs. Linux - South Park</title>
		<link>http://www.bujorel.net/humor/mac-vs-pc-vs-linux-south-park/</link>
		<comments>http://www.bujorel.net/humor/mac-vs-pc-vs-linux-south-park/#comments</comments>
		<pubDate>Wed, 07 May 2008 09:27:35 +0000</pubDate>
		<dc:creator>Bj</dc:creator>
		
		<category><![CDATA[Humor]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[mac]]></category>

		<category><![CDATA[pc]]></category>

		<category><![CDATA[south park]]></category>

		<guid isPermaLink="false">http://www.bujorel.net/?p=77</guid>
		<description><![CDATA[
<object	type="application/x-shockwave-flash"
			data="http://www.youtube.com/v/0-22EpQOm8c"
			width="425"
			height="350">
	<param name="movie" value="http://www.youtube.com/v/0-22EpQOm8c" />
	<param name=wmode" value="transparent" />
</object>
Fuente: http://southpark.wtdmusic.com/
]]></description>
			<content:encoded><![CDATA[<p><code>
<object	type="application/x-shockwave-flash"
			data="http://www.youtube.com/v/0-22EpQOm8c"
			width="425"
			height="350">
	<param name="movie" value="http://www.youtube.com/v/0-22EpQOm8c" />
	<param name=wmode" value="transparent" />
</object></code></p>
<p>Fuente: <a href="http://southpark.wtdmusic.com/">http://southpark.wtdmusic.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bujorel.net/humor/mac-vs-pc-vs-linux-south-park/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Comprimiendo las hojas de estilo - CSS</title>
		<link>http://www.bujorel.net/tutorial/comprimiendo-las-hojas-de-estilo-css/</link>
		<comments>http://www.bujorel.net/tutorial/comprimiendo-las-hojas-de-estilo-css/#comments</comments>
		<pubDate>Thu, 10 Apr 2008 17:13:49 +0000</pubDate>
		<dc:creator>Bj</dc:creator>
		
		<category><![CDATA[Tutorial]]></category>

		<category><![CDATA[comprimir]]></category>

		<category><![CDATA[css]]></category>

		<category><![CDATA[hojas de estilo]]></category>

		<category><![CDATA[optimizar]]></category>

		<category><![CDATA[style.css]]></category>

		<category><![CDATA[stylesheet]]></category>

		<guid isPermaLink="false">http://www.bujorel.net/?p=75</guid>
		<description><![CDATA[El otro día empecé a modificar algunas cosas en el blog para optimizarlo: limpiar el tema, optimizar el javascript y una cosa importante fue optimizar o mejor dicho comprimir el archivo CSS del tema de este blog.
Algunos páginas pueden tener incluso más archivos CSS cosa que no recomiendo porque solo aumentan el número de consultas [...]]]></description>
			<content:encoded><![CDATA[<p>El otro día empecé a modificar algunas cosas en el blog para optimizarlo: limpiar el tema, optimizar el javascript y una cosa importante fue optimizar o mejor dicho comprimir el archivo <a href="http://es.wikipedia.org/wiki/CSS">CSS</a> del tema de este blog.<br />
Algunos páginas pueden tener incluso más archivos CSS cosa que no recomiendo porque solo aumentan el número de consultas del servidor web y por lo tanto tardan más en cargar.</p>
<p>Comprimiendo el CSS además ahorra ancho de banda especialmente en sitios donde hay más de <strong>1.000 líneas</strong> de código.</p>
<p>Hay varias páginas donde podrás comprimir el archivo CSS, pero el problema puede ser el mantenimiento del archivo después.</p>
<p><img src='http://www.bujorel.net/wp-content/uploads/2008/04/css-comp.png' alt='Comprimiendo CSS' /></p>
<p>Para optimizarlo principalmente hay dos opciones:<br />
• comprimir el archivo CSS simplemente<br />
• crear un <strong>script PHP</strong> que comprima el archivo cada vez que es solicitado</p>
<p><span id="more-75"></span>Cada opción tiene su ventaja e inconveniente.<br />
El script PHP tiene la ventaja de que es muy fácil mantener el archivo CSS para hacer modificaciones, pero cada vez que se cargue la pagina el servidor tendrá que servir el código PHP.<br />
Yo como no suelo modificar el archivo CSS muy a menudo he optado por hacerlo estático - he comprimido el código CSS y lo he subido directamente al servidor.</p>
<p>1. Ambas opciones son bastante simples y eficaces, especialmente la primera.<br />
Para comprimir el archivo CSS he probado varios &#8220;servicios&#8221; web y finalmente me he<br />
decidido por <a href="http://iceyboard.no-ip.org/projects/css_compressor">Ice CSS Compressor</a>.</p>
<p>El resultado es asombroso:<br />
• Tamaño original: <strong>10.65 kB</strong> (10,910 B)<br />
• Tamaño final: <strong>5.48 kB</strong> (5,608 B)<br />
• Ahorrado: <strong>5.18 kB</strong> (5,302 B)<br />
• Reducción: <strong>48.6%</strong></p>
<p>2. La segunda opción es un poco más compleja - además de <strong>PHP</strong> requiere utilizar el archivo <strong>.htaccess</strong>.</p>
<p>Así es como funciona:<br />
• El navegador el usuario pide la hoja de estilo (archivo CSS) como siempre<br />
• El servidor comprime la hoja de estilo utilizando PHP<br />
• La hoja de estilo es servida al navegador</p>
<p>Todo esto pasa completamente desapercibido para el usuario.<br />
Además tiene la ventaja de que no hay que modificar el código CSS original.</p>
<p>Primero hay que añadir este código al principio del archivo CSS:</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
  <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="">'Content-type: text/css'</span><span style="color: #009900;">&#41;</span>;
  <span style="color: #990000;">ob_start</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;compress&quot;</span><span style="color: #009900;">&#41;</span>;
  <span style="color: #000000; font-weight: bold;">function</span> compress<span style="color: #009900;">&#40;</span><span style="color: #000088;">$buffer</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// quita comentarios</span>
    <span style="color: #000088;">$buffer</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="">'!/\*[^*]*\*+([^/][^*]*\*+)*/!'</span><span style="color: #339933;">,</span> <span style="">''</span><span style="color: #339933;">,</span> 
      <span style="color: #000088;">$buffer</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #666666; font-style: italic;">// quita tabuladores, espacios, nuevas lineas, etc.</span>
    <span style="color: #000088;">$buffer</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span><span style="color: #339933;">,</span>
       <span style="">'  '</span><span style="color: #339933;">,</span> <span style="">'    '</span><span style="color: #339933;">,</span> <span style="">'    '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="">''</span><span style="color: #339933;">,</span>  <span style="color: #000088;">$buffer</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$buffer</span>;
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>La primera línea informa al navegador de que esto es una hoja de estilos CSS.<br />
La función de comprimir es utilizada para quitar los comentarios y los espacios.<br />
Finalmente, el CSS comprimido es mandado al navegador.</p>
<p>Al final del archivo CSS hay que añadir esta línea:</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">ob_end_flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;?<span style="color: #339933;">&gt;</span></pre></div></div>

<p>Es para que el script sepa hasta donde tiene que colectar en el buffer la información que tiene que comprimir.</p>
<p>El último paso es necesario para seguir manteniendo la extensión CSS del archivo.<br />
Hay que modificar (o crear) el archivo <em>.htacces</em> y añadir un <strong>SetHandler</strong> que sirve para procesar otras extensiones como PHP:</p>

<div class="wp_syntax"><div class="code"><pre class="apache apache" style="font-family:monospace;">&lt;<span style="color: #000000; font-weight:bold;">Files</span> style.css&gt;
  <span style="color: #00007f;">SetHandler</span> application/x-httpd-php 
&lt;/<span style="color: #000000; font-weight:bold;">Files</span>&gt;</pre></div></div>

<p>Puedes descargar desde <a href="http://www.bujorel.net/wp-content/uploads/2008/04/CSS-comp.rar">aquí</a> ambos archivos para utilizarlos directamente.</p>
<p>Antes <a href="http://www.bujorel.net/wp-content/themes/ds/original_style.css">mi archivo CSS</a> pesaba <strong>10.6 KB</strong> (10.910 bytes).<br />
Ahora después de comprimirlo <a href="http://www.bujorel.net/wp-content/themes/ds/style.css">tiene casi la mitad</a> del tamaño <strong>5,47 KB</strong> (5.608 bytes).</p>
<p><strong>Nota:</strong> <em>las hojas de estilo de los blogs tienen un encabezado para la identificación donde están los detalles como el nombre, el creador, la pagina web&#8230;<br />
Se puede añadir después de comprimir el archivo para mantener la información aunque funciona perfectamente sin.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bujorel.net/tutorial/comprimiendo-las-hojas-de-estilo-css/feed/</wfw:commentRss>
		</item>
		<item>
		<title>[IMG] Nordkapp</title>
		<link>http://www.bujorel.net/fotografia/img-nordkapp/</link>
		<comments>http://www.bujorel.net/fotografia/img-nordkapp/#comments</comments>
		<pubDate>Thu, 03 Apr 2008 11:35:11 +0000</pubDate>
		<dc:creator>Bj</dc:creator>
		
		<category><![CDATA[Fotografía]]></category>

		<category><![CDATA[foto]]></category>

		<category><![CDATA[imagen]]></category>

		<category><![CDATA[nordkapp]]></category>

		<category><![CDATA[noruega]]></category>

		<category><![CDATA[norway]]></category>

		<guid isPermaLink="false">http://www.bujorel.net/?p=72</guid>
		<description><![CDATA[Imagen tomada a las 5 de la mañana a 25 km de Nordkapp, Noruega.

]]></description>
			<content:encoded><![CDATA[<p>Imagen tomada a las 5 de la mañana a 25 km de <strong>Nordkapp</strong>, Noruega.</p>
<p><a href='http://www.bujorel.net/wp-content/uploads/2008/03/nordkapp_1280.jpg' title='Nordkapp Norway'><img src='http://www.bujorel.net/wp-content/uploads/2008/03/nordkapp_500.jpg' alt='Nordkapp Norway' /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bujorel.net/fotografia/img-nordkapp/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Alta calidad en Youtube</title>
		<link>http://www.bujorel.net/informacion/alta-calidad-en-youtube/</link>
		<comments>http://www.bujorel.net/informacion/alta-calidad-en-youtube/#comments</comments>
		<pubDate>Thu, 27 Mar 2008 22:20:09 +0000</pubDate>
		<dc:creator>Bj</dc:creator>
		
		<category><![CDATA[Información]]></category>

		<category><![CDATA[calidad]]></category>

		<category><![CDATA[flash]]></category>

		<category><![CDATA[hd]]></category>

		<category><![CDATA[youtube]]></category>

		<guid isPermaLink="false">http://www.bujorel.net/informacion/alta-calidad-en-youtube/</guid>
		<description><![CDATA[Hace algo de tiempo que se está comentando que Google tiene planeado aumentar la calidad en los videos de Youtube.
Parece que finalmente hay una novedad &#8220;visible&#8221; con respecto a la calidad.
Todavía Youtube no es HD (High Definition) pero han hecho algunas progresos importantes.

Cuando subimos un vídeo WMV, AVI, MOV o MPG a Youtube, se redimensiona [...]]]></description>
			<content:encoded><![CDATA[<p>Hace algo de tiempo que se está comentando que <strong>Google</strong> tiene planeado aumentar la calidad en los videos de <strong>Youtube</strong>.<br />
Parece que finalmente hay una novedad &#8220;visible&#8221; con respecto a la calidad.<br />
Todavía Youtube no es HD (High Definition) pero han hecho algunas progresos importantes.</p>
<div align="center"><img src='http://www.bujorel.net/wp-content/uploads/2008/03/youtube_hd.jpg' alt='Youtube HD' /></div>
<p>Cuando subimos un vídeo WMV, AVI, MOV o MPG a Youtube, se redimensiona de forma automática a la resolución <strong>320&#215;240</strong> y es codificado en Flash 7 a unos <strong>250 kbps</strong> con el audio mono en MP3 a <strong>22.050 KHz</strong>.<br />
Esto hace que muchas veces la calidad sea pobre e insatisfactoria.</p>
<p>Por ahora la solución es añadir un parámetro en el enlace.<br />
 El vídeo <em>milagrosamente</em> se verá con una calidad diferente.</p>
<p>Estas son las dos opciones que tenemos:<br />
	• <strong>&#038;fmt=6	</strong>-> vídeo con mayor calidad - resolución de <strong>448&#215;336</strong> píxeles<br />
	• <strong>&#038;fmt=18</strong>	-> la mejor opción ya que el formato del vídeo es <strong>MP4</strong> (codificado con <strong>H.264</strong> y <strong>AAC</strong>) - resolución de <strong>480&#215;360</strong> píxeles y audio estéreo a <strong>44.100 KHz</strong>.</p>
<p>Aquí un ejemplo:<br />
<span id="more-68"></span>Vídeo normal:<br />
<code>
<object	type="application/x-shockwave-flash"
			data="http://www.youtube.com/v/M-5WFZOw8BE"
			width="425"
			height="350">
	<param name="movie" value="http://www.youtube.com/v/M-5WFZOw8BE" />
	<param name=wmode" value="transparent" />
</object></code></p>
<p>Vídeo mayor calidad:<br />
<code>
<object	type="application/x-shockwave-flash"
			data="http://www.youtube.com/v/M-5WFZOw8BE"
			width="425"
			height="350">
	<param name="movie" value="http://www.youtube.com/v/M-5WFZOw8BE" />
	<param name=wmode" value="transparent" />
</object></code></p>
<p>Vídeo mejor calidad:<br />
<code>
<object	type="application/x-shockwave-flash"
			data="http://www.youtube.com/v/M-5WFZOw8BE"
			width="425"
			height="350">
	<param name="movie" value="http://www.youtube.com/v/M-5WFZOw8BE" />
	<param name=wmode" value="transparent" />
</object></code></p>
<p>También ahora en el perfil de Youtube hay una nueva opción para poder seleccionar la calidad de reproducción de los vídeos:</p>
<p>Youtube -> Account -> <a href="http://www.youtube.com/video_quality_settings">Video Playback Quality</a></p>
<p><img src='http://www.bujorel.net/wp-content/uploads/2008/03/youtube_playback_quality.png' alt='Youtube Video Playback Quality' /></p>
<p>En teoría esto debería funcionar así:<br />
• detectar la conexión a Internet y reproducir el vídeo a una calidad acorde a la línea<br />
• reproducir el vídeo a baja calidad - Internet lento<br />
• reproducir el vídeo a alta calidad - Internet rápido</p>
<p>Para utilizar este pequeño truco basta con modificar la dirección del vídeo añadiendo la cadena correspondiente.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bujorel.net/informacion/alta-calidad-en-youtube/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Como crear un feed RSS desde MySQL con PHP</title>
		<link>http://www.bujorel.net/tutorial/como-crear-un-feed-rss-desde-mysql-con-php/</link>
		<comments>http://www.bujorel.net/tutorial/como-crear-un-feed-rss-desde-mysql-con-php/#comments</comments>
		<pubDate>Fri, 29 Feb 2008 01:14:52 +0000</pubDate>
		<dc:creator>Bj</dc:creator>
		
		<category><![CDATA[Tutorial]]></category>

		<category><![CDATA[feed]]></category>

		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[rss]]></category>

		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.bujorel.net/tutorial/como-crear-un-feed-rss-desde-mysql-con-php/</guid>
		<description><![CDATA[Recientemente he tenido que hacer un feed RSS para una página de antigüedades que tenía unos 90-100 artículos en puro HTML.
Así que he optado por utilizar una base de datos.
Mejor de cara a futuras actualizaciones (nuevos artículos) e incluso más practico ahora.
 El feed RSS es un sencillo formato de datos que es utilizado para [...]]]></description>
			<content:encoded><![CDATA[<p>Recientemente he tenido que hacer un feed <strong>RSS</strong> para una página de antigüedades que tenía unos 90-100 artículos en puro <strong>HTML</strong>.<br />
Así que he optado por utilizar una base de datos.<br />
Mejor de cara a futuras actualizaciones (nuevos artículos) e incluso más practico ahora.</p>
<p><img src='http://www.bujorel.net/wp-content/uploads/2008/02/feed-icon.png' alt='RSS Feed Icon' /> El <a href="http://es.wikipedia.org/wiki/Feed">feed</a> <a href="http://es.wikipedia.org/wiki/RSS">RSS</a> es un sencillo formato de datos que es utilizado para redifundir contenidos a suscriptores de un sitio web. El formato permite distribuir contenido sin necesidad de un navegador, utilizando un software diseñado para leer estos contenidos RSS (agregador). A pesar de eso, es posible utilizar el mismo navegador para ver los contenidos RSS. Las últimas versiones de los principales navegadores permiten leer los RSS sin necesidad de software adicional.</p>
<p><strong>Base de datos</strong><br />
El primer paso será crear la base de datos y añadir los datos. Si nuestra página ya utiliza algún tipo de base de datos para guardar los artículos no será necesario crear otra base de datos ni tampoco hacer cambios.<br />
Básicamente necesitaremos estos campos en la tabla:<br />
• <strong>id</strong> - no es obligatorio pero siempre me gusta que las tablas estén numeradas<br />
• <strong>categoria</strong> - categoría o tag del articulo (nos permitirá organizar mejor)<br />
• <strong>titulo</strong> - título que veremos en el RSS<br />
• <strong>resumen</strong> - un breve resumen del articulo (si ponemos el texto entero, el usuario no tendrá interés de visitar nuestra página)<br />
• <strong>fecha</strong> - fecha del articulo para la organización (los más nuevos son los primeros)<br />
• <strong>enlace</strong> - enlace a la pagina del articulo completo</p>
<p>Esta sería la <strong>estructura SQL</strong> para facilitar un poco el proceso:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql mysql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE TABLE</span> `articulos` <span style="color: #66cc66;">&#40;</span>
  `id` <span style="color: #aa9933; font-weight: bold;">INT</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">&#41;</span> <span style="color: #aa3399; font-weight: bold;">NOT NULL</span> <span style="color: #aa3399; font-weight: bold;">AUTO_INCREMENT</span>,
  `categoria` <span style="color: #aa9933; font-weight: bold;">TEXT</span> <span style="color: #aa3399; font-weight: bold;">NOT NULL</span>,
  `titulo` <span style="color: #aa9933; font-weight: bold;">TEXT</span> <span style="color: #aa3399; font-weight: bold;">NOT NULL</span>,
  `resumen` <span style="color: #aa9933; font-weight: bold;">TEXT</span> <span style="color: #aa3399; font-weight: bold;">NOT NULL</span>,
  `fecha` <span style="color: #aa9933; font-weight: bold;">DATE</span> <span style="color: #aa3399; font-weight: bold;">NOT NULL</span>,
  `enlace` <span style="color: #aa9933; font-weight: bold;">TEXT</span> <span style="color: #aa3399; font-weight: bold;">NOT NULL</span>,
  <span style="color: #aa3399; font-weight: bold;">UNIQUE</span> KEY `id` <span style="color: #66cc66;">&#40;</span>`id`<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span> ENG<span style="color: #66cc66;">IN</span>E<span style="color: #66cc66;">=</span>My<span style="color: #66cc66;">IS</span>AM  <span style="color: #aa3399; font-weight: bold;">DEFAULT</span> <span style="color: #aa3399; font-weight: bold;">CHARSET</span><span style="color: #66cc66;">=</span>utf8 <span style="color: #aa3399; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">=</span><span style="color: #cc66cc;">1</span> ;</pre></div></div>

<p></p>
<p><strong>Código PHP</strong></p>
<p>Lo primero será abrir un archivo RSS (.xml / .rss):</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #000088;">$fp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="">'index.xml'</span><span style="color: #339933;">,</span> <span style="">'w'</span><span style="color: #009900;">&#41;</span>;</pre></div></div>

<p></p>
<p>El siguiente paso es escribir <strong>la cabecera</strong> en el archivo index.xml (esta información suele ser estática):<br />
<span id="more-66"></span></p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;">$rand = &quot;\n&quot;;
fwrite($fp, '<span style="color: #339933;">&lt;</span>?xml version<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;1.0&quot;</span> encoding<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>' .$rand);
fwrite($fp, '&lt;rss version=&quot;2.0&quot; xmlns:atom=&quot;http://www.w3.org/2005/Atom&quot;&gt;' .$rand);
fwrite($fp, '&lt;channel&gt;' .$rand);
fwrite($fp, '&lt;title&gt;Bujorel' .$dirname. '&lt;/title&gt;' .$rand);
fwrite($fp, '&lt;description&gt;Bj - El blog de un limonero&lt;/description&gt;' .$rand);
fwrite($fp, '&lt;link&gt;http://www.bujorel.net' .$dirname. '/&lt;/link&gt;' .$rand);
fwrite($fp, '&lt;language&gt;es-sp&lt;/language&gt;' .$rand);
fwrite($fp, '&lt;copyright&gt;Copyright ' .date('Y'). ' Bujorel.net&lt;/copyright&gt;' .$rand .$rand);</pre></div></div>

<p></p>
<p>Ahora es el turno de la base de datos (información que se actualiza continuamente).<br />
Realiza la <strong>conexión a la base de datos</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #000088;">$db</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="">'localhost'</span><span style="color: #339933;">,</span><span style="">'usuario'</span><span style="color: #339933;">,</span><span style="">'contraseña'</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="">'base_de_datos'</span><span style="color: #339933;">,</span><span style="color: #000088;">$db</span><span style="color: #009900;">&#41;</span>;</pre></div></div>

<p></p>
<p>Crea la consulta (query):</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #000088;">$category</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="">'PHP_SELF'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$category</span> <span style="color: #339933;">!=</span> <span style="">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   	<span style="color: #000088;">$dirname</span> <span style="color: #339933;">=</span> <span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="">'PHP_SELF'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>;
       <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span> <span style="color: #000088;">$dirname</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
	<span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT id,categoria,titulo,resumen,fecha,enlace FROM articulos ORDER BY fecha DESC&quot;</span>;    
       <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>   
	<span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT * FROM articulos WHERE categoria='$categoria' ORDER BY fecha DESC&quot;</span>;    
       <span style="color: #009900;">&#125;</span>   
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="">'No se ha podido realizar la consulta.'</span><span style="color: #009900;">&#41;</span>;</pre></div></div>

<p></p>
<p>Extrae la información:</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$id</span>        <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="">'id'</span><span style="color: #009900;">&#93;</span>;
<span style="color: #000088;">$categoria</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="">'categoria'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #000088;">$titulo</span>    <span style="color: #339933;">=</span> <span style="color: #990000;">htmlentities</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="">'titulo'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> ENT_QUOTES<span style="color: #009900;">&#41;</span>;
<span style="color: #000088;">$resumen</span>   <span style="color: #339933;">=</span> <span style="color: #990000;">htmlentities</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="">'resumen'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> ENT_QUOTES<span style="color: #009900;">&#41;</span>;
<span style="color: #000088;">$fecha</span>     <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="">'fecha'</span><span style="color: #009900;">&#93;</span>;
<span style="color: #000088;">$enlace</span>    <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="">'enlace'</span><span style="color: #009900;">&#93;</span>;</pre></div></div>

<p></p>
<p>Y después escribe la información (contenido BBDD) en el archivo index.xml:</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="">'&lt;item&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="">'&lt;title&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$titulo</span><span style="color: #339933;">.</span> <span style="">'&lt;/title&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="">'&lt;description&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$resumen</span><span style="color: #339933;">.</span> <span style="">'&lt;/description&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="">'&lt;category&gt;![CDATA['</span> <span style="color: #339933;">.</span><span style="color: #000088;">$categoria</span><span style="color: #339933;">.</span> <span style="">']]&lt;/category&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="">'&lt;link&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$enlace</span><span style="color: #339933;">.</span> <span style="">'&lt;/link&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="">'&lt;pubDate&gt;'</span> <span style="color: #339933;">.</span><span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="">'D, d M Y H:i:s O'</span><span style="color: #339933;">,</span> <span style="color: #990000;">strtotime</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fecha</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span> <span style="">'&lt;/pubDate&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="">'&lt;/item&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span>;<span style="color: #009900;">&#125;</span></pre></div></div>

<p></p>
<p>Finalmente escribe el &#8220;<strong>pie de página</strong>&#8221; (footer) del archivo index.xml:</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="">'&lt;/channel&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="">'&lt;/rss&gt;'</span><span style="color: #009900;">&#41;</span>;</pre></div></div>

<p></p>
<p>Cierra el archivo:</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span>;</pre></div></div>

<p></p>
<p>Y termina mostrando un mensaje:</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #990000;">print</span> <span style="color: #009900;">&#40;</span><span style="">'Creado Feed RSS.'</span><span style="color: #009900;">&#41;</span>;</pre></div></div>

<p></p>
<p><strong>Resultado final:</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
</pre></td><td class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000088;">$fp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="">'index.xml'</span><span style="color: #339933;">,</span> <span style="">'w'</span><span style="color: #009900;">&#41;</span>;
&nbsp;
<span style="color: #000088;">$rand</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="">'&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="">'&lt;rss version=&quot;2.0&quot; xmlns:atom=&quot;http://www.w3.org/2005/Atom&quot;&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="">'&lt;channel&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="">'&lt;title&gt;Bujorel'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$dirname</span><span style="color: #339933;">.</span> <span style="">'&lt;/title&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="">'&lt;description&gt;Bj - El blog de un limonero&lt;/description&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="">'&lt;link&gt;http://www.bujorel.net'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$dirname</span><span style="color: #339933;">.</span> <span style="">'/&lt;/link&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="">'&lt;language&gt;es-sp&lt;/language&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="">'&lt;copyright&gt;Copyright '</span> <span style="color: #339933;">.</span><span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="">'Y'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span> <span style="">' Bujorel.net&lt;/copyright&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span>;
&nbsp;
<span style="color: #000088;">$db</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="">'localhost'</span><span style="color: #339933;">,</span><span style="">'usuario'</span><span style="color: #339933;">,</span><span style="">'contraseña'</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="">'base_de_datos'</span><span style="color: #339933;">,</span><span style="color: #000088;">$db</span><span style="color: #009900;">&#41;</span>;
&nbsp;
<span style="color: #000088;">$category</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="">'PHP_SELF'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$category</span> <span style="color: #339933;">!=</span> <span style="">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   	<span style="color: #000088;">$dirname</span> <span style="color: #339933;">=</span> <span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="">'PHP_SELF'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>;
       <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span> <span style="color: #000088;">$dirname</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
	<span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT id,categoria,titulo,resumen,fecha,enlace FROM articulos ORDER BY fecha DESC&quot;</span>;    
       <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>   
	<span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT * FROM articulos WHERE categoria='$categoria' ORDER BY fecha DESC&quot;</span>;    
       <span style="color: #009900;">&#125;</span>   
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="">'No se ha podido realizar la consulta.'</span><span style="color: #009900;">&#41;</span>;
&nbsp;
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$id</span>        <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="">'id'</span><span style="color: #009900;">&#93;</span>;
<span style="color: #000088;">$categoria</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="">'categoria'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #000088;">$titulo</span>    <span style="color: #339933;">=</span> <span style="color: #990000;">htmlentities</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="">'titulo'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> ENT_QUOTES<span style="color: #009900;">&#41;</span>;
<span style="color: #000088;">$resumen</span>   <span style="color: #339933;">=</span> <span style="color: #990000;">htmlentities</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="">'resumen'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> ENT_QUOTES<span style="color: #009900;">&#41;</span>;
<span style="color: #000088;">$fecha</span>     <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="">'fecha'</span><span style="color: #009900;">&#93;</span>;
<span style="color: #000088;">$enlace</span>    <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="">'enlace'</span><span style="color: #009900;">&#93;</span>
&nbsp;
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="">'&lt;item&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="">'&lt;title&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$titulo</span><span style="color: #339933;">.</span> <span style="">'&lt;/title&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="">'&lt;description&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$resumen</span><span style="color: #339933;">.</span> <span style="">'&lt;/description&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="">'&lt;category&gt;![CDATA['</span> <span style="color: #339933;">.</span><span style="color: #000088;">$categoria</span><span style="color: #339933;">.</span> <span style="">']]&lt;/category&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="">'&lt;link&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$enlace</span><span style="color: #339933;">.</span> <span style="">'&lt;/link&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="">'&lt;pubDate&gt;'</span> <span style="color: #339933;">.</span><span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="">'D, d M Y H:i:s O'</span><span style="color: #339933;">,</span> <span style="color: #990000;">strtotime</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fecha</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span> <span style="">'&lt;/pubDate&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="">'&lt;/item&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span>;<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="">'&lt;/channel&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="">'&lt;/rss&gt;'</span><span style="color: #009900;">&#41;</span>;
&nbsp;
<span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span>;
&nbsp;
<span style="color: #990000;">print</span> <span style="color: #009900;">&#40;</span><span style="">'Creado Feed RSS.'</span><span style="color: #009900;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p></p>
<p>Ahora para utilizar esto si tenemos una página que no actualizamos muy a menudo o tenemos que actualizar la base de datos de forma manual podemos simplemente abrir el archivo php creado cuando hace falta actualizar el feed.<br />
Pero si tenemos una página que escribe en la base de datos directamente y la actualizamos más a menudo podemos poner este código HTML:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;index.xml&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;XML&quot;</span> <span style="color: #000066;">onmouseover</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;parent.location='index-xml.php';&quot;</span>&gt;</span>   
 <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/icon-xml.gif&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;icon-xml&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;XML&quot;</span><span style="color: #66cc66;">/</span>&gt;</span>   
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span></pre></div></div>

<p></p>
<p>Cada vez que pasemos el ratón por encima del enlace se ejecutara el archivo<br />
<strong>index-xml.php</strong> (nuestro archivo) que actualizara el feed RSS.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bujorel.net/tutorial/como-crear-un-feed-rss-desde-mysql-con-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Como evitar el hotlinking con .htaccess</title>
		<link>http://www.bujorel.net/tutorial/como-evitar-el-hotlinking-con-htaccess/</link>
		<comments>http://www.bujorel.net/tutorial/como-evitar-el-hotlinking-con-htaccess/#comments</comments>
		<pubDate>Wed, 06 Feb 2008 00:00:38 +0000</pubDate>
		<dc:creator>Bj</dc:creator>
		
		<category><![CDATA[Tutorial]]></category>

		<category><![CDATA[apache]]></category>

		<category><![CDATA[hotlinking]]></category>

		<category><![CDATA[htaccess]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[protección]]></category>

		<guid isPermaLink="false">http://www.bujorel.net/tutorial/como-evitar-el-hotlinking-con-htaccess/</guid>
		<description><![CDATA[El hotlinking también llamado leeching, direct linking, inline linking o bandwidth theft (robo del ancho de banda) significa enlazar un archivo (casi siempre imagen - gif, jpg, png) que es de otra página que no es nuestra.


Ejemplos (mostrando una imagen en HTML):
Imagen en nuestro servidor:

&#60;img src=&#34;imagen.jpg&#34; height=&#34;320&#34; width=&#34;240&#34; /&#62;


Imagen en servidor ajeno (hotlinking):

&#60;img src=&#34;http://www.sitio.com/imagen.jpg&#34; height=&#34;320&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>El <a href="http://revistes.upc.es/wiki/Hotlinking"><strong>hotlinking</strong></a> también llamado <strong>leeching</strong>, <strong>direct linking</strong>, <strong>inline linking</strong> o <strong>bandwidth theft</strong> (robo del ancho de banda) significa enlazar un archivo (casi siempre imagen - gif, jpg, png) que es de otra página que no es nuestra.</p>
<div align="center"><img src='http://www.bujorel.net/wp-content/uploads/2008/02/hotlinking.jpg' alt='No Hotlinking Please'  border='0' /></div>
<p></p>
<p><strong>Ejemplos</strong> (mostrando una imagen en HTML):<br />
Imagen en nuestro servidor:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;imagen.jpg&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;320&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;240&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></pre></div></div>

<p></p>
<p>Imagen en servidor ajeno (hotlinking):</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.sitio.com/imagen.jpg&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;320&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;240&quot;</span><span style="color: #66cc66;">/</span>&gt;</span></pre></div></div>

<p></p>
<p>En el primer ejemplo la imagen siempre es cargada desde el servidor que sirve la pagina, pero en el segundo ejemplo, cada vez que nuestra página carga, la imagen es cargada desde el servidor externo que usa su ancho de banda para mostrar la imagen.</p>
<p>Se puede evitar el hotlinking utilizando el archivo <a href="http://en.wikipedia.org/wiki/Htaccess"><strong>.htaccess</strong></a>. Este archivo está disponible solamente en servidores <strong>Apache</strong> sobre <strong>Linux</strong>. El punto delantero (.) significa que el archivo es oculto.</p>
<p><strong>Ejemplo:</strong> La dirección de tu página es <em>www.mipagina.com</em>. Para evitar el hotlinking a tus imágenes desde otros sitios y mostrar una imagen llamada <em>nohotlink.jpe</em> que está en la carpeta <em>imagenes</em>, pon este código en el archivo .htaccess:<br />
<span id="more-60"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="apache apache" style="font-family:monospace;"><span style="color: #00007f;">RewriteEngine</span> <span style="color: #0000ff;">On</span>
<span style="color: #00007f;">RewriteCond</span> %{HTTP_REFERER} !^http://(.+\.)?mipagina\.com/ [NC]
<span style="color: #00007f;">RewriteCond</span> %{HTTP_REFERER} !^$
<span style="color: #00007f;">RewriteRule</span> .*\.(jpe?g|gif|bmp|png)$ /imagenes/nohotlink.jpe [L]</pre></td></tr></table></div>

<p>La primera línea empieza a reescribir las opciones en Apache.<br />
La segunda línea verifica las coincidencias desde la propia página (<em>mipagina.com</em>).<br />
El código <strong>[NC]</strong> significa &#8220;<strong>No Case</strong>&#8220;, haciendo que no importe si esta en minúsculas o mayúsculas la dirección.<br />
La tercera línea es para permitir las referencias directas (poner directamente el link en la barra de dirección - sin referencias de otras páginas).<br />
Finalmente la última línea sirve para las extensiones de los archivos <strong>jpeg</strong>, <strong>jpg</strong>, <strong>gif</strong>, <strong>bmp</strong>, <strong>png</strong>. Estas son reemplazadas por la imagen <em>nohotlink.jpg</em> que está en la carpeta <em>imagenes</em>. Esta imagen <em>JPEG</em> utiliza la extensión <em>jpe</em> y no <em>jpg</em> para evitar ser también bloqueada.</p>
<p>Para evitar el hotlinking solamente desde unos dominios específicos, como <em>digg.com</em>, <em>myspace.com</em> y <em>blogspot.com</em>, pero permitirlo para cualquier otro, utiliza este código:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="apache apache" style="font-family:monospace;"><span style="color: #00007f;">RewriteEngine</span> <span style="color: #0000ff;">On</span>
<span style="color: #00007f;">RewriteCond</span> %{HTTP_REFERER} ^http://(.+\.)?digg\.com/ [NC,OR]
<span style="color: #00007f;">RewriteCond</span> %{HTTP_REFERER} ^http://(.+\.)?myspace\.com/ [NC,OR]
<span style="color: #00007f;">RewriteCond</span> %{HTTP_REFERER} ^http://(.+\.)?blogspot\.com/ [NC]
<span style="color: #00007f;">RewriteRule</span> .*\.(jpe?g|gif|bmp|png)$ /imagenes/nohotlink.jpe [L]</pre></td></tr></table></div>

<p>Puedes añadir tantos dominios como quieras. Cada línea <strong>RewriteCond</strong> debe acabar con <strong>[NC,OR]</strong>. <strong>[NC]</strong> (No Case) significa que ignore las diferencias entre minúsculas y mayúsculas. <strong>[OR]</strong> &#8220;<strong>Or Next</strong>&#8221; significa que pase a la siguiente línea buscando coincidencias. El último dominio omite el uso de OR para dejar de seguir buscando coincidencias.</p>
<p>Si no quieres poner una imagen puedes redireccionar a una página web o mostrar una página de error <strong>403 Forbidden</strong>. Cambia la última línea con esta:</p>

<div class="wp_syntax"><div class="code"><pre class="apache apache" style="font-family:monospace;"><span style="color: #00007f;">RewriteRule</span> .*\.(jpe?g|gif|bmp|png)$ - [F]</pre></div></div>

<p>Si tenemos <strong>cPanel</strong> es bastante simple hacer esto, porque en <strong>Security</strong> tiene una opción para configurar la protección contra el hotlinking; si no, podemos utilizar <a href="http://www.htaccesstools.com/hotlink-protection/">este</a> asistente web que nos permite configurar las opciones y nos genera el código.</p>
<div align="center"><img src='http://www.bujorel.net/wp-content/uploads/2008/02/cpanel-hotlink.png' alt='cPanel - Hotlink Protection' border='0' /></div>
]]></content:encoded>
			<wfw:commentRss>http://www.bujorel.net/tutorial/como-evitar-el-hotlinking-con-htaccess/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
