<?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>arvaro.org</title>
	<atom:link href="http://www.arvaro.org/feed" rel="self" type="application/rss+xml" />
	<link>http://www.arvaro.org</link>
	<description>Yo diria que nos pusieramos todos contentos, sin preguntar por que</description>
	<lastBuildDate>Thu, 22 Dec 2011 20:10:44 +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>Tomar parametros de una URL con Javascript</title>
		<link>http://www.arvaro.org/tips/tomar-parametros-de-una-url-con-javascript</link>
		<comments>http://www.arvaro.org/tips/tomar-parametros-de-una-url-con-javascript#comments</comments>
		<pubDate>Wed, 14 Dec 2011 14:26:02 +0000</pubDate>
		<dc:creator>arvaro</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.arvaro.org/?p=638</guid>
		<description><![CDATA[visto en: anieto2kEsta función Javascript, me salvo para rescatar valores en portal, ahora si puedes usar PHP esto es totalmente RIDICULO!!! Código function getVarUrl( name ){ var regexS = "[\\?&#38;]"+name+"=([^&#38;#]*)"; var regex = new RegExp ( regexS ); var tmpURL = window.location.href; var results = regex.exec( tmpURL ); if( results == null ) return""; else [...]]]></description>
			<content:encoded><![CDATA[<p>visto en: <a title="anieto2k" href="http://www.anieto2k.com/2006/08/17/coge-los-parametros-de-tu-url-con-javascript/" target="_blank">anieto2k</a>Esta función Javascript, me salvo para rescatar valores en portal, ahora si puedes usar PHP esto es totalmente RIDICULO!!!<br />
Código</p>
<pre class="brush:js">function getVarUrl( name ){
	var regexS = "[\\?&amp;]"+name+"=([^&amp;#]*)";
	var regex = new RegExp ( regexS );
	var tmpURL = window.location.href;
	var results = regex.exec( tmpURL );
	if( results == null )
		return"";
	else
		return results[1];
}</pre>
<p>Esta función no permitirá parsear los obtener el valor de un parametro pasado por línea de comandos en concreto. La idea es la siguiente.<br />
Url de ejemplo</p>
<p>http://www.arvaro.org/index.html?var_uno=123&#038;la_variable=321&#038;otra_variable=213#top</p>
<p>Si queremos obtener el valor del parametro la_variable, la forma de hacerlo con esta función es la siguiente.</p>
<pre class="brush:js">var el_param = getVarUrl( 'la_variable' );</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.arvaro.org/tips/tomar-parametros-de-una-url-con-javascript/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Como Widgetizar un footer en WordPress</title>
		<link>http://www.arvaro.org/tips/como-widgetizar-un-footer-en-wordpress</link>
		<comments>http://www.arvaro.org/tips/como-widgetizar-un-footer-en-wordpress#comments</comments>
		<pubDate>Wed, 17 Aug 2011 14:11:10 +0000</pubDate>
		<dc:creator>fefamorales</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.arvaro.org/?p=606</guid>
		<description><![CDATA[Estoy de vuelta y traigo la panacea en customización de themes, ya que los widgets realmente facilitan la vida del usuario y tb del administrador de un wordpress puedes armar un sitio completo a puros widgets(eso estoy haciendo yo con el index del sitio del ministerio ), pero menos rodeo y más acción le dejó [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.arvaro.org/wp-content/uploads/2010/12/wordpress-150x1501.png"><img class="alignleft size-full wp-image-544" title="wordpress-150x150" src="http://www.arvaro.org/wp-content/uploads/2010/12/wordpress-150x1501.png" alt="" width="150" height="150" /></a>Estoy de vuelta y traigo la panacea en customización de themes, ya que los widgets realmente facilitan la vida del usuario y tb del administrador de un wordpress puedes armar un sitio completo a puros widgets(eso estoy haciendo yo con el index del sitio del ministerio ), pero menos rodeo y más acción le dejó a continuación el tutorial</p>
<p>Para realizar eso, simplemente tenemos que seguir unos pocos pasos:</p>
<p>Abrir el archivo <strong>functions.php</strong> de su theme y verán algo como ésto (<em>puede no ser igual, pero sí parecido</em>):</p>
<div>
<blockquote><p><code>if ( function_exists('register_sidebar') ) {<br />
register_sidebar(array(<br />
'before_widget' =&gt; '&lt;li id="%1$s"&gt;',<br />
'after_widget' =&gt; '&lt;/li&gt;',<br />
'before_title' =&gt; '&lt;h2&gt;',<br />
'after_title' =&gt; '&lt;/h2&gt;',<br />
));</code></p>
<p>}</p></blockquote>
<p>Entonces, antes de “}” deben pegar este codigo en donde crearemos otra sidebar llamada footer:</p>
</div>
<blockquote><p><code>register_sidebar(array(<br />
'name' =&gt; 'footer',<br />
'before_widget' =&gt; '&lt;div id="%1$s"&gt;',<br />
'after_widget' =&gt; '&lt;/div&gt;',<br />
'before_title' =&gt; '&lt;h2&gt;',<br />
'after_title' =&gt; '&lt;/h2&gt;',<br />
));</code></p></blockquote>
<p>Y debería quedarles algo así:</p>
<blockquote><p><code>if ( function_exists('register_sidebar') ) {<br />
register_sidebar(array(<br />
'before_widget' =&gt; '&lt;li id="%1$s"&gt;',<br />
'after_widget' =&gt; '&lt;/li&gt;',<br />
'before_title' =&gt; '&lt;h2&gt;',<br />
'after_title' =&gt; '&lt;/h2&gt;',<br />
));</code></p>
<p><code>register_sidebar(array(<br />
'name' =&gt; 'Footer',<br />
'before_widget' =&gt; '&lt;div id="%1$s"&gt;',<br />
'after_widget' =&gt; '&lt;/div&gt;',<br />
'before_title' =&gt; '&lt;h2&gt;',<br />
'after_title' =&gt; '&lt;/h2&gt;',<br />
)); }</code></p></blockquote>
<p>Ahora cerramos el functions.php y abrimos el archivo <strong>footer.php</strong> y agregamos está linea:</p>
<blockquote><p><code>&lt;div id="widgetfooter"&gt;<br />
&lt;?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Footer') ) ?&gt;<br />
&lt;/div&gt;</code></p></blockquote>
<p>Y listo!, desde este momento debería aparecerles una nueva sidebar llamada “<em><strong>footer</strong></em>” dentro de la sección Apareciencia/Widgets del panel de administración de WordPress. Pero ojo que todavía no hemos terminado, ya que ahora nos falta acomodar la apariencia de ese footer. Eso se hace editando el style.css del tema y acá cada uno es libre de armarlo como desee. Lo principal, es incluir las lineas:</p>
<p><code>clear: both; </code><code>float: left; width: 30%;</code></p>
<p>Que son las que nos darán las columnas.</p>
<p>Yo les dejo de ejemplo el que uso en mi blog que es a tres columnas con bordes redondeados a modo de ejemplo. Así que abramos el archivo <strong>style.css</strong> del theme (<em>En el tema de mi blog ya hay una sección footer, así que yo agregue el texto al final de esa parte</em>). Si su tema no la tiene, pueden agregar esto al comienzo:</p>
<blockquote><p><code>#widgetfooter {<br />
clear: both;<br />
margin: 0 10px;}</code></p></blockquote>
<p>Ahora si, mi style.css es:</p>
<blockquote><p><code>/*Widget Footer*/<br />
.widgetfooter {<br />
float: left;<br />
width: 30%;<br />
margin: 0 5px 0 5px;<br />
padding: 0 0 0 10px;<br />
border-radius: 8px;}<br />
.widgetfooter ul {padding-left: 15px;}</code></p></blockquote>
<p>Como pueden ver, el ancho de cada columna es un 30%, ahi pueden poner un numero exacto o un porcentaje a gusto de ustedes</p>
<p><strong>Nota</strong>: el tutorial no es exclusivo para un footer, de hecho yo lo ocupe para widgetizar el cuerpo de un index.</p>
<p>ojala les sea útil</p>
<p><a href="http://www.fefamorales.com">Fefa</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.arvaro.org/tips/como-widgetizar-un-footer-en-wordpress/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tips: borrar .svn , var_dump y tu localhost</title>
		<link>http://www.arvaro.org/php/tips-borrar-svn-var_dump-y-tu-localhost</link>
		<comments>http://www.arvaro.org/php/tips-borrar-svn-var_dump-y-tu-localhost#comments</comments>
		<pubDate>Tue, 26 Jul 2011 17:06:55 +0000</pubDate>
		<dc:creator>arvaro</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.arvaro.org/?p=599</guid>
		<description><![CDATA[Borrar archivos .svn find . -name .svn -print0 &#124; xargs -0 rm -rf &#160; var_dump() más bonito Instalar php5-xdebug: en ubuntu: apt-get install php5-xdebug Editar archivo /etc/php5/apache2/php.ini y poner la variable html_errors en On: html_errors = On Para la profundidad del var_dump, en /etc/php5/apache2/conf.d/xdebug.ini poner xdebug.var_display_max_depth = 5 Esto dejará la profundidad en nivel 5 [...]]]></description>
			<content:encoded><![CDATA[<h1><strong>Borrar archivos .svn</strong></h1>
<pre class="brush:shell">find . -name .svn -print0 | xargs -0 rm -rf</pre>
<p>&nbsp;</p>
<h1><strong>var_dump() más bonito</strong></h1>
<p>Instalar php5-xdebug:</p>
<p>en ubuntu: apt-get install php5-xdebug</p>
<p>Editar archivo /etc/php5/apache2/php.ini y poner la variable html_errors en On:</p>
<p>html_errors = On</p>
<p>Para la profundidad del var_dump, en /etc/php5/apache2/conf.d/xdebug.ini poner</p>
<p>xdebug.var_display_max_depth = 5</p>
<p>Esto dejará la profundidad en nivel 5</p>
<p>Reiniciar apache: /etc/init.d/apache2 restart</p>
<p><strong>Ahora los var_dump() se ven con colores <img src='http://www.arvaro.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </strong></p>
<p>&nbsp;</p>
<h1><strong>Localhost</strong></h1>
<p>para desarrollo local con Ubuntu</p>
<p>redireccionar el /var/www/ a tu /home/tu_usuario , para poder trabajar cómodamente en ambiente local. crea un directorio en tu home, para este ejemplo usaremos public_html</p>
<blockquote><p>~$ sudo gedit /etc/apache2/sites-enabled/000-default</p></blockquote>
<p>editar el archivo que se abrirá. ejemplo de configuración:</p>
<pre class="brush:shell">&lt;VirtualHost *:80&gt;
	ServerAdmin webmaster@localhost
	DocumentRoot /home/tu_usuario/public_html
	&lt;Directory /&gt;
		Options FollowSymLinks
		AllowOverride None
	&lt;/Directory&gt;
	&lt;Directory /home/tu_usuario/public_html/&gt;
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
	&lt;/Directory&gt;

	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
	&lt;Directory "/usr/lib/cgi-bin"&gt;
		AllowOverride None
		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
		Order allow,deny
		Allow from all
	&lt;/Directory&gt;

	ErrorLog /var/log/apache2/error.log

	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel warn

	CustomLog /var/log/apache2/access.log combined

    Alias /doc/ "/usr/share/doc/"
    &lt;Directory "/usr/share/doc/"&gt;
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    &lt;/Directory&gt;
&lt;/VirtualHost&gt;</pre>
<blockquote>
<pre>sudo /etc/init.d/apache2 restart</pre>
</blockquote>
<p><strong>IMPORTANTE</strong>: <strong>NO OLVIDAR DAR LOS PERMISOS DE ESCRITURA AL DIRECTORIO SELECCIONADO</strong></p>
<pre></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.arvaro.org/php/tips-borrar-svn-var_dump-y-tu-localhost/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eclipse + Aptana + perl</title>
		<link>http://www.arvaro.org/tips/eclipse-aptana</link>
		<comments>http://www.arvaro.org/tips/eclipse-aptana#comments</comments>
		<pubDate>Tue, 26 Jul 2011 16:55:15 +0000</pubDate>
		<dc:creator>arvaro</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://www.arvaro.org/?p=595</guid>
		<description><![CDATA[instalación opción 1: instalar desde repositorios apt-get install eclipse opción 2: descargar desde la web del proyecto agregar nuevo software Help » Install New Software APTANA (PHP, XML, JQuery, etc) http://download.eclipse.org/releases/galileo &#160; Para INDIGO Install PDT plugin PDT http://www.eclipse.org/downloads/php_package.php Choose All-In-One SDK Install Aptana Aptana http://download.aptana.com/studio3/plugin/install &#160; perl perl &#8211; http://e-p-i-c.sf.net/updates/testing]]></description>
			<content:encoded><![CDATA[<h3><a id="instalacion" name="instalacion"></a>instalación</h3>
<div>opción 1: instalar desde repositorios</p>
<pre>apt-get install eclipse</pre>
<p>opción 2: descargar desde la <a title="http://www.eclipse.org/" href="http://www.eclipse.org/" rel="nofollow">web del proyecto</a></p>
</div>
<h3>agregar nuevo software</h3>
<div>Help » Install New Software<br />
<strong>APTANA (PHP, XML, JQuery, etc)</strong></p>
<p>http://download.eclipse.org/releases/galileo</p></div>
<div>
<p>&nbsp;</p>
<p><strong>Para INDIGO</strong><br />
Install PDT plugin</p>
<p>PDT<span style="color: #ff0000;"><span style="text-decoration: line-through;"><br />
</span></span><a href="http://www.eclipse.org/downloads/php_package.php">http://www.eclipse.org/downloads/php_package.php</a><br />
Choose All-In-One SDK</p>
<p>Install Aptana<br />
Aptana</p>
<p>http://download.aptana.com/studio3/plugin/install</p>
<p>&nbsp;</p>
<p><strong>perl</strong></p>
<p>perl &#8211; http://e-p-i-c.sf.net/updates/testing</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.arvaro.org/tips/eclipse-aptana/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Virtual Box &#8211; Compartir Directorio (Ubuntu y Windows)</title>
		<link>http://www.arvaro.org/tips/virtual-box-compartir-directorio-ubuntu-y-windows</link>
		<comments>http://www.arvaro.org/tips/virtual-box-compartir-directorio-ubuntu-y-windows#comments</comments>
		<pubDate>Tue, 26 Jul 2011 16:48:05 +0000</pubDate>
		<dc:creator>arvaro</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.arvaro.org/?p=590</guid>
		<description><![CDATA[cómo compartir carpetas entre los dos sistemas operativos. El proceso es muy fácil si tenes instalada la ultima versión de VirtualBox, lo primero que tenemos que hacer es abrir VirtualBox desde “Aplicaciones → Herramientas del sistema → Innotek VirtualBox” una vez abierto seleccionamos la máquina virtual que creamos y hacemos click en Configurar. Se nos [...]]]></description>
			<content:encoded><![CDATA[<p>cómo compartir carpetas entre los dos sistemas operativos.</p>
<p>El proceso es muy fácil si tenes instalada la ultima versión de VirtualBox, lo primero que tenemos que hacer es abrir VirtualBox desde “Aplicaciones → Herramientas del sistema → Innotek VirtualBox” una vez abierto seleccionamos la máquina virtual que creamos y hacemos click en Configurar.</p>
<p>Se nos abrirá una pantalla donde tendremos que hacer un click sobre la opción Directorios Compartidos (1) y luego sobre el icono con un signo + (2).</p>
<p><a href="http://www.arvaro.org/wp-content/uploads/2011/07/vbox_compartir.jpg"><img class="alignnone size-full wp-image-591" title="vbox_compartir" src="http://www.arvaro.org/wp-content/uploads/2011/07/vbox_compartir.jpg" alt="" width="450" height="379" /></a></p>
<p>Luego aparecerá un cuadro donde pondremos la ruta de la carpeta que queremos compartir, por ejemplo /home/usuario/carpetacompartida le damos a Ok y ahora nos toca iniciar la máquina virtual. Hacemos click en Iniciar y una vez que este iniciado el sistema operativo tendremos que instalar las Guest Addition desde “Dispositivos → Instalar Guest Addition” en la ventana de la máquina. Es indispensable tener Guest Addition instalado para que funcione, si al hacer click no se instala, tendrás que entrar a Internet desde el sistema operativo emulado y descargarlo.</p>
<p>Bien, ahora viene el ultimo paso, hacemos click en “Inicio → Ejecutar” dentro de Windows y tecleamos cmd, se nos abrira la consola y tendremos que escribir la siguiente linea:</p>
<pre class="brush:shell">net use x: \\vboxsvr\carpetacompartida</pre>
<p>Si todo salio bien veremos un mensaje que dice “La operación se ha finalizado correctamente”. Ahora solo queda ir a Mi Pc y a la carpeta que creamos para compartir.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.arvaro.org/tips/virtual-box-compartir-directorio-ubuntu-y-windows/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>archivos idioma .po y .mo</title>
		<link>http://www.arvaro.org/tips/archivos-idioma-po-y-mo</link>
		<comments>http://www.arvaro.org/tips/archivos-idioma-po-y-mo#comments</comments>
		<pubDate>Mon, 09 May 2011 02:13:16 +0000</pubDate>
		<dc:creator>arvaro</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.arvaro.org/?p=586</guid>
		<description><![CDATA[La eterna duda de planteamiento en cuanto a localización de un proyecto -l10n ó multi-idioma para despistados-. Se puede resolver en forma de constantes en un archivo que se cargue al inicio dependiendo del idioma: es.php: define('USER','Usuario'); define('PASS', 'Contraseña'); en.php: define('USER','User'); define('PASS', 'Password'); if($_SESSION['lang']=='es') include('es.php'); También se puede abordar el problema desde el mismo punto [...]]]></description>
			<content:encoded><![CDATA[<h2><span style="font-size: 13px; font-weight: normal;">La eterna duda de planteamiento en cuanto a localización de un proyecto -<em>l10n ó multi-idioma para despistados</em>-. Se puede resolver en forma de constantes en un archivo que se cargue al inicio dependiendo del idioma:</span></h2>
<div>
<pre>es.php:
<a href="http://www.php.net/define">define</a>('USER','Usuario');
<a href="http://www.php.net/define">define</a>('PASS', 'Contraseña');

en.php:
<a href="http://www.php.net/define">define</a>('USER','User');
<a href="http://www.php.net/define">define</a>('PASS', 'Password');

if($_SESSION['lang']=='es') include('es.php');</pre>
<p>También se puede abordar el problema desde el mismo punto de vista pero cambiando constantes por variables, lo cual no sé hasta qué punto podría ser lógico puesto que realmente se trata de cadenas que no variarán a lo largo de la ejecución del script.</p>
<p>Y por último -<abbr title="At the moment">atm</abbr>- se pueden usar los archivos de idiomas soportados por la biblioteca de funciones <em>gettext();</em>, más conocidos por archivos <em>.po</em> y <em>.mo</em>. Ignoro si el consumo de recursos es mayor ó menor que las soluciones anteriores, pero como hay que probar de todo, análogamente al ejemplo anterior creamos un <em>fichero.po</em> con el siguiente contenido:</p>
<pre>msgid "User"
msgstr "Usuario"

msgid "Pass"
msgstr "Contraseña"</pre>
<p>Ahora debemos <em>compilarlo</em> para convertirlo en <em>.mo</em> y cargarlo en nuestra aplicación:</p>
<pre>$ msgfmt -o fichero.mo fichero.po</pre>
<p>Haremos lo mismo con el resto de idiomas pero ubicándolos en distintas carpetas siguiendo una estructura similar a la siguiente:</p>
<ul>
<li>/lang
<ul>
<li>en_US
<ul>
<li>LC_MESSAGES
<ul>
<li>fichero.po</li>
<li>fichero.mo</li>
</ul>
</li>
</ul>
</li>
<li>es_ES
<ul>
<li>LC_MESSAGES
<ul>
<li>fichero.po</li>
<li>fichero.mo</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>Tan solo queda la lógica del script, en la que le diremos el idioma a cargar y dónde se encuentra:</p>
<pre>// Cargamos locale e idioma
<a href="http://www.php.net/setlocale">setlocale</a>(LC_ALL, 'es_ES');
<a href="http://www.php.net/bindtextdomain">bindtextdomain</a>('fichero', '/lang/');
<a href="http://www.php.net/textdomain">textdomain</a>('fichero');</pre>
<p>Recordad que el uso -<em>si se cambia de idioma</em>- es similar al anterior:</p>
<pre>if($_SESSION['lang']=='en') <a href="http://www.php.net/setlocale">setlocale</a>(LC_ALL, 'en_US');</pre>
<p>Creo que no me dejo nada en el tintero&#8230; bueno, la función que <em>pinta</em> todo ésto podría ser algo similar a ésto -<em>seguro que os suena</em>-:</p>
<pre>/**
 * Gettext pero más cómodo
 */
function __($var)
{
	return <a href="http://www.php.net/gettext">gettext</a>($var);
}</pre>
<p>Con un simple <em>&lt;?=__(&#8216;User&#8217;);?&gt;</em> arreglaríamos, como veis es bastante &#8220;<em>vistoso</em>&#8221; -<em>esto va con segundas</em>-. Ahora si, post acabado.</p>
<p><strong>Ojo</strong>: Las locales (<em>es_ES, en_US&#8230;</em>) varían según el sistema operativo.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.arvaro.org/tips/archivos-idioma-po-y-mo/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Crear archivos ZIP con PHP</title>
		<link>http://www.arvaro.org/php/crear-archivos-zip-con-php</link>
		<comments>http://www.arvaro.org/php/crear-archivos-zip-con-php#comments</comments>
		<pubDate>Tue, 26 Apr 2011 18:14:05 +0000</pubDate>
		<dc:creator>arvaro</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.arvaro.org/?p=580</guid>
		<description><![CDATA[zipfile.php.tar En esta ocasión veremos la forma de crear archivos comprimidos en formato ZIP. Para este ejemplo utilizaremos la clase zipfile escrita por Eric Mueller y muy bien explicada en Creating ZIP files with PHP. Descargando la clase zipfile Lo primero es descargar la clase zipfile desde zipfile.inc.txt y renombrarla a zipfile.php. Esta clase tiene [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.arvaro.org/wp-content/uploads/2011/04/zipfile.php_.tar.gz">zipfile.php.tar</a></p>
<p>En esta ocasión veremos la forma de crear archivos comprimidos en formato ZIP. Para este ejemplo utilizaremos la clase zipfile escrita por Eric Mueller y muy bien explicada en Creating ZIP files with PHP.</p>
<p>Descargando la clase zipfile</p>
<p>Lo primero es descargar la clase zipfile desde zipfile.inc.txt y renombrarla a zipfile.php. Esta clase tiene dos metodos add_dir() y add_file() que permite agregar una carpeta o un archivo al zip que se esta creando.</p>
<p>Creando nuestro primer ZIP</p>
<p>Lo primero es incluir el archivo recién descargado, luego de ello creamos una instancia de la clase, para este ejemplo a la instancia lo llamamos $zipfile. Luego de ello agregamos un archivo de la siguiente forma.</p>
<pre class="brush:php">require ("zipfile.php");
$zipfile = new zipfile();
$zipfile-&gt;add_file(implode("",file("img01.jpg")), "foto.jpg");</pre>
<p>Nótese que estamos agregando un archivo llamado img01.jpg y al momento de incluirlo en el zip lo estamos renombrando a foto.jpg. Hasta este punto hemos creado un archivo zip, el siguiente paso es enviarlo al cliente, para ello agregamos headers indicando el tipo de archivo y finalmente imprimimos el archivo:</p>
<pre class="brush:php">require ("zipfile.php");
$zipfile = new zipfile();
$zipfile-&gt;add_file(implode("",file("img01.jpg")), "foto.jpg");
header("Content-type: application/octet-stream");
header("Content-disposition: attachment; filename=zipfile.zip");
echo $zipfile-&gt;file();
</pre>
<p>El resultado del ejemplo lo pueden ver en http://samples.unijimpe.net/php-zip/.</p>
<p>Agregando carpetas al ZIP<br />
En el caso que agregamos varios archivos y deseamos agruparlas en una carpeta, podemos utilizar el metodo add_folder. Luego de ello agregamos los archivos a la carpeta de la siguiente forma:</p>
<pre class="brush:php">require ("zipfile.php");
$zipfile = new zipfile();
$zipfile-&gt;add_dir("img/");
$zipfile-&gt;add_file(implode("",file("img01.jpg")), "img/01.jpg");
$zipfile-&gt;add_file(implode("",file("img02.jpg")), "img/02.jpg");
$zipfile-&gt;add_file(implode("",file("img03.jpg")), "img/03.jpg");
header("Content-type: application/octet-stream");
header("Content-disposition: attachment; filename=fotos.zip");
echo $zipfile-&gt;file();
</pre>
<p>Como ven agregar carpetas y multiples archivos es muy sencillo, incluso se pueden renombrar los archivos al momento de agregarlos al archivo zip. El resultado de este ejemplo lo pueden ver en: <a href="http://samples.unijimpe.net/php-zip/zipfolder.php">http://samples.unijimpe.net/php-zip/zipfolder.php</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.arvaro.org/php/crear-archivos-zip-con-php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Crear Archivos excel con perl</title>
		<link>http://www.arvaro.org/tips/crear-archivos-excel-con-perl</link>
		<comments>http://www.arvaro.org/tips/crear-archivos-excel-con-perl#comments</comments>
		<pubDate>Fri, 15 Apr 2011 16:08:36 +0000</pubDate>
		<dc:creator>arvaro</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.arvaro.org/?p=577</guid>
		<description><![CDATA[fuente: http://lena.franken.de/perl_hier/excel.html Create Excelfile You don&#8217;t need Win32 to create Excel-files because the format is standardized. So it&#8217;s possible to create excel-files in Linux. I use it to regularly create financial reports from a database. This is how you create the Spreadsheet: use strict; use warnings; use Date::Calc; use Spreadsheet::WriteExcel; use Spreadsheet::WriteExcel::Utility; our $workbook = [...]]]></description>
			<content:encoded><![CDATA[<p>fuente: <a href="http://lena.franken.de/perl_hier/excel.html" target="_blank">http://lena.franken.de/perl_hier/excel.html</a></p>
<h2>Create Excelfile</h2>
<p>You don&#8217;t need Win32 to create Excel-files because the format is standardized.  So it&#8217;s possible to create excel-files in Linux. I use it to regularly create  financial reports from a database.</p>
<p>This is how you create the Spreadsheet:</p>
<pre>use strict;
use warnings;
use Date::Calc;
<strong>use Spreadsheet::WriteExcel;</strong>
<strong>use Spreadsheet::WriteExcel::Utility;</strong>

our $workbook = Spreadsheet::WriteExcel-&gt;new("perl2.xls"); 

our %format = &amp;get_excel_cell_formats;
</pre>
<h2><a name="display_formats"></a>Defining display formats</h2>
<p>&amp;get_excel_cell_formats defines the different kinds how your text and  your numbers get displayed:</p>
<pre>sub get_excel_cell_formats {
    my $format;

    # bold
    $format{bold} = $workbook-&gt;add_format();
    $format{bold}-&gt;set_bold();

    # german date format
    $format{date_ger} = $workbook-&gt;add_format();
    $format{date_ger}-&gt;set_num_format('dd.mm.yyyy');

    # Euro-cells: 1.234,56 E
    $format{currency_euro} = $workbook-&gt;add_format();
    $format{currency_euro}-&gt;set_num_format( sprintf '0,000.00 "%s"', chr(128));

    # Euro-cells, with red values below zero
    $format{currency_euro_red} = $workbook-&gt;add_format();
    $format{currency_euro_red}-&gt;set_num_format(
            sprintf '0,000.00 "%s";[Red]-0,000.00 "%s"', chr(128), chr(128));
    return %format;
}
</pre>
<h2><a name="writing_text"></a>Writing Text</h2>
<p><img src="http://lena.franken.de/perl_hier/excel_text.gif" border="0" alt="excel_text.gif" width="530" height="267" /></p>
<p>&nbsp;</p>
<pre>sub write_text {
        my $worksheet = shift;
        my ($x,$y)=(0,0);
        # Simple text
        $worksheet-&gt;write($y++, $x, "Hi Excel!");
        # Simple text bold
        $worksheet-&gt;write($y++, $x, "Hi Excel!", $format{bold});
}
</pre>
<h2><a name="writing_dates"></a>Writing Dates</h2>
<p><img src="http://lena.franken.de/perl_hier/excel_dates.gif" border="0" alt="excel_dates.gif" width="530" height="267" /></p>
<p>&nbsp;</p>
<pre>sub write_dates {
    my $worksheet = shift;
    my $y         = 0;

    # Set width of column
    $worksheet-&gt;set_column( 0, 0, 20 );
    $worksheet-&gt;set_column( 1, 1, 15 );

    # German date: 30.01.2002
    my ( $year, $month, $day ) = Date::Calc::Today;
    my $date = xl_date_list( $year, $month, $day );
    $worksheet-&gt;write( $y, 0, "Today" );
    $worksheet-&gt;write( $y, 1, $date, $format{date_ger} );
    $y++;

...
</pre>
<p>&nbsp;</p>
<h2><a name="writing_money"></a>Writing Money</h2>
<p><img src="http://lena.franken.de/perl_hier/excel_money.gif" border="0" alt="excel_money.gif" width="439" height="431" /></p>
<p>&nbsp;</p>
<pre>sub write_money {
    my $worksheet = shift;
    my ( $x, $y ) = ( 1, 0 );

    # some currency values in a row and sum it up
    # remember first and last cell to sum it up later
    # SUM works only with A1 not 0/0

    my $first = xl_rowcol_to_cell( $y, $x );
    my $last;

    foreach ( 1 .. 10 ) {
        $worksheet-&gt;write(
            $y, $x, rand() * 90000 + 1 - 40000,
            $format{currency_euro}
        );

        # remember last row
        $last = xl_rowcol_to_cell( $y, $x );
        $y++;
    }

    # Sum it up
    $worksheet-&gt;write( $y, $x - 1, "Sum" );
    $worksheet-&gt;write(
        $y, $x, "=SUM($first:$last)",
        $format{currency_euro}
    );
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.arvaro.org/tips/crear-archivos-excel-con-perl/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CJuiDialog and AjaxSubmitButton</title>
		<link>http://www.arvaro.org/php/cjuidialog-and-ajaxsubmitbutton</link>
		<comments>http://www.arvaro.org/php/cjuidialog-and-ajaxsubmitbutton#comments</comments>
		<pubDate>Wed, 02 Mar 2011 18:01:01 +0000</pubDate>
		<dc:creator>arvaro</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Yii Framework]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[yii framework]]></category>

		<guid isPermaLink="false">http://www.arvaro.org/?p=567</guid>
		<description><![CDATA[Post original en: http://www.yiiframework.com/wiki/72/cjuidialog-and-ajaxsubmitbutton &#160; Hello ppl. Even though i have a small experience with yii I though of writing this to help people which want to do something similar. Scenario We have a model Person how represent persons. The person has a Job. The user must select a job from a dropdownlist when he [...]]]></description>
			<content:encoded><![CDATA[<p>Post original en: <a href="http://www.yiiframework.com/wiki/72/cjuidialog-and-ajaxsubmitbutton">http://www.yiiframework.com/wiki/72/cjuidialog-and-ajaxsubmitbutton</a></p>
<p>&nbsp;</p>
<p>Hello ppl. Even though i have a small experience with yii I though of  writing this to help people which want to do something similar.</p>
<p><strong>Scenario</strong></p>
<p>We have a model Person how represent persons. The person has a Job.  The user must select a job from a dropdownlist when he creates the  person.  What if the person&#8217;s job is not listed in the dropdownlist and we don&#8217;t  want to redirect user to the job/create page. Here comes the CJuiDialog.  We will create a CJuiDialog ( a modal one <img src='http://www.arvaro.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  and we will create a new  job and the new job inserted will be also appended to the existing  dropdowlist.</p>
<h2 id="hh0">What we will use</h2>
<h3 id="hh1">1. AjaxLink:</h3>
<p>We will use an ajaxLink which will be located to the  person/views/_form.php ( we will call it _form from now on ) where we  create the person. The role of this ajaxLink will be to open the  CJuiDialog.</p>
<h3 id="hh2">2. JobController ActionAddnew:</h3>
<p>The ajaxLink will call an action in the JobController with name  ActionAddnew ( we will call it Addnew from now on ), which will either  save the job ( after validation ) either rendering the job form.</p>
<h3 id="hh3">3. _FormDialog:</h3>
<p>Finally, the job form which consist of a create.php view and a  _formDialog.php view, both exist under under job/views/. The _formDialog.php ( we will call it _formDialog from now on ) will  contain an ajaxSubmitButton to submit the Job we want to create.</p>
<h2 id="hh4">Code and details</h2>
<p>Now, I don&#8217;t know from where exactly should i start to make it more  easy for you.I assume you have a little experience with ajaxLink etc  although i will try to be as much detailed as i can.</p>
<h3 id="hh5">_form. The person&#8217;s create form</h3>
<pre class="brush:php">&lt;div class="row"&gt;
.....
&lt;?php echo $form-&gt;labelEx($person,'jid'); ?&gt;
&lt;div id="job"&gt;
    &lt;?php echo $form-&gt;dropDownList($person,'jid',CHtml::listData(Job::model()-&gt;findAll(),'jid','jdescr'),array('prompt'=&gt;'Select')); ?&gt;
    &lt;?php echo CHtml::ajaxLink(Yii::t('job','Create Job'),$this-&gt;createUrl('job/addnew'),array(
        'onclick'=&gt;'$("#jobDialog").dialog("open"); return false;',
        'update'=&gt;'#jobDialog'
        ),array('id'=&gt;'showJobDialog'));?&gt;
    &lt;div id="jobDialog"&gt;&lt;/div&gt;
&lt;/div&gt;
.....
&lt;/div&gt;</pre>
<p>&nbsp;</p>
<h5>Where to pay attention:</h5>
<ol>
<li><a href="http://www.yiiframework.com/doc/api/CHtml#activeDropDownList-detail"><code>dropDownList</code></a>
<p><code>$attribute</code> set to  <code>'jid'</code></li>
<li><a href="http://www.yiiframework.com/doc/api/CHtml#ajaxLink-detail"><code>ajaxLink</code></a>
<p><code>$url</code> calls the <code>ActionAddnew</code> in <code>JobController.php</code></p>
<p><code>$ajaxOptions</code> has to do with <code>#jobDialog</code> the <code>div</code> after the <code>ajaxLink</code> which will contain the <code>CJuiDialog</code> after the <code>'update'</code></p>
<p>and finally last but not least the <code>$htmlOption</code> where I set an <code>id</code> to the <code>ajaxLink</code> for avoiding some issues.</li>
</ol>
<h3 id="hh6">JobController. The ActionAddnew</h3>
<p>&nbsp;</p>
<pre class="brush:php">public function actionAddnew() {
                $model=new Job;
        // Ajax Validation enabled
        $this-&gt;performAjaxValidation($model);
        // Flag to know if we will render the form or try to add
        // new jon.
                $flag=true;
        if(isset($_POST['Job']))
        {       $flag=false;
            $model-&gt;attributes=$_POST['Job'];

            if($model-&gt;save()) {
                //Return an &lt;option&gt; and select it
                            echo CHtml::tag('option',array (
                                'value'=&gt;$model-&gt;jid,
                                'selected'=&gt;true
                            ),CHtml::encode($model-&gt;jdescr),true);
                        }
                }
                if($flag) {
                    $this-&gt;renderPartial('createDialog',array('model'=&gt;$model,),false,true);
                }
        }</pre>
<p>&nbsp;</p>
<h4>Where to pay attention:</h4>
<p>I think this is straightforward. Pay attention the last 2 parameters of <a href="http://www.yiiframework.com/doc/api/CController#renderPartial-detail">renderPartial</a> We call first the <code>createDialog.php</code> from <code>job/views/</code> which is the following.</p>
<h3 id="hh7">createDialog.php</h3>
<pre class="brush:php">&lt;?php
$this-&gt;beginWidget('zii.widgets.jui.CJuiDialog',array(
                'id'=&gt;'jobDialog',
                'options'=&gt;array(
                    'title'=&gt;Yii::t('job','Create Job'),
                    'autoOpen'=&gt;true,
                    'modal'=&gt;'true',
                    'width'=&gt;'auto',
                    'height'=&gt;'auto',
                ),
                ));
echo $this-&gt;renderPartial('_formDialog', array('model'=&gt;$model)); ?&gt;
&lt;?php $this-&gt;endWidget('zii.widgets.jui.CJuiDialog');?&gt;</pre>
<p>&nbsp;</p>
<h4>Where to pay attention:</h4>
<p>The <code>'id'=&gt;'jobDialog',</code> and step back to the <code>_form</code> &#8220;pay attention.&#8221; <img src='http://www.arvaro.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Here we initialize the <code>CJuiDialog widget</code> and we render the <code>_formDialog.php</code></p>
<h3 id="hh8">_formDialog</h3>
<p>&nbsp;</p>
<pre class="brush:php">&lt;div class="form" id="jobDialogForm"&gt;

&lt;?php $form=$this-&gt;beginWidget('CActiveForm', array(
    'id'=&gt;'job-form',
    'enableAjaxValidation'=&gt;true,
));
//I have enableAjaxValidation set to true so i can validate on the fly the
?&gt;

    &lt;p class="note"&gt;Fields with &lt;span class="required"&gt;*&lt;/span&gt; are required.&lt;/p&gt;

    &lt;?php echo $form-&gt;errorSummary($model); ?&gt;

    &lt;div class="row"&gt;
        &lt;?php echo $form-&gt;labelEx($model,'jid'); ?&gt;
        &lt;?php echo $form-&gt;textField($model,'jid',array('size'=&gt;60,'maxlength'=&gt;90)); ?&gt;
        &lt;?php echo $form-&gt;error($model,'jid'); ?&gt;
    &lt;/div&gt;

    &lt;div class="row"&gt;
        &lt;?php echo $form-&gt;labelEx($model,'jdescr'); ?&gt;
        &lt;?php echo $form-&gt;textField($model,'jdescr',array('size'=&gt;60,'maxlength'=&gt;180)); ?&gt;
        &lt;?php echo $form-&gt;error($model,'jdescr'); ?&gt;
    &lt;/div&gt;

    &lt;div class="row buttons"&gt;
        &lt;?php echo CHtml::ajaxSubmitButton(Yii::t('job','Create Job'),CHtml::normalizeUrl(array('job/addnew','render'=&gt;false)),array('success'=&gt;'js: function(data) {
                        $("#Person_jid").append(data);
                        $("#jobDialog").dialog("close");
                    }'),array('id'=&gt;'closeJobDialog')); ?&gt;
    &lt;/div&gt;

&lt;?php $this-&gt;endWidget(); ?&gt;

&lt;/div&gt;</pre>
<p>&nbsp;</p>
<h4>Where to pay attention:</h4>
<ol>
<li>In the <code>'success'</code> <code>js function</code> the <code>data</code> is the what the <code>ActioAddnew</code> echoes.</li>
</ol>
<p><code>$("#Person_jid").append(data);</code> This append the <code>data</code> to the <code>'jid'</code> <code>dropDownList</code> ( check <code>_form</code> ).</p>
<ol>
<li><code>$("#jobDialog").dialog("close");</code> We close the dialog.</li>
<li><code>array('id'=&gt;'closeJobDialog')</code> We give unique id for this <code>ajaxLink</code> to avoid issues as we said before.</li>
</ol>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.arvaro.org/php/cjuidialog-and-ajaxsubmitbutton/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Parches en CSS</title>
		<link>http://www.arvaro.org/tips/parches-en-css</link>
		<comments>http://www.arvaro.org/tips/parches-en-css#comments</comments>
		<pubDate>Wed, 29 Dec 2010 13:47:33 +0000</pubDate>
		<dc:creator>fefamorales</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://www.arvaro.org/?p=549</guid>
		<description><![CDATA[Que lindo es terminar un sitio y ver que esta todo bien, pero derepente llega el demonio de internet explorer y a chrome le viene la maña y tu felicidad llega hasta ahí, bueno aqui les dejo la solución los famosos parches de css para chrome, safari, opera, iternet deplorer 7 y 8, para que [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.arvaro.org/wp-content/uploads/2010/12/parche.jpg"><img class="alignleft size-full wp-image-550" title="parche" src="http://www.arvaro.org/wp-content/uploads/2010/12/parche.jpg" alt="" width="294" height="92" /></a></p>
<p>Que lindo es terminar un sitio y ver que esta todo bien, pero derepente llega el demonio de internet explorer y a chrome le viene la maña y tu felicidad llega hasta ahí, bueno aqui les dejo la solución<span id="more-549"></span></p>
<p>los famosos parches de css para chrome, safari, opera, iternet deplorer 7 y 8, para que empiezen el año con sitios multibrowsing</p>
<p>Internet explorer</p>
<p>hay varios pero el que me ha dado mejro resultado es el siguiente</p>
<p>.clase {</p>
<p>background:#ff0000;   este es el atributo normal</p>
<p>background:#ff0000;  /* IE7 */este maravilloso comentario hace la magia</p>
<p>background:#ff0000;  /* IE8 */este maravilloso comentario hace la magia tambien</p>
<p>}</p>
<p>en el caso de este parche debe ser utilizado cada vez que &#8220;parchas&#8221; un atributo, a diferencia del parche de chrome que solo se agrega una vez(explico a continuación)</p>
<p><code>@media screen and (-webkit-min-device-pixel-ratio:0) {<br />
.clase { background-color: #FF0000; }<br />
#id {color: #0000FF;}<br />
p, a, li {text-shadow: 3px 3px 3px rgba(0, 0, 0, 0.4);<br />
}</code></p>
<p>este parche se aplica para chrome, safari y opera</p>
<p>como mencionaba antes este parche funciona diferente al de internet explorer, aqui solo debes escribir esta especie de marco</p>
<p><code>@media screen and (-webkit-min-device-pixel-ratio:0) {</code></p>
<p>}</p>
<p>y todo lo que quieran que se &#8220;parche&#8221; para estos exloradores lo escriben ahí</p>
<p>eso es todo</p>
]]></content:encoded>
			<wfw:commentRss>http://www.arvaro.org/tips/parches-en-css/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

