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

<channel>
	<title>Dave Ruiz blog</title>
	<atom:link href="http://blog.daveruiz.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.daveruiz.net</link>
	<description>programador web freelance</description>
	<lastBuildDate>Fri, 27 Aug 2010 09:00:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>jQuery: Colocar puntos suspensivos cuando un texto no cabe en una linea.</title>
		<link>http://blog.daveruiz.net/programacion/jquery-colocar-puntos-suspensivos-cuando-un-texto-no-cabe-en-una-linea/</link>
		<comments>http://blog.daveruiz.net/programacion/jquery-colocar-puntos-suspensivos-cuando-un-texto-no-cabe-en-una-linea/#comments</comments>
		<pubDate>Thu, 26 Aug 2010 10:07:02 +0000</pubDate>
		<dc:creator>Dave Ruiz</dc:creator>
				<category><![CDATA[Programación]]></category>
		<category><![CDATA[ellipsis]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[puntos suspensivos]]></category>
		<category><![CDATA[textoverflow]]></category>

		<guid isPermaLink="false">http://blog.daveruiz.net/?p=356</guid>
		<description><![CDATA[Un pequeño script rápido y muy sencillo que he elaborado para jQuery, que hace lo que el título de esta entrada. Hasta ahora estaba usando uno de los textOverflow que andan por ahí, pero me estaban dando algún problema.

$.fn.ellipsis = function&#40;&#41; &#123; return this.each&#40; function&#40;&#41; &#123;
&#160;
	var tar = $&#40;this&#41;,
		ow, ls, tg, 
		tw=tar.css&#40;&#123;&#34;display&#34;:&#34;block&#34;,&#34;white-space&#34;:&#34;nowrap&#34;&#125;&#41;.width&#40;&#41;, 
		ot=tar.html&#40;&#41;, pt=ot,
		alt=tar.text&#40;&#41;,
		ok=false, 
		ct=false,
		el=' [...]]]></description>
			<content:encoded><![CDATA[<p>Un pequeño script rápido y muy sencillo que he elaborado para <strong>jQuery</strong>, que hace lo que el título de esta entrada. Hasta ahora estaba usando uno de los <em>textOverflow</em> que andan <a href="http://www.google.es/search?hl=es&amp;q=jquery+textoverflow&amp;aq=f&amp;aqi=&amp;aql=&amp;oq=&amp;gs_rfai=" target="_blank">por ahí</a>, pero me estaban dando algún problema.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">fn</span>.<span style="color: #660066;">ellipsis</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> tar <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		ow<span style="color: #339933;">,</span> ls<span style="color: #339933;">,</span> tg<span style="color: #339933;">,</span> 
		tw<span style="color: #339933;">=</span>tar.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #3366CC;">&quot;display&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;block&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;white-space&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;nowrap&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> 
		ot<span style="color: #339933;">=</span>tar.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> pt<span style="color: #339933;">=</span>ot<span style="color: #339933;">,</span>
		alt<span style="color: #339933;">=</span>tar.<span style="color: #660066;">text</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		ok<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span> 
		ct<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span>
		el<span style="color: #339933;">=</span><span style="color: #3366CC;">' &amp;hellip;'</span><span style="color: #339933;">;</span>
&nbsp;
	tar.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #3366CC;">&quot;position&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;absolute&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>ok<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		ow <span style="color: #339933;">=</span> tar.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #3366CC;">&quot;width&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;auto&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>ow <span style="color: #339933;">&gt;</span> tw<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			ls <span style="color: #339933;">=</span> pt.<span style="color: #660066;">lastIndexOf</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot; &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			tg <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">new</span> RegExp<span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;&lt;[^&gt;]*$&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;g&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">test</span><span style="color: #009900;">&#40;</span> pt.<span style="color: #660066;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> ls<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>ls <span style="color: #339933;">&gt;</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
				pt <span style="color: #339933;">=</span> pt.<span style="color: #660066;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> ls<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				tar.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span> pt <span style="color: #339933;">+</span> el <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				ct<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
				tar.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span> el <span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;title&quot;</span><span style="color: #339933;">,</span> alt<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				ok<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">true</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span>tg<span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span> 
			<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>ct<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				tar.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;title&quot;</span><span style="color: #339933;">,</span> alt<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				tar.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #3366CC;">&quot;display&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;block&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;width&quot;</span><span style="color: #339933;">:</span>tw<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;px&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			ok <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	tar.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #3366CC;">&quot;position&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span></pre></div></div>

<p>Y para usarlo.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.textodeunalinea&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ellipsis</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p><strong>Actualización 27-10-2010:</strong> Se han hecho algunas correcciones. Y un detalle; se porta un poquito mal cuando hay Html en el texto. Pendiente de corregir.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.daveruiz.net/programacion/jquery-colocar-puntos-suspensivos-cuando-un-texto-no-cabe-en-una-linea/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JS: Convertir un objeto en una cadena XML</title>
		<link>http://blog.daveruiz.net/programacion/js-convertir-un-objeto-en-una-cadena-xml/</link>
		<comments>http://blog.daveruiz.net/programacion/js-convertir-un-objeto-en-una-cadena-xml/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 09:53:33 +0000</pubDate>
		<dc:creator>Dave Ruiz</dc:creator>
				<category><![CDATA[Programación]]></category>

		<guid isPermaLink="false">http://blog.daveruiz.net/?p=308</guid>
		<description><![CDATA[Os dejo una pequeña y sencilla función para realizar esta tarea en Javascript. Evidentemente, está sujeto a las mejoras que creáis convenientes.

function XMLString&#40; object, name, recursiveCall &#41; &#123;
	var xml = &#34;&#34;, i;
	var isArray = typeof&#40;object&#41; === 'object' &#38;&#38; typeof&#40;object.length&#41; === 'number' &#38;&#38;  !&#40;object.propertyIsEnumerable&#40;'length'&#41;&#41; &#38;&#38; typeof&#40;object.splice === 'function'&#41;;
&#160;
	if &#40;!recursiveCall&#41;	&#123;
		xml += &#34;&#60;?xml version=\&#34;1.0\&#34; ?&#62;&#34;;;
		xml += &#34;&#60;&#34;+name+&#34; xmlns:xsi=\&#34;http://www.w3.org/2001/XMLSchema-instance\&#34; xmlns:xsd=\&#34;http://www.w3.org/2001/XMLSchema\&#34;&#62;&#34;;
	&#125; [...]]]></description>
			<content:encoded><![CDATA[<p>Os dejo una pequeña y sencilla función para realizar esta tarea en Javascript. Evidentemente, está sujeto a las mejoras que creáis convenientes.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> XMLString<span style="color: #009900;">&#40;</span> object<span style="color: #339933;">,</span> <span style="color: #000066;">name</span><span style="color: #339933;">,</span> recursiveCall <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> xml <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #339933;">,</span> i<span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> isArray <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">typeof</span><span style="color: #009900;">&#40;</span>object<span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #3366CC;">'object'</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000066; font-weight: bold;">typeof</span><span style="color: #009900;">&#40;</span>object.<span style="color: #660066;">length</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #3366CC;">'number'</span> <span style="color: #339933;">&amp;&amp;</span>  <span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span>object.<span style="color: #660066;">propertyIsEnumerable</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'length'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000066; font-weight: bold;">typeof</span><span style="color: #009900;">&#40;</span>object.<span style="color: #660066;">splice</span> <span style="color: #339933;">===</span> <span style="color: #3366CC;">'function'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>recursiveCall<span style="color: #009900;">&#41;</span>	<span style="color: #009900;">&#123;</span>
		xml <span style="color: #339933;">+=</span> <span style="color: #3366CC;">&quot;&lt;?xml version=<span style="color: #000099; font-weight: bold;">\&quot;</span>1.0<span style="color: #000099; font-weight: bold;">\&quot;</span> ?&gt;&quot;</span><span style="color: #339933;">;;</span>
		xml <span style="color: #339933;">+=</span> <span style="color: #3366CC;">&quot;&lt;&quot;</span><span style="color: #339933;">+</span><span style="color: #000066;">name</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot; xmlns:xsi=<span style="color: #000099; font-weight: bold;">\&quot;</span>http://www.w3.org/2001/XMLSchema-instance<span style="color: #000099; font-weight: bold;">\&quot;</span> xmlns:xsd=<span style="color: #000099; font-weight: bold;">\&quot;</span>http://www.w3.org/2001/XMLSchema<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>isArray<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		xml <span style="color: #339933;">+=</span> <span style="color: #3366CC;">&quot;&lt;&quot;</span><span style="color: #339933;">+</span><span style="color: #000066;">name</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;&gt;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span><span style="color: #009900;">&#40;</span>object<span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #3366CC;">&quot;undefined&quot;</span> <span style="color: #339933;">||</span> object <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Nada</span>
	<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span><span style="color: #009900;">&#40;</span>object<span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #3366CC;">&quot;object&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>i <span style="color: #000066; font-weight: bold;">in</span> object<span style="color: #009900;">&#41;</span> xml <span style="color: #339933;">+=</span> XMLString<span style="color: #009900;">&#40;</span> object<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> isArray<span style="color: #339933;">?</span><span style="color: #000066;">name</span><span style="color: #339933;">:</span>i<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// Un objeto o array</span>
	<span style="color: #000066; font-weight: bold;">else</span> xml <span style="color: #339933;">+=</span> object<span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// Un texto</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>isArray <span style="color: #339933;">||</span> <span style="color: #339933;">!</span>recursiveCall<span style="color: #009900;">&#41;</span> xml <span style="color: #339933;">+=</span> <span style="color: #3366CC;">&quot;&lt;/&quot;</span><span style="color: #339933;">+</span><span style="color: #000066;">name</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">return</span> xml<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Y un ejemplo de uso sería:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> objeto <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
	campo1 <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;valor1&quot;</span><span style="color: #339933;">,</span>
	campo2 <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;valor2&quot;</span><span style="color: #339933;">,</span>
	campo3 <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;valor3&quot;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span> XMLString<span style="color: #009900;">&#40;</span> objeto<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;XML&quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Donde el <strong>primer parámetro</strong> es el <span style="text-decoration: underline;">objeto a convertir</span>, y el <strong>segundo</strong> es el <span style="text-decoration: underline;">nombre del elemento raíz</span>. Con el ejemplo anterior obtendríamos como salida la siguiente cadena:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;XML</span> <span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span> <span style="color: #000066;">xmlns:xsd</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;campo1<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>valor1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/campo1<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;campo2<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>valor2<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/campo2<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;campo3<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>valor3<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/campo3<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/XML<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Con 4 cambios es posible convertirlo en código AS2 o AS3. Aunque en estos casos creo que hay métodos mejores y nativos para hacer esta función.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.daveruiz.net/programacion/js-convertir-un-objeto-en-una-cadena-xml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Manifiesto: En defensa de los derechos fundamentales en internet</title>
		<link>http://blog.daveruiz.net/general/manifiesto-en-defensa-de-los-derechos-fundamentales-en-internet/</link>
		<comments>http://blog.daveruiz.net/general/manifiesto-en-defensa-de-los-derechos-fundamentales-en-internet/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 08:17:05 +0000</pubDate>
		<dc:creator>Dave Ruiz</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://blog.daveruiz.net/?p=302</guid>
		<description><![CDATA[Ante la inclusión en el Anteproyecto de Ley de Economía sostenible de modificaciones legislativas que afectan al libre ejercicio de las libertades de expresión, información y el derecho de acceso a la cultura a través de Internet, los periodistas, bloggers, usuarios, profesionales y creadores de Internet manifestamos nuestra firme oposición al proyecto, y declaramos que:
Los [...]]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Ante la inclusión en el Anteproyecto de Ley de Economía sostenible de modificaciones legislativas que afectan al libre ejercicio de las libertades de expresión, información y el derecho de acceso a la cultura a través de Internet, los periodistas, bloggers, usuarios, profesionales y creadores de Internet manifestamos nuestra firme oposición al proyecto, y declaramos que:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Los derechos de autor no pueden situarse por encima de los derechos fundamentales de los ciudadanos, como el derecho a la privacidad, a la seguridad, a la presunción de inocencia, a la tutela judicial efectiva y a la libertad de expresión.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">La suspensión de derechos fundamentales es y debe seguir siendo competencia exclusiva del poder judicial. Ni un cierre sin sentencia. Este anteproyecto, en contra de lo establecido en el artículo 20.5 de la Constitución, pone en manos de un órgano no judicial -un organismo dependiente del ministerio de Cultura-, la potestad de impedir a los ciudadanos españoles el acceso a cualquier página web.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">La nueva legislación creará inseguridad jurídica en todo el sector tecnológico español, perjudicando uno de los pocos campos de desarrollo y futuro de nuestra economía, entorpeciendo la creación de empresas, introduciendo trabas a la libre competencia y ralentizando su proyección internacional.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">La nueva legislación propuesta amenaza a los nuevos creadores y entorpece la creación cultural. Con Internet y los sucesivos avances tecnológicos se ha democratizado extraordinariamente la creación y emisión de contenidos de todo tipo, que ya no provienen prevalentemente de las industrias culturales tradicionales, sino de multitud de fuentes diferentes.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Los autores, como todos los trabajadores, tienen derecho a vivir de su trabajo con nuevas ideas creativas, modelos de negocio y actividades asociadas a sus creaciones. Intentar sostener con cambios legislativos a una industria obsoleta que no sabe adaptarse a este nuevo entorno no es ni justo ni realista. Si su modelo de negocio se basaba en el control de las copias de las obras y en Internet no es posible sin vulnerar derechos fundamentales, deberían buscar otro modelo.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Consideramos que las industrias culturales necesitan para sobrevivir alternativas modernas, eficaces, creíbles y asequibles y que se adecuen a los nuevos usos sociales, en lugar de limitaciones tan desproporcionadas como ineficaces para el fin que dicen perseguir.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Internet debe funcionar de forma libre y sin interferencias políticas auspiciadas por sectores que pretenden perpetuar obsoletos modelos de negocio e imposibilitar que el saber humano siga siendo libre.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Exigimos que el Gobierno garantice por ley la neutralidad de la Red en España, ante cualquier presión que pueda producirse, como marco para el desarrollo de una economía sostenible y realista de cara al futuro.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Proponemos una verdadera reforma del derecho de propiedad intelectual orientada a su fin: devolver a la sociedad el conocimiento, promover el dominio público y limitar los abusos de las entidades gestoras.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">En democracia las leyes y sus modificaciones deben aprobarse tras el oportuno debate público y habiendo consultado previamente a todas las partes implicadas. No es de recibo que se realicen cambios legislativos que afectan a derechos fundamentales en una ley no orgánica y que versa sobre otra materia.</div>
<p>Ante la inclusión en el Anteproyecto de Ley de Economía sostenible de modificaciones legislativas que afectan al libre ejercicio de las libertades de expresión, información y el derecho de acceso a la cultura a través de Internet, los periodistas, bloggers, usuarios, profesionales y creadores de Internet manifestamos nuestra firme oposición al proyecto, y declaramos que:</p>
<ol>
<li>Los derechos de autor no pueden situarse por encima de los derechos fundamentales de los ciudadanos, como el derecho a la privacidad, a la seguridad, a la presunción de inocencia, a la tutela judicial efectiva y a la libertad de expresión.</li>
<li>La suspensión de derechos fundamentales es y debe seguir siendo competencia exclusiva del poder judicial. Ni un cierre sin sentencia. Este anteproyecto, en contra de lo establecido en el artículo 20.5 de la Constitución, pone en manos de un órgano no judicial -un organismo dependiente del ministerio de Cultura-, la potestad de impedir a los ciudadanos españoles el acceso a cualquier página web.</li>
<li>La nueva legislación creará inseguridad jurídica en todo el sector tecnológico español, perjudicando uno de los pocos campos de desarrollo y futuro de nuestra economía, entorpeciendo la creación de empresas, introduciendo trabas a la libre competencia y ralentizando su proyección internacional.</li>
<li>La nueva legislación propuesta amenaza a los nuevos creadores y entorpece la creación cultural. Con Internet y los sucesivos avances tecnológicos se ha democratizado extraordinariamente la creación y emisión de contenidos de todo tipo, que ya no provienen prevalentemente de las industrias culturales tradicionales, sino de multitud de fuentes diferentes.</li>
<li>Los autores, como todos los trabajadores, tienen derecho a vivir de su trabajo con nuevas ideas creativas, modelos de negocio y actividades asociadas a sus creaciones. Intentar sostener con cambios legislativos a una industria obsoleta que no sabe adaptarse a este nuevo entorno no es ni justo ni realista. Si su modelo de negocio se basaba en el control de las copias de las obras y en Internet no es posible sin vulnerar derechos fundamentales, deberían buscar otro modelo.</li>
<li>Consideramos que las industrias culturales necesitan para sobrevivir alternativas modernas, eficaces, creíbles y asequibles y que se adecuen a los nuevos usos sociales, en lugar de limitaciones tan desproporcionadas como ineficaces para el fin que dicen perseguir.</li>
<li>Internet debe funcionar de forma libre y sin interferencias políticas auspiciadas por sectores que pretenden perpetuar obsoletos modelos de negocio e imposibilitar que el saber humano siga siendo libre.</li>
<li>Exigimos que el Gobierno garantice por ley la neutralidad de la Red en España, ante cualquier presión que pueda producirse, como marco para el desarrollo de una economía sostenible y realista de cara al futuro.</li>
<li>Proponemos una verdadera reforma del derecho de propiedad intelectual orientada a su fin: devolver a la sociedad el conocimiento, promover el dominio público y limitar los abusos de las entidades gestoras.</li>
<li>En democracia las leyes y sus modificaciones deben aprobarse tras el oportuno debate público y habiendo consultado previamente a todas las partes implicadas. No es de recibo que se realicen cambios legislativos que afectan a derechos fundamentales en una ley no orgánica y que versa sobre otra materia.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.daveruiz.net/general/manifiesto-en-defensa-de-los-derechos-fundamentales-en-internet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Invitaciones Google Wave</title>
		<link>http://blog.daveruiz.net/general/invitaciones-google-wave/</link>
		<comments>http://blog.daveruiz.net/general/invitaciones-google-wave/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 09:47:22 +0000</pubDate>
		<dc:creator>Dave Ruiz</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://blog.daveruiz.net/?p=297</guid>
		<description><![CDATA[Gracias a Ruben Colomer (http://www.online.com.es) he tenido oportunidad de probar este nuevo servicio de Google. Por ahora no hay mucho que ver; es una idea de cómo podría funcionar, pero está interesante.
El caso es que me acaban de llegar 8 invitaciones. ¿Quieres una? Pídelo comentando esta entrada...
]]></description>
			<content:encoded><![CDATA[<p>Gracias a Ruben Colomer (<a href="http://www.online.com.es">http://www.online.com.es</a>) he tenido oportunidad de probar este nuevo servicio de Google. Por ahora no hay mucho que ver; es una idea de cómo podría funcionar, pero está interesante.</p>
<p>El caso es que me acaban de llegar 8 invitaciones. ¿Quieres una? <strong>Pídelo comentando esta entrada.</strong>..</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.daveruiz.net/general/invitaciones-google-wave/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript: Habilitar :hover en todos los elementos para Internet Explorer con jQuery</title>
		<link>http://blog.daveruiz.net/programacion/javascript-habilitar-hover-en-todos-los-elementos-para-internet-explorer-con-jquery/</link>
		<comments>http://blog.daveruiz.net/programacion/javascript-habilitar-hover-en-todos-los-elementos-para-internet-explorer-con-jquery/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 15:49:28 +0000</pubDate>
		<dc:creator>Dave Ruiz</dc:creator>
				<category><![CDATA[Programación]]></category>

		<guid isPermaLink="false">http://blog.daveruiz.net/?p=286</guid>
		<description><![CDATA[De todos es conocido el problema de emplear la pseudo-clase :hover con Internet Explorer 6. Este funciona solamente con los hipervínculos (&#60;a&#62;&#60;/a&#62;) dejando fuera al resto de elementos.
Con la ayuda de jQuery, podemos solventar de manera fácil este problema añadiendo unas lineas al inicio del script, y teniendo en cuenta una regla en el CSS [...]]]></description>
			<content:encoded><![CDATA[<p>De todos es conocido el problema de emplear la pseudo-clase <strong>:hover</strong> con Internet Explorer 6. Este funciona solamente con los hipervínculos (<em>&lt;a&gt;&lt;/a&gt;</em>) dejando fuera al resto de elementos.</p>
<p>Con la ayuda de <strong>jQuery</strong>, podemos solventar de manera fácil este problema añadiendo unas lineas al inicio del script, y teniendo en cuenta una regla en el CSS que contenga los estilos.</p>
<p>Por ejemplo, teniendo el siguiente CSS:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#menu</span> li<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #3333ff;">:underline</span><span style="color: #00AA00;">:</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Habría que modificarlo tal que:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#menu</span> li<span style="color: #3333ff;">:hover</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#menu</span> li<span style="color: #6666ff;">.hover</span> <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span><span style="color: #993333;">underline</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>De manera que podamos acceder a dicho estilo mediante una clase.</p>
<p>Y ahora, solo quedaría realizar un script que añada la clase o la elimine según el evento llamado. Para ello emplearemos la función hover(mouseOver, mouseOut) que nos facilita jQuery.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">browser</span>.<span style="color: #660066;">msie</span><span style="color: #009900;">&#41;</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;*&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hover</span><span style="color: #009900;">&#40;</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;hover&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;hover&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Y a funcionar <img src='http://blog.daveruiz.net/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.daveruiz.net/programacion/javascript-habilitar-hover-en-todos-los-elementos-para-internet-explorer-con-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Indexado selectivo de los buscadores en tus páginas</title>
		<link>http://blog.daveruiz.net/general/indexado-selectivo-de-los-buscadores/</link>
		<comments>http://blog.daveruiz.net/general/indexado-selectivo-de-los-buscadores/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 08:00:50 +0000</pubDate>
		<dc:creator>Dave Ruiz</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[buscadores]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[indexado]]></category>
		<category><![CDATA[posicionamiento]]></category>
		<category><![CDATA[robots]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[yahoo]]></category>

		<guid isPermaLink="false">http://blog.daveruiz.net/?p=273</guid>
		<description><![CDATA[A veces interesa que los buscadores no indexen determinada parte de una página o incluso determinada palabra, ya sea porque repetimos contenidos (puede penalizarnos), o porque no queremos que nos relacionen con un determinado término.
Cada buscador implementa un método para realizar esta función. Los siguientes enlaces recopilan información de cómo usarlo con Google o Yahoo!, [...]]]></description>
			<content:encoded><![CDATA[<p>A veces interesa que los buscadores <strong>no indexen</strong> <strong>determinada parte de una página</strong> o incluso <strong>determinada palabra</strong>, ya sea porque repetimos contenidos (puede penalizarnos), o porque no queremos que nos relacionen con un determinado término.</p>
<p>Cada buscador implementa un método para realizar esta función. Los siguientes enlaces recopilan información de cómo usarlo con <strong>Google</strong> o <strong>Yahoo!</strong>, entre otros.</p>
<p>Recopilación de los métodos de indexado selectivo de varios buscadores<a href="http://wunderwood.org/most_casual_observer/2007/05/selective_page_indexing_direct.html"></p>
<p>http://wunderwood.org/most_casual_observer/2007/05/selective_page_indexing_direct.html</a></p>
<p>Propuesta de indexado selectivo por Microformats (usado por Yahoo!)<a href="http://microformats.org/wiki/robots-exclusion"></p>
<p>http://microformats.org/wiki/robots-exclusion</a></p>
<p>Ampliación de los métodos usados por Google<br />
<a href="http://code.google.com/intl/es-ES/apis/searchappliance/documentation/46/admin_crawl/Preparing.html#pagepart">http://code.google.com/intl/es-ES/apis/searchappliance/documentation/46/admin_crawl/Preparing.html#pagepart</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.daveruiz.net/general/indexado-selectivo-de-los-buscadores/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS3: Detener descarga del componente FLVPlayback</title>
		<link>http://blog.daveruiz.net/programacion/as3-detener-descarga-del-componente-flvplayback/</link>
		<comments>http://blog.daveruiz.net/programacion/as3-detener-descarga-del-componente-flvplayback/#comments</comments>
		<pubDate>Fri, 04 Sep 2009 07:19:07 +0000</pubDate>
		<dc:creator>Dave Ruiz</dc:creator>
				<category><![CDATA[Programación]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[componente]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[flv]]></category>
		<category><![CDATA[flvcomponent]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://blog.daveruiz.net/?p=257</guid>
		<description><![CDATA[Por alguna razón, Adobe no implementó un método para detener la descarga de un archivo FLV cuando queremos eliminar un componente FLVPlayback. Puedes crear un reproductor FLV dinámicamente y luego destruirlo, pero si ha comenzado la reproducción el fichero FLV continuará descargándose hasta que termine.
La clase FLVPlayback implementa el método closeVideoPlayer( índice ) que permite [...]]]></description>
			<content:encoded><![CDATA[<p>Por alguna razón, Adobe no implementó un método para detener la descarga de un archivo FLV cuando queremos eliminar un componente FLVPlayback. Puedes crear un reproductor FLV dinámicamente y luego destruirlo, pero si ha comenzado la reproducción el fichero FLV continuará descargándose hasta que termine.</p>
<p>La clase FLVPlayback implementa el método <em>closeVideoPlayer( índice ) </em>que permite detener la descarga del archivo FLV que esté descargando, pero está limitado a cuando abres múltiples vídeos en un solo componente. La limitación consiste en no dejarte eliminar el la conexión de video con la que creaste el reproductor.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// Creamos el reproductor y lo ponemos a reproducir</span>
<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">video</span>:FlvPlayback = <span style="color: #000000; font-weight: bold;">new</span> FlvPlayback<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">video</span>.<span style="color: #0066CC;">play</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;video.flv&quot;</span> <span style="color: #66cc66;">&#41;</span>;</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// Ahora intentamos cerrar el reproductor</span>
<span style="color: #0066CC;">video</span>.<span style="color: #0066CC;">stop</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">video</span>.<span style="color: #006600;">closeVideoPlayer</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// Debería detener la descarga, pero nos lanza un error</span>
<span style="color: #0066CC;">video</span> = <span style="color: #000000; font-weight: bold;">null</span>; <span style="color: #808080; font-style: italic;">// Para que el Garbage Collector lo elimine de memoria</span></pre></div></div>

<p>Si en el ejemplo omitimos <em>video.closeVideoPlayer(0)</em>, el reproductor se elimina, pero el vídeo continúa descargándose y consumiendo ancho de banda.</p>
<p>Esto puede ser un problema cuando haces uso de varias instancias de este componente, y debido a las circunstancias no puedes usar uno solo. Cada una de ellas llamará a la descarga de un FLV, y puede darse el caso de estar descargando varios FLV a la vez, con el consiguiente consumo de ancho de banda.</p>
<p>La solución, acceder a la primera instancia VideoPlayer y detenerlo uno mismo:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// Ahora intentamos cerrar el reproductor</span>
<span style="color: #0066CC;">video</span>.<span style="color: #0066CC;">stop</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">video</span>.<span style="color: #006600;">getVideoPlayer</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">close</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// Ahora sí, detiene la descarga del archivo FLV</span>
<span style="color: #0066CC;">video</span> = <span style="color: #000000; font-weight: bold;">null</span>; <span style="color: #808080; font-style: italic;">// Para que el Garbage Collector lo elimine de memoria</span></pre></div></div>

<p>Algo muy sencillo, pero que ya me ha hecho perder algo de tiempo buscándolo <img src='http://blog.daveruiz.net/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> .  Aquí lo dejo como apunte.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.daveruiz.net/programacion/as3-detener-descarga-del-componente-flvplayback/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Javascript: Cuando onload no es lanzado (actualizado)</title>
		<link>http://blog.daveruiz.net/programacion/cuando-onload-no-es-lanzado/</link>
		<comments>http://blog.daveruiz.net/programacion/cuando-onload-no-es-lanzado/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 22:10:30 +0000</pubDate>
		<dc:creator>Dave Ruiz</dc:creator>
				<category><![CDATA[Programación]]></category>
		<category><![CDATA[complete]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[ie]]></category>
		<category><![CDATA[internet explorer]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[onload]]></category>

		<guid isPermaLink="false">http://blog.daveruiz.net/?p=238</guid>
		<description><![CDATA[En ocasiones, ocurre que el evento onLoad, por ejemplo, de una imagen no es lanzado a la hora de cargar una página.
Imaginemos que en el script de una página, una vez cargado el DOM, añadimos una función determinada cuando carga la imagen de cabecera:

&#60;script type=&#34;text/javascript&#34;&#62;
  // Función que ejecutamos al cargar el DOM de [...]]]></description>
			<content:encoded><![CDATA[<p>En ocasiones, ocurre que el evento <strong>onLoad</strong>, por ejemplo, de una imagen no es lanzado a la hora de cargar una página.</p>
<p>Imaginemos que en el script de una página, una vez cargado el DOM, añadimos una función determinada cuando carga la imagen de cabecera:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
  <span style="color: #006600; font-style: italic;">// Función que ejecutamos al cargar el DOM de la página</span>
  window.<span style="color: #000066;">onload</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> cabecera <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;cabecera&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #006600; font-style: italic;">// Funcion lanzada cuando carga la imagen 'cabecera'</span>
    cabecera.<span style="color: #000066;">onload</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;carga completa&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>Nos encontraremos con que en algún navegador (por ejemplo, Internet Explorer) lanza la primera vez el evento, pero en las posteriores cargas este no es lanzado.</p>
<p>La razón es que, en la segunda carga, la imagen se encuentra cacheada y por tanto el navegador carga la imagen en cuanto inserta el elemento <em>IMG</em>, lanzando el correspondiente evento <em>onLoad</em>. Como en ese preciso momento todavía estamos cargando la estructura de la página y el evento no ha sido asignado (no se asigna hasta la carga completa de la estructura), cuando queremos asignarlo ya es demasiado tarde.</p>
<p><del datetime="2009-08-12T06:19:12+00:00">Otros navegadores como Mozilla Firefox no lanzan los eventos hasta que se ha completado la carga del DOM, haciendo inexistente este problema.</del></p>
<p>Una solución sencilla es comprobar, después de asignar el evento <em>onLoad </em>a la imagen, si esta ya se encuentra cargada complétamente. Nos serviremos del parámetro <strong>complete</strong>. Si nos devuelve <em>true</em>, lanzamos el evento <em>onLoad</em> manualmente.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
  <span style="color: #006600; font-style: italic;">// Función que ejecutamos al cargar el DOM de la página</span>
  window.<span style="color: #000066;">onload</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> cabecera <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;cabecera&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #006600; font-style: italic;">// Funcion lanzada cuando carga la imagen 'cabecera'</span>
    cabecera.<span style="color: #000066;">onload</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;carga completa&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>cabecera.<span style="color: #660066;">complete</span> <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span> cabecera.<span style="color: #000066;">onload</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p><strong>Actualización:</strong></p>
<p>Me comenta Marc Palau (y con toda la razón) que el ejemplo anterior no es válido porque <em>onLoad</em> no es lanzado hasta que carga toda la página, incluidas las imágenes. En este caso, nunca seran llamados los eventos <em>onLoad</em> de las imágenes porque se están definiendo después de haberlas cargado.</p>
<p>Para reproducir el error, he preparado <a href="http://lab.daveruiz.net/jquery.problema_onload/">una prueba</a> en la que se testea el framework <strong>jQuery</strong> y la función <strong><a href="http://www.thefutureoftheweb.com/blog/adddomloadevent">addDOMLoadEvent</a></strong> (el ejemplo que ponen en el enlace añade la imagen dinámicamente y no lo reproduce). Del mismo modo, se presenta una solución para ambas basados en el mismo procedimiento comentado antes.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.daveruiz.net/programacion/cuando-onload-no-es-lanzado/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Resaltar automáticamente enlaces con jQuery</title>
		<link>http://blog.daveruiz.net/programacion/auto-marcado-de-enlaces-con-jquery/</link>
		<comments>http://blog.daveruiz.net/programacion/auto-marcado-de-enlaces-con-jquery/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 09:27:25 +0000</pubDate>
		<dc:creator>Dave Ruiz</dc:creator>
				<category><![CDATA[Programación]]></category>
		<category><![CDATA[auto-highlight]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[marcado de enlaces]]></category>

		<guid isPermaLink="false">http://blog.daveruiz.net/?p=209</guid>
		<description><![CDATA[A modo de apunte, os dejo un método breve, usando jQuery, para resaltar los enlaces que apuntan a la página en la que nos encontramos. Muy útil, por ejemplo, para destacar en los menús la opción seleccionada automáticamente sin recurrir a PHP o a hacerlo manualmente:

$&#40;document&#41;.ready&#40; function&#40;&#41; &#123;
  var loc = document.location.href.split&#40;/[\?#]/&#41;.shift&#40;&#41;.replace&#40;/\/$/, ''&#41;;
&#160;
  [...]]]></description>
			<content:encoded><![CDATA[<p>A modo de apunte, os dejo un método breve, usando <a href="http://jquery.com/" target="_blank">jQuery</a>, para resaltar los enlaces que apuntan a la página en la que nos encontramos. Muy útil, por ejemplo, para destacar en los menús la opción seleccionada automáticamente sin recurrir a PHP o a hacerlo manualmente:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">var</span> loc <span style="color: #339933;">=</span> document.<span style="color: #660066;">location</span>.<span style="color: #660066;">href</span>.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/[\?#]/</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">shift</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\/$/</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">href</span> <span style="color: #339933;">==</span> loc<span style="color: #009900;">&#41;</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;selected&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>El funcionamiento es muy simple. Recorre todos los elementos <strong>&lt;a&gt;</strong> de la página y compara el parámetro <strong>href</strong> con la url actual. Si coincide, añade la clase &#8216;<strong>selected</strong>&#8216; a dicho elemento. La clase &#8217;selected&#8217; deberá estar definida dentro de los estilos css de la página.</p>
<p>Un ejemplo <a href="http://lab.daveruiz.net/jquery.linkhighlight">aquí</a>.</p>
<p><strong>Actualización:</strong> Ahora no tiene en cuenta si la URL tiene barra al final o no (como en el caso de las carpetas)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.daveruiz.net/programacion/auto-marcado-de-enlaces-con-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Precarga Flash de una sola linea.</title>
		<link>http://blog.daveruiz.net/programacion/precarga-flash-de-una-sola-linea/</link>
		<comments>http://blog.daveruiz.net/programacion/precarga-flash-de-una-sola-linea/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 12:26:50 +0000</pubDate>
		<dc:creator>Dave Ruiz</dc:creator>
				<category><![CDATA[Programación]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[precarga]]></category>

		<guid isPermaLink="false">http://blog.daveruiz.net/?p=199</guid>
		<description><![CDATA[Una precarga (muy) sencilla para Flash (AS3).  Suponiendo que el primer fotograma está vacío, podemos incluir el siguiente código en la linea de tiempo principal:
stop(); root.loaderInfo.addEventListener(Event.COMPLETE, function(e:Event) { play(); });
Esto comenzará a reproducir el flash en cuanto termine de cargar. Además, podemos aprovechar el primer fotograma para poner un mensaje &#8216;cargando&#8230; &#8216;, que será lo [...]]]></description>
			<content:encoded><![CDATA[<p>Una <strong>precarga (muy) sencilla </strong>para Flash (<strong>AS3</strong>).  Suponiendo que el primer fotograma está vacío, podemos incluir el siguiente código en la linea de tiempo principal:</p>
<p><code>stop(); root.loaderInfo.addEventListener(Event.COMPLETE, function(e:Event) { play(); });</code></p>
<p>Esto comenzará a reproducir el flash en cuanto termine de cargar. Además, podemos aprovechar el primer fotograma para poner un mensaje &#8216;<em>cargando&#8230; </em>&#8216;, que será lo que se muestre mientras se completa la carga.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.daveruiz.net/programacion/precarga-flash-de-una-sola-linea/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
