<?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>Smultron POTENCIA !! &#187; Resultados de la búsqueda  &#187;  +2009+06+page+3</title>
	<atom:link href="http://smultron.es/search/+2009+06+page+3/feed/rss2/" rel="self" type="application/rss+xml" />
	<link>http://smultron.es</link>
	<description>El Blog con Potencia pero sin Control.</description>
	<lastBuildDate>Sat, 11 Feb 2012 18:52:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Google Maps API &#8211; Personaliza tu mapa</title>
		<link>http://smultron.es/2009/11/google-maps-api-personaliza-tu-mapa/</link>
		<comments>http://smultron.es/2009/11/google-maps-api-personaliza-tu-mapa/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 23:39:35 +0000</pubDate>
		<dc:creator>NEO</dc:creator>
				<category><![CDATA[copy&page]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Interesante]]></category>
		<category><![CDATA[Programacion]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[videotutorial]]></category>

		<guid isPermaLink="false">http://smultron.es/?p=4607</guid>
		<description><![CDATA[&#160; Copy&#38;Page: http://www.elwebmaster.com/general/insertar-y-personalizar-google-maps-en-tu-sitio-web (version Inglesa: http://stiern.com/tutorials/adding-custom-google-maps-to-your-website) En los sitios web de una compa&#241;&#237;a a menudo se utilizan mapas para mostrarle a los clientes d&#243;nde los pueden encontrar. Para esto, Google Maps es excelente. Pero &#191;No ser&#237;a genial a&#241;adir el logo de nuestra compa&#241;&#237;a, los estacionamientos cercanos, las estaciones de trenes, y otros datos alternativos en [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p>Copy&amp;Page: http://www.elwebmaster.com/general/insertar-y-personalizar-google-maps-en-tu-sitio-web</p>
<p>(version Inglesa: http://stiern.com/tutorials/adding-custom-google-maps-to-your-website)</p>
<p><span id="more-4607"></span>En los <strong>sitios web</strong> de una compa&ntilde;&iacute;a a menudo se utilizan <strong>mapas</strong> para mostrarle a los<strong> clientes</strong> d&oacute;nde los pueden encontrar. Para esto, <strong>Google Maps</strong> es excelente.</p>
<p>Pero &iquest;No ser&iacute;a genial<strong> a&ntilde;adir el logo</strong> de nuestra compa&ntilde;&iacute;a, los estacionamientos cercanos, las estaciones de trenes,  y otros <strong>datos alternativos</strong> en el mapa para <strong>ayudar</strong> m&aacute;s a los clientes?</p>
<p>Antes de empezar, veamos lo que vamos a crear:</p>
<div class="iframe-wrapper"><iframe frameborder="0" src="http://dl.getdropbox.com/u/32709/googlemaps/index.html" style="height: 300px; width: 500px;">Please upgrade your browser</iframe></div>
<h2>Google Maps API</h2>
<p>La API Google Maps te permite embeber mapas directamente en tu sitio web. S&oacute;lo se necesita un poco de JavaScript, y algo de CSS para embellecer. Recientemente ha sido lanzada la <a title="Google Maps API V3" href="http://code.google.com/apis/maps/documentation/v3/" target="_blank">Version 3</a> de la API Google Maps que es la que vamos a utilizar.</p>
<h2>Obteniendo las coordenadas</h2>
<p>Como seguramente no conocen las coordenadas precisas de su locaci&oacute;n, les explicaremos una forma r&aacute;pida que Google ha puesto a nuestra disposici&oacute;n para conocerlas. Cuando conoces la direcci&oacute;n exacta, puedes ingresar una URL de esta forma:</p>
<div class="igBar"><span id="lphp-1"><a href="http://www.elwebmaster.com/general/insertar-y-personalizar-google-maps-en-tu-sitio-web#" onclick="javascript:showPlainTxt('php-1'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="php-1">
<div class="php">
<ol>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">http:<span style="color: rgb(255, 153, 51); font-style: italic;">//maps.google.com/maps/geo?q=1+Infinite Liip,+Cupertino,+CA+95014,+USA&amp;amp;output=csv&amp;amp;oe=utf8&amp;amp;sensor=false&amp;amp;key=your_google_maps_api_key </span></div>
</li>
</ol>
</div>
</div>
</div>
<p>Cuando ingreses esto en tu barra de direcciones, ver&aacute;s lo siguiente:</p>
<p><a title="&quot;The coordinates of Apple's head quarter in Cupertino&quot; " href="http://stiern.com/site/wp-content/everything/apple_coordinates.png"><img width="245" height="28" class="alignnone size-full wp-image-11105" src="http://www.elwebmaster.com/wp-content/uploads/2009/10/apple_coordinates.png" alt="apple_coordinates" /><br />
</a></p>
<p><em>Las coordenadas del cuartel general de Apple en Cupertino</em></p>
<p>El primer n&uacute;mero es el c&oacute;digo del estado en el que est&aacute; el punto del mapa seg&uacute;n Google, y 200 quiere decir que todo est&aacute; bien. El segundo n&uacute;mero muestra cu&aacute;n precisa es la direcci&oacute;n, en este caso el n&uacute;mero es 8, que es bastante bueno. Los &uacute;ltimos dos n&uacute;meros son latitudes y longitudes, que son los n&uacute;meros que necesitamos.</p>
<h2>A&ntilde;adiendo el mapa a tu web</h2>
<p>Abre tu editor HTML favorito y crea un archivo HTML est&aacute;ndar con codificaci&oacute;n UTF-8.</p>
<p>Primero que nada es necesario crear el puerto de visualizaci&oacute;n y decirle a nuestro archivo HTML que obtenga el archivo Javascript del c&oacute;digo Google.</p>
<p>A&ntilde;ade estas l&iacute;neas entre &lt;head&gt; y &lt;/head&gt;:</p>
<div class="igBar"><span id="lphp-2"><a href="http://www.elwebmaster.com/general/insertar-y-personalizar-google-maps-en-tu-sitio-web#" onclick="javascript:showPlainTxt('php-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="php-2">
<div class="php">
<ol>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&lt;script src=<span style="color: rgb(255, 0, 0);">&quot;http://maps.google.com/maps/api/js?sensor=false&quot;</span> type=<span style="color: rgb(255, 0, 0);">&quot;text/javascript&quot;</span>&gt;&lt;/script&gt;</div>
</li>
</ol>
</div>
</div>
</div>
<p>Luego de la URL, notar&aacute;s sensor=false. Dado que no utilizamos ning&uacute;n sensor, como un GPS, para localizar el lugar, esto se programa en false. Justo debajo de lo que hemos insertado, escriban lo siguiente:</p>
<div class="igBar"><span id="lphp-3"><a href="http://www.elwebmaster.com/general/insertar-y-personalizar-google-maps-en-tu-sitio-web#" onclick="javascript:showPlainTxt('php-3'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="php-3">
<div class="php">
<ol>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&lt;script type=<span style="color: rgb(255, 0, 0);">&quot;text/javascript&quot;</span>&gt;&lt;!&#8211;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: rgb(0, 0, 0); font-weight: bold;">function</span> initialize<span style="color: rgb(0, 102, 0); font-weight: bold;">(</span><span style="color: rgb(0, 102, 0); font-weight: bold;">)</span> <span style="color: rgb(0, 102, 0); font-weight: bold;">{</span></div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: rgb(0, 0, 0); font-weight: bold;">var</span> latlng = <span style="color: rgb(0, 0, 0); font-weight: bold;">new</span> google.maps.LatLng<span style="color: rgb(0, 102, 0); font-weight: bold;">(</span><span style="color: rgb(128, 0, 0);">57</span>.<span style="color: rgb(128, 0, 0);">0442</span>, <span style="color: rgb(128, 0, 0);">9</span>.<span style="color: rgb(128, 0, 0);">9116</span><span style="color: rgb(0, 102, 0); font-weight: bold;">)</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: rgb(0, 0, 0); font-weight: bold;">var</span> settings = <span style="color: rgb(0, 102, 0); font-weight: bold;">{</span></div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; zoom: <span style="color: rgb(128, 0, 0);">15</span>,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; center: latlng,</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mapTypeControl: <span style="color: rgb(0, 0, 0); font-weight: bold;">true</span>,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mapTypeControlOptions: <span style="color: rgb(0, 102, 0); font-weight: bold;">{</span>style: google.maps.MapTypeControlStyle.DROPDOWN_MENU<span style="color: rgb(0, 102, 0); font-weight: bold;">}</span>,</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; navigationControl: <span style="color: rgb(0, 0, 0); font-weight: bold;">true</span>,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; navigationControlOptions: <span style="color: rgb(0, 102, 0); font-weight: bold;">{</span>style: google.maps.NavigationControlStyle.SMALL<span style="color: rgb(0, 102, 0); font-weight: bold;">}</span>,</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mapTypeId: google.maps.MapTypeId.ROADMAP</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: rgb(0, 102, 0); font-weight: bold;">}</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p>En la l&iacute;nea 2 creamos la funci&oacute;n initialize(). Dentro de esta function vamos a definir las configuraciones b&aacute;sicas del mapa. En la l&iacute;nea 3 creamos una nueva variable, latlng. latlng que representa las latitudes y longitudes. La variable contiene las coordenadas que utilizaremos como centro de nuestro mapa.</p>
<p>Luego de esto creamos la variable settings. Aqu&iacute; tenemos muchas opciones.</p>
<ul>
<li>zoom espec&iacute;fica cu&aacute;nto zoom tundra el mapa.</li>
<li>center espec&iacute;fica nuestro centro. Al escribir latlng, nos referemos a la variable que hemos creado antes y se utilizar&aacute; la coordenada dentro de &eacute;sta.</li>
</ul>
<p>El &uacute;ltimo c&oacute;digo cambia el dise&ntilde;o del mapa para que sea un poco m&aacute;s minimalista. Los controles en la esquina superior derecha (Map, Satellite, Terrain) se cambian por un menu desplegable y los controles de navegaci&oacute;n/escalamiento en el lado izquierdo se cambiar por controles peque&ntilde;os.</p>
<p>mapTypeId: google.maps.MapTypeId.ROADMAP define que nuestro mapa debe ser del tipo ROADMAP &#8211; lo puedes cambiar por SATELLITE, HYBRID o TERRAIN.</p>
<p>Debajo del c&oacute;digo anterior, escriban esto:</p>
<div class="igBar"><span id="lphp-4"><a href="http://www.elwebmaster.com/general/insertar-y-personalizar-google-maps-en-tu-sitio-web#" onclick="javascript:showPlainTxt('php-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="php-4">
<div class="php">
<ol>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 0); font-weight: bold;">var</span> map = <span style="color: rgb(0, 0, 0); font-weight: bold;">new</span> google.maps.Map<span style="color: rgb(0, 102, 0); font-weight: bold;">(</span>document.getElementById<span style="color: rgb(0, 102, 0); font-weight: bold;">(</span><span style="color: rgb(255, 0, 0);">&quot;map_canvas&quot;</span><span style="color: rgb(0, 102, 0); font-weight: bold;">)</span>, settings<span style="color: rgb(0, 102, 0); font-weight: bold;">)</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p>Este c&oacute;digo crea la variable map, y define que el mapa debe utilizar las configuraciones que hemos creado.</p>
<p>Escriban:</p>
<div class="igBar"><span id="lphp-5"><a href="http://www.elwebmaster.com/general/insertar-y-personalizar-google-maps-en-tu-sitio-web#" onclick="javascript:showPlainTxt('php-5'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="php-5">
<div class="php">
<ol>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 102, 0); font-weight: bold;">}</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 0); font-weight: bold;">&lt;/script&gt;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>Para terminar la funci&oacute;n, y en <code>body</code>, escriban esto:</p>
<div class="igBar"><span id="lphp-6"><a href="http://www.elwebmaster.com/general/insertar-y-personalizar-google-maps-en-tu-sitio-web#" onclick="javascript:showPlainTxt('php-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="php-6">
<div class="php">
<ol>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&lt;body onload=<span style="color: rgb(255, 0, 0);">&quot;initialize()&quot;</span>&gt;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &lt;div id=<span style="color: rgb(255, 0, 0);">&quot;map_canvas&quot;</span> style=<span style="color: rgb(255, 0, 0);">&quot;width:800px; height:500px&quot;</span>&gt;&lt;/div&gt;</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&lt;/body&gt;</div>
</li>
</ol>
</div>
</div>
</div>
<p>Al hacer esto le decimos a nuestro sitio que ejecute la funci&oacute;n <code>the initialize()</code> al cargar, y que inserte un <code>div</code> con el tama&ntilde;o que deseamos que tenga nuestro mapa.</p>
<h2>A&ntilde;adiendo marcadores</h2>
<p>Ahora debemos a&ntilde;adir algunos marcadores. Comencemos por crear los est&aacute;ndar y luego los personalizaremos.</p>
<p>Justo debajo de:</p>
<div class="igBar"><span id="lphp-7"><a href="http://www.elwebmaster.com/general/insertar-y-personalizar-google-maps-en-tu-sitio-web#" onclick="javascript:showPlainTxt('php-7'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="php-7">
<div class="php">
<ol>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 0); font-weight: bold;">var</span> map = <span style="color: rgb(0, 0, 0); font-weight: bold;">new</span> google.maps.Map<span style="color: rgb(0, 102, 0); font-weight: bold;">(</span>document.getElementById<span style="color: rgb(0, 102, 0); font-weight: bold;">(</span><span style="color: rgb(255, 0, 0);">&quot;map_canvas&quot;</span><span style="color: rgb(0, 102, 0); font-weight: bold;">)</span>, settings<span style="color: rgb(0, 102, 0); font-weight: bold;">)</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p>Inserten el siguiente c&oacute;digo:</p>
<div class="igBar"><span id="lphp-8"><a href="http://www.elwebmaster.com/general/insertar-y-personalizar-google-maps-en-tu-sitio-web#" onclick="javascript:showPlainTxt('php-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="php-8">
<div class="php">
<ol>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 0); font-weight: bold;">var</span> companyPos = <span style="color: rgb(0, 0, 0); font-weight: bold;">new</span> google.maps.LatLng<span style="color: rgb(0, 102, 0); font-weight: bold;">(</span><span style="color: rgb(128, 0, 0);">57</span>.<span style="color: rgb(128, 0, 0);">0442</span>, <span style="color: rgb(128, 0, 0);">9</span>.<span style="color: rgb(128, 0, 0);">9116</span><span style="color: rgb(0, 102, 0); font-weight: bold;">)</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; <span style="color: rgb(0, 0, 0); font-weight: bold;">var</span> companyMarker = <span style="color: rgb(0, 0, 0); font-weight: bold;">new</span> google.maps.Marker<span style="color: rgb(0, 102, 0); font-weight: bold;">(</span><span style="color: rgb(0, 102, 0); font-weight: bold;">{</span></div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; position: companyPos,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; map: map,</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; title:<span style="color: rgb(255, 0, 0);">&quot;Some title&quot;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; <span style="color: rgb(0, 102, 0); font-weight: bold;">}</span><span style="color: rgb(0, 102, 0); font-weight: bold;">)</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p>Primero, hemos creado la variable <code>companyPos</code>, donde especificamos la posici&oacute;n del marcador. Luego hemos creado al marcador en s&iacute; utilizando la variable <code>companyMarker</code>.</p>
<h2>Personalizando los marcadores</h2>
<p>Podemos hacer mucho m&aacute;s bonitos nuestros marcadores. Simplemente creemos una imagen en Photoshop con un tama&ntilde;o de 100&times;50 p&iacute;xeles, y creemos algo similar a esto:</p>
<p><img width="100" height="50" class="alignnone size-full wp-image-11106" src="http://www.elwebmaster.com/wp-content/uploads/2009/10/logo.png" alt="logo" /></p>
<p>Luego, creemos una sombra para la imagen:</p>
<p><img width="130" height="50" class="alignnone size-full wp-image-11107" src="http://www.elwebmaster.com/wp-content/uploads/2009/10/logo_shadow.png" alt="logo_shadow" /></p>
<p>Para a&ntilde;adir estas im&aacute;genes como marcadores, tenemos que cambiar el c&oacute;digo del marcador por esto:</p>
<div class="igBar"><span id="lphp-9"><a href="http://www.elwebmaster.com/general/insertar-y-personalizar-google-maps-en-tu-sitio-web#" onclick="javascript:showPlainTxt('php-9'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="php-9">
<div class="php">
<ol>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 0); font-weight: bold;">var</span> companyLogo = <span style="color: rgb(0, 0, 0); font-weight: bold;">new</span> google.maps.MarkerImage<span style="color: rgb(0, 102, 0); font-weight: bold;">(</span><span style="color: rgb(255, 0, 0);">&#8216;images/logo.png&#8217;</span>,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: rgb(0, 0, 0); font-weight: bold;">new</span> google.maps.Size<span style="color: rgb(0, 102, 0); font-weight: bold;">(</span><span style="color: rgb(128, 0, 0);">100</span>,<span style="color: rgb(128, 0, 0);">50</span><span style="color: rgb(0, 102, 0); font-weight: bold;">)</span>,</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: rgb(0, 0, 0); font-weight: bold;">new</span> google.maps.Point<span style="color: rgb(0, 102, 0); font-weight: bold;">(</span><span style="color: rgb(128, 0, 0);">0</span>,<span style="color: rgb(128, 0, 0);">0</span><span style="color: rgb(0, 102, 0); font-weight: bold;">)</span>,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: rgb(0, 0, 0); font-weight: bold;">new</span> google.maps.Point<span style="color: rgb(0, 102, 0); font-weight: bold;">(</span><span style="color: rgb(128, 0, 0);">50</span>,<span style="color: rgb(128, 0, 0);">50</span><span style="color: rgb(0, 102, 0); font-weight: bold;">)</span></div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 102, 0); font-weight: bold;">)</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 0); font-weight: bold;">var</span> companyShadow = <span style="color: rgb(0, 0, 0); font-weight: bold;">new</span> google.maps.MarkerImage<span style="color: rgb(0, 102, 0); font-weight: bold;">(</span><span style="color: rgb(255, 0, 0);">&#8216;images/logo_shadow.png&#8217;</span>,</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: rgb(0, 0, 0); font-weight: bold;">new</span> google.maps.Size<span style="color: rgb(0, 102, 0); font-weight: bold;">(</span><span style="color: rgb(128, 0, 0);">130</span>,<span style="color: rgb(128, 0, 0);">50</span><span style="color: rgb(0, 102, 0); font-weight: bold;">)</span>,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: rgb(0, 0, 0); font-weight: bold;">new</span> google.maps.Point<span style="color: rgb(0, 102, 0); font-weight: bold;">(</span><span style="color: rgb(128, 0, 0);">0</span>,<span style="color: rgb(128, 0, 0);">0</span><span style="color: rgb(0, 102, 0); font-weight: bold;">)</span>,</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: rgb(0, 0, 0); font-weight: bold;">new</span> google.maps.Point<span style="color: rgb(0, 102, 0); font-weight: bold;">(</span><span style="color: rgb(128, 0, 0);">65</span>, <span style="color: rgb(128, 0, 0);">50</span><span style="color: rgb(0, 102, 0); font-weight: bold;">)</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 102, 0); font-weight: bold;">)</span>;</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 0); font-weight: bold;">var</span> companyPos = <span style="color: rgb(0, 0, 0); font-weight: bold;">new</span> google.maps.LatLng<span style="color: rgb(0, 102, 0); font-weight: bold;">(</span><span style="color: rgb(128, 0, 0);">57</span>.<span style="color: rgb(128, 0, 0);">0442</span>, <span style="color: rgb(128, 0, 0);">9</span>.<span style="color: rgb(128, 0, 0);">9116</span><span style="color: rgb(0, 102, 0); font-weight: bold;">)</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 0); font-weight: bold;">var</span> companyMarker = <span style="color: rgb(0, 0, 0); font-weight: bold;">new</span> google.maps.Marker<span style="color: rgb(0, 102, 0); font-weight: bold;">(</span><span style="color: rgb(0, 102, 0); font-weight: bold;">{</span></div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; position: companyPos,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; map: map,</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; icon: companyLogo,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; shadow: companyShadow,</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; title:<span style="color: rgb(255, 0, 0);">&quot;Company Title&quot;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 102, 0); font-weight: bold;">}</span><span style="color: rgb(0, 102, 0); font-weight: bold;">)</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p>La variable <code>companyImage</code> apunta al nombre de la imagen del logo. Luego define el tama&ntilde;o, origen y el tip de la imagen (d&oacute;nde estar&aacute; la imagen a&ntilde;adida a la coordenada). Luego, hacemos exactamente lo mismo para la sombra en la variable <code>companyShadow</code>. En la variable <code>companyMarker</code> a&ntilde;adimos icon y shadow, y listo.</p>
<p>Ahora, si actualizas tu sitio ver&aacute;s que el marcador ha cambiado por tu propio logo. Para a&ntilde;adir m&aacute;s marcadores, sigue simplemente el mismo m&eacute;todo, cambiando los nombres de las variables.</p>
<p>Si tienes dos marcadores muy cerca el uno del otro, quiz&aacute; debas agregar algo de <code>z-index</code>. El marcador con el <code>z-index</code> m&aacute;s alto, es el que m&aacute;s arriba est&aacute;:</p>
<p><img width="147" height="87" class="alignnone size-full wp-image-11108" src="http://www.elwebmaster.com/wp-content/uploads/2009/10/zindex.png" alt="zindex" /></p>
<p>A&ntilde;adir <code>zIndex</code> nos permite seleccionar qu&eacute; marcador debe ir arriba.</p>
<div class="igBar"><span id="lphp-10"><a href="http://www.elwebmaster.com/general/insertar-y-personalizar-google-maps-en-tu-sitio-web#" onclick="javascript:showPlainTxt('php-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="php-10">
<div class="php">
<ol>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 0); font-weight: bold;">var</span> companyMarker = <span style="color: rgb(0, 0, 0); font-weight: bold;">new</span> google.maps.Marker<span style="color: rgb(0, 102, 0); font-weight: bold;">(</span><span style="color: rgb(0, 102, 0); font-weight: bold;">{</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">position: companyPos,</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">map: map,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">icon: companyImage,</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">shadow: companyShadow,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">title:<span style="color: rgb(255, 0, 0);">&quot;H&oslash;genhaug&quot;</span>,</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">zIndex: <span style="color: rgb(128, 0, 0);">4</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 102, 0); font-weight: bold;">}</span><span style="color: rgb(0, 102, 0); font-weight: bold;">)</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<h2>A&ntilde;adiendo cajas de informaci&oacute;n</h2>
<p>Para a&ntilde;adir una descripci&oacute;n de tu compa&ntilde;&iacute;a que aparezca cuando un visitante hace clic en el logo podemos agregar un infobox. Con la API Google Maps esto es f&aacute;cilisimo.</p>
<p><img width="500" height="398" class="alignnone size-full wp-image-11109" src="http://www.elwebmaster.com/wp-content/uploads/2009/10/infobox.png" alt="infobox" /></p>
<p>Peguemos este c&oacute;digo luego de definir la variable map:</p>
<div class="igBar"><span id="lphp-11"><a href="http://www.elwebmaster.com/general/insertar-y-personalizar-google-maps-en-tu-sitio-web#" onclick="javascript:showPlainTxt('php-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="php-11">
<div class="php">
<ol>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 0); font-weight: bold;">var</span> contentString = <span style="color: rgb(255, 0, 0);">&#8216;&lt;div id=&quot;content&quot;&gt;&#8217;</span>+</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: rgb(255, 0, 0);">&#8216;&lt;div id=&quot;siteNotice&quot;&gt;&#8217;</span>+</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: rgb(255, 0, 0);">&#8216;&lt;/div&gt;&#8217;</span>+</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: rgb(255, 0, 0);">&#8216;&lt;h1 id=&quot;firstHeading&quot; class=&quot;firstHeading&quot;&gt;H&oslash;genhaug&lt;/h1&gt;&#8217;</span>+</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: rgb(255, 0, 0);">&#8216;&lt;div id=&quot;bodyContent&quot;&gt;&#8217;</span>+</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: rgb(255, 0, 0);">&#8216;&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.&lt;/p&gt;&#8217;</span>+</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: rgb(255, 0, 0);">&#8216;&lt;/div&gt;&#8217;</span>+</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: rgb(255, 0, 0);">&#8216;&lt;/div&gt;&#8217;</span>;</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 0); font-weight: bold;">var</span> infowindow = <span style="color: rgb(0, 0, 0); font-weight: bold;">new</span> google.maps.InfoWindow<span style="color: rgb(0, 102, 0); font-weight: bold;">(</span><span style="color: rgb(0, 102, 0); font-weight: bold;">{</span></div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp; &nbsp; content: contentString</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 102, 0); font-weight: bold;">}</span><span style="color: rgb(0, 102, 0); font-weight: bold;">)</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p>Para hacer que las cajas de informaci&oacute;n aparezcan al hacer clic en nuestro logo, simplemente debemos a&ntilde;adir este c&oacute;digo justo antes del &uacute;ltimo } en la funci&oacute;n <code>initialize()</code>:</p>
<div class="igBar"><span id="lphp-12"><a href="http://www.elwebmaster.com/general/insertar-y-personalizar-google-maps-en-tu-sitio-web#" onclick="javascript:showPlainTxt('php-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="php-12">
<div class="php">
<ol>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">google.maps.event.addListener<span style="color: rgb(0, 102, 0); font-weight: bold;">(</span>companyMarker, <span style="color: rgb(255, 0, 0);">&#8216;click&#8217;</span>, <span style="color: rgb(0, 0, 0); font-weight: bold;">function</span><span style="color: rgb(0, 102, 0); font-weight: bold;">(</span><span style="color: rgb(0, 102, 0); font-weight: bold;">)</span> <span style="color: rgb(0, 102, 0); font-weight: bold;">{</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">infowindow.open<span style="color: rgb(0, 102, 0); font-weight: bold;">(</span>map,companyMarker<span style="color: rgb(0, 102, 0); font-weight: bold;">)</span>;</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 102, 0); font-weight: bold;">}</span><span style="color: rgb(0, 102, 0); font-weight: bold;">)</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p>Para hacer un poco m&aacute;s bonita la caja de informaci&oacute;n, a&ntilde;adamos algo de estilo en nuestra hoja de estilos:</p>
<div class="igBar"><span id="lcss-13"><a href="http://www.elwebmaster.com/general/insertar-y-personalizar-google-maps-en-tu-sitio-web#" onclick="javascript:showPlainTxt('css-13'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="css-13">
<div class="css">
<ol>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">body <span style="color: rgb(102, 204, 102);">{</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 0); font-weight: bold;">font-family</span>: Helvetica, Arial, <span style="color: rgb(153, 51, 51);">sans-serif</span>;</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 0); font-weight: bold;">font-size</span>:10pt;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(102, 204, 102);">}</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>Y ah&iacute; lo tienen. Un Google Map bonito y f&aacute;cilmente a&ntilde;adido en tu sitio web o blog.</p>
<h2>Descarga</h2>
<p>Para descargar los archivos de muestra hagan <a href="http://dl.getdropbox.com/u/32709/googlemaps.zip" target="_blank">clic aqu&iacute;</a>.</p>
<p>Fuente: <a href="http://stiern.com/tutorials/adding-custom-google-maps-to-your-website" target="_blank">Stiern</a></p>
]]></content:encoded>
			<wfw:commentRss>http://smultron.es/2009/11/google-maps-api-personaliza-tu-mapa/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Seguir una llamada a sistema concreta con strace</title>
		<link>http://smultron.es/2009/10/seguir-una-llamada-a-sistema-concreta-con-strace/</link>
		<comments>http://smultron.es/2009/10/seguir-una-llamada-a-sistema-concreta-con-strace/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 08:24:17 +0000</pubDate>
		<dc:creator>NEO</dc:creator>
				<category><![CDATA[copy&page]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[sistema]]></category>

		<guid isPermaLink="false">http://smultron.es/?p=4577</guid>
		<description><![CDATA[&#160; Copy&#38;Page: http://systemadmin.es/2009/09/seguir-una-llamada-a-sistema-concreta-con-strace Cuando se deben resolver problemas extra&#241;os con el sistema se suele recurrir a strace para ver que esta ocurriendo. El principal inconveniente de strace es que da mucha informaci&#243;n, lo cual puede llegar a despistar m&#225;s que ayudar. Vamos a ver como seguir una llamada concreta al sistema. Mediante el par&#225;metro -e [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p>Copy&amp;Page: http://systemadmin.es/2009/09/seguir-una-llamada-a-sistema-concreta-con-strace</p>
<p><span id="more-4577"></span></p>
<p>Cuando se deben resolver problemas extra&ntilde;os con el sistema se suele recurrir a <strong>strace</strong> para ver que esta ocurriendo. El principal inconveniente de <strong>strace</strong> es que da mucha informaci&oacute;n, lo cual puede llegar a despistar m&aacute;s que ayudar. Vamos a ver como seguir una llamada concreta al sistema.</p>
<p><!-- more --></p>
<p>Mediante el par&aacute;metro <strong>-e</strong> podemos indicar una expresi&oacute;n que filtre las llamadas que queremos ver. Por ejemplo, si queremos ver solo las llamadas a la funci&oacute;n <strong>open</strong> usar&iacute;amos como par&aacute;metro <strong>trace=open</strong>. El comando completo ser&iacute;a:</p>
<pre>
# strace -s 128 -fF -e trace=open ls
open(&quot;/etc/ld.so.cache&quot;, O_RDONLY)      = 3
open(&quot;/lib64/librt.so.1&quot;, O_RDONLY)     = 3
open(&quot;/lib64/libacl.so.1&quot;, O_RDONLY)    = 3
open(&quot;/lib64/libc.so.6&quot;, O_RDONLY)      = 3
open(&quot;/lib64/libpthread.so.0&quot;, O_RDONLY) = 3
open(&quot;/lib64/libattr.so.1&quot;, O_RDONLY)   = 3
open(&quot;/lib64/libdl.so.2&quot;, O_RDONLY)     = 3
open(&quot;/lib64/libsepol.so.1&quot;, O_RDONLY)  = 3
open(&quot;/proc/mounts&quot;, O_RDONLY)          = 3
open(&quot;/usr/lib/locale/locale-archive&quot;, O_RDONLY) = 3
open(&quot;.&quot;, O_RDONLY|O_NONBLOCK|O_DIRECTORY) = 3
index.php
</pre>
<p>Tambi&eacute;n podemos definir un conjunto de llamadas separadas por comas:</p>
<pre>
# strace -s 128 -fF -e trace=open,close ls
open(&quot;/etc/ld.so.cache&quot;, O_RDONLY)      = 3
close(3)                                = 0
open(&quot;/lib64/librt.so.1&quot;, O_RDONLY)     = 3
close(3)                                = 0
open(&quot;/lib64/libacl.so.1&quot;, O_RDONLY)    = 3
close(3)                                = 0                           = 0
open(&quot;/lib64/libc.so.6&quot;, O_RDONLY)      = 3
close(3)                                = 0
open(&quot;/lib64/libpthread.so.0&quot;, O_RDONLY) = 3
close(3)                                = 0
open(&quot;/lib64/libattr.so.1&quot;, O_RDONLY)   = 3
close(3)                                = 0
open(&quot;/lib64/libdl.so.2&quot;, O_RDONLY)     = 3
close(3)                                = 0
open(&quot;/lib64/libsepol.so.1&quot;, O_RDONLY)  = 3
close(3)                                = 0                            = 0
open(&quot;/proc/mounts&quot;, O_RDONLY)          = 3
close(3)                                = 0
open(&quot;/usr/lib/locale/locale-archive&quot;, O_RDONLY) = 3
close(3)                                = 0
open(&quot;.&quot;, O_RDONLY|O_NONBLOCK|O_DIRECTORY) = 3
close(3)                                = 0
index.php
close(1)                                = 0
</pre>
<p>Podemos incluso definir <strong>filtros inversos</strong>, es decir, ver todas las llamadas al sistema excepto una o un conjunto indicando una admiraci&oacute;n (<strong>!</strong>) para indicar la negaci&oacute;n del <strong>filtro</strong>. Por ejemplo, para ver todas las llamadas excepto <strong>open</strong> y <strong>close</strong> usar&iacute;amos el filtro &ldquo;<strong>trace=!open,close</strong>&ldquo;:</p>
<pre>
# strace -s 128 -fF -e 'trace=!open,close' ls
execve(&quot;/bin/ls&quot;, [&quot;ls&quot;], [/* 25 vars */]) = 0
brk(0)                                  = 0x127c3000
uname({sys=&quot;Linux&quot;, node=&quot;maria.grupointercom.com&quot;, ...}) = 0
access(&quot;/etc/ld.so.preload&quot;, R_OK)      = -1 ENOENT (No such file or directory)
fstat(3, {st_mode=S_IFREG|0644, st_size=39087, ...}) = 0
read(3, &quot;\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0&gt;\0\1\0\0\0 \&quot;`&lt;2\0\0\0@\0\0\0\0\0\0\0\10\307\0\0\0\0\0\0\0\0\0\0@\0008\0\t\0@\0'\0&amp;\0\6\0\0\0\5\0\0\0@\0\0\0\0\0\0\0@\0`&lt;2\0\0\0@\0`&lt;2\0\0\0\370\1\0\0\0\0\0\0\370\1\0\0\0\0\0\0\10\0\0\0\0\0\0\0\3\0\0\0\4\0\0\0&quot;..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=53448, ...}) = 0
mprotect(0x323c607000, 2097152, PROT_NONE) = 0
read(3, &quot;\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0&gt;\0\1\0\0\0\0\31 \2234\0\0\0@\0\0\0\0\0\0\0(f\0\0\0\0\0\0\0\0\0\0@\0008\0\5\0@\0\35\0\34\0\1\0\0\0\5\0\0\0\0\0\0\0\0\0\0\0\0\0 \2234\0\0\0\0\0 \2234\0\0\0004Y\0\0\0\0\0\0004Y\0\0\0\0\0\0\0\0 \0\0\0\0\0\1\0\0\0\6\0\0\0&quot;..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=28008, ...}) = 0
(...)
</pre>
<p><!-- Social Bookmarking Reloaded BEGIN --></p>
]]></content:encoded>
			<wfw:commentRss>http://smultron.es/2009/10/seguir-una-llamada-a-sistema-concreta-con-strace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Expresiones regulares para VIM</title>
		<link>http://smultron.es/2009/09/expresiones-regulares-para-vim/</link>
		<comments>http://smultron.es/2009/09/expresiones-regulares-para-vim/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 16:49:22 +0000</pubDate>
		<dc:creator>NEO</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://smultron.es/?p=4483</guid>
		<description><![CDATA[&#160; Copy&#38;Page:http://www.geocities.com/volontir/ &#160; &#169; WebRing Inc. The Vi IMproved Editor Web Ring &#60;&#60; Prev &#124; Ring Hub &#124; Join &#124; Rate&#124; Next &#62;&#62; &#160; &#60;center&#62; &#60;table width=&#34;75%&#34; cellpadding=2 cellspacing=0&#62; &#60;tr valign=bottom&#62;&#60;td&#62; &#60;table bgcolor=990066 border=0 width=&#34;75%&#34;&#62;&#60;tr&#62;&#60;td&#62; &#60;table bgcolor=eeeeee cellpadding=6 cellspacing=0 border=0 width=&#34;100%&#34;&#62;&#60;tr&#62;&#60;td align=center&#62; &#60;font face=arial size=-1&#62;This site is a member of WebRing. To browse visit&#60;/font&#62;&#60;br&#62;&#60;font face=arial [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p>Copy&amp;Page:http://www.geocities.com/volontir/</p>
<p><span id="more-4483"></span></p>
<table border="0" width="636">
<tbody>
<tr>
<td width="29">&nbsp;</td>
<td width="597" colspan="2">
            <script src="http://ss.webring.com/navbar?f=j&amp;y=oleg66&amp;u=10002161" language="javascript" type="text/javascript">
</script></p>
<table cellspacing="0" cellpadding="0" border="0" align="center" width="160">
<tbody>
<tr>
<td><center><!--vim--><br />
<style type="text/css"><!--.st1 {color: blue;}.st2 {color: black; text-decoration: none;}--></style>
<table cellspacing="0" cellpadding="2" bordercolor="#990066" border="1" width="470">
<tbody>
<tr>
<td nowrap="nowrap">
<table cellspacing="0" cellpadding="1" border="0" bgcolor="#eeeeee" width="470">
<tbody>
<tr>
<td nowrap="nowrap" width="1%"><a target="_top" href="http://u.webring.com/t/The-Vi-IMproved-Editor-Web-Ring?sid=8"><img height="50" border="0" width="35" alt="The Vi IMproved Editor Web Ring" src="http://mywebpage.netscape.com/pottsdl1/gifs/vim_gindikin_vim_on_fire.gif" /></a><font face="arial" size="-2"><br />
                                                <span class="st2">&copy; </span><a href="http://www.webring.com/"><span class="st1">WebRing Inc.</span></a></font></td>
<td nowrap="nowrap">
<table cellspacing="2" cellpadding="0" border="0" width="100%">
<tbody>
<tr>
<td nowrap="nowrap"><a target="_top" href="http://u.webring.com/t/The-Vi-IMproved-Editor-Web-Ring?sid=8"><span class="st2"><b>The Vi IMproved Editor Web Ring</b></span></a></td>
</tr>
<tr>
<td nowrap="nowrap" colspan="2"><span class="st2"><b><a title="visit previous site in The Vi IMproved Editor Web Ring" target="_top" href="http://u.webring.com/go?ring=vim;sid=8;id=8;prev"><span class="st1">&lt;&lt; Prev</span></a></b> | <a target="_top" href="http://u.webring.com/t/The-Vi-IMproved-Editor-Web-Ring?sid=8"><span title="visit The Vi IMproved Editor Web Ring community pages" class="st1">Ring Hub</span></a> | <a title="join The Vi IMproved Editor Web Ring communiy" target="_top" href="http://u.webring.com/wrman?ring=vim;sid=8;addsite"><span class="st1">Join</span></a> | <b><a title="Rate this site" target="_top" href="http://u.webring.com/go?ring=vim;sid=8;id=8;prvw"><span class="st1">Rate</span></a></b>| <b><a title="go to next site in The Vi IMproved Editor Web Ring" target="_top" href="http://u.webring.com/go?ring=vim;sid=8;id=8;next"><span class="st1">Next &gt;&gt;</span></a></b> </span></td>
</tr>
<tr>
<form action="http://U.webring.com/cgi-bin/Hubsearch?ringsearch" method="post">
                                                                &nbsp;<br />
                                                            </form>
<td nowrap="nowrap" colspan="2">
<input type="text" style="height: 19px;" size="18" name="query" />
<input type="submit" style="height: 19px;" value="Search" name="Submit" />
<input type="hidden" value="vim" name="ring" /></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p>                        </center></td>
</tr>
</tbody>
</table>
<p>            <noscript>&lt;center&gt; &lt;table width=&quot;75%&quot; cellpadding=2 cellspacing=0&gt; &lt;tr valign=bottom&gt;&lt;td&gt; &lt;table bgcolor=990066 border=0 width=&quot;75%&quot;&gt;&lt;tr&gt;&lt;td&gt; &lt;table bgcolor=eeeeee cellpadding=6 cellspacing=0 border=0 width=&quot;100%&quot;&gt;&lt;tr&gt;&lt;td align=center&gt; &lt;font face=arial size=-1&gt;This site is a member of WebRing.  To browse visit&lt;/font&gt;&lt;br&gt;&lt;font face=arial size=-2&gt; &lt;a href=&quot;http://ss.webring.com/navbar?f=l&amp;y=oleg66&amp;u=10002161&quot;&gt; http://ss.webring.com/navbar?f=l&amp;y=oleg66&amp;u=10002161 &lt;/a&gt;&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/center&gt;</noscript></td>
</tr>
<tr>
<td class="title" colspan="3"><img height="75" width="524" src="http://www.geocities.com/volontir/images/regex-title.gif" alt="" /></td>
</tr>
<tr>
<td class="title" colspan="3">
<table height="20" cellspacing="2" cellpadding="2" border="0" width="556" class="buttonbar">
<tbody>
<tr>
<td><a href="http://www.geocities.com/volontir/#news">news</a></td>
<td>
<ul>
<li><a href="http://www.geocities.com/volontir/#intro">&nbsp;intro</a></li>
</ul>
</td>
<td>
<ul>
<li><a href="http://www.geocities.com/volontir/#substitute">&nbsp;substitute</a></li>
</ul>
</td>
<td>
<ul>
<li><a href="http://www.geocities.com/volontir/#global">&nbsp;global</a></li>
</ul>
</td>
<td>
<ul>
<li><a href="http://www.geocities.com/volontir/#pattern">&nbsp;patterns</a></li>
</ul>
</td>
<td>
<ul>
<li><a href="http://www.geocities.com/volontir/#examples">&nbsp;examples</a></li>
</ul>
</td>
<td nowrap="nowrap">
<ul>
<li><a href="http://www.geocities.com/volontir/#compare">other flavors</a></li>
</ul>
</td>
<td>
<ul>
<li>&nbsp;<a href="http://www.geocities.com/volontir/#links">links</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
<tr>
<td colspan="3">
<h1>Contents</h1>
</td>
</tr>
<tr>
<td width="29">&nbsp;</td>
<td width="597" colspan="2">
<p><a class="majorhead" href="http://www.geocities.com/volontir/#news">I. News</a><br />
            <a class="majorhead" href="http://www.geocities.com/volontir/#intro">II. Introduction</a><br />
            <a href="http://www.geocities.com/volontir/#whatisvim" class="minorhead">2.1 What is VIM?</a><br />
            <a href="http://www.geocities.com/volontir/#about" class="minorhead">2.2 About this Tutorial</a><br />
            <a href="http://www.geocities.com/volontir/#credits" class="minorhead">2.3 Credits</a><br />
            <a class="majorhead" href="http://www.geocities.com/volontir/#substitute">III. Substitute Command</a><br />
            <a href="http://www.geocities.com/volontir/#substitute" class="minorhead">3.1 Search &amp; Replace</a><br />
            <a href="http://www.geocities.com/volontir/#address" class="minorhead">3.2 Line Ranges &amp; Addressing</a><br />
            <a class="majorhead" href="http://www.geocities.com/volontir/#pattern">IV. Pattern Description </a><br />
            <a href="http://www.geocities.com/volontir/#anchors" class="minorhead">4.1 Anchors</a><br />
            <a href="http://www.geocities.com/volontir/#metacharacters" class="minorhead">4.2 &quot;Escaped&quot; characters          or metacharacters</a><br />
            <a href="http://www.geocities.com/volontir/#Non-Greedy" class="minorhead">4.3 Quantifiers, Greedy and Non-Greedy</a><br />
            <a href="http://www.geocities.com/volontir/#ranges" class="minorhead">4.4 Character ranges</a><br />
            <a href="http://www.geocities.com/volontir/#backreferences" class="minorhead">4.5 Grouping and Backreferences</a><br />
            <a href="http://www.geocities.com/volontir/#alternations" class="minorhead">4.6 Alternations</a><br />
            <a href="http://www.geocities.com/volontir/#precedence" class="minorhead">4.7 Operator Precedence</a><br />
            <a class="majorhead" href="http://www.geocities.com/volontir/#global">V. Global Command</a><br />
            <a href="http://www.geocities.com/volontir/#global%20search" class="minorhead">5.1 Global search and execution</a><br />
            <a href="http://www.geocities.com/volontir/#global%20examples" class="minorhead">5.2 Examples</a><br />
            <a class="majorhead" href="http://www.geocities.com/volontir/#examples">VI. Examples</a><br />
            <a href="http://www.geocities.com/volontir/#tips" class="minorhead">6.1 Tips &amp; Techniques</a><br />
            <a href="http://www.geocities.com/volontir/#contents" class="minorhead">6.2 Creating Outline</a><br />
            <a href="http://www.geocities.com/volontir/#tables" class="minorhead">6.3 Working with Tables</a><br />
            <a class="majorhead" href="http://www.geocities.com/volontir/#compare">VII. Other Regexp Flavors</a><br />
            <a class="majorhead" href="http://www.geocities.com/volontir/#links">VIII. Links</a></p>
</td>
</tr>
<tr>
<td colspan="3">
<h1><a name="news">I. News</a></h1>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="2">
<ul>
<li>Finally, I&#8217;ve moved this page from City College&#8217;s physlab server,            which is no longer maintained.</li>
<li>VIM 6.0 is now official. A lot of changes and new features were introduced.            I&#8217;ll try to bring this page in a line with the current VIM version.</li>
<li>I no longer support the VIM reference guide. <a href="mailto:sheffner@web.de"><b>Stephan            Heffner</b></a> has voluntereed to update the guide.</li>
</ul>
</td>
</tr>
<tr>
<td colspan="3">
<h1><a name="intro">II. Introduction</a></h1>
</td>
</tr>
<tr>
<td colspan="3">
<h2><a name="whatisvim">2.1 What is VIM?</a></h2>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="2">
<p>Vim is an improved (in many ways) version of vi, a ubiquitous text editor          found on any UNIX system. VIM was created by <a href="http://www.geocities.com/volontir/images/photos/nyc/pics/linux-bram.jpg">Bram          Moolenaar</a> with a help of other people. It&#8217;s free but if you like it          you can make a charitable contribution to orphans in Uganda.</p>
<p>Vim has its own web site, <a href="http://www.vim.org/"><b>www.vim.org</b></a>          and several <a href="http://www.vim.org/mail.html">mailing lists</a>,          with a wealth of information on every aspect of VIM. Vim was successfully          ported to nearly all existing OS. It is a default editor in many Linux          distributions (e.g. RedHat).</p>
<p>VIM has all features of a modern programmer&#8217;s editor &#8211; macro language,          syntax highlighting, customizable user interface, easy integration with          various IDEs plus a set of features which makes VIM so attractive to its          users: crash recovery, automatic commands, session management.</p>
<p>VIM has a very broad and loyal user base. Over 10 million people have          it installed (counting only Linux users). Estimation is that there are          about half a million people using Vim as their main editor. And this number          is growing.</p>
</td>
</tr>
<tr>
<td colspan="3">
<h2><a name="about">2.2 About this Tutorial</a></h2>
</td>
</tr>
<tr>
<td width="29">&nbsp;</td>
<td width="597" colspan="2">
<p>I started this tutorial for one simple reason &#8211; I like regular expressions.          Nothing compares to the satisfaction from a well-crafted regexp which          does exactly what you wanted it to do :-). I hope it&#8217;s passable as a foreword.</p>
<p>Speaking more seriously, regular expressions (or regexps for short) are          tools used to manipulate text and data. They don&#8217;t exist as a standalone          product but usually are a part of some program/utility. The best known          example is UNIX<i> grep, </i>a program to search files for lines that          match certain pattern. The search pattern is described in terms of <i>regular          expressions. </i>You can think of regexps as a specialized pattern language.          Regexps are quite useful and can greatly reduce time it takes to do some          tedious text editing.</p>
<p>(Regexp terminology is largely borrowed from Jeffrey Friedl &quot;Mastering          Regular Expressions.&quot;)</p>
</td>
</tr>
<tr>
<td colspan="3">
<h2><a name="credits">2.3 Credits</a></h2>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="2">
<p>Many thanks (in no particular order): Benji Fisher, Zdenek Sekera, Preben          &quot;Peppe&quot; Guldberg, Steve Kirkendall, Shaul Karl and all others          who helped me with their comments.</p>
<p>Feel free to send me (<a href="mailto:volontir%20at%20yahoo%20dot%20com"><img border="0" align="absbottom" src="http://www.geocities.com/volontir/images/email.gif" alt="" /></a><b>volontir          at yahoo dot com</b>) your comments. suggestions, examples&#8230;</p>
</td>
</tr>
<tr>
<td colspan="3">
<h1><a name="substitute">III. Substitute Command</a></h1>
</td>
</tr>
<tr>
<td width="29">&nbsp;</td>
<td width="597" colspan="2">
<h2><a name="replace">3.1 Search &amp; Replace</a></h2>
<p>So, what can you do with regular expressions? The most common task is          to make replacements in a text following some certain rules. For this          tutorial you need to know VIM search and replace command (S&amp;R) <code>:substitute</code>.          Here is an excerpt from VIM help:</p>
<table cellspacing="3" class="vimdoc">
<tbody>
<tr>
<td colspan="2"><b>:<i>range</i> s[ubstitute]/<i>pattern</i>/<i>string</i>/cgiI</b></td>
</tr>
<tr>
<td colspan="2">For each line in<b> <i>the range</i></b> replace a match              of <i><b>the pattern</b></i> with <i><b>the string</b></i> where:</td>
</tr>
<tr>
<td width="44">
<div align="center"><b>c</b></div>
</td>
<td width="551">Confirm each substitution</td>
</tr>
<tr>
<td width="44">
<div align="center"><b>g</b></div>
</td>
<td width="551">Replace all occurrences in the line (without <b>g </b>-              only first).</td>
</tr>
<tr>
<td width="44">
<div align="center"><b>i</b></div>
</td>
<td height="19" width="551">Ignore case for the pattern.</td>
</tr>
<tr>
<td width="44">
<div align="center"><b>I </b></div>
</td>
<td width="551">Don&#8217;t ignore case for the pattern.</td>
</tr>
</tbody>
</table>
<p>Part of the command word enclosed in the &quot;[&quot; &amp; &quot;]&quot;          can be omitted.</p>
<h2><a name="address">3.2 Range of Operation, Line Addressing and Marks</a></h2>
<p>Before I begin with a pattern description let&#8217;s talk about line addresses          in Vim. Some Vim commands can accept a line range in front of them. By          specifying the line range you restrict the command execution to this particular          part of text only. Line range consists of one or more line specifiers,          separated with a comma or semicolon. You can also mark your current position          in the text typing <code>m<i>l</i></code> , where <i>&quot;l&quot;</i>          can be any letter, and use it later defining the line address.</p>
<table cellspacing="3" width="585" class="vimdoc">
<tbody>
<tr>
<td>
<div align="center"><b>Specifier</b></div>
</td>
<td>
<div align="center"><b>Description</b></div>
</td>
</tr>
<tr>
<td>
<div align="center"><b><i>number</i></b></div>
</td>
<td>an absolute line number</td>
</tr>
<tr>
<td>
<div align="center"><b>. </b></div>
</td>
<td>the current line</td>
</tr>
<tr>
<td>
<div align="center"><b>$</b></div>
</td>
<td>the last line in the file</td>
</tr>
<tr>
<td>
<div align="center"><b>%</b></div>
</td>
<td>the whole file. The same as <b>1,$</b></td>
</tr>
<tr>
<td>
<div align="center"><b>&#8216;<i>t </i></b></div>
</td>
<td>position of mark &quot;t&quot;</td>
</tr>
<tr>
<td>
<div align="center"><b>/<i>pattern</i>[/]</b></div>
</td>
<td>the next line where text<i> &quot;pattern</i>&quot; matches.</td>
</tr>
<tr>
<td>
<div align="center"><b> ?<i>pattern</i>[?] </b></div>
</td>
<td>the previous line where text &quot;<i>pattern</i>&quot; matches</td>
</tr>
<tr>
<td>
<div align="center"><b>\/ </b></div>
</td>
<td>the next line where the previously used search pattern matches</td>
</tr>
<tr>
<td>
<div align="center"><b>\?</b></div>
</td>
<td>the previous line where the previously used search pattern matches</td>
</tr>
<tr>
<td>
<div align="center"><b>\&amp;</b></div>
</td>
<td>the next line where the previously used substitute pattern matches</td>
</tr>
</tbody>
</table>
<p>If no line range is specified the command will operate on the current          line only.</p>
<p>Here are a few examples:</p>
<p><code>10,20 </code></p>
<p>- from 10 to 20 line.</p>
<p>Each may be followed (several times) by &quot;+&quot; or &quot;-&quot;          and an optional number. This number is added or subtracted from the preceding          line number. If the number is omitted, 1 is used.</p>
<p class="pattern"><code>/Section 1/+,/Section 2/-</code></p>
<p>- all lines between <span class="pattern">Section 1</span> and <span class="pattern">Section          2</span>, non-inclusively, i.e. the lines containing <span class="pattern">Section          1</span> and <span class="pattern">Section 2</span> will not be affected.</p>
<p>The <code>/<i>pattern</i>/</code> and <code>?<i>pattern</i>?</code> may          be followed by another address separated by a semicolon. A semicolon between          two search patterns tells Vim to find the location of the first pattern,          then start searching from that location for the second pattern.</p>
<p><code>/Section 1/;/Subsection/-,/Subsection/+</code></p>
<p>- first find <span class="pattern">Section 1</span>, then the first line          with <span class="pattern">Subsection</span>, step one line down (beginning          of the range) and find the next line with <span class="pattern">Subsection</span>,          step one line up (end of the range).</p>
<p>The next example shows how you can reuse you search pattern:</p>
<p><code>:/Section/+ y</code></p>
<p>- this will search for the <span class="pattern">Section</span> line          and yank (copy) one line after into the memory.</p>
<p><code>:// normal p</code></p>
<p>- and that will search for the next <span class="pattern">Section</span>          line and put (paste) the saved text on the next line.</p>
</td>
</tr>
<tr>
<td width="29">&nbsp;</td>
<td width="597" colspan="2">
<div class="tip">
<p><b>Tip 1:</b> frequently you need to do S&amp;R in a text which contains            UNIX file paths &#8211; text strings with slashes (&quot;/&quot;) inside.            Because S&amp;R command uses slashes for pattern/replacement separation            you have to escape every slash in your pattern, i.e. use &quot;\/&quot;            for every &quot;/&quot; in your pattern:</p>
<p><code>s/\/dir1\/dir2\/dir3\/file/dir4\/dir5\/file2/g</code></p>
<p>To avoid this so-called &quot;backslashitis&quot; you can use different            separators in S&amp;R (I prefer &quot;:&quot;)</p>
<p><code>s:/dir1/dir2/dir3/file:/dir4/dir5/file2:g</code></p>
<p><b>Tip 2:</b> You may find these mappings useful (put them in your            <b>.vimrc</b> file)</p>
<p><code>noremap ;; :%s:::g&lt;Left&gt;&lt;Left&gt;&lt;Left&gt;<br />
            noremap ;' :%s:::cg&lt;Left&gt;&lt;Left&gt;&lt;Left&gt;&lt;Left&gt;</code></p>
<p>These mappings save you some keystrokes and put you where you start            typing your search pattern. After typing it you move to the replacement            part , type it and hit return. The second version adds confirmation            flag.</p>
</p></div>
</td>
</tr>
<tr>
<td colspan="3">
<h1><a name="pattern">IV. Pattern Description</a></h1>
</td>
</tr>
<tr>
<td width="29">&nbsp;</td>
<td width="597" colspan="2">
<h2><a name="anchors">4.1 Anchors</a></h2>
<p>Suppose you want to replace all occurrences of <span class="pattern">vi</span>          with <span class="pattern">VIM</span>. This can be easily done with</p>
<p><code>s/vi/VIM/g</code></p>
<p>If you&#8217;ve tried this example then you, no doubt, noticed that <span class="pattern">VIM</span>          replaced all occurrences of <span class="pattern">vi</span> even if it&#8217;s          a part of the word (e.g. na<span class="match">vi</span>gator). If we          want to be more specific and replace only whole words <span class="pattern">vi</span>          then we need to correct our pattern. We may rewrite it by putting spaces          around <span class="pattern">vi</span>:</p>
<p><code>s: vi : VIM :g</code></p>
<p>But it will still miss <span class="pattern">vi</span> followed by the          punctuation or at the end of the line/file. The right way is to put special          word boundary symbols &quot;<code>\&lt;</code>&quot; and &quot;<code>\&gt;</code>&quot;          around <span class="pattern">vi</span>.</p>
<p><code>s:\&lt;vi\&gt;:VIM:g</code></p>
<p>The beginning and the end of the line have their own special anchors          &#8211; &quot;<code>^</code>&quot; and &quot;<code>$</code>&quot;, respectively.          So, for all <span class="pattern">vi</span> only at the start of the line:</p>
<p><code>s:^vi\&gt;:VIM:</code></p>
<p>To match the lines where <span class="pattern">vi</span> is the only          word:</p>
<p><code>s:^vi$:VIM:</code></p>
<p>Now suppose you want to replace not only all <span class="pattern">vi</span>          but also <span class="pattern">Vi</span> and <span class="pattern">VI</span>.          There are several ways to do this:</p>
<ul>
<li>probably the simplest way is to put &quot;i&quot; &#8211; ignore case in            a pattern <code>%s:vi:VIM:gi</code></li>
<li>define a class of characters. This is a sequence of characters enclosed            by square brackets &quot;[&quot; and &quot;]&quot;. It matches any character            from this set. So <code>:%s:[Vv]i:VIM:</code> will match <span class="pattern">vi</span>            and <span class="pattern">Vi</span>. More on character ranges in the            following <a href="http://www.geocities.com/volontir/#ranges">section</a>.</li>
</ul>
</td>
</tr>
<tr>
<td width="29">&nbsp;</td>
<td width="597" colspan="2">
<h2><a name="metacharacters">4.2 &quot;Escaped&quot; characters or metacharacters</a></h2>
<p>So far our pattern strings were constructed from normal or <i><b>literal          </b></i>text characters. The power of regexps is in the use of <i><b>metacharacters</b>.          </i>These are types of characters which have special meaning inside the          search pattern. With a few exceptions these metacharacters are distinguished          by a &quot;magic&quot; backslash in front of them. The table below lists          some common VIM metacharacters.</p>
<table cellspacing="3" class="vimdoc">
<tbody>
<tr>
<th width="43">
<div align="center"><b>#</b></div>
</th>
<th width="245">
<div align="center"><b>Matching</b></div>
</th>
<th width="46">
<div align="center"><b>#</b></div>
</th>
<th width="225">
<div align="center"><b>Matching</b></div>
</th>
</tr>
<tr>
<td width="43">
<div align="center"><b>.</b></div>
</td>
<td width="245">any character except new line</td>
<td width="46">&nbsp;</td>
<td width="225">&nbsp;</td>
</tr>
<tr>
<td width="43">
<div align="center"><b>\s</b></div>
</td>
<td width="245">whitespace character</td>
<td width="46">
<div align="center"><b>\S</b></div>
</td>
<td width="225">non-whitespace character</td>
</tr>
<tr>
<td width="43">
<div align="center"><b>\d</b></div>
</td>
<td width="245">digit</td>
<td width="46">
<div align="center"><b>\D</b></div>
</td>
<td width="225">non-digit</td>
</tr>
<tr>
<td width="43">
<div align="center"><b>\x</b></div>
</td>
<td width="245">hex digit</td>
<td width="46">
<div align="center"><b>\X</b></div>
</td>
<td width="225">non-hex digit</td>
</tr>
<tr>
<td width="43">
<div align="center"><b>\o</b></div>
</td>
<td width="245">octal digit</td>
<td width="46">
<div align="center"><b>\O</b></div>
</td>
<td width="225">non-octal digit</td>
</tr>
<tr>
<td width="43">
<div align="center"><b>\h</b></div>
</td>
<td width="245">head of word character (a,b,c&#8230;z,A,B,C&#8230;Z and _)</td>
<td width="46">
<div align="center"><b>\H</b></div>
</td>
<td width="225">non-head of word character</td>
</tr>
<tr>
<td width="43">
<div align="center"><b>\p</b></div>
</td>
<td width="245">printable character</td>
<td width="46">
<div align="center"><b>\P</b></div>
</td>
<td width="225">like <b>\p</b>, but excluding digits</td>
</tr>
<tr>
<td width="43">
<div align="center"><b>\w</b></div>
</td>
<td width="245">word character</td>
<td width="46">
<div align="center"><b>\W</b></div>
</td>
<td width="225">non-word character</td>
</tr>
<tr>
<td width="43">
<div align="center"><b>\a</b></div>
</td>
<td width="245">alphabetic character</td>
<td width="46">
<div align="center"><b>\A</b></div>
</td>
<td width="225">non-alphabetic character</td>
</tr>
<tr>
<td width="43">
<div align="center"><b>\l</b></div>
</td>
<td width="245">lowercase character</td>
<td width="46">
<div align="center"><b>\L</b></div>
</td>
<td width="225">non-lowercase character</td>
</tr>
<tr>
<td width="43">
<div align="center"><b>\u</b></div>
</td>
<td width="245">uppercase character</td>
<td width="46">
<div align="center"><b>\U</b></div>
</td>
<td width="225">non-uppercase character</td>
</tr>
</tbody>
</table>
<p>So, to match a date like 09/01/2000 you can use (assuming you don&#8217;t use          &quot;/&quot; as a separator in the S&amp;R)<code> </code></p>
<p><code>\d\d/\d\d/\d\d\d\d</code></p>
<p>To match 6 letter word starting with a capital letter</p>
<p><code>\u\w\w\w\w\w</code></p>
<p>Obviously, it is not very convenient to write <code>\w</code> for any          character in the pattern &#8211; what if you don&#8217;t know how many letters in          your word? This can be helped by introducing so-called <i>quantifiers</i>.</p>
</td>
</tr>
<tr>
<td width="29">&nbsp;</td>
<td width="597" colspan="2">
<h2><a name="Non-Greedy">4.3 Quantifiers, Greedy and Non-Greedy</a></h2>
<p>Using quantifiers you can set how many times certain part of you pattern          should repeat by putting the following after your pattern:</p>
<table cellspacing="3" width="585" class="vimdoc">
<tbody>
<tr>
<th>
<div align="center"><b>Quantifier</b></div>
</th>
<th>
<div align="center"><b>Description</b></div>
</th>
</tr>
<tr>
<td>
<div align="center"><b>*</b></div>
</td>
<td>matches 0 or more of the preceding characters, ranges or metacharacters              .* matches everything including empty line</td>
</tr>
<tr>
<td>
<div align="center"><b>\+</b></div>
</td>
<td>matches 1 or more of the preceding characters&#8230;</td>
</tr>
<tr>
<td>
<div align="center"><b>\= </b></div>
</td>
<td>matches 0 or 1 more of the preceding characters&#8230;</td>
</tr>
<tr>
<td>
<div align="center"><b>\{n,m}</b></div>
</td>
<td>matches from n to m of the preceding characters&#8230;</td>
</tr>
<tr>
<td>
<div align="center"><b>\{n}</b></div>
</td>
<td>matches exactly n times of the preceding characters&#8230;</td>
</tr>
<tr>
<td>
<div align="center"><b>\{,m}</b></div>
</td>
<td>matches at most m (from 0 to m) of the preceding characters&#8230;</td>
</tr>
<tr>
<td>
<div align="center"><b>\{n,}</b></div>
</td>
<td>matches at least n of of the preceding characters&#8230;</td>
</tr>
<tr>
<td colspan="2">
<div align="center">where <b>n</b> and <b>m</b> are positive integers                (&gt;0)</div>
</td>
</tr>
</tbody>
</table>
<p>Now it&#8217;s much easier to define a pattern that matches a word of <i>any          </i> length <code>\u\w\+</code>.</p>
<p>These quantifiers are <i>greedy</i> &#8211; that is your pattern will try to          match <i> <b>as much text as</b></i> possible. Sometimes it presents a          problem. Let&#8217;s consider a typical example &#8211; define a pattern to match          delimited text, i.e. text enclosed in quotes, brackets, etc. Since we          don&#8217;t know what kind of text is inside the quotes we&#8217;ll use</p>
<p><code>/&quot;.*&quot;/</code></p>
<p>But this pattern will match <i>everything</i> between the first &quot;          and the last &quot; in the following line:</p>
<p><code>this file is normally <span class="match">&quot;$VIM/.gvimrc&quot;. You          can check this with &quot;:version&quot;</span>.</code></p>
<p>This problem can be resolved by using non-greedy quantifiers:</p>
<table cellspacing="3" width="585" class="vimdoc">
<tbody>
<tr>
<td>
<div align="center"><b>Quantifier</b></div>
</td>
<td>
<div align="center"><b>Description</b></div>
</td>
</tr>
<tr>
<td>
<div align="center"><b>\{-}</b></div>
</td>
<td>matches 0 or more of the preceding atom, as few as possible</td>
</tr>
<tr>
<td>
<div align="center"><b>\{-n,m} </b></div>
</td>
<td>matches 1 or more of the preceding characters&#8230;</td>
</tr>
<tr>
<td>
<div align="center"><b>\{-n,}</b></div>
</td>
<td>matches at lease or more of the preceding characters&#8230;</td>
</tr>
<tr>
<td>
<div align="center"><b>\{-,m} </b></div>
</td>
<td>matches 1 or more of the preceding characters&#8230;</td>
</tr>
<tr>
<td colspan="2">
<div align="center">where <b>n</b> and <b>m</b> are positive integers                (&gt;0)</div>
</td>
</tr>
</tbody>
</table>
<p>Let&#8217;s use <code>\{-}</code> in place of <code>*</code> in our pattern.          So, now <code>&quot;.\{-}&quot;</code> will match the first quoted text:</p>
<p><code>this file is normally <span class="match">&quot;$VIM/gvimrc&quot;</span>.          You can check this with &quot;:version&quot;.</code></p>
<p><code>.\{-}</code> pattern is not without surprises. Look what will happen          to the following text after we apply:</p>
<p><code>:s:.\{-}:_:g</code></p>
<p>Before:</p>
<p><code>n and m are decimal numbers between</code></p>
<p>After:</p>
<p><code>_n_ _a_n_d_ _m_ _a_r_e_ _d_e_c_i_m_a_l_ _n_u_m_b_e_r_s_ _b_e_t_w_e_e_n_</code></p>
<p>&quot;As few as possible&quot; applied here means zero character replacements.          However match <b>does occur</b> between characters! To explain this behavior          I quote Bram himself:</p>
<p><cite>Matching zero characters is still a match. Thus it will replace          zero characters with a &quot;_&quot;. And then go on to the next position, where          it will match again. </cite></p>
<p><cite>It&#8217;s true that using &quot;\{-}&quot; is mostly useless. It works this way          to be consistent with &quot;*&quot;, which also matches zero characters. There are          more useless ones: &quot;x\{-1,}&quot; always matches one x. You could just use          &quot;x&quot;. More useful is something like &quot;x\{70}&quot;. The others are just consistent          behavior: &#8230;, &quot;x\{-3,}&quot;, &quot;x\{-2,}&quot;, &quot;x\{-1,}. </cite></p>
<p><cite>- Bram </cite></p>
<p>But what if we want to match only the second occurrence of quoted text?          Or we want to replace only a part of the quoted text keeping the rest          untouched? We will need <i>grouping</i> and <i>backreferences.</i> But          before let&#8217;s talk more about character ranges.</p>
</td>
</tr>
<tr>
<td width="29">&nbsp;</td>
<td width="597" colspan="2">
<h2><a name="ranges">4.4 Character ranges</a></h2>
<p>Typical character ranges:</p>
<p><code>[012345]</code> will match any of the numbers inside the brackets.          The same range can be written as <code>[0-5]</code>, where dash indicates          a range of characters in ASCII order. Likewise, we can define the range          for all lowercase letters: <code>[a-z]</code>, for all letters: <code>[a-zA-Z]</code>,          letters and digits: <code>[0-9a-zA-Z]</code> etc. Depending on your system          locale you can define range which will include characters like &agrave;,          &Ouml;, &szlig; and other non ASCII characters.</p>
<p>Note that the range represents just <i>one character</i> in the search          pattern, that is <code>[0123]</code> and <code>0123</code> are not the          same. Likewise the order (with a few exceptions) is not important: <code>[3210]</code>          and <code>[0123]</code> are the same character ranges, while <code>0123</code>          and <code>3210</code> are two different patterns. Watch what happens when          we apply</p>
<p><code>s:[65]:Dig:g</code></p>
<p>to the following text:</p>
<p>Before:</p>
<p><code>High <span class="match">65</span> to 70. Southeast wind around          10</code></p>
<p>After:</p>
<p><code>High <span class="replace">DigDig</span> to 70. Southeast wind          around 10</code></p>
<p>and now:</p>
<p><code>s:65:Dig:g</code></p>
<p>Before:</p>
<p><code>High <span class="match">65</span> to 70. Southeast wind around          10</code></p>
<p>After:</p>
<p><code>High <span class="replace">Dig</span> to 70. Southeast wind around          10</code></p>
<p>Sometimes it&#8217;s easier to define the characters you don&#8217;t want to match.          This is done by putting a negation sign <code>&quot;^&quot;</code> (caret)          as a first character of the range</p>
<p>/<code>[^A-Z]</code>/</p>
<p>- will match <i>any character</i> except capital letters. We can now          rewrite our pattern for quoted text using</p>
<p><code>/&quot;[^&quot;]\+&quot;</code>/</p>
<p>Note: inside the [ ] all metacharacters behave like ordinary characters.          If you want to include &quot;-&quot; (dash) in your range put it first</p>
<p><code>/[-0-9]/</code></p>
<p>- will match all digits <i>and </i> -. &quot;^&quot; will lose its special          meaning if it&#8217;s not the first character in the range.</p>
<p>Now, let&#8217;s have some real life example. Suppose you want to run a grammar          check on your file and find all places where new sentence does not start          with a capital letter. The pattern that will catch this:</p>
<p><code>\.\s\+[a-z] </code></p>
<p>- a period followed by one or more blanks and a lowercase word. We know          how to find an error, now let&#8217;s see how we can correct it. To do this          we need some ways to remember our matched pattern and recall it later.          That is exactly what <i>backreferences</i> are for.</p>
</td>
</tr>
<tr>
<td width="29">&nbsp;</td>
<td width="597" colspan="2">
<h2><a name="backreferences">4.5 Grouping and Backreferences</a></h2>
<p>You can group parts of the pattern expression enclosing them with &quot;<code>\(</code>&quot;          and &quot;<code>\)</code>&quot; and refer to them inside the replacement          pattern by their special number <code>\1, \2 ... \9</code>. Typical example          is swapping first two words of the line:</p>
<p>            <code>s:\(\w\+\)\(\s\+\)\(\w\+\):\3\2\1:</code></p>
<p>where <code>\1</code> holds the first word, <code>\2</code> &#8211; any number          of spaces or tabs in between and <code>\3</code> &#8211; the second word. How          to decide what number holds what pair of <code>\(\)</code> ? &#8211; count opening          &quot;<code>\(</code>&quot; from the left.</p>
<h2>Replacement Part of :substitute</h2>
<p>Replacement part of the S&amp;R has its own special characters which          we are going to use to fix grammar:</p>
<table cellspacing="3" class="vimdoc">
<tbody>
<tr>
<td width="43">
<div align="center"><b>#</b></div>
</td>
<td width="245">
<div align="center"><b>Meaning</b></div>
</td>
<td width="46">
<div align="center"><b>#</b></div>
</td>
<td width="225">
<div align="center"><b>Meaning</b></div>
</td>
</tr>
<tr>
<td width="43">
<div align="center"><b>&amp;</b></div>
</td>
<td width="245">the whole matched pattern</td>
<td width="46">
<div align="center"><b>\L</b></div>
</td>
<td width="225">the following characters are made lowercase</td>
</tr>
<tr>
<td width="43">
<div align="center"><b>\0</b></div>
</td>
<td width="245">the whole matched pattern</td>
<td width="46">
<div align="center"><b>\U</b></div>
</td>
<td width="225">the following characters are made uppercase</td>
</tr>
<tr>
<td width="43">
<div align="center"><b>\1</b></div>
</td>
<td width="245">the matched pattern in the first pair of \(\)</td>
<td width="46">
<div align="center"><b>\E</b></div>
</td>
<td width="225">end of \U and \L</td>
</tr>
<tr>
<td width="43">
<div align="center"><b>\2</b></div>
</td>
<td width="245">the matched pattern in the second pair of \(\)</td>
<td width="46">
<div align="center"><b>\e</b></div>
</td>
<td width="225">end of \U and \L</td>
</tr>
<tr>
<td width="43">
<div align="center"><b>&#8230;</b></div>
</td>
<td width="245">&#8230;</td>
<td width="46">
<div align="center"><b>\r</b></div>
</td>
<td width="225">split line in two at this point</td>
</tr>
<tr>
<td width="43">
<div align="center"><b>\9</b></div>
</td>
<td width="245">the matched pattern in the ninth pair of \(\)</td>
<td width="43">
<div align="center"><b>\l </b></div>
</td>
<td width="245">next character made lowercase</td>
</tr>
<tr>
<td width="43">
<div align="center"><b>~</b></div>
</td>
<td width="245">the previous substitute string</td>
<td width="43">
<div align="center"><b>\u</b></div>
</td>
<td width="245">next character made uppercase</td>
</tr>
</tbody>
</table>
<p>Now the full S&amp;R to correct non-capital words at the beginning of          the sentences looks like</p>
<p><code>s:\([.!?]\)\s\+\([a-z]\):\1&nbsp;&nbsp;\u\2:g</code></p>
<p>We have corrected our grammar and as an extra job we replaced variable          number of spaces between punctuation and the first letter of the next          sentence with exactly two spaces.</p>
</td>
</tr>
<tr>
<td width="29">&nbsp;</td>
<td width="597" colspan="2">
<h2><a name="alternations">4.6 Alternations</a></h2>
<p>Using &quot;<code>\|</code>&quot; you can combine several expressions          into one which matches any of its components. The first one matched will          be used.</p>
<p><code>\(Date:\|Subject:\|From:\)\(\s.*\)</code></p>
<p>            will parse various mail headings and their contents into \1 and \2, respectively.        The thing to remember about VIM alternation that it is not <i>greedy. </i>        It won&#8217;t search for the longest possible match, it will use the first that        matched. That means that the order of the items in the alternation is important!</td>
</tr>
<tr>
<td width="29">&nbsp;</td>
<td width="597" colspan="2">
<div class="tip">
<p><b>Tip 3:</b> Quick mapping to put \(\) in your pattern string</p>
<p><code>cmap ;\ \(\)&lt;Left&gt;&lt;Left&gt;</code></p>
</p></div>
</td>
</tr>
<tr>
<td width="29">&nbsp;</td>
<td width="597" colspan="2">
<h2><a name="precedence">4.7 Regexp Operator Precedence</a></h2>
<p>As in arithmetic expressions, regular expressions are executed in a certain          order of precedence. Here the table of precedence, from highest to lowest:</p>
<table cellspacing="3" class="vimdoc">
<tbody>
<tr>
<td width="94">
<div align="center"><b>Precedence</b></div>
</td>
<td width="192">
<div align="center"><b>Regexp</b></div>
</td>
<td width="261">
<div align="center"><b>Description</b></div>
</td>
</tr>
<tr>
<td width="94">
<div align="center"><b>1</b></div>
</td>
<td width="192">
<div align="center"><b>\( \)</b></div>
</td>
<td width="261">
<div align="center">grouping</div>
</td>
</tr>
<tr>
<td width="94">
<div align="center"><b>2</b></div>
</td>
<td width="192">
<div align="center"><b>\=,\+,*,\{n} etc.</b></div>
</td>
<td width="261">
<div align="center">quantifiers</div>
</td>
</tr>
<tr>
<td width="94">
<div align="center"><b>3</b></div>
</td>
<td width="192">
<div align="center"><b>abc\t\.\w</b></div>
</td>
<td width="261">
<div align="center">sequence of characters/ metacharacters, not containing                quantifiers or grouping operators</div>
</td>
</tr>
<tr>
<td width="94">
<div align="center"><b>4</b></div>
</td>
<td width="192">
<div align="center"><b>\|</b></div>
</td>
<td width="261">
<div align="center">alternation</div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td colspan="3">
<h1><a name="global">V. Global Command</a></h1>
</td>
</tr>
<tr>
<td width="29">&nbsp;</td>
<td width="597" colspan="2">
<h2><a name="global search">5.1 Global search and execution</a></h2>
<p>I want to introduce another quite useful and powerful Vim command which          we&#8217;re going to use later</p>
<table cellspacing="3" class="vimdoc">
<tbody>
<tr>
<td colspan="2"><b>:<i>range</i> g[lobal][!]/<i>pattern</i>/<i>cmd</i></b></td>
</tr>
<tr>
<td colspan="2">Execute the Ex command <b><i>cmd</i></b> (default &quot;<b>:p</b>&quot;)              on the lines within [<b><i>range</i></b>] where <b><i>pattern</i></b>              matches. If <b><i>pattern</i></b> is preceded with a <b>!</b> &#8211; only              where match <b>does not</b> occur.</td>
</tr>
</tbody>
</table>
<p>The global commands work by first scanning through the [<i>range</i>]          of of the lines and marking each line where a match occurs. In a second          scan the [<i>cmd</i>] is executed for each marked line with its line number          prepended. If a line is changed or deleted its mark disappears. The default          for the [<i>range</i>] is the whole file.</p>
<p>Note: Ex commands are all commands you are entering on the Vim command          line like <code>:s[ubstitute], :co[py] , :d[elete], :w[rite] </code>etc.          Non-Ex commands (normal mode commands) can be also executed via</p>
<p><code>:norm[al]<i>non-ex command</i></code></p>
<p>mechanism.</p>
<h2><a name="global examples">5.2 Examples</a></h2>
<p>Some examples of <code>:global</code> usage:</p>
<p><code>:g/^$/ d</code></p>
<p>- delete all empty lines in a file</p>
<p><code>:g/^$/,/./-j</code></p>
<p>- reduce multiple blank lines to a single blank</p>
<p><code>:10,20g/^/ mo 10</code></p>
<p>- reverse the order of the lines starting from the line 10 up to the          line 20.</p>
<p>Here is a modified example from <a href="http://www.networkcomputing.com/unixworld/tutorial/009/009.html">Walter          Zintz vi tutorial</a>:</p>
<p><code>:'a,'b g/^Error/ . w &gt;&gt; errors.txt</code></p>
<p>- in the text block marked by <code>'a</code> and <code>'b </code>find          all the lines starting with <span class="pattern">Error</span> and copy          (append) them to &quot;errors.txt&quot; file.<b> Note:</b> . (current          line address) in front of the <code>w</code> is very important, omitting          it will cause <code>:write</code> to write the whole file to &quot;errors.txt&quot;          for every <span class="pattern">Error</span> line found.</p>
<p>You can give multiple commands after <code>:global </code>using &quot;|&quot;          as a separator. If you want to use &quot;|&#8217; in an argument, precede it          with &quot;\&#8217;. Another example from Zintz tutorial:</p>
<p><code>:g/^Error:/ copy $ | s /Error/copy of the error/</code></p>
<p>- will copy all <span class="pattern">Error</span> line to the end of          the file and then make a substitution in the copied line. Without giving          the line address <code>:s</code> will operate on the current line, which          is the newly copied line.</p>
<p><code>:g/^Error:/ s /Error/copy of the error/ | copy $</code></p>
<p>- here the order is reversed: first modify the string then copy to the          end.</p>
</td>
</tr>
<tr>
<td width="29">&nbsp;</td>
<td width="597" colspan="2">&nbsp;</td>
</tr>
<tr>
<td colspan="3">
<h1><a name="examples">VI. Examples</a></h1>
</td>
</tr>
<tr>
<td width="29">&nbsp;</td>
<td width="597" colspan="2">
<h2><a name="tips">6.1 Tips and Techniques</a></h2>
<p>A collection of some useful S&amp;R tips:</p>
<p>(1) sent by Antonio Colombo:</p>
<p><cite>&quot;a simple regexp I use quite often to clean up a text: it          drops the blanks at the end of the line:&quot;</cite></p>
<p><code> s:\s*$::</code></p>
<p><cite>or (to avoid acting on all lines): </cite></p>
<p><code>s:\s\+$::</code></p>
</td>
</tr>
<tr>
<td width="29">&nbsp;</td>
<td width="597" colspan="2">
<h2><a name="contents">6.2 Creating outline</a></h2>
<p>For this example you need to know a bit of HTML. We want to make a table          of contents out of <code>h1</code> and <code>h2</code> headings, which          I will call majors and minors. HTML heading <code>h1</code> is a text          enclosed by <code>&lt;h1&gt;</code> tags as in <code>&lt;h1&gt;Heading&lt;/h1&gt;</code>.</p>
<p>(1) First let&#8217;s make named anchors in all headings, i.e. put <code>&lt;h1&gt;&lt;a          name=&quot;anchor&quot;&gt;Heading&lt;/a&gt;&lt;/h1&gt;</code> around          all headings. The <code>&quot;anchor</code>&quot; is a unique identifier          of this particular place in HTML document. The following S&amp;R does          exactly this:</p>
<p><code> :s:\(&lt;h[12]&gt;\)\(.*\s\+\([-a-zA-Z]\+\)\)\s*\(&lt;/h[12]&gt;\):\1&lt;a          name=&quot;\3&quot;&gt;\2&lt;/a&gt;\4:</code></p>
<p><b>Explanation:</b> the first pair of <code>\(\)</code> saves the opening          tag (<code>h1</code> or <code>h2</code>) to the <code>\1</code>, the second          pair saves all heading text before the closing tag, the third pair saves          the last word in the heading which we will later use for &quot;anchor&quot;          and the last pair saves the closing tag. The replacement is quite obvious          &#8211; we just reconstruct a new &quot;named&quot; heading using <code>\1-\4</code>          and link tag <code>&lt;a&gt;.</code></p>
<p>(2) Now let&#8217;s copy all headings to one place:</p>
<p><code>:%g/&lt;h[12]&gt;/ t$</code></p>
<p>This command searches our file for the lines starting with <code>&lt;h1&gt;</code>          or <code>&lt;h2&gt;</code> and copies them to the end of the file. Now          we have a bunch of lines like:</p>
<p><code>&lt;h1&gt;&lt;a name=&quot;anchor1&quot;&gt;Heading1&gt;&lt;/a&gt;&lt;/h1&gt;<br />
            &lt;h2&gt;&lt;a name=&quot;anchor2&quot;&gt;Heading2&gt;&lt;/a&gt;&lt;/h2&gt;<br />
            &lt;h2&gt;&lt;a name=&quot;anchor3&quot;&gt;Heading3&gt;&lt;/a&gt;&lt;/h2&gt;<br />
            ..........................<br />
            &lt;h1&gt;&lt;a name=&quot;anchorN&quot;&gt;HeadingN&gt;&lt;/a&gt;&lt;/h1&gt;</code></p>
<p>First, we want to convert all <code>name=&quot;</code> to <code>href=&quot;#</code>          in order to link table entries to their respective places in the text:</p>
<p><code>s:name=&quot;:href=&quot;#:</code></p>
<p>Second, we want our <code>h1</code> entries look different from <code>h2</code>.          Let&#8217;s define CSS classes &quot;majorhead&quot; and &quot;minorhead&quot;          and do the following:</p>
<p><code>g/&lt;h1&gt;/ s:&lt;a:&amp; class=&quot;majorhead&quot;:<br />
            g/&lt;h2&gt;/ s:&lt;a:&amp; class=&quot;minorhead&quot;: </code></p>
<p>Now our entries look like:</p>
<p><code>&lt;h1&gt;&lt;a class=&quot;majorhead&quot; name=&quot;anchor1&quot;&gt;Heading1&gt;&lt;/a&gt;&lt;/h1&gt;<br />
            &lt;h2&gt;&lt;a class=&quot;minorhead&quot; name=&quot;anchor2&quot;&gt;Heading2&gt;&lt;/a&gt;&lt;/h2&gt;</code></p>
<p>We no longer need <code>h1</code> and <code>h2</code> tags:</p>
<p><code>s:&lt;h[21]&gt;::</code></p>
<p>and replace closing tags with breaklines <code>&lt;br&gt;</code></p>
<p><code>s:/h[21]:br:</code></p>
<p><code>&lt;a class=&quot;majorhead&quot; name=&quot;anchor1&quot;&gt;Heading1&gt;&lt;/a&gt;&lt;br&gt;<br />
            &lt;a class=&quot;minorhead&quot; name=&quot;anchor2&quot;&gt;Heading2&gt;&lt;/a&gt;&lt;br&gt;</code></p>
</td>
</tr>
<tr>
<td width="29">&nbsp;</td>
<td width="597" colspan="2">
<h2><a name="tables">6.3 Working with Tables</a></h2>
<p>Quite often you have to work with a text organized in tables/columns.          Consider, for example, the following text</p>
<table border="0" align="center" width="500">
<tbody>
<tr>
<td>
<div align="center">Asia</div>
</td>
<td>
<div align="center">America</div>
</td>
<td>
<div align="center">Africa</div>
</td>
<td>
<div align="center">Europe</div>
</td>
</tr>
<tr>
<td>
<div align="center">Africa</div>
</td>
<td>
<div align="center">Europe</div>
</td>
<td>
<div align="center">Europe</div>
</td>
<td>
<div align="center">Africa</div>
</td>
</tr>
<tr>
<td>
<div align="center">Europe</div>
</td>
<td>
<div align="center">Asia</div>
</td>
<td>
<div align="center">Europe</div>
</td>
<td>
<div align="center">Europe</div>
</td>
</tr>
</tbody>
</table>
<p>Suppose we want to change all &quot;Europe&quot; cells in the third column          to &quot;Asia&quot;:</p>
<p><code>:%s:\(\(\w\+\s\+\)\{2}\)Europe:\1Asia:</code></p>
<table border="0" align="center" width="500">
<tbody>
<tr>
<td>
<div align="center">Asia</div>
</td>
<td>
<div align="center">America</div>
</td>
<td>
<div align="center">Africa</div>
</td>
<td>
<div align="center">Europe</div>
</td>
</tr>
<tr>
<td>
<div align="center">Africa</div>
</td>
<td>
<div align="center">Europe</div>
</td>
<td>
<div align="center" class="replace">Asia</div>
</td>
<td>
<div align="center">Africa</div>
</td>
</tr>
<tr>
<td>
<div align="center">Europe</div>
</td>
<td>
<div align="center">Asia</div>
</td>
<td>
<div align="center" class="replace">Asia</div>
</td>
<td>
<div align="center">Europe</div>
</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>To swap the first and the last columns:</p>
<p><code>:%s:\(\w\+\)\(.*\s\+\)\(\w\+\)$:\3\2\1:</code></p>
<table border="0" align="center" width="500">
<tbody>
<tr>
<td class="replace">
<div align="center">Europe</div>
</td>
<td>
<div align="center">America</div>
</td>
<td>
<div align="center">Africa</div>
</td>
<td class="replace">
<div align="center">Asia</div>
</td>
</tr>
<tr>
<td class="replace">
<div align="center">Africa</div>
</td>
<td>
<div align="center">Europe</div>
</td>
<td>
<div align="center">Europe</div>
</td>
<td class="replace">
<div align="center">Africa</div>
</td>
</tr>
<tr>
<td class="replace">
<div align="center">Europe</div>
</td>
<td>
<div align="center">Asia</div>
</td>
<td>
<div align="center">Europe</div>
</td>
<td class="replace">
<div align="center">Europe</div>
</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>To be continued&#8230;</p>
</td>
</tr>
<tr>
<td width="29">&nbsp;</td>
<td width="597" colspan="2">&nbsp;</td>
</tr>
<tr>
<td colspan="3">
<h1><a name="compare">VII. Other Regexp Flavors</a></h1>
</td>
</tr>
<tr>
<td width="29">&nbsp;</td>
<td width="597" colspan="2">
<p>Here I would like to compare Vim&#8217;s regexp implementation with others,          in particular, Perl&#8217;s. You can&#8217;t talk about regular expressions without          mentioning Perl.</p>
<p>(with a help from <a href="mailto:skirkendall@uswest.net">Steve Kirkendall</a>)          The main differences between Perl and Vim are:</p>
<ul>
<li>Perl doesn&#8217;t require backslashes before most of its operators. Personally,            I think it makes regexps more readable &#8211; the less backlashes are there            the better.</li>
<li>Perl allows you to convert any quantifier into a non-greedy version            by adding an extra ? after it. So *? is a non-greedy *.</li>
<li>Perl supports a lots of weird options that can be appended to the            regexp, or even embedded in it.</li>
<li>You can also embed variable names in a Perl regular expression. Perl            replaces the name with its value; this is called &quot;variable interpolation&quot;.</li>
</ul>
</td>
</tr>
<tr>
<td colspan="3">
<h1><a name="links">VIII. Links</a></h1>
</td>
</tr>
<tr>
<td width="29">&nbsp;</td>
<td width="597" colspan="2">
<p>Read VIM documentation about pattern and searching. To get this type          &quot;:help pattern&quot; in VIM normal mode.</p>
<p>There are currently two books on the market that deal with VIM regular          expressions:</p>
<ul>
<li><b><a href="http://www.oreilly.com/catalog/vi6/">&quot;Learning the            vi Editor&quot;</a></b> by Linda Lamb and Arnold Robbins.</li>
<li><b>&quot;<a href="http://www.oualline.com/">vi Improved &#8211; VIM</a>&quot;</b> by Steve Oualline</li>
</ul>
<p>Definitive reference on regular expressions is Jeffrey Friedl&#8217;s <b><a href="http://www.oreilly.com/catalog/regex/chapter/ch04.html">&quot;Mastering          Regular Expressions&quot;</a></b> published by O&#8217;Reilly &amp; Associates,          but it mostly deals with Perl regular expressions. O&#8217;Reilly has one of          the book chapters available online.</p>
</td>
</tr>
<tr>
<td width="29">&nbsp;</td>
<td width="297">
<div align="left"><a href="http://us.geocities.yahoo.com/gb/sign?member=volontir"><font face="Arial, Helvetica, sans-serif" size="-1"><b>Sign          Guestbook</b></font></a></div>
</td>
<td width="298">
<div align="right"><a href="http://us.geocities.yahoo.com/gb/view?member=volontir"><font size="-1"><b>View          Guestbook</b></font></a><b><font size="-1">&nbsp;</font></b></div>
</td>
</tr>
<tr>
<td width="29">&nbsp;</td>
<td width="597" colspan="2">
<hr noshade="noshade" />
            </td>
</tr>
<tr>
<td width="29">&nbsp;</td>
<td width="297">
<table cellspacing="0" cellpadding="1" border="0" bgcolor="#660066" width="1%">
<tbody>
<tr>
<td>
<table cellspacing="0" cellpadding="3" border="0" bgcolor="#eeeeee" width="1%">
<tbody>
<tr>
<td width="1%"><a href="http://us.geocities.yahoo.com/pstats/volontir"><img height="14" border="0" width="14" alt="See who's visiting this page." src="http://pic.geocities.com/us/i/geo/ao/pstat.gif" /></a></td>
<td nowrap="nowrap"><font face="arial" size="-2"><a href="http://us.geocities.yahoo.com/pstats/volontir">View                    Page Stats</a></font></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
<td width="298" class="footer">Copyright &copy; 2000-2001, <a href="mailto:volontir%20at%20yahoo%20dot%20com">Oleg  			 Raisky</a>. Last update: Sun 27 2002</td>
</tr>
</tbody>
</table>
<p><!-- text below generated by server. PLEASE REMOVE --><br />
<script src="http://us.i1.yimg.com/us.yimg.com/i/mc/mc.js" language="JavaScript" type="text/javascript"></script><br />
<script src="http://us.geocities.com/js_source/geov2.js" language="JavaScript" type="text/javascript"></script><br />
<script language="javascript" type="text/javascript">geovisit();</script><br />
<img border="0" src="http://visit.geocities.com/visit.gif?&amp;r=http%3A//www.geocities.com/volontir/%3F200915&amp;b=Netscape%205.0%20%28Windows%3B%20es-ES%29&amp;s=1024x768&amp;o=Win32&amp;c=16&amp;j=true&amp;v=1.2" alt="" /> <noscript>&lt;img src=&quot;http://visit.geocities.com/visit.gif?1012147342&quot; border=0 width=1 height=1&gt;</noscript> <img height="1" width="1" alt="1" src="http://geo.yahoo.com/serv?s=76001067&amp;t=1012147342" /> <!-- text below generated by server. PLEASE REMOVE --><br />
<script src="http://us.i1.yimg.com/us.yimg.com/i/mc/mc.js" language="JavaScript" type="text/javascript"></script><br />
<script src="http://us.js2.yimg.com/us.js.yimg.com/lib/smb/js/hosting/cp/js_source/geov2_001.js" language="JavaScript" type="text/javascript"></script><br />
<script language="javascript" type="text/javascript">geovisit();</script><br />
<noscript>&lt;img src=&quot;http://visit.geocities.yahoo.com/visit.gif?us1253033119&quot; alt=&quot;setstats&quot; border=&quot;0&quot; width=&quot;1&quot; height=&quot;1&quot;&gt;</noscript> <img height="1" width="1" alt="1" src="http://geo.yahoo.com/serv?s=76001067&amp;t=1253033119&amp;f=us-w6" /></p>
]]></content:encoded>
			<wfw:commentRss>http://smultron.es/2009/09/expresiones-regulares-para-vim/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Video: Mae Shi &#8211; The lamb and the lion</title>
		<link>http://smultron.es/2009/05/video-mae-shi-the-lamb-and-the-lion/</link>
		<comments>http://smultron.es/2009/05/video-mae-shi-the-lamb-and-the-lion/#comments</comments>
		<pubDate>Wed, 13 May 2009 03:00:59 +0000</pubDate>
		<dc:creator>umax46</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Musica]]></category>
		<category><![CDATA[Videos]]></category>

		<guid isPermaLink="false">http://smultron.es/?p=4019</guid>
		<description><![CDATA[No s&#233; como definir muy bien la m&#250;sica, de unos t&#237;os que se ponen como a ladrar en su cancion &#8220;Boys In The Attic&#8221;,por lo que no se puede decir con exactitud cual es el estilo que tocan, de The Mae Shi. Mejor vean su nuevo v&#237;deo para la canci&#243;n &#8220;The Lamb And The Lion&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">No s&eacute; como definir muy bien la m&uacute;sica, de unos t&iacute;os que se ponen como a ladrar en su cancion &#8220;Boys In The Attic&#8221;,por lo que  no se puede decir con exactitud cual es el estilo que tocan, de <a href="http://www.myspace.com/themaeshi">The Mae Shi</a>. Mejor vean su nuevo v&iacute;deo para la canci&oacute;n &#8220;The Lamb And The Lion&#8221; y disfruten de este bizarro v&iacute;deo medieval.</p>
<p style="text-align: center;"><object width="560" height="400" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="delve_playerf41db15d64b449eaa0064d5529d83f23334260o"><param value="http://assets.delvenetworks.com/player/loader.swf" name="movie" /><param value="window" name="wmode" /><param value="always" name="allowScriptAccess" /><param value="true" name="allowFullScreen" /><param value="mediaId=b69db5d431044d018a9d3b5dd018f385&#038;playerForm=88a26316a62d4655a806dda0da4e95ca&#038;autoplayNextClip=true" name="flashvars" /><embed width="560" height="400" flashvars="mediaId=b69db5d431044d018a9d3b5dd018f385&#038;playerForm=88a26316a62d4655a806dda0da4e95ca&#038;autoplayNextClip=true" pluginspage="http://www.adobe.com/go/getflashplayer" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" wmode="window" name="delve_playerf41db15d64b449eaa0064d5529d83f23334260e" src="http://assets.delvenetworks.com/player/loader.swf"></embed></object></p>
<p style="text-align: justify;">Via: <a href="http://indiespot.es/2009/05/08/increible-nuevo-video-de-the-mae-shi/">indiespot</a></p>
]]></content:encoded>
			<wfw:commentRss>http://smultron.es/2009/05/video-mae-shi-the-lamb-and-the-lion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>100 &#8216;single ladies&#8217; se reunen en Londres</title>
		<link>http://smultron.es/2009/04/100-single-ladies-se-reunen-en-londres/</link>
		<comments>http://smultron.es/2009/04/100-single-ladies-se-reunen-en-londres/#comments</comments>
		<pubDate>Tue, 21 Apr 2009 14:58:37 +0000</pubDate>
		<dc:creator>umax46</dc:creator>
				<category><![CDATA[Musica]]></category>
		<category><![CDATA[Publicidad]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Guerrilla]]></category>

		<guid isPermaLink="false">http://smultron.es/?p=3392</guid>
		<description><![CDATA[De antemano, estas cosas me parecen geniales, pero si adem&#225;s le sumas 100, s&#237;, has le&#237;do bien, 100 solteras, para llevarlo a cabo solo puede ser legen&#8230;.. espero un segundo&#8230; dar&#237;o. Pues en la famosa plaza de Piccadilly Circus se reunieron estos damas para interpretar la canci&#243;n &#34;Single Ladies&#34; de Beyonc&#233;. La parte donde mueven [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">De antemano, estas cosas me parecen geniales, pero si adem&aacute;s le sumas 100, s&iacute;, has le&iacute;do bien, 100 solteras, para llevarlo a cabo solo puede ser <a href="http://www.youtube.com/watch?v=PiEKkQkOy7E">legen&#8230;.. espero un segundo&#8230; dar&iacute;o</a>. Pues en la famosa plaza de <b><a href="http://es.wikipedia.org/wiki/Piccadilly_Circus">Piccadilly Circus</a> </b>se reunieron estos damas para interpretar la canci&oacute;n &quot;Single Ladies&quot; de Beyonc&eacute;.</p>
<p style="text-align: center;"><object width="560" height="400"><param value="http://www.youtube.com/v/OLj5zphusLw&amp;hl=es&amp;fs=1&amp;color1=0x234900&amp;color2=0x4e9e00" name="movie" /><param value="true" name="allowFullScreen" /><param value="always" name="allowscriptaccess" /><embed width="560" height="400" allowfullscreen="true" allowscriptaccess="always" type="application/x-shockwave-flash" src="http://www.youtube.com/v/OLj5zphusLw&amp;hl=es&amp;fs=1&amp;color1=0x234900&amp;color2=0x4e9e00"></embed></object></p>
<p style="text-align: justify;">La parte donde mueven &uacute;nicamente la cabeza mola bastante, al final me va a gustar Beyonc&eacute; y todo, bueno creo que este &uacute;ltimo va a ser que no. S&eacute; que la parte masculina que lea esto seguir&aacute; viendo el v&iacute;deo y le dar&aacute; igual todo lo dem&aacute;s, me ha pasado lo mismo, pero se realiz&oacute; para anunciar <a href="http://www.tridentunwrapped.co.uk/Pages/homehtml.aspx">una actuaci&oacute;n de la artista en la misma ciudad en Noviembre gracias a Trident</a>.</p>
<p style="text-align: justify;">Via: <a href="http://www.kanyeuniversecity.com/blog/?em3106=229161_-1__0_~0_-1_4_2009_0_0&amp;em3298=&amp;em3282=&amp;em3281=&amp;em3161=">Kanye&#8217;s Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://smultron.es/2009/04/100-single-ladies-se-reunen-en-londres/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

