<?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>/dev/GON.cl &#187; php</title>
	<atom:link href="http://blog.gon.cl/en/cat/development/php/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.gon.cl</link>
	<description>blog respaldo anti-amnesia</description>
	<lastBuildDate>Thu, 05 Aug 2010 15:54:24 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Respect you yourself should (Joomla Critique #1)</title>
		<link>http://blog.gon.cl/en/post/676</link>
		<comments>http://blog.gon.cl/en/post/676#comments</comments>
		<pubDate>Wed, 11 Mar 2009 06:29:27 +0000</pubDate>
		<dc:creator>gon</dc:creator>
				<category><![CDATA[joomla]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[crÃ­tica]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://blog.gon.cl/?p=676</guid>
		<description><![CDATA[While working to re-build a site formerly used joomla 1.0, I had a little trouble in the control panel of the new 1.5, because I was leaving an error message.
Fortunately it was not fatal, since it could also modify the site parameters without much inconvenience. But it is not comfortable to see that something is [...]]]></description>
			<content:encoded><![CDATA[<p>While working to re-build a site formerly used joomla 1.0, I had a little trouble in the control panel of the new 1.5, because I was leaving an error message.</p>
<p>Fortunately it was not fatal, since it could also modify the site parameters without much inconvenience. But it is not comfortable to see that something is not right, except for a large system such as Joomla. </p>
<p>The error indicated that I had an XML file that was not being parsed properly, but it&#8217;s not saying which file or which was wrong.</p>
<p>Then I downloaded a backup of the site, and replicate it on my local machine to find out the error. I remembered that there are thousands of Linux applications for console enough powerful to <strong>parse</strong> and <strong>validate</strong> the XML&#8217;s from my site.</p>
<p>I had <a href="http://blog.gon.cl/post/12">an enjoyable experience with the <strong>find</strong> command</a>. But I was missing the command to validate an xml file. Searching the web, I found that possibly the command <strong>xmllint</strong> I could. But ultimately did not help, this reveals a small unexpected detail.</p>
<p><strong>xmllint</strong> has an option to validate, but to do this work, requires that 1) the XML file using a defined DTD or 2) it passes a DTD as a parameter. Testing without using a DTD by parameter, I tried the following:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">find. <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;*.xml&quot;</span> <span style="color: #660033;">-exec</span> xmllint <span style="color: #660033;">--noout</span> <span style="color: #660033;">--valid</span> <span style="color: #ff0000;">&quot;{}&quot;</span> \;</pre></div></div>

<p>Unfortunately, the result was not what I expected. ALL XML files except one, were invalid because they didn&#8217;t have defined the DTD. Thanks to that file that it was, I found that joomla has on its site a DTD file so that developers include it in yours XML configuration files. In this way, the developer requires that your XML files have the structure that the system requires.</p>
<p>The worst&#8230; that single valid file, was a third-party plugin and not the official developers. That is, the official joomla developers do not respect their own rules when writing code.</p>
<p>Finally, xmllint was not what I was looking for, and only had to check the file was malformed (bad labels closed nested bad &#8230;). As I did not know, see on a mailing list (the one I have in the list of <a href="http://blog.gon.cl/foss">FOSS Communities</a>), where I got the solution: <strong>xmlwf</strong>.</p>
<p>Just change the above command with the following matter and fixed:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">find. <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;*.xml&quot;</span><span style="color: #660033;">-exec</span> xmlwf <span style="color: #ff0000;">&quot;{}&quot;</span> \;</pre></div></div>

<p>I found the causers (they were 2), which I fixed and gave the matter ended.<br />
But I stayed with the bitter taste of the disregard that the Joomla developers as a mere detail. What gives me confidence for when a new system update?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gon.cl/en/post/676/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Migration FAIL! (and a wordpress critique #1)</title>
		<link>http://blog.gon.cl/en/post/464</link>
		<comments>http://blog.gon.cl/en/post/464#comments</comments>
		<pubDate>Thu, 08 Jan 2009 23:21:59 +0000</pubDate>
		<dc:creator>gon</dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[crÃ­tica]]></category>
		<category><![CDATA[openid]]></category>

		<guid isPermaLink="false">http://blog.gon.cl/?p=464</guid>
		<description><![CDATA[I have not yet fully completed the migration of this blog, but while I have had every experience &#8230;
Among the most serious, the worst was having deleted the previous blog at WordPress.com
I do that to avoid the content duplication. Unfortunately, forget the little detail about my URL, which was used as an Openid address. I [...]]]></description>
			<content:encoded><![CDATA[<p>I have not yet fully completed the migration of this blog, but while I have had every experience &#8230;</p>
<p>Among the most serious, the worst was having deleted the previous blog at WordPress.com</p>
<p>I do that to avoid the content duplication. Unfortunately, forget the little detail about my URL, which was used as an Openid address. I was 3 feeds pointing to <a href="http://twitter.com">twitter</a> accounts through <a href="http://twitterfeed.com/">twitterfeed</a>. But now I can&#8217;t log on twitterfeed, it only uses openid. As I was using the WordPress.com account as openid and now I can&#8217;t use it, can&#8217;t go to administer the accounts in twitterfeed. EPIC OWNED :retard: .</p>
<p>At least, the only solution I have is to change the password to the twitter accounts </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gon.cl/en/post/464/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gonium has new blog</title>
		<link>http://blog.gon.cl/en/post/402</link>
		<comments>http://blog.gon.cl/en/post/402#comments</comments>
		<pubDate>Mon, 29 Dec 2008 09:52:23 +0000</pubDate>
		<dc:creator>gon</dc:creator>
				<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[gonium]]></category>
		<category><![CDATA[temas wordpress]]></category>

		<guid isPermaLink="false">http://blog.gon.cl/?p=402</guid>
		<description><![CDATA[Since I have the space, I will use it.
One place, to explain things
While I do not have a blog module functional for Gonium, I have no further use the enemy (Wordpress). Which is not bad at all, but just the opposite.

While I do not have a blog module functional Gonium, I have no further use [...]]]></description>
			<content:encoded><![CDATA[<p>Since I have the space, I will use it.</p>
<h2>One place, to explain things</h2>
<p>While I do not have a blog module functional for Gonium, I have no further use the enemy (Wordpress). Which is not bad at all, but just the opposite.</p>
<p><a onclick="javascript:pageTracker._trackPageview('/outbound/article/gon.boaboa.org');" href="http://gon.boaboa.org/wblog/"><img class="aligncenter size-full wp-image-400" title="gonium_blog_120x60" src="http://blog.gon.cl/wp-content/uploads/2008/12/gonium_blog_120x60.png" alt="gonium_blog_120x60" width="120" height="60" /></a></p>
<p>While I do not have a blog module functional Gonium, I have no further use to the enemy (Wordpress). Which is not bad at all, but just the opposite.</p>
<p>An important detail: the blog, the project on Google Code, the messages on Twitter, the svn commits and autogenerada API documentation, all will remain mainly in English.</p>
<p>The reason for this is simple: <strong>universality</strong>. Unfortunately, although I do not like the idea, English is the most universal. Not because of Chilean origin, I would like just a few friends try it. I hope that everyone has the possibility to use it. Who tells me that someone is already looking at the code? And if someone spoke in Italian? Or French? Or German? Or Chinese?</p>
<p>Moreover, the experience in the <a href="http://gdt.sourceforge.net/">GDT</a>, I noticed the users (mostly Spanish-speaking), the displeasure of using classes / objects and methods named in Spanish. I do not understand these odd habits, but they are frequent and widespread. In fact, <a href="http://edsiper.linuxchile.cl/blog/">Eduardo Silva</a>, in his speech at the <a href="http://monkeyd.sourceforge.net/blog/">Monkey HTTP Daemon</a> at <a href="http://2008.encuentrolinux.cl/">Linux Meeting</a>, mentioned the same problem with its Spanish-speaking users, so he decided to simply leave the mailing list, blog, documentation, etc. in English. This time, take the same idea and I will see what happens.</p>
<p>For now, I do not expect an explosion of users, while functional version lacking, but I hope ideas, comments and general feedback. I have been asking things like &#8220;Are you recruiting people?&#8221; This is a relief for those minutes that I question the &#8220;What the hell am I doing something that only I care.&#8221; If anything, I am recruiting people :B . Zend Framework Developers? Welcome! Any contribution will be equally well received, either from a <strong>PHP</strong>ers, <strong>jQuery</strong>st, <strong>CSS</strong>ers, Translator, Web Designer or Artist are fully welcome.</p>
<p><span id="more-402"></span></p>
<h2>Confirming what I thought</h2>
<p>Through all this, I had an occurrence like &#8220;oh, what if I do the same template Gonium but for wordpress.&#8221; That is enough to get a little hand in creating a theme. Once again confirm what I thought long ago about wordpress: is spaghetti.</p>
<p>It really is one of the APIs (if it can even call his &#8220;codex&#8221;) most horrific I have seen. Because I participate in <a href="http://tecnosquad.org">tecnosquad.org</a> spend a day for &#8220;the epic quest for a new theme&#8221;, that afternoon I collected a lot of attractive themes, and saved&#8221; just in case. &#8221; Finally we found nothing we do feel that &#8220;wow, this themes looks like perfect for tecnosquad&#8221;, but the search also brought me a good result.</p>
<p>I took one of those issues to code my own. That was when I noticed the importance of certain details.</p>
<p>The first is about the size of a theme. For example the most &#8220;professionals&#8221; often have more files, and even allow you to add option panels to the wordpress backend. These extra files, themes define their own functions, which have no common interface, each item implements his things to his liking. Some wore classes/objects, but most just loose functions.</p>
<p>Another important detail is that even if the &#8220;kernel&#8221; for templates are documented, just read a source file is chaotic. Almost none of pulchritude, I would even venture that none of the themes I downloaded (and there were many), not even had the code properly indented.
<p>One of the first things I learned with the Zend Framework, was the &#8220;Two Steps&#8221; design pattern for templates: a template layout that creates the skeleton of the page, and then add the content on this layout, which may come from other view scripts. In wordpress, there is simply no such thing. I did not look inside the code, but what I saw on the outside (templates), I want to give more &#8220;complete&#8221; once the first version of usable Gonium. I&#8217;m sure it would be a delight for designers.</p>
<p>Later, when I already can blogging calm in Gonium, I will migrate the content and I will reject wordpress. The main idea is more alive than ever: the objective is to create an content manager system of general porpuse, but WELL DONE.<br />
]]></content:encoded>
			<wfw:commentRss>http://blog.gon.cl/en/post/402/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gonium, nuevo demo y nuevos componentes</title>
		<link>http://blog.gon.cl/en/post/357</link>
		<comments>http://blog.gon.cl/en/post/357#comments</comments>
		<pubDate>Thu, 11 Dec 2008 04:17:46 +0000</pubDate>
		<dc:creator>gon</dc:creator>
				<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[datagrid]]></category>
		<category><![CDATA[docbook]]></category>
		<category><![CDATA[gonium]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[phpdocumentor]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://blog.gon.cl/?p=357</guid>
		<description><![CDATA[Gracias a la wena onda de Tecnoman, que se auspicio con hosting y me dejo hincharle las pelotas para que instalara PDO en un servidor en producci&#243;n, tengo el demo de Gonium en un hosting nuevo. Ahora intentar&#233; de alg&#250;n modo recompensar aquello, posteando m&#225;s seguido en tecnosquad.org.
Aprovechando eso, sub&#237; una copia m&#225;s reciente.
Hace unos [...]]]></description>
			<content:encoded><![CDATA[<p>Gracias a la <em>wena onda</em> de Tecnoman, que se auspicio con hosting <span style="text-decoration:line-through;">y me dejo hincharle las pelotas para que instalara PDO en un servidor en producci&oacute;n</span>, tengo el demo de Gonium en un <a href="http://gon.boaboa.org">hosting nuevo</a>. Ahora intentar&eacute; de alg&uacute;n modo recompensar aquello, posteando m&aacute;s seguido en <a href="http://tecnosquad.org">tecnosquad.org</a>.</p>
<p>Aprovechando eso, sub&iacute; una copia m&aacute;s reciente.</p>
<p>Hace unos d&iacute;as agregu&eacute; al trunk del repositorio, una copia propia del proyecto <cite><a href="code.google.com/p/zend-framework-datagrid/"><strong>zend-framework-datagrid</strong></a></cite>, con la diferencia de que mi copia permite traducirlo con Zend_Translate y los comentarios est&aacute;n corregidos. Tambi&eacute;n correg&iacute; unos <em>warnings</em> menores. Adem&aacute;s le cambi&eacute; el prefijo a las clases de &#8220;Core_&#8221; (originalmente en zf-datagrid) a &#8220;Rox_&#8221;, para darle concordancia a mi estructura de directorios. Podr&iacute;a decir entonces que es un peque&ntilde;o fork :B</p>
<p>Tambi&eacute;n agregu&eacute; todo jQuery UI al directorio p&uacute;blico. Una ejemplo de esto es la peque&ntilde;a demostraci&oacute;n con el efecto acorde&oacute;n que le agregu&eacute; al widget de Login.</p>
<p>Y por &uacute;ltimo, agregu&eacute; un directorio con XML&#8217;s en formato docbook, para poder usarlos en conjunto con la documentaci&oacute;n creada con phpDocumentor.</p>
<p>Espero tener una documentaci&oacute;n un poco m&aacute;s completa m&aacute;s adelante.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gon.cl/en/post/357/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Gonium: Rompiendo el RoadMap</title>
		<link>http://blog.gon.cl/en/post/352</link>
		<comments>http://blog.gon.cl/en/post/352#comments</comments>
		<pubDate>Tue, 25 Nov 2008 23:16:10 +0000</pubDate>
		<dc:creator>gon</dc:creator>
				<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[gonium]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://blog.gon.cl/?p=352</guid>
		<description><![CDATA[Sorry, this entry is only available in EspaÃ±ol.
]]></description>
			<content:encoded><![CDATA[<p>Sorry, this entry is only available in <a href="http://blog.gon.cl/cat/development/php/feed">EspaÃ±ol</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gon.cl/en/post/352/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>phpDocumentor: como doxygen pero para PHP</title>
		<link>http://blog.gon.cl/en/post/296</link>
		<comments>http://blog.gon.cl/en/post/296#comments</comments>
		<pubDate>Tue, 23 Sep 2008 20:11:51 +0000</pubDate>
		<dc:creator>gon</dc:creator>
				<category><![CDATA[Desarrollo]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[documentaciÃ³n]]></category>
		<category><![CDATA[phpdocumentor]]></category>

		<guid isPermaLink="false">http://blog.gon.cl/?p=296</guid>
		<description><![CDATA[Documentar el c&#243;digo es m&#225;s que dejarlo bonito. Es hacerlo entendible.
&#8220;Comentar el c&#243;digo es como limpiar el cuarto de ba&#241;o; nadie quiere hacerlo, pero el resultado es siempre una experiencia m&#225;s agradable para uno mismo y sus invitados&#8221;
 &#8211; Ryan Campbell
Uno de los prop&#243;sitos iniciales de este blog, era combatir mi inquietante amnesia. No se [...]]]></description>
			<content:encoded><![CDATA[<p>Documentar el c&oacute;digo es m&aacute;s que dejarlo bonito. Es hacerlo entendible.</p>
<blockquote><p>&#8220;Comentar el c&oacute;digo es como limpiar el cuarto de ba&ntilde;o; nadie quiere hacerlo, pero el resultado es siempre una experiencia m&aacute;s agradable para uno mismo y sus invitados&#8221;<br />
<em> </em><em>&#8211; Ryan Campbell</em></p></blockquote>
<p>Uno de los prop&oacute;sitos iniciales de este blog, era combatir mi inquietante amnesia. No se ustedes, pero me es muy frecuente, que despu&eacute;s de muchos d&iacute;as, semanas o meses sin ver el c&oacute;digo que estaba trabajando, termino olvidando que hac&iacute;a o como funcionaba.</p>
<blockquote><p>&#8220;Ley de Alzheimer de la programaci&oacute;n: si lees un c&oacute;digo que escribiste hace m&aacute;s de dos semanas es como si lo vieras por primera vez&#8221;<br />
<em> &#8212; Via Dan Hurvitz</em></p></blockquote>
<p>Hay solo una forma de combatirlo: documentando.</p>
<p>Ser&aacute; una lata, pero creo (seriamente) que los lenguajes de programaci&oacute;n debieran mandar <strong>advertencias</strong> cuando no documentamos el c&oacute;digo fuente.</p>
<p>Cuando estuve en inserto en el proyecto GDT, me top&eacute; de cerca con Doxygen, una excelente herramienta para documentar el c&oacute;digo en funci&oacute;n de etiquetas especiales insertas en los comentarios. Muchos a&ntilde;os antes, me toc&oacute; conocer otra grandiosa herramienta, que ayer re-descubr&iacute;: <a href="http://www.phpdoc.org/"><strong>phpdocumentor</strong></a>.</p>
<h2>&iquest;Que tiene de fant&aacute;stico?</h2>
<p>Tiene varios detalles que lo hacen un amor:</p>
<ul>
<li>Esta escrito en PHP.</li>
<li>En su documentaci&oacute;n incluye los tags especiales, con ejemplos, para escribir correctamente los comentarios.</li>
<li>Funciona por interfaz web y por consola. Posibilitando automatizar el proceso de documentaci&oacute;n</li>
<li>Se puede configurar, guardando un archivo personalizado <strong>.ini</strong> con las opciones. Esto permite automatizar m&aacute;s a&uacute;n el proceso.</li>
<li>Exporta a varios formatos, incluyendo HTML, PDF y CHM. Incluso tiene diversas plantillas para producir distintos estilos de HTML. Tambi&eacute;n se pueden personalizar estas plantillas.</li>
</ul>
<p>Sin duda debe tener m&aacute;s gracias, pero con eso es suficiente por ahora.</p>
<h2>Ejemplos</h2>
<p>Para probar, document&eacute; TODAS las clases de Gonium y <a href="http://boaboa.org/docs/">dej&eacute; copia ac&aacute;</a>. Sin ir m&aacute;s lejos, la <a href="http://framework.zend.com/apidoc/core/">documentaci&oacute;n del API de Zend Framework</a> est&aacute; producida con phpDocumentor.</p>
<h2>Sugerencia</h2>
<p>Ser buen programador, no solo significa adoptar las mejores convenciones para escribir el c&oacute;digo, usar el mejor IDE (esto es una estupidez, pero lo he escuchado), presumir el uso de patrones de dise&ntilde;o novedosos o presumir de c&oacute;digo limpio y &oacute;ptimo. Documentar es una tarea b&aacute;sica que DEBIERA SER OBLIGATORIA. No solo si sufres alg&uacute;n problema de memoria (con la de tu cabeza, no con la del PC) como yo.</p>
<p>Adem&aacute;s es mucho m&aacute;s tedioso documentar un mont&oacute;n de clases ya escritas, que no sabes exactamente que hace, que comenzar documentando desde le principio. Si estas comenzando un proyecto, HAZLO YA, sino TAMBIÉN.</p>
<h2>Caso personal</h2>
<p>En Gonium hay algunas cuantas clases, que en su momento me pareci&oacute; bueno crear mientras se me ocurr&iacute;a como implementarlas (por ah&iacute; por febrero de este a&ntilde;o). Ahora no recuerdo que diablos quer&iacute;a hacer con ellas :B</p>
<p>Fuente de las citas: <a title="Otras 101 citas c&eacute;lebres del mundo de la inform&aacute;tica" href="http://www.variablenotfound.com/2008/04/otras-101-citas-clebres-del-mundo-de-la.html">Variable not found: Otras 101 citas c&eacute;lebres del mundo de la inform&aacute;tica</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gon.cl/en/post/296/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Roxydemo!</title>
		<link>http://blog.gon.cl/en/post/285</link>
		<comments>http://blog.gon.cl/en/post/285#comments</comments>
		<pubDate>Mon, 22 Sep 2008 03:02:38 +0000</pubDate>
		<dc:creator>gon</dc:creator>
				<category><![CDATA[Desarrollo]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[demo]]></category>
		<category><![CDATA[gonium]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[poo]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://blog.gon.cl/?p=285</guid>
		<description><![CDATA[Sorry, this entry is only available in EspaÃ±ol.
]]></description>
			<content:encoded><![CDATA[<p>Sorry, this entry is only available in <a href="http://blog.gon.cl/cat/development/php/feed">EspaÃ±ol</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gon.cl/en/post/285/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>ZendFramework: problemas de codificaci&#243;n de caract&#233;res con la Base de datos.</title>
		<link>http://blog.gon.cl/en/post/275</link>
		<comments>http://blog.gon.cl/en/post/275#comments</comments>
		<pubDate>Tue, 16 Sep 2008 05:14:55 +0000</pubDate>
		<dc:creator>gon</dc:creator>
				<category><![CDATA[Desarrollo]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[juego de caractÃ©res]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[zend db]]></category>
		<category><![CDATA[zend form]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://blog.gon.cl/?p=275</guid>
		<description><![CDATA[Este es otro caso en que me pena el tema de las codificaciones de caracteres.
SIEMPRE que uno trabaje con Bases de datos, sobre todo en paises de habla no-inglesa, se esta expuesto al tremendo cacho (problema) de manipular datos con caracteres no-ascii, como por ejemplo las &#241;-Ñ y diversas vocales acentuadas, tildes, apostrofes, cremillas, tongos [...]]]></description>
			<content:encoded><![CDATA[<p>Este es otro caso en que me pena el tema de las codificaciones de caracteres.</p>
<p>SIEMPRE que uno trabaje con Bases de datos, sobre todo en paises de habla no-inglesa, se esta expuesto al tremendo cacho (problema) de manipular datos con caracteres no-ascii, como por ejemplo las &ntilde;-Ñ y diversas vocales acentuadas, tildes, apostrofes, cremillas, tongos y cuanta modificacion rara se le pueda hacer a una letra.</p>
<p>Hasta ahora, he trabajado TODO con codificaci&oacute;n utf8 por ser m&aacute;s amplia en este sentido que las otras codificaciones corrientes (iso-8859-1*, latin1, &#8230;).</p>
<h2>Motivo</h2>
<p>Trabajando con Zend Form, note un extra&ntilde;o comportamiento. Cuando establec&iacute;a manualmente un dato en un campo, si este ven&iacute;a acentuado, entonces al dibujar por la vista, <strong>aparec&iacute;a en blanco</strong>.</p>
<p>Haciendo un <code>var_dump( $dato );</code> descubr&iacute; que la cadena de texto ven&iacute;a con caracteres mal formados. Preguntando en <a href="http://www.forosdelweb.com/f68/zend-form-zend-db-no-llevan-bien-624967/">Foros del Web</a> y navegando, d&iacute; con una pista.</p>
<p>El m&eacute;todo escape() de Zend_View provocaba que la cadena mal formada retornara en blanco. Seguramente si me pongo a mirar el c&oacute;digo fuente de Zend_Form* llegar&eacute; a encontrar una llamada a ese m&eacute;todo (no lo he hecho, pero por el efecto lo deduzco).</p>
<p>Adem&aacute;s, buscando por este problema, tanto en listas de correo sobre ZF, como en la documentaci&oacute;n de Mysql y adem&aacute;s en otra respuesta a mi pregunta en el mismo foro, encontr&eacute; que existen 2 consultas SQL (para MySQL) que arreglan el problema:</p>
<blockquote>
<pre>SET NAMES 'UTF8'
SET CHARACTER SET UTF8</pre>
</blockquote>
<p>Pero eso es espec&iacute;fico a Mysql. La otra soluci&oacute;n es manipular la configuraci&oacute;n del servidor, cosa que no se puede hacer en un hosting.</p>
<h2>Soluci&oacute;n</h2>
<p>La soluci&oacute;n b&aacute;sica es ejecutar esa par de consultas SQL. Pero hay que ver globalmente el problema para saber donde, como y cuando hacerlo.</p>
<p>De partida, mi aplicaci&oacute;n pretender ser no-dependiente del motor de base de datos.</p>
<p>Lo otro, es que intento mantener &#8220;limpio&#8221; el dise&ntilde;o del c&oacute;digo, en el sentido de que cada cosa valla en el lugar que corresponde, dependiendo del patr&oacute;n y/o paradigma adoptado.</p>
<p>Entonces, no es cosa de llegar y ponerlo en el index.php</p>
<p>Una soluci&oacute;n podr&iacute;a ser extender la clase Zend_Db_Adaptar_PdoMysql y a&ntilde;adir la consulta. Pero esto a&ntilde;ade un prop&oacute;sito espec&iacute;fico a algo que pretende ser general.</p>
<p>Bajo el mismo sentido de llegar a una soluci&oacute;n generalizada, se me ocurri&oacute; externalizar el charset de la consulta. As&iacute; que simplemente, a&ntilde;ad&iacute; un dato m&aacute;s al config.ini</p>
<blockquote>
<pre>database.adapter          = pdo_mysql   ; php extension, or Object adapter (1)
<strong>database.charset          = utf8        ; (optional) Character Set </strong>
database.params.host      = localhost   ; database host
database.params.username  = username    ; username to conect database
database.params.password  = password    ; password to conect database
database.params.dbname    = goniumdb   ; name of database
database.params.prefix    = rox_        ; table prefix
database.params.profiler  = "1"         ; Enable/disable profiler</pre>
</blockquote>
<p>Los Controller Plugins b&aacute;sicos de Gonium los dise&ntilde;&eacute; con el prop&oacute;sito de configurar cosas espec&iacute;ficas, asi que decid&iacute; por el momento, hacer ah&iacute; las consultas, PERO solo cuando el adapter ocupado sea alguno basado en mysql. As&iacute; que finalmente mi c&oacute;digo quedo as&iacute;:</p>
<blockquote>
<pre>$config = Zend_Registry::get('core_config');
$db = Zend_Registry::get('core_db');
$db-&gt;getConnection();

// Set charset
if( isset($config-&gt;database-&gt;charset) &amp;&amp; $config-&gt;database-&gt;charset !== null )
{
    switch( $config-&gt;database-&gt;adapter )
    {
        case 'mysql':
        case 'mysqli':
        case 'pdo_mysql':
            $db-&gt;query('SET NAMES \''.strtoupper($config-&gt;database-&gt;charset).'\'');
            $db-&gt;query('SET CHARACTER SET '.strtoupper($config-&gt;database-&gt;charset));
        break;
    }
}</pre>
</blockquote>
<p>Todo eso en el plugin Database. Es cosa de gustos en donde ponerlo, yo lo hice en un plugin, tambi&eacute;n se puede poner directo en el bootstrap, o extendiendo Zend_Db*, o que se yo&#8230;</p>
<h2>&iquest;Y luego que?</h2>
<p>Creo que me ver&eacute; obligado a probar YA en otros motores de base de datos, haber como se comportan&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gon.cl/en/post/275/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>ZendFramework: Manejar errores de los Controller Plugins</title>
		<link>http://blog.gon.cl/en/post/269</link>
		<comments>http://blog.gon.cl/en/post/269#comments</comments>
		<pubDate>Sun, 14 Sep 2008 23:58:54 +0000</pubDate>
		<dc:creator>gon</dc:creator>
				<category><![CDATA[Desarrollo]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[excepciÃ³n]]></category>
		<category><![CDATA[excepciones]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[poo]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://blog.gon.cl/?p=269</guid>
		<description><![CDATA[Sorry, this entry is only available in EspaÃ±ol.
]]></description>
			<content:encoded><![CDATA[<p>Sorry, this entry is only available in <a href="http://blog.gon.cl/cat/development/php/feed">EspaÃ±ol</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gon.cl/en/post/269/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Traducci&#243;n de Zend Validate con gettext y poedit</title>
		<link>http://blog.gon.cl/en/post/210</link>
		<comments>http://blog.gon.cl/en/post/210#comments</comments>
		<pubDate>Sat, 06 Sep 2008 07:54:37 +0000</pubDate>
		<dc:creator>gon</dc:creator>
				<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[i18n]]></category>
		<category><![CDATA[internationalization]]></category>
		<category><![CDATA[l10n]]></category>
		<category><![CDATA[localizaciÃ³n]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[poo]]></category>
		<category><![CDATA[traducciÃ³n]]></category>
		<category><![CDATA[zend form]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[zend validate]]></category>

		<guid isPermaLink="false">http://blog.gon.cl/?p=210</guid>
		<description><![CDATA[Sorry, this entry is only available in EspaÃ±ol.
]]></description>
			<content:encoded><![CDATA[<p>Sorry, this entry is only available in <a href="http://blog.gon.cl/cat/development/php/feed">EspaÃ±ol</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gon.cl/en/post/210/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.656 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2010-09-09 05:35:49 -->
