
<?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>Otro Blog Más &#187; php</title>
	<atom:link href="http://otroblogmas.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://otroblogmas.com</link>
	<description>Blog de informática: programación, internet, php, wordpress, zend framework, mysql, windows, mootools, linux,...</description>
	<lastBuildDate>Mon, 02 Jan 2012 07:33:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>XDebug: funciones indispensables</title>
		<link>http://otroblogmas.com/xdebug-funciones-indispensables/</link>
		<comments>http://otroblogmas.com/xdebug-funciones-indispensables/#comments</comments>
		<pubDate>Thu, 01 Sep 2011 06:00:30 +0000</pubDate>
		<dc:creator>otroblogmas.com</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[xdebug]]></category>

		<guid isPermaLink="false">http://otroblogmas.com/?p=2743</guid>
		<description><![CDATA[XDebug es una extensión para PHP, que permite depurar y perfilar una aplicación. Ofrece una serie de funciones muy útiles que reportan un conjunto de información en el momento que se desee. Solo quiero recoger las funciones que he visto más interesantes o que más comúnmente se pueden usar: var_dump(): XDebug sobreescribe la función nativa, mostrando más [...]
Entradas relacionadas:<ol>
<li><a href='http://otroblogmas.com/configurar-xampp-para-debugar-con-xdebug-en-netbeans/' rel='bookmark' title='Configurar XAMPP para debugar con XDebug en Netbeans'>Configurar XAMPP para debugar con XDebug en Netbeans</a></li>
<li><a href='http://otroblogmas.com/configurar-php-para-que-muestre-los-errores/' rel='bookmark' title='Configurar PHP para que muestre los errores'>Configurar PHP para que muestre los errores</a></li>
<li><a href='http://otroblogmas.com/dbug-clase-en-php-para-substituir-a-var_dump-o-print_r/' rel='bookmark' title='dBug: clase en PHP para substituir a var_dump o print_r'>dBug: clase en PHP para substituir a var_dump o print_r</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><img class="alignright size-full wp-image-2139" title="Logo de XDebug" src="http://otroblogmas.com/wp-content/uploads/2010/07/xdebug-logo.png" alt="xdebug logo XDebug: funciones indispensables" width="200" height="116" /><a href="http://otroblogmas.com/tag/xdebug/" class="st_tag internal_tag" rel="tag" title="Entradas etiquetadas con xdebug">XDebug</a> es una extensión para <a href="http://otroblogmas.com/tag/php/" class="st_tag internal_tag" rel="tag" title="Entradas etiquetadas con php">PHP</a>, que permite depurar y perfilar una aplicación. Ofrece una serie de <a href="http://xdebug.org/docs/all_functions">funciones </a>muy útiles que reportan un conjunto de información en el momento que se desee.</p>
<p><span id="more-2743"></span></p>
<p style="text-align: justify;">Solo quiero recoger las funciones que he visto más interesantes o que más comúnmente se pueden usar:</p>
<ul>
<li style="text-align: justify;"><strong>var_dump()</strong>: XDebug sobreescribe la función nativa, mostrando más detalles de una variable.</li>
<li style="text-align: justify;"><strong>xdebug_break()</strong>: establece un breakpoint.</li>
<li style="text-align: justify;"><strong>xdebug_call_class()</strong>: retorna el nombre de la clase en la que se encuentra la ejecución.</li>
<li style="text-align: justify;"><strong>xdebug_call_file()</strong>: retorna el nombre del fichero en el que se encuentra la ejecución.</li>
<li style="text-align: justify;"><strong>xdebug_call_function()</strong>: retorna el nombre del método en el que se encuentra la ejecución.</li>
<li style="text-align: justify;"><strong>xdebug_call_line()</strong>: retorna el número de línea en el que se encuentra la ejecución.</li>
<li style="text-align: justify;"><strong>xdebug_debug_zval()</strong>: retorna información sobre los puntos que apuntan a una variable, o si es un puntero la variable.</li>
<li style="text-align: justify;"><strong>xdebug_dump_superglobals()</strong>: retorna información sobre las variables super globales.</li>
<li style="text-align: justify;"><strong>xdebug_get_code_coverage()</strong>: retorna información sobre que líneas han sido ejecutadas, y cuantas veces.</li>
<li style="text-align: justify;"><strong>xdebug_get_declared_vars()</strong>: retorna las variables declaradas o accesibles en el momento de la ejecución.</li>
<li style="text-align: justify;"><strong>xdebug_get_function_stack()</strong>: retorna información sobre la pila de llamadas en el momento de ejecución.</li>
<li style="text-align: justify;"><strong>xdebug_get_headers()</strong>: retorna todos los headers establecidos hasta el momento.</li>
<li style="text-align: justify;"><strong>xdebug_memory_usage()</strong>: retorna el número de memoria en uso.</li>
<li style="text-align: justify;"><strong>xdebug_print_function_stack()</strong>: printa directamente la pila de llamadas en curso.</li>
<li style="text-align: justify;"><strong>xdebug_time_index()</strong>: retorna el instante actual desde el inicio de la ejecución.</li>
</ul>
<p>Entradas relacionadas:</p><ol>
<li><a href='http://otroblogmas.com/configurar-xampp-para-debugar-con-xdebug-en-netbeans/' rel='bookmark' title='Configurar XAMPP para debugar con XDebug en Netbeans'>Configurar XAMPP para debugar con XDebug en Netbeans</a></li>
<li><a href='http://otroblogmas.com/configurar-php-para-que-muestre-los-errores/' rel='bookmark' title='Configurar PHP para que muestre los errores'>Configurar PHP para que muestre los errores</a></li>
<li><a href='http://otroblogmas.com/dbug-clase-en-php-para-substituir-a-var_dump-o-print_r/' rel='bookmark' title='dBug: clase en PHP para substituir a var_dump o print_r'>dBug: clase en PHP para substituir a var_dump o print_r</a></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://otroblogmas.com/xdebug-funciones-indispensables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHPUnit Cheat Sheet</title>
		<link>http://otroblogmas.com/phpunit-cheat-sheet/</link>
		<comments>http://otroblogmas.com/phpunit-cheat-sheet/#comments</comments>
		<pubDate>Sat, 04 Jun 2011 06:00:33 +0000</pubDate>
		<dc:creator>otroblogmas.com</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[cheat sheet]]></category>
		<category><![CDATA[Mock]]></category>
		<category><![CDATA[phpunit]]></category>

		<guid isPermaLink="false">http://otroblogmas.com/?p=2636</guid>
		<description><![CDATA[Después de aprender a construir pruebas unitarias, de estudiar a fondo PHPUnit y hacerme apuntes, solo me quedaba crear un Cheat Sheet de PHPUnit. Esta basado en la versión 3.6 de PHPUnit, y aparecen los diferentes métodos &#8221;asserts&#8221; que existen, los elementos necesarios para generar los Mock Objects que se requieran, utilidades, ejemplos, &#8230; Cualquier corrección [...]
Entradas relacionadas:<ol>
<li><a href='http://otroblogmas.com/firebug-cheat-sheet-maximo-rendimiento/' rel='bookmark' title='Firebug: cheat sheet para sacar el máximo provecho'>Firebug: cheat sheet para sacar el máximo provecho</a></li>
<li><a href='http://otroblogmas.com/patrones-de-diseno-cheat-sheet/' rel='bookmark' title='Patrones de diseño: cheat sheet'>Patrones de diseño: cheat sheet</a></li>
<li><a href='http://otroblogmas.com/instalar-phpunit-en-el-xampp-de-ubuntu/' rel='bookmark' title='Instalar PHPUnit en el XAMPP de Ubuntu'>Instalar PHPUnit en el XAMPP de Ubuntu</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><img class="alignright size-full wp-image-1833" title="PHPUnit Logo" src="http://otroblogmas.com/wp-content/uploads/2010/03/phpunit-logo.png" alt="phpunit logo PHPUnit Cheat Sheet" width="102" height="80" /></p>
<p style="text-align: justify;">Después de aprender a construir pruebas unitarias, de estudiar a fondo <strong><a href="http://otroblogmas.com/tag/phpunit/" class="st_tag internal_tag" rel="tag" title="Entradas etiquetadas con phpunit">PHPUnit</a> </strong>y hacerme apuntes, solo me quedaba crear un <strong>Cheat Sheet</strong> de PHPUnit.</p>
<p style="text-align: justify;">Esta basado en la versión 3.6 de PHPUnit, y aparecen los diferentes métodos &#8221;<em>asserts</em>&#8221; que existen, los elementos necesarios para generar los Mock Objects que se requieran, utilidades, ejemplos, &#8230;</p>
<p><span id="more-2636"></span></p>
<p style="text-align: justify;">Cualquier corrección o mejora, será bién recibida.</p>
<p style="text-align: justify;"><strong>English version</strong></p>
<p style="text-align: justify;">This cheat sheet is based on verion 3.6 of PHPUnit, and there are the diffferent methods &#8220;asserts&#8221; that exist, the necessary elements to generate Mock Objects are required, utilities, examples,&#8230;</p>
<p style="text-align: justify;">Any correction or improvement is welcome.</p>
<p style="text-align: justify;"><strong>Versión 0.1</strong></p>
<ul>
<li>Format PNG &#8211; <strong><a title="PHPUnit Cheat Sheet - Version PNG" href="http://otroblogmas.com/wp-content/uploads/2011/06/PHPUnit-Cheat-Sheet.png">Download</a></strong></li>
<li>Format PDF &#8211; <strong><a title="PHPUnit Cheat Sheet - Version PDF" href="http://otroblogmas.com/wp-content/uploads/2011/06/PHPUnit-Cheat-Sheet.pdf">Download</a></strong></li>
<li>SlideShare &#8211; <strong><a href="http://www.slideshare.net/ianmonge/phpunit-cheat-sheet">Link</a></strong></li>
</ul>
<div id="__ss_8185906" style="width: 520px;">
<p><object id="__sse8185906" width="520" height="750"><param name="movie" value="http://static.slidesharecdn.com/swf/doc_player.swf?doc=phpunitcheatsheet-110602092804-phpapp02&amp;stripped_title=phpunit-cheat-sheet&amp;userName=ianmonge" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><embed type="application/x-shockwave-flash" width="520" height="750" src="http://static.slidesharecdn.com/swf/doc_player.swf?doc=phpunitcheatsheet-110602092804-phpapp02&amp;stripped_title=phpunit-cheat-sheet&amp;userName=ianmonge" name="__sse8185906" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
</div>
<p><script src="http://b.scorecardresearch.com/beacon.js?c1=7&amp;c2=7400849&amp;c3=1&amp;c4=&amp;c5=&amp;c6="></script> <script src="http://b.scorecardresearch.com/beacon.js?c1=7&amp;c2=7400849&amp;c3=1&amp;c4=&amp;c5=&amp;c6="></script></p>
<p><script src="http://b.scorecardresearch.com/beacon.js?c1=7&amp;c2=7400849&amp;c3=1&amp;c4=&amp;c5=&amp;c6="></script><br />
<script src="http://b.scorecardresearch.com/beacon.js?c1=7&amp;c2=7400849&amp;c3=1&amp;c4=&amp;c5=&amp;c6="></script><script src="http://b.scorecardresearch.com/beacon.js?c1=7&amp;c2=7400849&amp;c3=1&amp;c4=&amp;c5=&amp;c6="></script></p>
<p>Entradas relacionadas:</p><ol>
<li><a href='http://otroblogmas.com/firebug-cheat-sheet-maximo-rendimiento/' rel='bookmark' title='Firebug: cheat sheet para sacar el máximo provecho'>Firebug: cheat sheet para sacar el máximo provecho</a></li>
<li><a href='http://otroblogmas.com/patrones-de-diseno-cheat-sheet/' rel='bookmark' title='Patrones de diseño: cheat sheet'>Patrones de diseño: cheat sheet</a></li>
<li><a href='http://otroblogmas.com/instalar-phpunit-en-el-xampp-de-ubuntu/' rel='bookmark' title='Instalar PHPUnit en el XAMPP de Ubuntu'>Instalar PHPUnit en el XAMPP de Ubuntu</a></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://otroblogmas.com/phpunit-cheat-sheet/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Desarrollo de PHP avanzado</title>
		<link>http://otroblogmas.com/desarrollo-php-avanzado/</link>
		<comments>http://otroblogmas.com/desarrollo-php-avanzado/#comments</comments>
		<pubDate>Mon, 23 May 2011 06:00:19 +0000</pubDate>
		<dc:creator>otroblogmas.com</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[ide]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://otroblogmas.com/?p=2621</guid>
		<description><![CDATA[Charla buenísima de Carlos Buenosvinos (@buenosvinos), que dio en mayo del 2011 en Castellón de la Plana. Habla de muchos aspectos que cualquier desarrollador PHP que se considere avanzado, ha de conocer. También esos aspectos deben ser utilizados en ciertos proyectos con un nivel de complejidad o tráfico elevado. Habla de aspectos muy importantes como: [...]
Entradas relacionadas:<ol>
<li><a href='http://otroblogmas.com/configurar-xampp-proyectos-desarrollo-local/' rel='bookmark' title='Configurar XAMPP para proyectos en desarrollo en local'>Configurar XAMPP para proyectos en desarrollo en local</a></li>
<li><a href='http://otroblogmas.com/crear-maquina-virtual-desarrollo-virtualbox/' rel='bookmark' title='Crear máquina virtual de desarrollo en VirtualBox'>Crear máquina virtual de desarrollo en VirtualBox</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><img class="size-full wp-image-2627 alignright" title="PHP avanzado" src="http://otroblogmas.com/wp-content/uploads/2011/05/php-avanzado.jpg" alt="php avanzado Desarrollo de PHP avanzado" width="150" height="150" />Charla buenísima de <strong>Carlos Buenosvinos</strong> (<a href="http://twitter.com/buenosvinos">@buenosvinos</a>), que dio en mayo del 2011 en Castellón de la Plana. Habla de muchos aspectos que cualquier <strong>desarrollador <a href="http://otroblogmas.com/tag/php/" class="st_tag internal_tag" rel="tag" title="Entradas etiquetadas con php">PHP</a></strong> que se considere avanzado, ha de conocer. También esos aspectos deben ser utilizados en ciertos proyectos con un <strong>nivel de complejidad o tráfico elevado</strong>.</p>
<p><span id="more-2621"></span></p>
<p style="text-align: justify;">Habla de <strong>aspectos muy importantes</strong> como:</p>
<ul>
<li style="text-align: justify;">Coding Standards</li>
<li style="text-align: justify;">IDEs</li>
<li style="text-align: justify;">Metodologías</li>
<li style="text-align: justify;">Pruebas unitarias</li>
<li style="text-align: justify;">Pruebas automáticas</li>
<li style="text-align: justify;">Frameworks</li>
<li style="text-align: justify;">Integración continua</li>
<li style="text-align: justify;">Servidores de control de versiones</li>
<li style="text-align: justify;">Documentación</li>
<li style="text-align: justify;">Issue trackers</li>
<li style="text-align: justify;">&#8230;</li>
</ul>
<p><iframe src="http://player.vimeo.com/video/23846442?title=0&amp;byline=0&amp;portrait=0" width="520" height="390" frameborder="0"></iframe>
<p><a href="http://vimeo.com/23846442">PHP profesional</a> from <a href="http://vimeo.com/decharlas">decharlas.com</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p style="text-align: justify;">Como dice en la charla, se podría crear una <strong>checklist </strong>y comprobando los <strong>aspectos que nos faltan</strong> dominar o implementar en nuestro proyecto.</p>
<p style="text-align: justify;">Presentación en SlideShare <a href="http://www.slideshare.net/carlosbuenosvinos/al-rico-php">&#8220;Al rico&#8221; PHP</a>:</p>
<div style="width:510px" id="__ss_7991629"> <strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/carlosbuenosvinos/al-rico-php" title="&quot;Al rico&quot; PHP">&quot;Al rico&quot; PHP</a></strong> <object id="__sse7991629" width="510" height="426"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=guidetoprofessionalphpdevelopment-110517041552-phpapp02&#038;stripped_title=al-rico-php&#038;userName=carlosbuenosvinos" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed name="__sse7991629" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=guidetoprofessionalphpdevelopment-110517041552-phpapp02&#038;stripped_title=al-rico-php&#038;userName=carlosbuenosvinos" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="510" height="426"></embed></object>
<div style="padding:5px 0 12px"> View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/carlosbuenosvinos">Carlos Buenosvinos</a> </div>
</p></div>
<p>Entradas relacionadas:</p><ol>
<li><a href='http://otroblogmas.com/configurar-xampp-proyectos-desarrollo-local/' rel='bookmark' title='Configurar XAMPP para proyectos en desarrollo en local'>Configurar XAMPP para proyectos en desarrollo en local</a></li>
<li><a href='http://otroblogmas.com/crear-maquina-virtual-desarrollo-virtualbox/' rel='bookmark' title='Crear máquina virtual de desarrollo en VirtualBox'>Crear máquina virtual de desarrollo en VirtualBox</a></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://otroblogmas.com/desarrollo-php-avanzado/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Principios de programación para Unit-Testing</title>
		<link>http://otroblogmas.com/principios-programacion-unit-testing/</link>
		<comments>http://otroblogmas.com/principios-programacion-unit-testing/#comments</comments>
		<pubDate>Mon, 09 May 2011 06:00:51 +0000</pubDate>
		<dc:creator>otroblogmas.com</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[phpunit]]></category>
		<category><![CDATA[unit-testing]]></category>

		<guid isPermaLink="false">http://otroblogmas.com/?p=2560</guid>
		<description><![CDATA[Lista de aspectos de la programación que dificultan las pruebas unitarias. Decisiones que NO se deben de tomar: Uso de private en propiedades o métodos. Uso de static en propiedades o métodos. Uso de final en métodos. Uso del operador new. Uso del patrón Singleton, que conlleva el uso de los 4 puntos anteriores. Uso [...]
Entradas relacionadas:<ol>
<li><a href='http://otroblogmas.com/mock-stub-otros-elementos-unit-testing/' rel='bookmark' title='Mock vs Stub, y otros elementos de Unit-Testing'>Mock vs Stub, y otros elementos de Unit-Testing</a></li>
<li><a href='http://otroblogmas.com/solid-los-principios-de-la-programacion-orientada-a-objetos/' rel='bookmark' title='SOLID: los principios de la programación orientada a objetos'>SOLID: los principios de la programación orientada a objetos</a></li>
<li><a href='http://otroblogmas.com/patrones-de-diseno-patron-singleton/' rel='bookmark' title='Patrones de diseño: patrón Singleton'>Patrones de diseño: patrón Singleton</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><img class="alignright size-medium wp-image-2566" title="Testing" src="http://otroblogmas.com/wp-content/uploads/2011/05/testing-200x146.jpg" alt="testing 200x146 Principios de programación para Unit Testing" width="200" height="146" />Lista de aspectos de la programación que dificultan las pruebas unitarias.</p>
<p><span id="more-2560"></span></p>
<p style="text-align: justify;">Decisiones que NO se deben de tomar:</p>
<ul style="text-align: justify;">
<li>Uso de <strong>private</strong> en propiedades o métodos.</li>
<li>Uso de <strong>static</strong> en propiedades o métodos.</li>
<li>Uso de <strong>final</strong> en métodos.</li>
<li>Uso del operador <strong>new</strong>.</li>
<li>Uso del <strong><a href="http://otroblogmas.com/patrones-de-diseno-patron-singleton/">patrón Singleton</a></strong>, que conlleva el uso de los 4 puntos anteriores.</li>
<li>Uso de variables globales.</li>
</ul>
<p style="text-align: justify;">Alternativas:</p>
<ul>
<li style="text-align: justify;">Uso del <strong>Dependency Injection</strong>.</li>
<li style="text-align: justify;">Uso de la <a href="http://es2.php.net/manual/es/class.reflection.php">clase <strong>Reflection</strong></a>.</li>
</ul>
<p>Entradas relacionadas:</p><ol>
<li><a href='http://otroblogmas.com/mock-stub-otros-elementos-unit-testing/' rel='bookmark' title='Mock vs Stub, y otros elementos de Unit-Testing'>Mock vs Stub, y otros elementos de Unit-Testing</a></li>
<li><a href='http://otroblogmas.com/solid-los-principios-de-la-programacion-orientada-a-objetos/' rel='bookmark' title='SOLID: los principios de la programación orientada a objetos'>SOLID: los principios de la programación orientada a objetos</a></li>
<li><a href='http://otroblogmas.com/patrones-de-diseno-patron-singleton/' rel='bookmark' title='Patrones de diseño: patrón Singleton'>Patrones de diseño: patrón Singleton</a></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://otroblogmas.com/principios-programacion-unit-testing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mock vs Stub, y otros elementos de Unit-Testing</title>
		<link>http://otroblogmas.com/mock-stub-otros-elementos-unit-testing/</link>
		<comments>http://otroblogmas.com/mock-stub-otros-elementos-unit-testing/#comments</comments>
		<pubDate>Wed, 27 Apr 2011 06:00:19 +0000</pubDate>
		<dc:creator>otroblogmas.com</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[Mock]]></category>
		<category><![CDATA[phpunit]]></category>
		<category><![CDATA[Stub]]></category>
		<category><![CDATA[unit-testing]]></category>

		<guid isPermaLink="false">http://otroblogmas.com/?p=2547</guid>
		<description><![CDATA[Empezando en el mundo de las pruebas unitarias (UT), al principio no se ve la diferencia entre un Mock y un Stub. Centrandose en PHPUnit, ambos se consiguen usando el método getMock(), y eso aún genera más confusión. Stub: se genera un nuevo objeto usando el método getMock(), a partir de una clase que puede ser [...]
Entradas relacionadas:<ol>
<li><a href='http://otroblogmas.com/principios-programacion-unit-testing/' rel='bookmark' title='Principios de programación para Unit-Testing'>Principios de programación para Unit-Testing</a></li>
<li><a href='http://otroblogmas.com/patrones-de-diseno-patron-singleton/' rel='bookmark' title='Patrones de diseño: patrón Singleton'>Patrones de diseño: patrón Singleton</a></li>
<li><a href='http://otroblogmas.com/phpunit-cheat-sheet/' rel='bookmark' title='PHPUnit Cheat Sheet'>PHPUnit Cheat Sheet</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><img class="alignright size-medium wp-image-2549" title="to-mock-or-not-to-mock" src="http://otroblogmas.com/wp-content/uploads/2011/04/to-mock-or-not-to-mock-200x146.png" alt="to mock or not to mock 200x146 Mock vs Stub, y otros elementos de Unit Testing" width="200" height="146" />Empezando en el mundo de las <strong>pruebas unitarias</strong> (<a href="http://en.wikipedia.org/wiki/Unit_testing">UT</a>), al principio no se ve la diferencia entre un Mock y un Stub. Centrandose en <a href="http://otroblogmas.com/tag/phpunit/" class="st_tag internal_tag" rel="tag" title="Entradas etiquetadas con phpunit">PHPUnit</a>, ambos se consiguen usando el método <strong>getMock()</strong>, y eso aún genera más confusión.</p>
<p><span id="more-2547"></span></p>
<ul style="text-align: justify;">
<li><strong>Stub</strong>: se genera un nuevo objeto usando el método getMock(), a partir de una clase que puede ser la misma que se esta testeando o otra clase que se usa.</li>
<li><strong>Mock</strong>: idéntico a un Stub, pero con el añadido que en la creación del Mock, se añaden condiciones o &#8220;matchers&#8221; para comprobar la correcta utilización de la clase. Aportando así más pruebas al test.</li>
</ul>
<p style="text-align: justify;">Los siguientes diagramas quizás ayudan más a entender algo muy parecido:</p>
<p style="text-align: center;"><a href="http://otroblogmas.com/wp-content/uploads/2011/04/mock-diagram.jpg"><img class="aligncenter size-full wp-image-2551" title="Mock diagram" src="http://otroblogmas.com/wp-content/uploads/2011/04/mock-diagram.jpg" alt="mock diagram Mock vs Stub, y otros elementos de Unit Testing" width="520" height="390" /></a><a href="http://otroblogmas.com/wp-content/uploads/2011/04/stub-diagram.jpg"><img class="aligncenter size-full wp-image-2552" title="Stub diagram" src="http://otroblogmas.com/wp-content/uploads/2011/04/stub-diagram.jpg" alt="stub diagram Mock vs Stub, y otros elementos de Unit Testing" width="520" height="390" /></a></p>
<p style="text-align: justify;">A parte de un stub o un mock, también se puedan usar<strong> otros elementos</strong> para realizar las pruebas unitarias:</p>
<ul>
<li style="text-align: justify;"><strong>Fake</strong>: clase programada para generar objetos que aparientan un funcionamiento correcto.</li>
<li style="text-align: justify;"><strong>Dummy</strong>: objetos usados para rellenar o ser pasados por parámetro. De implementación pueden estar vacíos, ya que no van a ser usados directamente.</li>
<li style="text-align: justify;"><strong>Spy</strong>: stub pero además de cumplit su función, almacena información como los métodos llamados.</li>
</ul>
<p>Entradas relacionadas:</p><ol>
<li><a href='http://otroblogmas.com/principios-programacion-unit-testing/' rel='bookmark' title='Principios de programación para Unit-Testing'>Principios de programación para Unit-Testing</a></li>
<li><a href='http://otroblogmas.com/patrones-de-diseno-patron-singleton/' rel='bookmark' title='Patrones de diseño: patrón Singleton'>Patrones de diseño: patrón Singleton</a></li>
<li><a href='http://otroblogmas.com/phpunit-cheat-sheet/' rel='bookmark' title='PHPUnit Cheat Sheet'>PHPUnit Cheat Sheet</a></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://otroblogmas.com/mock-stub-otros-elementos-unit-testing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Funcionalidades avanzadas con las expresiones regulares</title>
		<link>http://otroblogmas.com/funcionalidades-avanzadas-expresiones-regulares/</link>
		<comments>http://otroblogmas.com/funcionalidades-avanzadas-expresiones-regulares/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 07:00:52 +0000</pubDate>
		<dc:creator>otroblogmas.com</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[expresiones regulares]]></category>
		<category><![CDATA[regular expressions]]></category>

		<guid isPermaLink="false">http://otroblogmas.com/?p=2463</guid>
		<description><![CDATA[Las expresiones regulares son un mundo muy extenso y difícil de dominar completamente. Pero a medida que van surgiendo necesidades, puedes descubrir funciones interesantes y muy útiles. Para realizar una captura, hay que usar los paréntesis. Pero puede darse el caso en que se usen los paréntesis y no se quiera la captura, sinó que [...]
Entradas relacionadas:<ol>
<li><a href='http://otroblogmas.com/expresiones-regulares-con-php/' rel='bookmark' title='Expresiones regulares con PHP'>Expresiones regulares con PHP</a></li>
<li><a href='http://otroblogmas.com/parsear-strings-formato-camelcase-php/' rel='bookmark' title='Parsear strings en formato camelCase en PHP'>Parsear strings en formato camelCase en PHP</a></li>
<li><a href='http://otroblogmas.com/herramientas-para-detectar-redes-wifi-en-windows/' rel='bookmark' title='Herramientas para detectar redes WIFI en Windows'>Herramientas para detectar redes WIFI en Windows</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><img class="alignright size-medium wp-image-2470" title="ancient-egyptian-regexp" src="http://otroblogmas.com/wp-content/uploads/2011/03/ancient-egyptian-regexp-200x139.jpg" alt="ancient egyptian regexp 200x139 Funcionalidades avanzadas con las expresiones regulares" width="200" height="139" />Las <strong><a href="http://otroblogmas.com/tag/expresiones-regulares/" class="st_tag internal_tag" rel="tag" title="Entradas etiquetadas con expresiones regulares">expresiones regulares</a></strong> son un mundo muy extenso y difícil de dominar completamente. Pero a medida que van surgiendo necesidades, puedes descubrir funciones interesantes y muy útiles.</p>
<p style="text-align: justify;">Para realizar una captura, hay que usar <strong>los paréntesis</strong>. Pero puede darse el caso en que se usen los paréntesis y no se quiera la captura, sinó que simplemente se utiliza para decir que es opcional su contenido.</p>
<p><span id="more-2463"></span></p>
<p style="text-align: justify;">Para <strong>anular la captura</strong> sería de la forma <strong>(?: )</strong></p>
<p style="text-align: justify;">Las capturas que hace una expresión regular, son guardadas en un array que <strong>numéricamente </strong>va añadiendo. Después tenemos que ir cogiendo los resultados según el índice numérico que ha asignado. Con la expresión regular:</p>

<div class="wp_syntax"><div class="code"><pre class="reg" style="font-family:monospace;"><span style="color: #000000;">&#40;</span>http|ftp<span style="color: #000000;">&#41;</span>:\/\/<span style="color: #000000;">&#40;</span>?:<span style="color: #000000;">&#40;</span>.*<span style="color: #000000;">&#41;</span>\.<span style="color: #000000;">&#41;</span>?<span style="color: #000000;">&#40;</span>.*<span style="color: #000000;">&#41;</span>\.<span style="color: #000000;">&#40;</span>.<span style="color: #000000;">&#123;</span>2,4<span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span></pre></div></div>

<p style="text-align: justify;">en las siguentes cadenas:</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">http://www.softonic.jp
ftp://es.mmi.imonge.net
http://otroblogmas.com</pre></div></div>

<p style="text-align: justify;">se obtiene:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">Array</span>
<span style="color: #009900;">&#40;</span>
    <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">Array</span>
        <span style="color: #009900;">&#40;</span>
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//www.softonic.jp</span>
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> ftp<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//es.mmi.imonge.net</span>
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//otroblogmas.com</span>
        <span style="color: #009900;">&#41;</span>
&nbsp;
    <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">Array</span>
        <span style="color: #009900;">&#40;</span>
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> http
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> ftp
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> http
        <span style="color: #009900;">&#41;</span>
&nbsp;
    <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">Array</span>
        <span style="color: #009900;">&#40;</span>
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> www
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> es<span style="color: #339933;">.</span>mmi
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span>
        <span style="color: #009900;">&#41;</span>
&nbsp;
    <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">Array</span>
        <span style="color: #009900;">&#40;</span>
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> softonic
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> imonge
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> otroblogmas
        <span style="color: #009900;">&#41;</span>
&nbsp;
    <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">Array</span>
        <span style="color: #009900;">&#40;</span>
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> jp
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> net
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> com
        <span style="color: #009900;">&#41;</span>
&nbsp;
<span style="color: #009900;">&#41;</span></pre></div></div>

<p style="text-align: justify;">Si se quiere <strong>etiquetas las capturas</strong> hechas, se puede hacer de la forma <strong>(?&#8217;captura&#8217; )</strong> o <strong>(?< >)</strong>. De esta manera, con la expresión:</p>

<div class="wp_syntax"><div class="code"><pre class="reg" style="font-family:monospace;"><span style="color: #000000;">&#40;</span>?'protocol'http|ftp<span style="color: #000000;">&#41;</span>:\/\/<span style="color: #000000;">&#40;</span>?:<span style="color: #000000;">&#40;</span>?'subdomain'.*<span style="color: #000000;">&#41;</span>\.<span style="color: #000000;">&#41;</span>?<span style="color: #000000;">&#40;</span>?'domain'.*<span style="color: #000000;">&#41;</span>\.<span style="color: #000000;">&#40;</span>?'tld'.<span style="color: #000000;">&#123;</span>2,4<span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span></pre></div></div>

<p style="text-align: justify;">se obtiene un array más usable:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">Array</span>
<span style="color: #009900;">&#40;</span>
    <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">Array</span>
        <span style="color: #009900;">&#40;</span>
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//www.softonic.jp</span>
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> ftp<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//es.mmi.imonge.net</span>
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//otroblogmas.com</span>
        <span style="color: #009900;">&#41;</span>
&nbsp;
    <span style="color: #009900;">&#91;</span>protocol<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">Array</span>
        <span style="color: #009900;">&#40;</span>
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> http
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> ftp
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> http
        <span style="color: #009900;">&#41;</span>
&nbsp;
    <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">Array</span>
        <span style="color: #009900;">&#40;</span>
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> http
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> ftp
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> http
        <span style="color: #009900;">&#41;</span>
&nbsp;
    <span style="color: #009900;">&#91;</span>subdomain<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">Array</span>
        <span style="color: #009900;">&#40;</span>
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> www
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> es<span style="color: #339933;">.</span>mmi
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span>
        <span style="color: #009900;">&#41;</span>
&nbsp;
    <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">Array</span>
        <span style="color: #009900;">&#40;</span>
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> www
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> es<span style="color: #339933;">.</span>mmi
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span>
        <span style="color: #009900;">&#41;</span>
&nbsp;
    <span style="color: #009900;">&#91;</span>domain<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">Array</span>
        <span style="color: #009900;">&#40;</span>
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> softonic
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> imonge
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> otroblogmas
        <span style="color: #009900;">&#41;</span>
&nbsp;
    <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">Array</span>
        <span style="color: #009900;">&#40;</span>
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> softonic
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> imonge
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> otroblogmas
        <span style="color: #009900;">&#41;</span>
&nbsp;
    <span style="color: #009900;">&#91;</span>tld<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">Array</span>
        <span style="color: #009900;">&#40;</span>
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> jp
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> net
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> com
        <span style="color: #009900;">&#41;</span>
&nbsp;
    <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">Array</span>
        <span style="color: #009900;">&#40;</span>
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> jp
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> net
            <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> com
        <span style="color: #009900;">&#41;</span>
&nbsp;
<span style="color: #009900;">&#41;</span></pre></div></div>

<p style="text-align: justify;">Para <strong>añadir un comentario</strong> en la expresión regular, se puede hacer de dos manera:</p>
<ul>
<li style="text-align: justify;"> Añadir el comentario en medio de la expresión regular con la forma <strong>(?#comentario)</strong>.</li>
<li style="text-align: justify;"> Usar el <strong><a href="http://www.regular-expressions.info/freespacing.html">modo free-spacing</a></strong> para hacer la expresión regular en varias líneas, y poder añadir comentarios. Para activar el modo free-spacing, hay que añadir la <strong>&#8220;x&#8221;</strong> al final. De esta manera los espacios ( espacios, tabuladores y saltos de línea) son ignorados, excepto en los grupos. Si encuentra una almohadilla, todo lo siguiente lo considera un comentario. Mejor un ejemplo:

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$regexExpr</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;/
	# Match a 20th or 21st century date in yyyy-mm-dd format
	(19|20)\d\d                # year (group 1)
	[- /.]                     # separator
	(0[1-9]|1[012])            # month (group 2)
	[- /.]                     # separator
	(0[1-9]|[12][0-9]|3[01])   # day (group 3)
/x&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Para determinar un espacio a ser buscado, se puede hacer <strong>&#8220;\ &#8220;</strong>, <strong>&#8220;\s&#8221;</strong> o <strong>&#8220;\x20&#8243;</strong>.</li>
</ul>
<p>Entradas relacionadas:</p><ol>
<li><a href='http://otroblogmas.com/expresiones-regulares-con-php/' rel='bookmark' title='Expresiones regulares con PHP'>Expresiones regulares con PHP</a></li>
<li><a href='http://otroblogmas.com/parsear-strings-formato-camelcase-php/' rel='bookmark' title='Parsear strings en formato camelCase en PHP'>Parsear strings en formato camelCase en PHP</a></li>
<li><a href='http://otroblogmas.com/herramientas-para-detectar-redes-wifi-en-windows/' rel='bookmark' title='Herramientas para detectar redes WIFI en Windows'>Herramientas para detectar redes WIFI en Windows</a></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://otroblogmas.com/funcionalidades-avanzadas-expresiones-regulares/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Autocompletado en Netbeans y Eclipse</title>
		<link>http://otroblogmas.com/autocompletado-netbeans-eclipse/</link>
		<comments>http://otroblogmas.com/autocompletado-netbeans-eclipse/#comments</comments>
		<pubDate>Wed, 23 Mar 2011 07:00:02 +0000</pubDate>
		<dc:creator>otroblogmas.com</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[autocompletado]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[ide]]></category>
		<category><![CDATA[netbeans]]></category>

		<guid isPermaLink="false">http://otroblogmas.com/?p=2454</guid>
		<description><![CDATA[Los Entornos de Desarrollo Integrado (IDE) son muy útiles para programar. Ofrecen una serie de funciones que ayudan muchos aspectos del desarrollo, ahorrando tiempo y agilizando procesos. Una de las funciones que más gusta a los desarrolladores es la función de autocompletado: a medida que se va escribiendo el código, el IDE ofrece un desplegable con [...]
Entradas relacionadas:<ol>
<li><a href='http://otroblogmas.com/instalar-y-configurar-xampp-y-eclipse-en-windows/' rel='bookmark' title='Instalar y configurar XAMPP y Eclipse en Windows'>Instalar y configurar XAMPP y Eclipse en Windows</a></li>
<li><a href='http://otroblogmas.com/atajos-de-teclado-de-netbeans-para-zend-framework/' rel='bookmark' title='Atajos de teclado de Netbeans para Zend Framework'>Atajos de teclado de Netbeans para Zend Framework</a></li>
<li><a href='http://otroblogmas.com/configurar-xampp-para-debugar-con-xdebug-en-netbeans/' rel='bookmark' title='Configurar XAMPP para debugar con XDebug en Netbeans'>Configurar XAMPP para debugar con XDebug en Netbeans</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><img class="alignright size-medium wp-image-2461" title="netbeans-eclipse-logos" src="http://otroblogmas.com/wp-content/uploads/2011/03/netbeans-eclipse-logos-200x100.jpg" alt="netbeans eclipse logos 200x100 Autocompletado en Netbeans y Eclipse" width="200" height="100" />Los <strong>Entornos de Desarrollo Integrado</strong> (<a title="Entorno de desarrollo integrado - Wikipedia" href="http://es.wikipedia.org/wiki/Entorno_de_desarrollo_integrado">IDE</a>) son muy útiles para programar. Ofrecen una serie de funciones que ayudan muchos aspectos del desarrollo, ahorrando tiempo y agilizando procesos. Una de las funciones que más gusta a los desarrolladores es la <strong>función de autocompletado</strong>: a medida que se va escribiendo el código, el <a href="http://otroblogmas.com/tag/ide/" class="st_tag internal_tag" rel="tag" title="Entradas etiquetadas con ide">IDE</a> ofrece un <strong>desplegable con sugerencias</strong> a lo que se quiere escribir, ayudando a escribir más rápido. En esas sugerencias pueden salir constantes o funciones nativas de los lenguajes de programación, o cualquier otra parte del código que ya se haya desarrollado en el proyecto en uso.</p>
<p><span id="more-2454"></span></p>
<p style="text-align: justify;">En la programación orientada a objetos (<a title="Programación orientada a objetos - Wikipedia" href="http://es.wikipedia.org/wiki/Programaci%C3%B3n_orientada_a_objetos">POO</a>), la función de autocompletado ayuda a <strong>encontrar propiedades o funciones de clases</strong> desarrolladas. Pero si el objeto no es creado a traves del <strong><a href="http://www.php.net/manual/en/language.oop5.basic.php#language.oop5.basic.new">operador new</a></strong>, el IDE no sabrá de que clase es el objeto, y no podrá ofrecer las sugerencias correctamente. Es el típico caso de los <a href="http://otroblogmas.com/category/patrones-diseno/">patrones de diseño</a> de Factory, incluso dependiendo del caso podría ocurrir con el <a href="http://otroblogmas.com/patrones-de-diseno-patron-singleton/">patrón Singleton</a>.</p>
<p style="text-align: justify;">Una manera de informar al IDE sobre de que clase es el objeto que se esta utilizando, es añadir un comentario en el código.</p>
<p style="text-align: justify;">Para el desarrollo de <a href="http://otroblogmas.com/tag/php/" class="st_tag internal_tag" rel="tag" title="Entradas etiquetadas con php">PHP</a> en el IDE Netbeans sería:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/*</span> <span style="color: #000000; font-weight: bold;">@</span>var <span style="color: #007800;">$objeto</span> SuClase <span style="color: #000000; font-weight: bold;">*/</span></pre></div></div>

<p style="text-align: justify;">Y para Eclipse sería:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/*</span> <span style="color: #000000; font-weight: bold;">@</span>var objeto SuClase <span style="color: #000000; font-weight: bold;">*/</span></pre></div></div>

<p style="text-align: justify;">Vía <a title="fiunchinho - Twitter" href="http://twitter.com/#!/fiunchinho">@fiunchinho</a></p>
<p>Entradas relacionadas:</p><ol>
<li><a href='http://otroblogmas.com/instalar-y-configurar-xampp-y-eclipse-en-windows/' rel='bookmark' title='Instalar y configurar XAMPP y Eclipse en Windows'>Instalar y configurar XAMPP y Eclipse en Windows</a></li>
<li><a href='http://otroblogmas.com/atajos-de-teclado-de-netbeans-para-zend-framework/' rel='bookmark' title='Atajos de teclado de Netbeans para Zend Framework'>Atajos de teclado de Netbeans para Zend Framework</a></li>
<li><a href='http://otroblogmas.com/configurar-xampp-para-debugar-con-xdebug-en-netbeans/' rel='bookmark' title='Configurar XAMPP para debugar con XDebug en Netbeans'>Configurar XAMPP para debugar con XDebug en Netbeans</a></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://otroblogmas.com/autocompletado-netbeans-eclipse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Presentaciones de la PHP Barcelona Conference 2010</title>
		<link>http://otroblogmas.com/presentaciones-php-barcelona-conference-2010/</link>
		<comments>http://otroblogmas.com/presentaciones-php-barcelona-conference-2010/#comments</comments>
		<pubDate>Mon, 01 Nov 2010 20:30:35 +0000</pubDate>
		<dc:creator>Eloi Poch</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[pbc10]]></category>
		<category><![CDATA[phpbarcelona]]></category>

		<guid isPermaLink="false">http://otroblogmas.com/?p=2393</guid>
		<description><![CDATA[Lista de Presentaciones de la PHP Barcelona Conference 2010: Hidden features of PHP APC &#38; Memcached the high performance duo A new approach to object persistence in PHP Split A/B Testing Database-driven PHP Web Applications In search of: Integrating site search How to scale PHP applications Cloud computing with PHP and Azure Design patterns&#8230; revisited [...]
Entradas relacionadas:<ol>
<li><a href='http://otroblogmas.com/straight_join-y-el-order-de-las-tablas-en-joins-de-mysql/' rel='bookmark' title='STRAIGHT_JOIN y el order de las tablas en JOINs de MySQL'>STRAIGHT_JOIN y el order de las tablas en JOINs de MySQL</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-medium wp-image-2402" title="PHP Barcelona Conference 2010" src="http://otroblogmas.com/wp-content/uploads/2010/11/pbc10_logo-200x40.png" alt="pbc10 logo 200x40 Presentaciones de la PHP Barcelona Conference 2010" width="200" height="40" />Lista de Presentaciones de la PHP Barcelona Conference 2010:<br />
<span id="more-2393"></span></p>
<ul>
<li> <a title="PDF de la Presentación &quot;Características ocultas de PHP&quot;" lang="en" hreflang="en" href="http://ilia.ws/files/barcelona_2010_hidden_features.pdf">Hidden features of PHP</a></li>
<li> <a title="PDF de la Presentación &quot;APC y Memcached Duo de alto rendimiento&quot;" lang="en" hreflang="en" href="http://ilia.ws/files/Barcelona_APC_MEM2010.pdf">APC &amp; Memcached the high performance duo</a></li>
<li> <a title="Presentación de &quot;Nuevo enfoque a la persistencia de objetos en PHP&quot;" lang="en" hreflang="en" href="http://www.slideshare.net/spriebsch/a-new-approach-to-object-persistence">A new approach to object persistence in PHP</a></li>
<li> Split A/B Testing Database-driven PHP Web Applications</li>
<li> <a title="Presnetación de &quot;En busca de: Integrando sistemas de búsqueda&quot;" lang="en" hreflang="en" href="http://www.slideshare.net/IanBarber/in-search-of-integrating-site-search-php-barcelona">In search of: Integrating site search</a></li>
<li> <a title="Presentación de &quot;Como escalar aplicaciones PHP&quot;" lang="en" hreflang="en" href="http://www.slideshare.net/e.zimuel/how-to-scale-php-applications">How to scale PHP applications</a></li>
<li><a href="http://www.slideshare.net/DavidSalgado1/cloud-computing-with-php-and-azure"> Cloud computing with PHP and Azure</a></li>
<li> <a title="Presentación de &quot;Patrones de Diseño... revisión para PHP 5.3&quot;" lang="en" hreflang="en" href="http://www.slideshare.net/fabpot/design-patternrevisitedphp53">Design patterns&#8230; revisited for PHP 5.3</a></li>
<li> PHP in the Enterprise: Develop and Deploy Mission Critical Applications</li>
<li> <a title="Presentación de &quot;RDBMS En La Edad de las Redes Sociales&quot;" lang="en" hreflang="en" href="http://www.slideshare.net/quipo/rdbms-in-the-social-networks-age"><acronym title="Relational database management system">RDBMS</acronym> in the social networks age</a></li>
<li> Cómo involucrarse con PHP</li>
<li> <a title="Presentación de &quot;Técnicas de comunicación en tiempo real con PHP&quot;" lang="en" hreflang="en" href="http://spoutserver.com/demos/presentation/">Real-time Communication Techniques with PHP</a></li>
<li> <a title="Presentación de &quot;Desmistificando PostgreSQL&quot;" lang="en" hreflang="en" href="http://www.slideshare.net/noloh/demystifying-postgresql">Demystifying PostgreSQL</a></li>
<li> <a title="Presentación de &quot;Control de Versión de Base de Datos sin sufrimiento&quot;" lang="en" hreflang="en" href="http://www.slideshare.net/harrieverveer/database-version-control-without-pain-the-php-barcelona-version">Database version control without pain</a></li>
<li> <a title="Presentación de &quot;PHP en Android&quot;" href="http://www.slideshare.net/irontec/phpforandroid-phpconference-barcelona20102010">PHP en Android</a></li>
<li> <a title="Presentación de &quot;Escalando Magento&quot;" lang="en" href="http://www.slideshare.net/fpalomo/php-barcelona-conference-2010-scaling-magento">Scaling Magento</a></li>
<li> <a title="Presentación de &quot;Mejora continua en proyectos PHP&quot;" lang="en" hreflang="en" href="http://www.slideshare.net/mayflowergmbh/continuous-improvement-in-php-projects">Continuous Improvement in PHP projects</a></li>
<li> iPhone Websites with PHP</li>
<li> <a title="Presentación de &quot;Gestión distribuida de código fuente&quot;" lang="en" hreflang="en" href="http://www.slideshare.net/gilmation/dscm-barcelona">Distributed Source Code Management</a></li>
<li> <a title="Presentación de &quot;Varnish en acción&quot;" lang="en" hreflang="en" href="http://www.slideshare.net/combell/varnish-in-action-pbc10">Varnish in action</a></li>
<li> <a title="Presentación de &quot;Arquitectura y testabilidad&quot;" lang="en" hreflang="en" href="http://www.slideshare.net/piccoloprincipe/php-barcelona-2010-architecture-and-testability">Architecture and testability</a></li>
<li> <a title="Presentación de &quot;Comet: Al enviar datos al servidor, empujamos la web hacia delante&quot;" lang="en" hreflang="en" href="http://www.slideshare.net/noloh/comet-by-pushing-server-data-we-push-the-web-forward">Comet: By Pushing Server Data, We Push the Web Forward</a></li>
<li> <a title="Presentación de &quot;Doctrine 2.0&quot;" lang="en" hreflang="en" href="http://www.slideshare.net/juokaz/2010-1029doctrine-2pbc10-5607358">Doctrine 2.0</a></li>
<li> <a title="Presentación de &quot;Lemur Framework&quot;" lang="en" hreflang="en" href="http://lemurframework.com/phpconference/talk/">Lemur Framework</a></li>
<li><a href="http://www.slideshare.net/jwenl/service-oriented-architecture-a-good-thing-to-do"> Service Oriented Architecture: a good thing to do</a></li>
<li> <a title="Presentación de &quot;Mondongo, un ODM para PHP y MongoDB&quot;" lang="en" hreflang="en" href="http://www.slideshare.net/pablodip/mondongo">Mondongo, un ODM para PHP y MongoDB</a></li>
<li> <a title="Presentación de &quot;SCRUM al detalle: Revisión práctica y perversiones humanas&quot;" lang="en" hreflang="en" href="http://www.slideshare.net/carlosbuenosvinos/scrum-al-detalle-revision-prctica-y-perversiones-humanas">SCRUM al detalle: Revisión práctica y perversiones humanas</a></li>
<li><a href="http://schlueters.de/presentations/20101030_barcelona_MySQL_Caching/barcelona_mysqlnd_qc.pdf"> MySQL client caching</a></li>
<li> <a title="Presentación del Taller &quot;Desarrollo de aplicaciones para Facebook en PHP&quot;" lang="en" hreflang="en" href="http://phpbc10-fbapps.heroku.com/">Desarrollo de aplicaciones para Facebook en PHP</a></li>
<li> <a title="Presentación de &quot;Organización de Equipos PHP&quot;" lang="en" hreflang="en" href="http://www.slideshare.net/alterway/php-team-organisation">PHP Team organisation</a></li>
<li> <a title="Presentación de &quot;PHP a través de los ojos de un proveedor de alojamiento&quot;" lang="en" hreflang="en" href="http://www.slideshare.net/combell/php-through-the-eyes-of-a-hoster-pbc10">PHP through the eyes of a hoster</a></li>
<li> High Performance WebApps Faster &amp; Easier with NOLOH</li>
</ul>
<p>Y una última presentación como bonus, el <a title="Demostración de &quot;Test PHP 5.3 de Zend&quot;" href="http://www.slideshare.net/carlosbuenosvinos/zend-php-53-demo-certification-test">test para el certificado de PHP 5.3 de Zend</a></p>
<p>Entradas relacionadas:</p><ol>
<li><a href='http://otroblogmas.com/straight_join-y-el-order-de-las-tablas-en-joins-de-mysql/' rel='bookmark' title='STRAIGHT_JOIN y el order de las tablas en JOINs de MySQL'>STRAIGHT_JOIN y el order de las tablas en JOINs de MySQL</a></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://otroblogmas.com/presentaciones-php-barcelona-conference-2010/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Configurar XAMPP para proyectos en desarrollo en local</title>
		<link>http://otroblogmas.com/configurar-xampp-proyectos-desarrollo-local/</link>
		<comments>http://otroblogmas.com/configurar-xampp-proyectos-desarrollo-local/#comments</comments>
		<pubDate>Mon, 18 Oct 2010 06:00:59 +0000</pubDate>
		<dc:creator>otroblogmas.com</dc:creator>
				<category><![CDATA[hosting]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[seguridad]]></category>
		<category><![CDATA[xampp]]></category>
		<category><![CDATA[xdebug]]></category>

		<guid isPermaLink="false">http://otroblogmas.com/?p=2348</guid>
		<description><![CDATA[Después de una instalación limpia de XAMPP, uno de los primeros pasos que pueden interesar es ejecutar el chequeo de seguridad (localizado en la URI http://localhost/security/). Por la configuración inicial, habrá unos cuantos puntos que marcará como inseguros; son fáciles de solucionar con el solucionador que trae XAMPP (lozalizado en la URI http://localhost/security/). A parte [...]
Entradas relacionadas:<ol>
<li><a href='http://otroblogmas.com/configurar-xampp-para-debugar-con-xdebug-en-netbeans/' rel='bookmark' title='Configurar XAMPP para debugar con XDebug en Netbeans'>Configurar XAMPP para debugar con XDebug en Netbeans</a></li>
<li><a href='http://otroblogmas.com/instalar-zend-framework-y-zend_tool-para-construir-proyectos-en-windows/' rel='bookmark' title='Instalar Zend Framework y Zend_Tool para construir proyectos en Windows'>Instalar Zend Framework y Zend_Tool para construir proyectos en Windows</a></li>
<li><a href='http://otroblogmas.com/instalar-y-configurar-xampp-y-eclipse-en-windows/' rel='bookmark' title='Instalar y configurar XAMPP y Eclipse en Windows'>Instalar y configurar XAMPP y Eclipse en Windows</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><img class="alignright size-medium wp-image-2351" title="Logo de XAMPP con Apache, PHP y MySQL" src="http://otroblogmas.com/wp-content/uploads/2010/10/xampp-logo-apache-php-mysql-143x150.jpg" alt="xampp logo apache php mysql 143x150 Configurar XAMPP para proyectos en desarrollo en local" width="143" height="150" />Después de una instalación limpia de XAMPP, uno de los <strong>primeros pasos</strong> que pueden interesar es ejecutar el <strong>chequeo de <a href="http://otroblogmas.com/tag/seguridad/" class="st_tag internal_tag" rel="tag" title="Entradas etiquetadas con seguridad">seguridad</a></strong> (localizado en la URI <a href="http://localhost/security/">http://localhost/security/</a>). Por la configuración inicial, habrá unos cuantos puntos que marcará como inseguros; son fáciles de solucionar con <strong>el solucionador</strong> que trae XAMPP (lozalizado en la URI <a href="http://localhost/security/">http://localhost/security/</a>).</p>
<p><span id="more-2348"></span></p>
<p style="text-align: justify;">A parte de lo anterior, també puede ser interesante cambiar unos parámetros de la configuración por defecto. En el <strong>php.ini</strong> se puede modificar lo siguiente:</p>
<ul>
<li style="text-align: justify;">La variable que determina el <strong>nivell de error que muestra PHP</strong>. Para mostrar todos los errores:

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #000099;">error_reporting</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #000066; font-weight:bold;"><span style="color: #660066;"> E_ALL | E_STRICT</span></span></pre></div></div>

</li>
<li style="text-align: justify;"><strong>Activar la extensión XDEBUG</strong> del servidor, para mostrar más datos al utilizar la función <strong>var_dump()</strong> o realizar debugs remotos. Hay que descomentar la línia:

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #000099;">zend_extension</span> <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;C:\xampp\php\ext\php_xdebug.dll&quot;</span></pre></div></div>

</li>
<li style="text-align: justify;">Por defecto, los <strong>parámetros de XDEBUG</strong> pueden ser bajos. Así que se pueden ampliar sus valores:

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">xdebug.var_display_max_children <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 300</span>
xdebug.var_display_max_data <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 1000</span>
xdebug.var_display_max_depth <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 7</span></pre></div></div>

</li>
<li style="text-align: justify;">Si se desea que se muestren ciertas <strong>variables globales</strong>, se han de añadir las siguiente líneas:

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">xdebug.dump.GET <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> *</span>
xdebug.dump.POST <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> *</span>
xdebug.dump.SERVER <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> REMOTE_ADDR, REQUEST_METHOD, HTTP_ACCEPT_LANGUAGE, HTTP_ACCEPT_LANGUAGE</span></pre></div></div>

</li>
</ul>
<p style="text-align: justify;">Según la arquitectura del proyecto, o simplemente por comodidad, se desea <strong>utilizar un dominio</strong> inventado para acceder a la aplicación que se esta desarrollando, sin tener que pasar por la URI <a href="http://localhost/">http://localhost/</a>. Por requisitos quizás interesa que este dominio apunte a una subcarpeta de la aplicación, convirtiéndola en el DOCUMENT_ROOT del sitio web.</p>
<p style="text-align: justify;">Para ello hay que realizar 3 operaciones. Por el <strong>ejemplo</strong>, se ha supuesto que se utilizaría un dominio &#8220;test.local&#8221;, y que apuntaría a la carpeta &#8220;C:\xampp\htdocs\test\public&#8221;:</p>
<ul>
<li style="text-align: justify;">Modificar el archivo <a href="http://es.wikipedia.org/wiki/Archivo_hosts">hosts</a>, y añadir una línea con el dominio apuntando hacia la máquina de pruebas:

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">127.0.0.1    test.local</pre></div></div>

</li>
<li style="text-align: justify;">Modificar el archivo <a href="http://httpd.apache.org/docs/1.3/vhosts/">vhosts</a> (en <a href="http://otroblogmas.com/tag/windows/" class="st_tag internal_tag" rel="tag" title="Entradas etiquetadas con windows">Windows</a> esta en &#8220;C:\xampp\apache\conf\extra\httpd-vhosts.conf&#8221;), y descomentar la línea:

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">NameVirtualHost *:<span style="">80</span></pre></div></div>

<p>Y añadir el siguiente código:</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">&lt;VirtualHost *:<span style="">80</span>&gt;
	ServerName localhost
	DocumentRoot <span style="color: #933;">&quot;C:/xampp/htdocs/&quot;</span>
&lt;/VirtualHost&gt;</pre></div></div>

<p><strong>ATENCIÓN!</strong> Este paso solo se debe realizar la primera vez que se cree un proyecto. Las siguiente veces no hace falta.</li>
<li style="text-align: justify;">En el mismo archivo vhosts, añadir el siguiente bloque:

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">&lt;VirtualHost *:<span style="">80</span>&gt;
    ServerName test.local
    DocumentRoot C:\xampp\htdocs\test\public
&nbsp;
    SetEnv APP_ENV <span style="color: #933;">&quot;development&quot;</span>
&nbsp;
    &lt;Directory <span style="color: #933;">&quot;C:\xampp\htdocs\test\public&quot;</span>&gt;
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
    &lt;/Directory&gt;
&lt;/VirtualHost&gt;</pre></div></div>

</li>
</ul>
<p>Entradas relacionadas:</p><ol>
<li><a href='http://otroblogmas.com/configurar-xampp-para-debugar-con-xdebug-en-netbeans/' rel='bookmark' title='Configurar XAMPP para debugar con XDebug en Netbeans'>Configurar XAMPP para debugar con XDebug en Netbeans</a></li>
<li><a href='http://otroblogmas.com/instalar-zend-framework-y-zend_tool-para-construir-proyectos-en-windows/' rel='bookmark' title='Instalar Zend Framework y Zend_Tool para construir proyectos en Windows'>Instalar Zend Framework y Zend_Tool para construir proyectos en Windows</a></li>
<li><a href='http://otroblogmas.com/instalar-y-configurar-xampp-y-eclipse-en-windows/' rel='bookmark' title='Instalar y configurar XAMPP y Eclipse en Windows'>Instalar y configurar XAMPP y Eclipse en Windows</a></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://otroblogmas.com/configurar-xampp-proyectos-desarrollo-local/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Parsear strings en formato camelCase en PHP</title>
		<link>http://otroblogmas.com/parsear-strings-formato-camelcase-php/</link>
		<comments>http://otroblogmas.com/parsear-strings-formato-camelcase-php/#comments</comments>
		<pubDate>Thu, 14 Oct 2010 06:00:47 +0000</pubDate>
		<dc:creator>otroblogmas.com</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[CamelCase]]></category>
		<category><![CDATA[expresiones regulares]]></category>

		<guid isPermaLink="false">http://otroblogmas.com/?p=2334</guid>
		<description><![CDATA[Para un pequeño framework que estoy realizando, necesito parsear un string que se encuentra en formato CamelCase. Un ejemplo sería parsear &#8220;IndexCategoryController&#8220;, y conseguir un array con &#8220;Index&#8220;, &#8220;Category&#8221; y &#8220;Controller&#8220;. No es una operación complicada, y lo más eficiente parece ser utilizar expresiones regulares. Buscando he encontrado diferentes maneras de hacerlo, y he hecho [...]
Entradas relacionadas:<ol>
<li><a href='http://otroblogmas.com/switch-php-ofuscacion-codigo/' rel='bookmark' title='Switch en PHP o ofuscación de código'>Switch en PHP o ofuscación de código</a></li>
<li><a href='http://otroblogmas.com/funcion-remove-para-array-de-javascript/' rel='bookmark' title='Función REMOVE para Array de Javascript'>Función REMOVE para Array de Javascript</a></li>
<li><a href='http://otroblogmas.com/guia-crear-documentacion-phpdocumentor/' rel='bookmark' title='Guía para crear documentación con PHPDocumentor'>Guía para crear documentación con PHPDocumentor</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><img src="http://otroblogmas.com/wp-content/uploads/2010/10/tijeras-arana-200x147.jpg" alt="tijeras arana 200x147 Parsear strings en formato camelCase en PHP" title="Araña hecha de tijeras" width="200" height="147" class="alignright size-medium wp-image-2361" />Para un pequeño framework que estoy realizando, necesito <strong>parsear un string</strong> que se encuentra en <strong>formato <a href="http://es.wikipedia.org/wiki/CamelCase">CamelCase</a></strong>. Un ejemplo sería parsear &#8220;<em>IndexCategoryController</em>&#8220;, y <strong>conseguir un array</strong> con &#8220;<em>Index</em>&#8220;, &#8220;<em>Category</em>&#8221; y &#8220;<em>Controller</em>&#8220;. No es una operación complicada, y lo más eficiente parece ser utilizar <a href="http://otroblogmas.com/tag/expresiones-regulares/" class="st_tag internal_tag" rel="tag" title="Entradas etiquetadas con expresiones regulares">expresiones regulares</a>. Buscando he encontrado diferentes maneras de hacerlo, y he hecho un pequeño recopilatorio.</p>
<p><span id="more-2334"></span></p>
<p style="text-align: justify;">En <a href="http://www.paulferrett.com/2009/php-camel-case-functions/">Stuff and things</a> hay dos funciones que son opuestas:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">  <span style="color: #009933; font-style: italic;">/**
   * Translates a camel case string into a string with underscores (e.g. firstName -&gt; first_name)
   * @param    string   $str    String in camel case format
   * @return    string            $str Translated into underscore format
   */</span>
  <span style="color: #000000; font-weight: bold;">function</span> from_camel_case<span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$str</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$func</span> <span style="color: #339933;">=</span> <span style="color: #990000;">create_function</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'$c'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'return &quot;_&quot; . strtolower($c[1]);'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #990000;">preg_replace_callback</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/([A-Z])/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$func</span><span style="color: #339933;">,</span> <span style="color: #000088;">$str</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #009933; font-style: italic;">/**
   * Translates a string with underscores into camel case (e.g. first_name -&gt; firstName)
   * @param    string   $str                     String in underscore format
   * @param    bool     $capitalise_first_char   If true, capitalise the first char in $str
   * @return   string                              $str translated into camel caps
   */</span>
  <span style="color: #000000; font-weight: bold;">function</span> to_camel_case<span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #339933;">,</span> <span style="color: #000088;">$capitalise_first_char</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$capitalise_first_char</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$str</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strtoupper</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000088;">$func</span> <span style="color: #339933;">=</span> <span style="color: #990000;">create_function</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'$c'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'return strtoupper($c[1]);'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #990000;">preg_replace_callback</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/_([a-z])/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$func</span><span style="color: #339933;">,</span> <span style="color: #000088;">$str</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p style="text-align: justify;">En <a href="http://www.phpro.org/examples/Parse-Camel-Case.html">PHPro.org</a> utilizan otra expresión regular:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 *
 * @Parse CamelCase to Camel Case
 *
 * @param string $string
 *
 * @return string
 *
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> parseCamelCase<span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/(?&gt;=[a-z])(?=[A-Z])/'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span><span style="color: #000088;">$string</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p style="text-align: justify;">En un comentario en la <a href="http://otroblogmas.com/tag/documentacion/" class="st_tag internal_tag" rel="tag" title="Entradas etiquetadas con documentación">documentación</a> de php.net sobre <a href="http://php.net/manual/en/function.preg-split.php">preg_split</a>, utilizan otra función con otra expresión regular:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> splitCamelCase<span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #990000;">preg_split</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/(?&gt;=\\w)(?=[A-Z])/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$str</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p style="text-align: justify;">Y para finalizar, en el blog Charl van Niekerk encuentro otro método:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * Splits up a string into an array similar to the explode() function but according to CamelCase.
 * Uppercase characters are treated as the separator but returned as part of the respective array elements.
 * @author Charl van Niekerk
 * @param string $string The original string
 * @param bool $lower Should the uppercase characters be converted to lowercase in the resulting array?
 * @return array The given string split up into an array according to the case of the individual characters.
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> explodeCase<span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #339933;">,</span> <span style="color: #000088;">$lower</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #666666; font-style: italic;">// Split up the string into an array according to the uppercase characters</span>
  <span style="color: #000088;">$array</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_split</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/([A-Z][^A-Z]*)/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$string</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> PREG_SPLIT_NO_EMPTY <span style="color: #339933;">|</span> PREG_SPLIT_DELIM_CAPTURE<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Convert all the array elements to lowercase if desired</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$lower</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$array</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_map</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strtolower</span><span style="color: #339933;">,</span> <span style="color: #000088;">$array</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Return the resulting array</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$array</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Entradas relacionadas:</p><ol>
<li><a href='http://otroblogmas.com/switch-php-ofuscacion-codigo/' rel='bookmark' title='Switch en PHP o ofuscación de código'>Switch en PHP o ofuscación de código</a></li>
<li><a href='http://otroblogmas.com/funcion-remove-para-array-de-javascript/' rel='bookmark' title='Función REMOVE para Array de Javascript'>Función REMOVE para Array de Javascript</a></li>
<li><a href='http://otroblogmas.com/guia-crear-documentacion-phpdocumentor/' rel='bookmark' title='Guía para crear documentación con PHPDocumentor'>Guía para crear documentación con PHPDocumentor</a></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://otroblogmas.com/parsear-strings-formato-camelcase-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

