<?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>Blog[nbsp] &#187; Turoriales</title>
	<atom:link href="http://www.nbsp.es/category/turoriales/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nbsp.es</link>
	<description>.Desarrollo web para profesionales de internet.</description>
	<lastBuildDate>Fri, 12 Aug 2011 07:04:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Formas de acortar un condicional de varios elementos</title>
		<link>http://www.nbsp.es/2010/05/28/formas-de-acortar-un-condicional-de-varios-elementos/</link>
		<comments>http://www.nbsp.es/2010/05/28/formas-de-acortar-un-condicional-de-varios-elementos/#comments</comments>
		<pubDate>Fri, 28 May 2010 20:51:40 +0000</pubDate>
		<dc:creator>marc</dc:creator>
				<category><![CDATA[Desarrollo web]]></category>
		<category><![CDATA[Turoriales]]></category>

		<guid isPermaLink="false">http://www.nbsp.es/?p=631</guid>
		<description><![CDATA[Estaba mirando stackoverflow cuando he encontrado la pregunta que da nombre a esta entrada, me ha encantando ver que tanta gente añade sus propuestas y hay tantas que no me he podido resistir las ganas de compartir esto con vosotros. NOTA: Los créditos de toda la entrada se van a stackoverflow y a sus respectivos [...]]]></description>
			<content:encoded><![CDATA[<p>Estaba mirando stackoverflow cuando he encontrado la pregunta que da nombre a esta entrada, me ha encantando ver que tanta gente añade sus propuestas y hay tantas que no me he podido resistir las ganas de compartir esto con vosotros.<br />
<strong>NOTA: </strong>Los créditos de toda la entrada se van a <a href="http://stackoverflow.com/questions/2932131/short-hand-for-chaining-logical-operators-in-javascript">stackoverflow</a> y a sus respectivos usuarios.</p>
<p>Imaginemos que tenemos un condicional largo como el siguiente:</p>
<p><code>if (value == 1 || value == 16 || value == -500 || value == 42.42 || value == 'something' ) {<br />
  // blah blah blah<br />
}</code></p>
<p>Y queremos acortarlo para que nos sea más fácil de mantener y gestionar, bien, a continuación varias formas de tratar ese condicional de una forma un poco alternativa:</p>
<p>Primera opción (no compatible con IE)</p>
<p><code>var a = [1, 16, -500, 42.42, 'something'];<br />
var value = true;<br />
if (a.indexOf(testVar) > -1){<br />
// blah blah blah<br />
}<br />
</code></p>
<p>Lo que hace es utilizar la función indexOf de Array, la cual nos retorna la posición del elemento que estemos buscando, si el array no contiene lo que buscamos devuelve -1. Podéis obtener más información del siguiente enlace: <a href="http://www.tutorialspoint.com/javascript/array_indexof.htm">pulsa aquí</a>.</p>
<p>Basicamente la mejora sería implementar un indexOf manualmente.<br />
<code>Object.prototype.in = function(){<br />
  for(var i = 0; i < arguments.length; i++){<br />
    if (this == arguments[i]) return true;<br />
  }<br />
  return false;<br />
}</p>
<p>if (value.in(1, 16, -500, 42.42, 'something')){<br />
// blah blah blah<br />
}<br />
</code></p>
<p>Otra alternativa menos sofisticada, el mítico switch:</p>
<p><code>switch (value) {<br />
  case 1 :<br />
  case 16 :<br />
  case -500 :<br />
  case 42.42:<br />
  case 'something'<br />
    //código<br />
  break;<br />
}</code></p>
<p>Basicamente es como el if pero a lo vertical. </p>
<p>Otra opción será creando un objeto, y luego accediendo directamente al indice del mismo:</p>
<p><code>var accept = { 1: true, 16: true, '-500': true, 42.42: true, something: true }; //mas corto cambiando el true por un 1<br />
if (accept[value]) {<br />
  // blah blah blah<br />
}<br />
</code></p>
<p>Sinceramente esta me parece una idea muy original, pero menos practica que las otras.</p>
<p>Pues listos, 3 métodos alternativos para comprobar si un array contiene un elemento dado.</p>
<p>&#8230; por cierto 3 no son tantas :P</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nbsp.es/2010/05/28/formas-de-acortar-un-condicional-de-varios-elementos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lo bueno de FireBug para Internet Explorer 6+</title>
		<link>http://www.nbsp.es/2009/09/17/lo-bueno-de-firebug-para-internet-explorer-6/</link>
		<comments>http://www.nbsp.es/2009/09/17/lo-bueno-de-firebug-para-internet-explorer-6/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 18:10:28 +0000</pubDate>
		<dc:creator>marc</dc:creator>
				<category><![CDATA[Aplicaciones web]]></category>
		<category><![CDATA[Desarrollo web]]></category>
		<category><![CDATA[Turoriales]]></category>
		<category><![CDATA[Varios]]></category>

		<guid isPermaLink="false">http://www.nbsp.es/2009/09/17/lo-bueno-de-firebug-para-internet-explorer-6/</guid>
		<description><![CDATA[Buxplorer es un pequeño bookmarklet (unas 700 líneas de chatarra) que te iniciará una barra inferior en tu Internet Explorer y que te permitirá recorrer el código HTML viendo los margenes y los paddings de cada elemento, de la misma forma que lo hace Firebug. Es un excelente complemento para la developer toolbar (que tan [...]]]></description>
			<content:encoded><![CDATA[<p>Buxplorer es un pequeño bookmarklet  (unas 700 líneas de chatarra) que te iniciará una barra inferior en tu Internet Explorer y que te permitirá recorrer el código HTML viendo los margenes y los paddings de cada elemento, de la misma forma que lo hace Firebug. Es un excelente complemento para la developer toolbar (que tan solo te bordea el elemento).</p>
<p>Hace más de un año que tengo esto pendiente de terminar, naturalmente es una beta que funciona con pinzas, pero funciona:</p>
<div class="igBar"><span id="lhtml-2"><a href="#" onclick="javascript:showPlainTxt('html-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-2">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">javascript:scScript=document.createElement('script');scScript.src='http://www.javascript.es/bmk/buxplorer.js?nocache='+Math.random();scScript.type='text/javascript';void(document.getElementsByTagName('head')[0].appendChild(scScript)); </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Recuerda, el bookmarklet que os propongo sólo funciona con Internet Explorer 6.</p>
<p>A ver si alguien se anima a meterle un empujón :), y si lo pruebas, me das tu opinión (O el gran <a href="http://www.venganza.org/">FSM</a> colgará un Ubuntu al azar).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nbsp.es/2009/09/17/lo-bueno-de-firebug-para-internet-explorer-6/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Configurar VirtualHost para tener varios dominios con su directorio cada uno en Apache</title>
		<link>http://www.nbsp.es/2009/07/17/configurar-virtualhost-para-tener-varios-dominios-con-su-directorio-cada-uno-en-apache/</link>
		<comments>http://www.nbsp.es/2009/07/17/configurar-virtualhost-para-tener-varios-dominios-con-su-directorio-cada-uno-en-apache/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 15:09:05 +0000</pubDate>
		<dc:creator>marc</dc:creator>
				<category><![CDATA[Desarrollo web]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Turoriales]]></category>
		<category><![CDATA[[nbsp]]]></category>

		<guid isPermaLink="false">http://www.nbsp.es/2009/07/17/configurar-virtualhost-para-tener-varios-dominios-con-su-directorio-cada-uno-en-apache/</guid>
		<description><![CDATA[Esto me lo dejo aquí a modo de recordatorio para configurar el dichoso httpd.conf para poder tener varios sitios en local con su correspondiente dominio (local tambien). Primero añadimos los dominios en el archivo hosts: 127.0.0.1 local.dominio-1.org 127.0.0.1 local.dominio-2.net Y luego añadimos las siguiente líneas a nuestro querido httpd.conf: PLAIN TEXT CODE: NameVirtualHost&#160;&#160;127.0.0.1 &#60;VirtualHost local.dominio-1.org&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>Esto me lo dejo aquí a modo de recordatorio para configurar el dichoso httpd.conf para poder tener varios sitios en local con su correspondiente dominio (local tambien).</p>
<p>Primero añadimos los dominios en el archivo hosts:</p>
<p><code>127.0.0.1		local.dominio-1.org<br />
127.0.0.1       local.dominio-2.net</code></p>
<p>Y luego añadimos las siguiente líneas a nuestro querido httpd.conf:</p>
<div class="igBar"><span id="lcode-4"><a href="#" onclick="javascript:showPlainTxt('code-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-4">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">NameVirtualHost&nbsp;&nbsp;<span style="color:#800000;color:#800000;">127</span>.<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">1</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;VirtualHost local.<span style="">dominio</span>-<span style="color:#800000;color:#800000;">1</span>.<span style="">org</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; ServerName&nbsp; &nbsp; local.<span style="">dominio</span>-<span style="color:#800000;color:#800000;">1</span>.<span style="">org</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; DocumentRoot&nbsp; &nbsp; <span style="color:#CC0000;">"D:/www/dominio-1.org/web/"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; DirectoryIndex&nbsp; index.<span style="">php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; AccessFileName&nbsp; .<span style="">htaccess</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; ErrorLog&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#CC0000;">"D:/www/dominio-1.org/logs/error.log"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; LogLevel&nbsp; &nbsp; &nbsp; &nbsp; warn</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; CustomLog&nbsp; &nbsp;&nbsp; &nbsp;<span style="color:#CC0000;">"D:/www/dominio-1.org/logs/access.log"</span> combined</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;Directory <span style="color:#CC0000;">"D:/www/dominio-1.org/web/"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Options -Indexes FollowSymLinks</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; AllowOverride AuthConfig FileInfo</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Order allow,deny</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Allow from all</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/Directory&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/VirtualHost&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;VirtualHost local.<span style="">dominio</span>-<span style="color:#800000;color:#800000;">2</span>.<span style="">net</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; ServerName&nbsp; &nbsp; local.<span style="">dominio</span>-<span style="color:#800000;color:#800000;">2</span>.<span style="">net</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; DocumentRoot&nbsp; &nbsp; <span style="color:#CC0000;">"D:/www/dominio-2.net/web/"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; DirectoryIndex&nbsp; index.<span style="">php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; AccessFileName&nbsp; .<span style="">htaccess</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; ErrorLog&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#CC0000;">"D:/www/dominio-2.net/logs/error.log"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; LogLevel&nbsp; &nbsp; &nbsp; &nbsp; warn</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; CustomLog&nbsp; &nbsp;&nbsp; &nbsp;<span style="color:#CC0000;">"D:/www/dominio-2.net/logs/access.log"</span> combined</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;Directory <span style="color:#CC0000;">"D:/www/dominio-2.net/web/"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Options -Indexes FollowSymLinks</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; AllowOverride AuthConfig FileInfo</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Order allow,deny</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Allow from all</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/Directory&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/VirtualHost&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Y listos! ideal para los que no se aclaran ni p'atrás (como yo :P).</p>
<p><strong>NOTA:</strong> modificad las comillas “...” por las de SHIFT+2.<br />
<strong>NOTA 2:</strong> Creo que nadie lo ha probado, ya que había un fallo en el paste y no se veía el código VirtualHost ...</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nbsp.es/2009/07/17/configurar-virtualhost-para-tener-varios-dominios-con-su-directorio-cada-uno-en-apache/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Cómo crear un archivo vacío en Windows y Linux/BSD</title>
		<link>http://www.nbsp.es/2009/04/02/como-crear-un-archivo-vacio-en-windows-y-linuxbsd/</link>
		<comments>http://www.nbsp.es/2009/04/02/como-crear-un-archivo-vacio-en-windows-y-linuxbsd/#comments</comments>
		<pubDate>Thu, 02 Apr 2009 08:14:07 +0000</pubDate>
		<dc:creator>marc</dc:creator>
				<category><![CDATA[Turoriales]]></category>
		<category><![CDATA[Varios]]></category>

		<guid isPermaLink="false">http://www.nbsp.es/2009/04/02/como-crear-un-archivo-vacio-en-windows-y-linuxbsd/</guid>
		<description><![CDATA[Para sistemas Linux/BSD: dd if=/dev/zero of=nombre_archivo.txt bs=1024 count=1 donde 1024, podemos poner el valor que queramos (por defecto son bytes). Podemos usar 100M para crear un archivo de 100MB o 3G para crear un archivo de 3GB. Y en sistemas windows: fsutil file createnew nombre_archivo.txt 1024 donde 1024 es el tamaño en bytes. En ambos, [...]]]></description>
			<content:encoded><![CDATA[<p>Para sistemas Linux/BSD:</p>
<p><code>dd if=/dev/zero of=nombre_archivo.txt bs=1024 count=1</code></p>
<p>donde 1024, podemos poner el valor que queramos (por defecto son bytes). Podemos usar 100M para crear un archivo de 100MB o 3G para crear un archivo de 3GB.</p>
<p>Y en sistemas windows:</p>
<p><code>fsutil file createnew nombre_archivo.txt 1024</code></p>
<p>donde 1024 es el tamaño en bytes.</p>
<p>En ambos, el nombre del archivo creado será el especificado en "nombre_archivo.txt"</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nbsp.es/2009/04/02/como-crear-un-archivo-vacio-en-windows-y-linuxbsd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mis datos son mios, y mi navegación tambien, ¿ok?</title>
		<link>http://www.nbsp.es/2008/11/21/mis-datos-son-mios-y-mi-navegacion-tambien-%c2%bfok/</link>
		<comments>http://www.nbsp.es/2008/11/21/mis-datos-son-mios-y-mi-navegacion-tambien-%c2%bfok/#comments</comments>
		<pubDate>Fri, 21 Nov 2008 19:45:44 +0000</pubDate>
		<dc:creator>marc</dc:creator>
				<category><![CDATA[Desarrollo web]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Turoriales]]></category>
		<category><![CDATA[Varios]]></category>
		<category><![CDATA[[nbsp]]]></category>

		<guid isPermaLink="false">http://www.nbsp.es/2008/11/21/mis-datos-son-mios-y-mi-navegacion-tambien-%c2%bfok/</guid>
		<description><![CDATA[Estamos sentados en una cómoda butaca del congreso webmasters y nos hemos puesto a charlar con una pareja muy simpática que nos ha comentado una historia muy triste del robo de varios dominios por culpa de gmail (después de esto aconsejo NO usar gmail para el contacto administrativo de un dominio). Aunque eso no es [...]]]></description>
			<content:encoded><![CDATA[<p>Estamos sentados en una cómoda butaca del congreso webmasters y nos hemos puesto a charlar con una pareja muy simpática que nos ha comentado una historia muy triste del robo de varios dominios por culpa de gmail (después de esto aconsejo NO usar gmail para el contacto administrativo de un dominio). Aunque eso no es del tema que quiero hablar, me ha hecho decidir a explicar un poco la opinión que tengo de la gran mano que todo lo cubre de Google. Me explico:<br />
En un principio, Google era mi gran amigo. Google me facilitaba la información que necesitaba (confirmo que aún uso su buscador, insuperable). Google me proporcionaba una serie de herramientas que, aunque nunca me he decidido a utilizar (a excepción de Adsense) me parecían muy bien.<br />
El problema vino el día que me empecé a preocupar por el hecho que casi cada página que visito tiene publicidad de Google, o estadísticas de Google, o uno de esos cientos de servicios "gratuitos" que nos ofrece a los internautas y webmasters. Me dije: Vaya! si Google me está espiando por todas bandas!!, si encima uso gmail, y gcalendar y todo eso, y saben por donde navego, y mis intereses, y mis busquedas... ostia... yo no se vosotros, seguro que ya habíais llegado a esta conclusión, pero...sinceramente me sentí muy iluso y muy confiado.<br />
Llegado a este punto os preguntaréis a donde quiero llegar y yo me pregunto si pensaréis que estoy loco o que tengo razón, o incluso sabiendo esto creéis que Google aún es vuestro amigo, pues quiero llegar al punto de explicar cómo capé Google de mi vida y cómo sólo le permito saber qué busco (por como buscador es insuperable):</p>
<p>Explicación fácil:</p>
<p>Hay un archivo en nuestro sistema operativo (si usamos Windows o Linux, desconozco en MAC) llamado <strong>hosts</strong>.<br />
Este archivo contiene una serie de redirecciones de hosts (dominios y subdominios) y IPs asociadas.<br />
Lo que hace el sistema operativo para saber qué dirección IP tiene un dominio, es primero consultar este archivo y si no existe el host, pues consulta el servidor DNS.<br />
El archivo hosts está en:</p>
<ul>
<li>Windows 95/98/Me: C:\Windows\hosts</li>
<li>Windows NT/2000: C:\WINNT\System32\drivers\etc\hosts</li>
<li>Windows XP: C:\WINDOWS\system32\drivers\etc\hosts</li>
<li>Windows 2003: C:\WINDOWS\system32\drivers\etc\hosts</li>
<li>Windows Vista: C:\WINDOWS\system32\drivers\etc\hosts</li>
<li>Unix (en general): /etc/hosts</li>
<li>Linux (en general): /etc/hosts</li>
<li>MacOS (en general): /etc/hosts</li>
</ul>
<p>lo editáis.<br />
Lo que vamos a hacer es añadir un listado de servidores de publicidad y monitorización, tanto de google como de otras empresas y la apuntaremos hacia una IP local (127.0.0.1):</p>
<p><code>127.0.0.1	www.google-analytics.com<br />
127.0.0.1	googlesyndication.com<br />
127.0.0.1	pagead.googlesyndication.com<br />
127.0.0.1	pagead2.googlesyndication.com<br />
127.0.0.1	advertising.com<br />
127.0.0.1	smartadserver.com<br />
127.0.0.1	r1.beta.ace.advertising.com<br />
127.0.0.1	uac.advertising.com<br />
127.0.0.1	bannerfarm.ace.advertising.com<br />
127.0.0.1	doubleclick.net<br />
127.0.0.1	ad.z5x.net<br />
127.0.0.1	ad.yieldmanager.com<br />
127.0.0.1	fastclick.net<br />
127.0.0.1	ssl.google-analytics.com<br />
127.0.0.1	as.casalemedia.com<br />
127.0.0.1	ad.doubleclick.net<br />
127.0.0.1	ads1.msn.com<br />
127.0.0.1	ads.sup.com<br />
127.0.0.1	dehp.myspace.com<br />
127.0.0.1	demr.myspace.com<br />
127.0.0.1	desk.myspace.com<br />
127.0.0.1	delb.myspace.com<br />
127.0.0.1	delb2.myspace.com<br />
127.0.0.1	debr.myspace.com<br />
127.0.0.1	view.atdmt.com<br />
127.0.0.1	rad.msn.com<br />
127.0.0.1	themis.geocities.yahoo.com<br />
127.0.0.1	impes.tradedoubler.com<br />
127.0.0.1	code.impresionesweb.com<br />
</code></p>
<p>¿Hay alguien que piense como yo?</p>
<p><strong>Actualización</strong></p>
<p>Pablo de <a href="http://www.tintapixel.com.ar/">tintapixel.com.ar</a> propone en los comentarios hacer una copia de seguridad. Es buena idea.<br />
<a href="http://www.lesm.es/wordpress">Lesm.es</a> me comentó que sería necesario cambiar los permisos del archivo hosts a 'solo lectura' o 440.</p>
<p>Gracias Oscar por el host en los comentarios.</p>
<p>Añadidos tradedoubler y impresionesweb.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nbsp.es/2008/11/21/mis-datos-son-mios-y-mi-navegacion-tambien-%c2%bfok/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Distancia entre dos puntos en AS2</title>
		<link>http://www.nbsp.es/2008/08/06/distancia-entre-dos-puntos-en-as2/</link>
		<comments>http://www.nbsp.es/2008/08/06/distancia-entre-dos-puntos-en-as2/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 16:22:31 +0000</pubDate>
		<dc:creator>marc</dc:creator>
				<category><![CDATA[Aplicaciones web]]></category>
		<category><![CDATA[Desarrollo web]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Turoriales]]></category>
		<category><![CDATA[Varios]]></category>

		<guid isPermaLink="false">http://www.nbsp.es/2008/08/06/distancia-entre-dos-puntos-en-as2/</guid>
		<description><![CDATA[Estamos desarrollando con Joan Garnet una cosita que ya enseñaré y he montado una función para detectar la distancia entre el centro del Stage y el ratón, ahí va: PLAIN TEXT Actionscript: import flash.geom.Point; &#160; var punt_centre_x:Number=Stage.width/2; var punt_centre_y:Number=Stage.height/2; &#160; var punt_centre:Point=new Point&#40;punt_centre_x,punt_centre_y&#41;; &#160; function check_distance&#40;&#41;&#123; &#160; &#160; var punt_mouse_x:Number=this._xmouse; &#160; &#160; var punt_mouse_y:Number=this._ymouse; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Estamos desarrollando con Joan Garnet una cosita que ya enseñaré y he montado una función para detectar la distancia entre el centro del Stage y el ratón, ahí va:</p>
<div class="igBar"><span id="lactionscript-6"><a href="#" onclick="javascript:showPlainTxt('actionscript-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-6">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">geom</span>.<span style="color: #006600;">Point</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> punt_centre_x:<span style="color: #0066CC;">Number</span>=<span style="color: #0066CC;">Stage</span>.<span style="color: #0066CC;">width</span>/<span style="color: #cc66cc;color:#800000;">2</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> punt_centre_y:<span style="color: #0066CC;">Number</span>=<span style="color: #0066CC;">Stage</span>.<span style="color: #0066CC;">height</span>/<span style="color: #cc66cc;color:#800000;">2</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> punt_centre:Point=<span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span>punt_centre_x,punt_centre_y<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> check_distance<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> punt_mouse_x:<span style="color: #0066CC;">Number</span>=<span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">_xmouse</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> punt_mouse_y:<span style="color: #0066CC;">Number</span>=<span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">_ymouse</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> punt_mouse:Point=<span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span>punt_mouse_x,punt_mouse_y<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> dist:<span style="color: #0066CC;">Number</span>=Point.<span style="color: #006600;">distance</span><span style="color: #66cc66;">&#40;</span>punt_centre,punt_mouse<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; distancia.<span style="color: #0066CC;">text</span>=dist+<span style="color: #ff0000;">"px"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">onMouseMove</span>=check_distance; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nbsp.es/2008/08/06/distancia-entre-dos-puntos-en-as2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MI PUNTO DE VISTA: Fórmulas &#8211; Por Rolf Ruiz</title>
		<link>http://www.nbsp.es/2008/01/16/mi-punto-de-vista-formulas-por-rolf-ruiz/</link>
		<comments>http://www.nbsp.es/2008/01/16/mi-punto-de-vista-formulas-por-rolf-ruiz/#comments</comments>
		<pubDate>Wed, 16 Jan 2008 16:01:32 +0000</pubDate>
		<dc:creator>marc</dc:creator>
				<category><![CDATA[Aplicaciones web]]></category>
		<category><![CDATA[Desarrollo web]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Otras páginas]]></category>
		<category><![CDATA[Turoriales]]></category>

		<guid isPermaLink="false">http://www.nbsp.es/2008/01/16/mi-punto-de-vista-formulas-por-rolf-ruiz/</guid>
		<description><![CDATA[Rolf Ruiz, uno de los maestros de la escena Flashera hispana se curró hace 6 años y medio un PDF donde explicaba como programar animaciones en Flash. Por ese entonces aún no había aparecido el dichoso Robert Penner con sus super formulas de easing, y los pobres autodidactas como yo nos teníamos que apañar con [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.alesys.net">Rolf Ruiz</a>, uno de los maestros de la escena Flashera hispana se curró hace 6 años y medio un PDF donde explicaba como programar animaciones en Flash. Por ese entonces aún no había aparecido el dichoso <a href="http://www.robertpenner.com/easing/">Robert Penner</a> con sus super formulas de easing, y los pobres autodidactas como yo nos teníamos que apañar con cualquier cosa.</p>
<p>La sencillez de uso de estas formulas me ha hecho echarlas de menos durante mucho tiempo y estoy muy contento de poder colgarlas aquí a modo de copia de seguridad.</p>
<p><a id="p399" href="/images/2008/01/01_formulas_esp.zip">MI PUNTO DE VISTA: Fórmulas - Por Rolf Ruiz</a></p>
<p>Gracias Rolfito!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nbsp.es/2008/01/16/mi-punto-de-vista-formulas-por-rolf-ruiz/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fast getElementById</title>
		<link>http://www.nbsp.es/2007/12/31/fast-getelementbyid/</link>
		<comments>http://www.nbsp.es/2007/12/31/fast-getelementbyid/#comments</comments>
		<pubDate>Mon, 31 Dec 2007 08:25:41 +0000</pubDate>
		<dc:creator>marc</dc:creator>
				<category><![CDATA[Aplicaciones web]]></category>
		<category><![CDATA[Desarrollo web]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Turoriales]]></category>

		<guid isPermaLink="false">http://www.nbsp.es/2007/12/31/fast-getelementbyid/</guid>
		<description><![CDATA[Es una tontería, pero cuando llevas muchos te ahorras un espacio considerable: PLAIN TEXT JavaScript: function d&#40;e&#41;&#123;return document.getElementById&#40;e&#41;;&#125; Y luego: PLAIN TEXT JavaScript: var salida = d&#40;"salida"&#41;;]]></description>
			<content:encoded><![CDATA[<p>Es una tontería, pero cuando llevas muchos te ahorras un espacio considerable:</p>
<div class="igBar"><span id="ljavascript-9"><a href="#" onclick="javascript:showPlainTxt('javascript-9'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-9">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">function</span> d<span style="color: #66cc66;">&#40;</span>e<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><span style="color: #000066; font-weight: bold;">return</span> document.<span style="color: #006600;">getElementById</span><span style="color: #66cc66;">&#40;</span>e<span style="color: #66cc66;">&#41;</span>;<span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Y luego:</p>
<div class="igBar"><span id="ljavascript-10"><a href="#" onclick="javascript:showPlainTxt('javascript-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-10">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> salida = d<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"salida"</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nbsp.es/2007/12/31/fast-getelementbyid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>appendChild, frames y Internet Explorer</title>
		<link>http://www.nbsp.es/2007/11/14/appendchild-frames-y-internet-explorer/</link>
		<comments>http://www.nbsp.es/2007/11/14/appendchild-frames-y-internet-explorer/#comments</comments>
		<pubDate>Wed, 14 Nov 2007 18:25:26 +0000</pubDate>
		<dc:creator>marc</dc:creator>
				<category><![CDATA[Aplicaciones web]]></category>
		<category><![CDATA[Desarrollo web]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Turoriales]]></category>

		<guid isPermaLink="false">http://www.nbsp.es/2007/11/14/appendchild-frames-y-internet-explorer/</guid>
		<description><![CDATA[Para los que tengáis que trabajar con frames y DOM, tened en cuenta que con Internet Explorer no se pueden crear los elementos en la página contenedora del frameset para luego insertarla en un frame. Para poder hacerlo correctamente, tan solo se tiene que crear el elemento dentro del frame, con lo que para insertarlo [...]]]></description>
			<content:encoded><![CDATA[<p>Para los que tengáis que trabajar con frames y DOM, tened en cuenta que con Internet Explorer no se pueden crear los elementos en la página contenedora del frameset para luego insertarla en un frame. Para poder hacerlo correctamente, tan solo se tiene que crear el elemento dentro del frame, con lo que para insertarlo ya no se tendrá que hacer entre marcos.</p>
<p>Como lo he hecho:</p>
<div class="igBar"><span id="ljavascript-12"><a href="#" onclick="javascript:showPlainTxt('javascript-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-12">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> marco=window.<span style="color: #006600;">nombredelmarco</span>.<span style="color: #006600;">frameElement</span>.<span style="color: #006600;">contentWindow</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> capa=marco.<span style="color: #006600;">document</span>.<span style="color: #006600;">createElement</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"div"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">marco.<span style="color: #006600;">document</span>.<span style="color: #006600;">body</span>.<span style="color: #006600;">appendChild</span><span style="color: #66cc66;">&#40;</span>capa<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Perfecto!! :)</p>
<p>Con Firefox si se puede, así que de momento entenderemos que no hay documentación clara al respecto en lugar de achacarlo a un fallo del citado explotador :P.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nbsp.es/2007/11/14/appendchild-frames-y-internet-explorer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Creador de Paletas de colores en JavaScript</title>
		<link>http://www.nbsp.es/2007/11/09/creador-de-paletas-de-colores-en-javascript/</link>
		<comments>http://www.nbsp.es/2007/11/09/creador-de-paletas-de-colores-en-javascript/#comments</comments>
		<pubDate>Fri, 09 Nov 2007 14:56:44 +0000</pubDate>
		<dc:creator>marc</dc:creator>
				<category><![CDATA[Aplicaciones web]]></category>
		<category><![CDATA[Desarrollo web]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Turoriales]]></category>

		<guid isPermaLink="false">http://www.nbsp.es/2007/11/09/creador-de-paletas-de-colores-en-javascript/</guid>
		<description><![CDATA[Hace mucho tiempo hice un método para el objeto MovieClip de Flash, el cual te creaba una paleta de colores en el lugar indicado de la película (ideal para CMSs entre otras utilidades). Hoy rascando en el baúl de los recuerdos me he encontrado con el script en la página de proto.layer51.com y ni corto [...]]]></description>
			<content:encoded><![CDATA[<p>Hace mucho tiempo hice un método para el objeto MovieClip de Flash, el cual te creaba una paleta de colores en el lugar indicado de la película (ideal para CMSs entre otras utilidades).</p>
<p>Hoy rascando en el baúl de los recuerdos me he encontrado con el script en la página de <a href="http://proto.layer51.com/d.aspx?f=1275">proto.layer51.com</a> y ni corto ni perezoso me he decidido a rehacerlo para que funcione en javascript. </p>
<p>El resultado es el siguiente:</p>
<div id="paleta" style="background-color:black;margin-left:30px;"></div>
<p><script type="text/javascript" src="/ajax/jspc.js"></script></p>
<p>Podéis pulsar sobre los colores para que se ejecute la función de retorno (callBack).</p>
<p>El código es muy sencillo, un tiple bucle con tirabuzón y mortal para atrás :P</p>
<div class="igBar"><span id="ljavascript-14"><a href="#" onclick="javascript:showPlainTxt('javascript-14'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-14">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> ancho=<span style="color: #CC0000;color:#800000;">10</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> alto=<span style="color: #CC0000;color:#800000;">10</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> sep=<span style="color: #CC0000;color:#800000;">1</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">creaPaleta=<span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>element,callBack<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> clip,col,top,left;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> aColors=<span style="color: #66cc66;">&#91;</span><span style="color: #3366CC;">"00"</span>,<span style="color: #3366CC;">"33"</span>,<span style="color: #3366CC;">"66"</span>,<span style="color: #3366CC;">"99"</span>,<span style="color: #3366CC;">"CC"</span>,<span style="color: #3366CC;">"FF"</span><span style="color: #66cc66;">&#93;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> x=<span style="color: #CC0000;color:#800000;">0</span>;x&lt;<span style="color: #CC0000;color:#800000;">6</span>;x++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> y=<span style="color: #CC0000;color:#800000;">0</span>;y&lt;<span style="color: #CC0000;color:#800000;">6</span>;y++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> z=<span style="color: #CC0000;color:#800000;">0</span>,d=<span style="color: #CC0000;color:#800000;">0</span>;z&lt;<span style="color: #CC0000;color:#800000;">6</span>;z++,d++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; col=<span style="color: #3366CC;">"#"</span>+aColors<span style="color: #66cc66;">&#91;</span>z<span style="color: #66cc66;">&#93;</span>+aColors<span style="color: #66cc66;">&#91;</span>x<span style="color: #66cc66;">&#93;</span>+aColors<span style="color: #66cc66;">&#91;</span>y<span style="color: #66cc66;">&#93;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; clip=document.<span style="color: #006600;">createElement</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"a"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; clip.<span style="color: #006600;">href</span>=<span style="color: #3366CC;">"Color: "</span>+col;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; clip.<span style="color: #006600;">funcio</span>=callBack;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; clip.<span style="color: #006600;">onclick</span>=<span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">funcio</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">color</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cs=clip.<span style="color: #006600;">style</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cs.<span style="color: #006600;">backgroundColor</span>=clip.<span style="color: #006600;">color</span>=col;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; top=sep+y*<span style="color: #66cc66;">&#40;</span>alto+sep<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cs.<span style="color: #006600;">top</span>=top+<span style="color: #3366CC;">"px"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; left=sep+<span style="color: #66cc66;">&#40;</span>z*<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>sep+ancho<span style="color: #66cc66;">&#41;</span>*<span style="color: #CC0000;color:#800000;">6</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>+<span style="color: #66cc66;">&#40;</span>x*<span style="color: #66cc66;">&#40;</span>ancho+sep<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cs.<span style="color: #006600;">left</span>=left+<span style="color: #3366CC;">"px"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cs.<span style="color: #006600;">width</span>=ancho+<span style="color: #3366CC;">"px"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cs.<span style="color: #006600;">height</span>=alto+<span style="color: #3366CC;">"px"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cs.<span style="color: #006600;">position</span>=<span style="color: #3366CC;">"absolute"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cs.<span style="color: #006600;">overflow</span>=<span style="color: #3366CC;">"hidden"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; element.<span style="color: #006600;">appendChild</span><span style="color: #66cc66;">&#40;</span>clip<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; element.<span style="color: #006600;">style</span>.<span style="color: #006600;">position</span>=<span style="color: #3366CC;">"relative"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; element.<span style="color: #006600;">style</span>.<span style="color: #006600;">height</span>=<span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">6</span>*<span style="color: #66cc66;">&#40;</span>alto+sep<span style="color: #66cc66;">&#41;</span>+<span style="color: #CC0000;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>+<span style="color: #3366CC;">"px"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; element.<span style="color: #006600;">style</span>.<span style="color: #006600;">width</span>=<span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">6</span>*<span style="color: #CC0000;color:#800000;">6</span>*<span style="color: #66cc66;">&#40;</span>ancho+sep<span style="color: #66cc66;">&#41;</span>+<span style="color: #CC0000;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>+<span style="color: #3366CC;">"px"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">function</span> funcionRetorno<span style="color: #66cc66;">&#40;</span>e<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><span style="color: #000066;">alert</span><span style="color: #66cc66;">&#40;</span>e<span style="color: #66cc66;">&#41;</span>;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">creaPaleta<span style="color: #66cc66;">&#40;</span>document.<span style="color: #006600;">getElementById</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"paleta"</span><span style="color: #66cc66;">&#41;</span>,funcionRetorno<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Los parámetros configurables son:</p>
<p>ancho y alto: para definir el tamaño de los botones<br />
sep: para definir la separación entre botones</p>
<p>Para crear una paleta se tiene que ejecutar la función creaPaleta pasandole dos argumentos:</p>
<p>element: el cual requiere un elemento HTML (si puede ser un DIV mejor :))<br />
callBack: la función que se ejecutará al pulsar sobre del color seleccionado.</p>
<p>La función es MUY escalable, si queréis añadir efectos rollOver y rollOut solo tenéis que añadirlo en donde figura "clip.onclick=function(){" y ahí le podéis pasar cualquier evento válido para javascript.</p>
<p>Oh! que no lo he dicho! es compatible con FF1.0+,IE5.0+,Opera7.0+ y Safari beta 3 windows, si podéis probarlo con otros navegadores y comentarme si va o no me haréis un grato favor :)</p>
<p>¿Que os parece? :P</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nbsp.es/2007/11/09/creador-de-paletas-de-colores-en-javascript/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Palabras reservadas</title>
		<link>http://www.nbsp.es/2007/10/16/palabras-reservadas/</link>
		<comments>http://www.nbsp.es/2007/10/16/palabras-reservadas/#comments</comments>
		<pubDate>Tue, 16 Oct 2007 11:44:38 +0000</pubDate>
		<dc:creator>marc</dc:creator>
				<category><![CDATA[Aplicaciones web]]></category>
		<category><![CDATA[Desarrollo web]]></category>
		<category><![CDATA[Otras páginas]]></category>
		<category><![CDATA[Turoriales]]></category>
		<category><![CDATA[[nbsp]]]></category>

		<guid isPermaLink="false">http://www.nbsp.es/2007/10/16/palabras-reservadas/</guid>
		<description><![CDATA[Hace unos días nos llegó una queja de un usuario de CDmon donde decía que en Opera no funcionaba bien el gestor de correo electrónico y nos pusimos manos a la obra para ver que problema había. Después de debugar el script utilizando la consola de errores, vimos el siguiente error: JavaScript - correo.php Inline [...]]]></description>
			<content:encoded><![CDATA[<p>Hace unos días nos llegó una queja de un usuario de CDmon donde decía que en Opera no funcionaba bien el gestor de correo electrónico y nos pusimos manos a la obra para ver que problema había. Después de debugar el script utilizando la consola de errores, vimos el siguiente error:</p>
<p><code>JavaScript - correo.php<br />
Inline script compilation<br />
Syntax error while loading: line 6 of inline script at correo.php :<br />
	window.goto=290;<br />
-------------^<br />
</code></p>
<p>¿goto? y que problema da goto... ¿será algo de Opera?... pues no, es algo tan sencillo como que es una palabra reservada. Me siento incluso un poco tontaina por no haber caído en eso antes.</p>
<p>¿Reservada? Si, eso significa que no se puede utilizar ya que puede ser que en futuras versiones de los navegadores haya nuevas implementaciones de javascript las cuales incluyan dichas palabras "reservadas". Entonces, Opera parece que se lo toma muy en serio y directamente lanza error cuando se utilizan estas palabras.</p>
<p>Me comenta <a href="http://zigotica.com/">Zigotica</a> que hace un tiempo él tuvo problemas con Firefox y la palabra reservada "class".</p>
<div class="igBar"><span id="ljavascript-16"><a href="#" onclick="javascript:showPlainTxt('javascript-16'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-16">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">//Esto no funciona</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">function</span> blah<span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">class</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Parece que aquí cada uno permite lo que le da la gana.</p>
<p>Os dejo un listado de palabras que figuran en la referencia ECMAScript las cuales están reservadas:</p>
<p><em>Extracto del PDF::Página 14-15</em><br />
<strong>Reserved Keywords</strong></p>
<p>break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof</p>
<p><strong>Future Reserved Words</strong></p>
<p>abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protecte</p>
<p>A continuación os dejo unos enlaces  que contienen información con las palabras que NO debéis usar para definir ni variables, ni propiedades, ni métodos, ni ná!.</p>
<p><a href="http://www.javascripter.net/faq/reserved.htm">Palabras reservadas javascript</a><br />
<a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">Referencia ECMAScript, página 14 del PDF</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nbsp.es/2007/10/16/palabras-reservadas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Utilizar un dominio con blogger</title>
		<link>http://www.nbsp.es/2007/09/20/utilizar-un-dominio-con-blogger/</link>
		<comments>http://www.nbsp.es/2007/09/20/utilizar-un-dominio-con-blogger/#comments</comments>
		<pubDate>Thu, 20 Sep 2007 17:04:25 +0000</pubDate>
		<dc:creator>marc</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Otras páginas]]></category>
		<category><![CDATA[Turoriales]]></category>
		<category><![CDATA[Varios]]></category>

		<guid isPermaLink="false">http://www.nbsp.es/2007/09/20/utilizar-un-dominio-con-blogger/</guid>
		<description><![CDATA[Y no lo digo yo, que lo dicen otros: canutgeek.uni.cc/traspasar blog de blogger a dominio propio/ Y lo pongo porque me ha hecho gracia que utilicen CDmon.]]></description>
			<content:encoded><![CDATA[<p>Y no lo digo yo, que lo dicen otros:</p>
<p><a href="http://canutgeek.uni.cc/wp/index.php/2007/07/20/tutorial-traspasar-un-blog-de-blogger-a-dominio-propio/">canutgeek.uni.cc/traspasar blog de blogger a dominio propio/</a></p>
<p><em>Y lo pongo porque me ha hecho gracia que utilicen CDmon.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nbsp.es/2007/09/20/utilizar-un-dominio-con-blogger/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Encapsular código en javascript</title>
		<link>http://www.nbsp.es/2007/07/18/encapsular-codigo-en-javascript/</link>
		<comments>http://www.nbsp.es/2007/07/18/encapsular-codigo-en-javascript/#comments</comments>
		<pubDate>Wed, 18 Jul 2007 11:46:22 +0000</pubDate>
		<dc:creator>marc</dc:creator>
				<category><![CDATA[Desarrollo web]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Otras páginas]]></category>
		<category><![CDATA[Turoriales]]></category>
		<category><![CDATA[Varios]]></category>

		<guid isPermaLink="false">http://www.nbsp.es/2007/07/18/encapsular-codigo-en-javascript/</guid>
		<description><![CDATA[Una forma sencilla de encapsular un código de javascript es mediante objetos (JSON): PLAIN TEXT JavaScript: capsula=&#123;funcion1:function&#40;&#41;&#123;&#125;&#125; Lo malo es que te ves forzado a llamar a dicho objecto para ejecutar el código: PLAIN TEXT JavaScript: capsula.funcion1&#40;&#41;; una técnica más elemental y que no permite llamar a la función (ya que es anónima) es la [...]]]></description>
			<content:encoded><![CDATA[<p>Una forma sencilla de encapsular un código de javascript es mediante objetos (JSON):</p>
<div class="igBar"><span id="ljavascript-20"><a href="#" onclick="javascript:showPlainTxt('javascript-20'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-20">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">capsula=<span style="color: #66cc66;">&#123;</span>funcion1:<span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Lo malo es que te ves forzado a llamar a dicho objecto para ejecutar el código:</p>
<div class="igBar"><span id="ljavascript-21"><a href="#" onclick="javascript:showPlainTxt('javascript-21'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-21">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">capsula.<span style="color: #006600;">funcion1</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>una técnica más elemental y que no permite llamar a la función (ya que es anónima) es la siguiente (no se que nombre recibe):</p>
<div class="igBar"><span id="ljavascript-22"><a href="#" onclick="javascript:showPlainTxt('javascript-22'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-22">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#40;</span>javascript<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>...<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Se usa principalmente para encapsular código que se ejecutará posteriormente en bookmarklets, aunque siempre es útil de conocerlo para crear un entorno de ejecución para bloques de códigos estructurales.</p>
<p>Esto lo he utilizado esta misma mañana en un script, ya que si no, me hubiera sobrescrito el nombre de una función por culpa de mi falta de organización jeje :P. Ahora tendría que saltar por aquí <a href="http://meddle.dzygn.com/esp/weblog/">don Zigotica</a> diciendo que los namespaces son la solución a ese problema ... POZI! (JSON)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nbsp.es/2007/07/18/encapsular-codigo-en-javascript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>$PHP_SELF ¡Peligro a la vista!</title>
		<link>http://www.nbsp.es/2007/07/18/php_self-%c2%a1peligro-a-la-vista/</link>
		<comments>http://www.nbsp.es/2007/07/18/php_self-%c2%a1peligro-a-la-vista/#comments</comments>
		<pubDate>Wed, 18 Jul 2007 10:43:56 +0000</pubDate>
		<dc:creator>marc</dc:creator>
				<category><![CDATA[Aplicaciones web]]></category>
		<category><![CDATA[Desarrollo web]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Turoriales]]></category>
		<category><![CDATA[Varios]]></category>

		<guid isPermaLink="false">http://www.nbsp.es/2007/07/18/php_self-%c2%a1peligro-a-la-vista/</guid>
		<description><![CDATA[Leyendo Buayacorp.com me he encontrado con algo que creo necesario compartir. Mucha gente usa la variable de PHP $PHP_SELF para apuntar los formularios hacia la misma página. El problema que tiene PHP_SELF es que se puede trampear para añadir javascripts en la página, con lo que se puede conseguir robar sesiones y otras cosas típicas [...]]]></description>
			<content:encoded><![CDATA[<p>Leyendo <a href="http://www.buayacorp.com/">Buayacorp.com</a> me he encontrado con algo que creo necesario compartir.<br />
Mucha gente usa la variable de PHP <em>$PHP_SELF</em> para apuntar los formularios hacia la misma página. El problema que tiene PHP_SELF es que se puede trampear para añadir javascripts en la página, con lo que se puede conseguir robar sesiones y otras cosas típicas del XSS.</p>
<p>Me explico:</p>
<p>Tenemos un formulario</p>
<div class="igBar"><span id="lhtml-27"><a href="#" onclick="javascript:showPlainTxt('html-27'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-27">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/form.html"><span style="color: #000000; font-weight: bold;">&lt;form</span></a> <span style="color: #000066;">method</span>=<span style="color: #ff0000;">"POST"</span> <span style="color: #000066;">action</span>=<span style="color: #ff0000;">"&lt;?=$PHP_SELF?&gt;</span>&quot;&gt;<span style="color: #009900;">&lt;/form&gt;</span> </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Y desde la barra de navegación cargamos la página que contiene el formulario añadiendo una barra al final y el script a ejecutar</p>
<div class="igBar"><span id="lhtml-28"><a href="#" onclick="javascript:showPlainTxt('html-28'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-28">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">/formulario.php/&quot;&gt;<span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">&lt;script</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>alert(&quot;Hackme&quot;);<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span><span style="color: #009900;"><a href="http://december.com/html/4/element/form.html"><span style="color: #000000; font-weight: bold;">&lt;form</span></a> <span style="color: #000066;">action</span>=<span style="color: #ff0000;">" </span></span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Con lo que el contenido de la página cambia:</p>
<div class="igBar"><span id="lhtml-29"><a href="#" onclick="javascript:showPlainTxt('html-29'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-29">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/form.html"><span style="color: #000000; font-weight: bold;">&lt;form</span></a> <span style="color: #000066;">method</span>=<span style="color: #ff0000;">"POST"</span> <span style="color: #000066;">action</span>=<span style="color: #ff0000;">"/marc/hack/formulario.php/formulario.php/"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">&lt;script</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>alert(&quot;Hackme&quot;);<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span><span style="color: #009900;"><a href="http://december.com/html/4/element/form.html"><span style="color: #000000; font-weight: bold;">&lt;form</span></a> <span style="color: #000066;">action</span>=<span style="color: #ff0000;">""</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/form&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Venga, ¿alguien propone soluciones?</p>
<p>-Yo propongo escapar $PHP_SELF con un urlencode:</p>
<div class="igBar"><span id="lphp-30"><a href="#" onclick="javascript:showPlainTxt('php-30'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-30">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?</span> <span style="color:#0000FF;">$PHP_SELF</span>=<a href="http://www.php.net/urlencode"><span style="color:#000066;">urlencode</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$PHP_SELF</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nbsp.es/2007/07/18/php_self-%c2%a1peligro-a-la-vista/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Acentos, codificación y expresiones regulares</title>
		<link>http://www.nbsp.es/2007/06/22/acentos-codificacion-y-expresiones-regulares/</link>
		<comments>http://www.nbsp.es/2007/06/22/acentos-codificacion-y-expresiones-regulares/#comments</comments>
		<pubDate>Fri, 22 Jun 2007 08:04:10 +0000</pubDate>
		<dc:creator>marc</dc:creator>
				<category><![CDATA[Aplicaciones web]]></category>
		<category><![CDATA[Desarrollo web]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Turoriales]]></category>
		<category><![CDATA[Varios]]></category>

		<guid isPermaLink="false">http://www.nbsp.es/2007/06/22/acentos-codificacion-y-expresiones-regulares/</guid>
		<description><![CDATA[Ultimamente estoy viciado a las expresiones regulares, facilitan el trabajo de una forma asombrosa. De momento os dejo una que os servirá para filtrar un nombre de persona (con acentos y tal). Es codificación Latin-1, así que no esperéis que valide caracteres chinos ni japoneses, pero la idea va por aquí. /^[\ \'\-\.A-Za-z\xc0-\xfc]{3,64}$/ Tengo ganas [...]]]></description>
			<content:encoded><![CDATA[<p>Ultimamente estoy viciado a las expresiones regulares, facilitan el trabajo de una forma asombrosa. De momento os dejo una que os servirá para filtrar un nombre de persona (con acentos y tal). Es codificación Latin-1, así que no esperéis que valide caracteres chinos ni japoneses, pero la idea va por aquí.</p>
<p><code>/^[\ \'\-\.A-Za-z\xc0-\xfc]{3,64}$/</code></p>
<p>Tengo ganas de hablar más de las expresiones regulares, pero no tengo ni tiempo ni Internet en casa, así que de momento voy jodido.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nbsp.es/2007/06/22/acentos-codificacion-y-expresiones-regulares/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

