<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8587897704769639737</id><updated>2024-10-06T20:16:56.175-07:00</updated><category term="linux"/><category term="servidores"/><category term="java"/><category term="comando"/><category term="desarrollo"/><category term="email"/><category term="programming"/><category term="designing"/><category term="framework"/><category term="spring"/><category term="python"/><category term="red"/><category term="JBoss"/><category term="annotation"/><category term="datos"/><category term="mashup"/><category term="maven"/><category term="php"/><category term="programacion"/><category term="xtreme programming"/><category term="AOP"/><category term="ajax"/><category term="apache"/><category term="git"/><category term="google"/><category term="jackbe"/><category term="jasper"/><category term="js"/><category term="junit"/><category term="mapeo"/><category term="patrones"/><category term="planning"/><category term="presto"/><category term="sql"/><category term="symfony"/><category term="testing"/><category term="windows"/><category term="xml"/><category term="xp"/><category term="Gmail"/><category term="IDE"/><category term="POI"/><category term="android"/><category term="anotacion"/><category term="arquitectura"/><category term="autowiring"/><category term="base de datos"/><category term="book"/><category term="branch"/><category term="control de versiones"/><category term="dataset"/><category term="db"/><category term="dbunit"/><category term="debugging"/><category term="escritorio remoto"/><category term="excel"/><category term="grails"/><category term="groovy"/><category term="hdd"/><category term="hibernate"/><category term="inalámbrica"/><category term="jquery"/><category term="jsf"/><category term="log4j"/><category term="metodología"/><category term="mongoDB"/><category term="mysql"/><category term="no-sql"/><category term="pdf"/><category term="pojo"/><category term="pruebas unitarias"/><category term="report"/><category term="sed"/><category term="seguridad"/><category term="shell"/><category term="tag"/><category term="unix"/><category term="virtualbox"/><category term="web"/><title type='text'>micro - How To</title><subtitle type='html'>&amp;lt;-- Una disciplina para recordar --&amp;gt;</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://micro-howto.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default'/><link rel='alternate' type='text/html' href='http://micro-howto.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default?start-index=26&amp;max-results=25'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05477259225859568605</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>78</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8587897704769639737.post-1300157988136537399</id><published>2014-10-25T16:24:00.004-07:00</published><updated>2014-10-25T16:24:43.369-07:00</updated><title type='text'>GIT - Vista Rapida Comandos</title><content type='html'>&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;&lt;b&gt;Para crear un Branch&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;git checkout -b newLocalBranch&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;git push -u origin newLocalBranch&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Arial; font-size: x-small;&quot;&gt;&lt;b&gt;Uso de checkout&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;branch (cambiar de branch a branch):&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;git checkout remoteBranch&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;Para restaurar al archivo original (olvidar cambios):&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;git checkout path/local/file&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;&lt;b&gt;Watering - traerte los cambios del branch origen a tu branch actual&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;git merge origin/master --no-commit&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;git commit&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Arial; font-size: 13px;&quot;&gt;&amp;nbsp;-m&quot;watering&quot;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;git push&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;&lt;b&gt;Cherry pick - traerte los cambios de un commit a tu branch actual&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;1. git cherry-pick #hash&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;2. git push&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;&lt;b&gt;Hacer un merge de un branch sobre master (o el origen de donde surgio el branch)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;git checkout {upstream-branch-name}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;git pull&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;git merge --squash --no-commit origin/{branch-to-merge}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;git commit&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;mvn clean install&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;ant test.js.all&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;git push&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;&lt;b&gt;Borrar un branch&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;git branch -rd origin/remoteBranchName (forzar a borrarlo cuando no tienes una copia localmente)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;or&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;git branch -D localBranchName&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;git push origin :remoteBranchName&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;&lt;b&gt;Esconder cambios con stash&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;ver lista de cambios escondidos: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; git stash list&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;ver cambios de un elemento de la lista: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;git stash show stash@{#} &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;esconder cambios como uno en la lista: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;git stash save &quot;Some stash message here”&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;aplicar cambios al branch sin borrar de la lista: &amp;nbsp; git stash apply stash@{#}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;aplicar cambios y eliminarlos de la lista : &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;git stash pop stash@{#}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;borrar un elemento de la lista : &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;git stash drop stash@{#}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;borrar todos los elementos de la lista: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; git stash clear&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;&lt;b&gt;Revertir cambios de un branch remoto (o ya pusheados)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;git revert #exactlyTheRemoteHashOfInterest —no-commit&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;&lt;b&gt;Resetear cambios del branch local (commiteados pero no pusheados)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;1. buscar el #hash previo (no el hash que estas interesado en resetear, sino uno antes)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;git log&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;2.1 resetear (todos los commits van a ser devueltos a la bandeja de unstage - antes de comitear)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;git reset #localHash&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;2.2 O tambien puedes deshacer el commit N (con HEAD~N)&amp;nbsp;y perder los cambios (con --hard)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;git reset --hard HEAD~1&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;2.3. Si quieres deshacer cambios pero no perderlos (que por default usa --soft)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial; font-size: 13px; font-stretch: normal;&quot;&gt;git reset HEAD~1&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://micro-howto.blogspot.com/feeds/1300157988136537399/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://micro-howto.blogspot.com/2014/10/git-vista-rapida-comandos.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/1300157988136537399'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/1300157988136537399'/><link rel='alternate' type='text/html' href='http://micro-howto.blogspot.com/2014/10/git-vista-rapida-comandos.html' title='GIT - Vista Rapida Comandos'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05477259225859568605</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8587897704769639737.post-3139895998042882945</id><published>2014-10-25T16:10:00.001-07:00</published><updated>2014-10-25T16:10:55.457-07:00</updated><title type='text'>Patron de Diseño Command</title><content type='html'>&lt;span style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;El patrón comando permite que solicitudes del cliente sean encapsuladas como objetos, indicar parámetros a diferentes solicitudes, encolarlas, registrarlas y hasta dar soporte para operaciones des-hacer.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnuvUc8y-V5dsnv237UmsBtk4MIZJD_Jz1EGsZ7VMyyBdQbXfWAivnwSI0TE8mF0Qjldxt3bCGob0dR9MwXufQ1e84iHu09EPIctGPdeY0yaYOc4um8VtO4U0RcCUK3frf3tJ0jxeLApk/s1600/Command_Design_Pattern_Class_Diagram.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnuvUc8y-V5dsnv237UmsBtk4MIZJD_Jz1EGsZ7VMyyBdQbXfWAivnwSI0TE8mF0Qjldxt3bCGob0dR9MwXufQ1e84iHu09EPIctGPdeY0yaYOc4um8VtO4U0RcCUK3frf3tJ0jxeLApk/s1600/Command_Design_Pattern_Class_Diagram.png&quot; height=&quot;250&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span id=&quot;goog_1484037714&quot;&gt;&lt;/span&gt;&lt;span id=&quot;goog_1484037715&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot; /&gt;
&lt;b style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;Participantes&lt;/b&gt;&lt;span style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;:&lt;/span&gt;&lt;br /&gt;
&lt;ol style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;
&lt;li style=&quot;margin-left: 15px;&quot;&gt;invocador (invoker) - el que almacena las ordenes y las manda ejecutar.&lt;/li&gt;
&lt;li style=&quot;margin-left: 15px;&quot;&gt;cliente (client) - el que proporciona la orden al invocador.&lt;/li&gt;
&lt;li style=&quot;margin-left: 15px;&quot;&gt;receptor (receiver) - aquél que en verdad realiza la acción que se mandó a ejecutar&lt;/li&gt;
&lt;li style=&quot;margin-left: 15px;&quot;&gt;comando (command) -la orden que relaciona al invocador con el receptor de manera general&lt;/li&gt;
&lt;li style=&quot;margin-left: 15px;&quot;&gt;comando concreto (concrete command) - la implementación para la ejecución de la orden (es más específica)&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;Ejemplo:&lt;/b&gt;&lt;span style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ul style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;
&lt;li style=&quot;margin-left: 15px;&quot;&gt;El consumidor (cliente) da órdenes (comandos) a un mesero (invocador), el cuál las apila para después pasarla al cocinero (ejecutar la acción).&amp;nbsp; El cocinero (receptor) entonces realiza la acción.&lt;/li&gt;
&lt;li style=&quot;margin-left: 15px;&quot;&gt;El usuario abre su programa favorito (cliente) , da clic sobre el contenedor de comandos llamado &quot;menú Archivo&quot; (invocador) y después sobre abrir archivo (comando), el cual abre una segunda ventana para indicarle de que archivo se trata (receptor). Cada opción del menú archivo ejecuta una acción que es un comando parametrizado.&lt;/li&gt;
&lt;/ul&gt;
&lt;b style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;Consecuencias&lt;/b&gt;&lt;span style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;El objeto que invoca el comando y el que lo realiza están des-acoplados. El invocador no tiene por que saber de que forma se ejecuta la acción.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;Los objetos comandos se pueden extender usando patrones como Composite y Memento.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;Es fácil agregar comandos porque no tienes que modificar las clases ya hechas.&lt;/span&gt;&lt;br /&gt;
&lt;br style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot; /&gt;
&lt;b style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;Decisiones de diseño&lt;/b&gt;&lt;span style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;:&lt;/span&gt;&lt;br /&gt;
&lt;ul style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;
&lt;li style=&quot;margin-left: 15px;&quot;&gt;Cuando quieras parametrizar objetos que realicen una acción determinada&lt;/li&gt;
&lt;li style=&quot;margin-left: 15px;&quot;&gt;Cuando necesites encolar y ejecutar una serie de solicitudes en diferentes momentos&lt;/li&gt;
&lt;li style=&quot;margin-left: 15px;&quot;&gt;Si deseas mantener un historial de ejecuciones para así permitirte des-hacerlas, también es sencillo logear cada proceso de manera que si falla el sistema, se pueda saber en que punto quedó para una restauración manual.&lt;/li&gt;
&lt;/ul&gt;
</content><link rel='replies' type='application/atom+xml' href='http://micro-howto.blogspot.com/feeds/3139895998042882945/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://micro-howto.blogspot.com/2014/10/patron-de-diseno-command.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/3139895998042882945'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/3139895998042882945'/><link rel='alternate' type='text/html' href='http://micro-howto.blogspot.com/2014/10/patron-de-diseno-command.html' title='Patron de Diseño Command'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05477259225859568605</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnuvUc8y-V5dsnv237UmsBtk4MIZJD_Jz1EGsZ7VMyyBdQbXfWAivnwSI0TE8mF0Qjldxt3bCGob0dR9MwXufQ1e84iHu09EPIctGPdeY0yaYOc4um8VtO4U0RcCUK3frf3tJ0jxeLApk/s72-c/Command_Design_Pattern_Class_Diagram.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8587897704769639737.post-8947663089076071088</id><published>2013-09-11T10:25:00.002-07:00</published><updated>2013-09-11T10:42:29.228-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="android"/><title type='text'>Aceleración del Emulador Android en Linux</title><content type='html'>&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Apenas me estoy metiendo a jugar un poco para programar en Android y me topé con el problema de que el emulador va lentísimo en Linux. Cabe notar que el Android SDK Manager tiene un paquete que menciona la aceleración del emulador en Intel, pero explícitamente dice: &lt;i&gt;&quot;NO SOPORTADO EN LINUX&quot;&lt;/i&gt;. Lo cual no significa que todo esté perdido ;-)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Investigando me topé con este hilo en stackoverflow:&amp;nbsp;&lt;a href=&quot;http://stackoverflow.com/questions/1554099/slow-android-emulator&quot;&gt;http://stackoverflow.com/questions/1554099/slow-android-emulator&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Que hace referencia a esta información del sitio de Intel:&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://software.intel.com/en-us/blogs/2012/03/12/how-to-start-intel-hardware-assisted-virtualization-hypervisor-on-linux-to-speed-up-intel-android-x86-gingerbread-emulator&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;http://software.intel.com/en-us/blogs/2012/03/12/how-to-start-intel-hardware-assisted-virtualization-hypervisor-on-linux-to-speed-up-intel-android-x86-gingerbread-emulator&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;En resumen, hay que instalar Qemu (para virtualización en Linux usando KVM), y puesto que el emulador de Android se basa en Qemu, es sólo cuestión de ligarlos.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Hecho eso, se puede crear un AVD que utilice como CPU/ABI un Intel Atom (x86), y que al emular se debe usar el host del GPU. Si emulas vía la consola, debes usar emulator-x86 con las opciones&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;-qemu -m 2047 -enable-kvm&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Voilá, tu emulador debería de volar ahora...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Issues con los que me topé:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;-Al instalar los módulos del kernel de KVM hay que asegurarse que la virtualización no esté deshabilitada en la BIOS. (Y ya con esto tengo para virtualizar lo que quiera! suelo usar virtualbox, luego jugaré con esto también :D )&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;- No hay que olvidar que se debe instalar también la imagen Intel X86 en el Android SDK Manager&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://micro-howto.blogspot.com/feeds/8947663089076071088/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://micro-howto.blogspot.com/2013/09/aceleracion-del-emulador-android-en.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/8947663089076071088'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/8947663089076071088'/><link rel='alternate' type='text/html' href='http://micro-howto.blogspot.com/2013/09/aceleracion-del-emulador-android-en.html' title='Aceleración del Emulador Android en Linux'/><author><name>Javier Novoa C. (Stitch)</name><uri>http://www.blogger.com/profile/13132360799518616672</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_Hp7QjnMlZmKlVQDHZsaIQ9YnmWC4sel26ibs9FHig1ffPukjGQKgnGf4o6JV5MJYRfqEo5UmWmd3VQj0ZkCTBv1muBIu3QTs5jCkZ2_DD7GPa_x32zdIT0oFvFRLmrU/s220/55857695_2385261704837842_7917967493749014528_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8587897704769639737.post-2973971513619714018</id><published>2013-09-06T09:56:00.001-07:00</published><updated>2013-09-06T09:56:47.395-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="git"/><title type='text'>Hacer Push de un branch local a un repositorio Git remoto</title><content type='html'>&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Tan simple como usar git push con el nombre del branch.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Digamos que tenemos un branch plugin que queremos subir al repositorio origin:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;git push -u origin plugin&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;El parámetro -u permite crear un upstream en donde sea que bajemos este branch desde origin, de forma que hacer push/pull sea mucho más sencillo.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Para bajar este branch desde el repositorio, bastaría hacer:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;git fetch origin&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;[Git nos informará que se ha creado un nuevo branch, origin/plugin]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;git checkout --track origin/plugin&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Con esto cambiamos al nuevo branch, y además le damos seguimiento para hacer actualizaciones de manera rápida y sencilla cuando hagamos push.&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://micro-howto.blogspot.com/feeds/2973971513619714018/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://micro-howto.blogspot.com/2013/09/hacer-push-un-branch-local-un.html#comment-form' title='1 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/2973971513619714018'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/2973971513619714018'/><link rel='alternate' type='text/html' href='http://micro-howto.blogspot.com/2013/09/hacer-push-un-branch-local-un.html' title='Hacer Push de un branch local a un repositorio Git remoto'/><author><name>Javier Novoa C. (Stitch)</name><uri>http://www.blogger.com/profile/13132360799518616672</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_Hp7QjnMlZmKlVQDHZsaIQ9YnmWC4sel26ibs9FHig1ffPukjGQKgnGf4o6JV5MJYRfqEo5UmWmd3VQj0ZkCTBv1muBIu3QTs5jCkZ2_DD7GPa_x32zdIT0oFvFRLmrU/s220/55857695_2385261704837842_7917967493749014528_n.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8587897704769639737.post-8124254965727069501</id><published>2013-08-30T09:00:00.001-07:00</published><updated>2013-08-30T09:01:04.533-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="js"/><title type='text'>Como agregar una libreria al codigo manualmente (jQuery)</title><content type='html'>&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #1f497d; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-theme-font: minor-bidi; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-themecolor: dark2;&quot;&gt;function loadJQuery() {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #1f497d; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-theme-font: minor-bidi; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-themecolor: dark2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var
fileref = document.createElement(&#39;script&#39;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #1f497d; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-theme-font: minor-bidi; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-themecolor: dark2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fileref.setAttribute(&quot;type&quot;,
&quot;text/javascript&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #1f497d; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-theme-font: minor-bidi; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-themecolor: dark2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fileref.setAttribute(&quot;src&quot;,
&quot;http://code.jquery.com/jquery-1.5.min.js&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #1f497d; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-theme-font: minor-bidi; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-themecolor: dark2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; document.getElementsByTagName(&#39;head&#39;)[0].appendChild(fileref);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #1f497d; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-theme-font: minor-bidi; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-themecolor: dark2;&quot;&gt;}();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #1f497d; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-theme-font: minor-bidi; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-themecolor: dark2;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #1f497d; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-theme-font: minor-bidi; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-themecolor: dark2;&quot;&gt;Fácil no? .. Puedes cambiar la version si deseas otra de jQuery o bien , la URL completa para cualquier otra libreria.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #1f497d; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-theme-font: minor-bidi; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-themecolor: dark2;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #1f497d;&quot;&gt;Por otro lado, si ya la cargaste previamente en el render de tu documento, no olvides poner tu código dentro de ready:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #1f497d;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre style=&quot;background-color: #eeeeee; background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; font-family: source-code-pro, Consolas, monospace !important; font-size: 15px; height: auto !important; left: auto !important; line-height: 16.5px; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre-wrap; width: auto !important; word-wrap: break-word;&quot;&gt;&lt;div class=&quot;container&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;
&lt;div class=&quot;line&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;&quot;&gt;
&lt;code style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: block; float: none !important; font-family: source-code-pro, Consolas, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;$(document).ready(&lt;span class=&quot;keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;function&lt;/span&gt;() {&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;container&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;
&lt;div class=&quot;line&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;&quot;&gt;
&lt;code style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: block; float: none !important; font-family: source-code-pro, Consolas, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;  &lt;span class=&quot;comment&quot; style=&quot;box-sizing: border-box; color: #999988; font-style: italic;&quot;&gt;// Handler for .ready() called.&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;container&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;
&lt;div class=&quot;line&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;&quot;&gt;
&lt;code style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: block; float: none !important; font-family: source-code-pro, Consolas, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;});&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/pre&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #1f497d;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://micro-howto.blogspot.com/feeds/8124254965727069501/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://micro-howto.blogspot.com/2013/08/como-agregar-una-libreria-al-codigo.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/8124254965727069501'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/8124254965727069501'/><link rel='alternate' type='text/html' href='http://micro-howto.blogspot.com/2013/08/como-agregar-una-libreria-al-codigo.html' title='Como agregar una libreria al codigo manualmente (jQuery)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05477259225859568605</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8587897704769639737.post-604173059682883265</id><published>2012-08-24T14:01:00.001-07:00</published><updated>2012-08-24T14:45:03.794-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="email"/><category scheme="http://www.blogger.com/atom/ns#" term="Gmail"/><category scheme="http://www.blogger.com/atom/ns#" term="google"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="spring"/><title type='text'>2 configuraciones con Spring Mail para usar Gmail</title><content type='html'>He notado que la configuración de la clase &quot;JavaMailSender&quot; de Spring es un poco confusa para algunos y personalmente me ocurrió cuando al principio tomé el proyecto de enviar correos con Spring.&lt;br /&gt;
&lt;br /&gt;
Así que dejo aquí, dos configuraciones que me funcionaron a la perfección con Gmail: TLS y SSL&lt;br /&gt;
&lt;br /&gt;
Debo hacer notar que también funciona con &lt;a href=&quot;http://www.google.com/intl/es-419/enterprise/apps/business/&quot; target=&quot;_blank&quot;&gt;Google Apps for Business&lt;/a&gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Usando &lt;b&gt;TLS&lt;/b&gt; en puerto &lt;i&gt;587&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;small&gt;
&lt;/small&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:xml;&quot;&gt;&lt;small&gt;&amp;lt;bean class=&quot;org.springframework.mail.javamail.JavaMailSenderImpl&quot;&amp;gt;
    &amp;lt;property name=&quot;defaultEncoding&quot; value=&quot;UTF-8&quot;&amp;gt;
    &amp;lt;property name=&quot;host&quot; value=&quot;smtp.gmail.com&quot;&amp;gt;
    &amp;lt;property name=&quot;port&quot; value=&quot;587&quot;&amp;gt;
    &amp;lt;property name=&quot;protocol&quot; value=&quot;smtp&quot;&amp;gt;
    &amp;lt;property name=&quot;username&quot; value=&quot;correo@gmail.com&quot;&amp;gt;
    &amp;lt;property name=&quot;password&quot; value=&quot;miPassword&quot;&amp;gt;
    &amp;lt;property name=&quot;javaMailProperties&quot;&amp;gt;
        &amp;lt;props&amp;gt;
            &amp;lt;prop key=&quot;mail.debug&quot;&amp;gt;true&amp;lt;/prop&amp;gt;&amp;lt;!--Este se puede omitir--&amp;gt;
            &amp;lt;prop key=&quot;mail.smtp.auth&quot;&amp;gt;true&amp;lt;/prop&amp;gt;
            &amp;lt;prop key=&quot;mail.smtp.starttls.enable&quot;&amp;gt;true&amp;lt;/prop&amp;gt;
            &amp;lt;prop key=&quot;mail.smtp.quitwait&quot;&amp;gt;false&amp;lt;/prop&amp;gt;
        &amp;lt;/props&amp;gt;
    &amp;lt;/property&amp;gt;
&amp;lt;/bean&amp;gt;
&lt;/small&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Usando &lt;b&gt;SSL&lt;/b&gt; en puerto &lt;i&gt;465&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;small&gt;
&lt;/small&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:xml;&quot;&gt;&lt;small&gt;&amp;lt;bean class=&quot;org.springframework.mail.javamail.JavaMailSenderImpl&quot;&amp;gt;
    &amp;lt;property name=&quot;defaultEncoding&quot; value=&quot;UTF-8&quot;&amp;gt;
    &amp;lt;property name=&quot;host&quot; value=&quot;smtp.gmail.com&quot;&amp;gt;
    &amp;lt;property name=&quot;port&quot; value=&quot;25&quot;&amp;gt;
    &amp;lt;property name=&quot;username&quot; value=&quot;correo@gmail.com&quot;&amp;gt;
    &amp;lt;property name=&quot;password&quot; value=&quot;miPassword&quot;&amp;gt;
    &amp;lt;property name=&quot;javaMailProperties&quot;&amp;gt;
        &amp;lt;props&amp;gt;
            &amp;lt;prop key=&quot;hostname&quot;&amp;gt;smtp.gmail.com&amp;lt;/prop&amp;gt;
            &amp;lt;prop key=&quot;mail.debug&quot;&amp;gt;true&amp;lt;/prop&amp;gt;&amp;lt;!--Este se puede omitir--&amp;gt;
            &amp;lt;prop key=&quot;mail.smtp.auth&quot;&amp;gt;true&amp;lt;/prop&amp;gt;
            &amp;lt;prop key=&quot;mail.smtp.socketFactory.class&quot;&amp;gt;javax.net.ssl.SSLSocketFactory&amp;lt;/prop&amp;gt;
            &amp;lt;prop key=&quot;mail.smtp.socketFactory.port&quot;&amp;gt;465&amp;lt;/prop&amp;gt;
            &amp;lt;prop key=&quot;mail.smtp.socketFactory.fallback&quot;&amp;gt;false&amp;lt;/prop&amp;gt;
        &amp;lt;/props&amp;gt;
    &amp;lt;/property&amp;gt;
&amp;lt;/bean&amp;gt;
&lt;/small&gt;&lt;/pre&gt;
&lt;br /&gt;
Otras fuentes:&lt;br /&gt;
&amp;nbsp;- &lt;a href=&quot;http://stackoverflow.com/questions/46663/how-do-you-send-email-from-a-java-app-using-gmail/47452#47452&quot; target=&quot;_blank&quot;&gt;Configuracion con código&lt;/a&gt;.&lt;br /&gt;
&amp;nbsp;- &lt;a href=&quot;http://qmail.jms1.net/test-auth.shtml&quot; target=&quot;_blank&quot;&gt;Probar conecciones SMTP AUTH&lt;/a&gt; &lt;i&gt;(inglés)&lt;/i&gt;&lt;br /&gt;
&amp;nbsp;- &lt;a href=&quot;http://tureceta.es/telnet-comandos-smtp-envio-de-correo/&quot; target=&quot;_blank&quot;&gt;Enviar Mail con Telnet&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://micro-howto.blogspot.com/feeds/604173059682883265/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://micro-howto.blogspot.com/2012/08/2config2springMail.html#comment-form' title='1 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/604173059682883265'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/604173059682883265'/><link rel='alternate' type='text/html' href='http://micro-howto.blogspot.com/2012/08/2config2springMail.html' title='2 configuraciones con Spring Mail para usar Gmail'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05477259225859568605</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total><georss:featurename>Condesa, Cuauhtémoc, 06140 Ciudad de México, D.F., México</georss:featurename><georss:point>19.4149803 -99.1774462</georss:point><georss:box>19.4074923 -99.187316700000011 19.4224683 -99.1675757</georss:box></entry><entry><id>tag:blogger.com,1999:blog-8587897704769639737.post-162460109090162042</id><published>2012-06-19T07:00:00.000-07:00</published><updated>2012-08-24T13:43:22.272-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="desarrollo"/><category scheme="http://www.blogger.com/atom/ns#" term="programacion"/><title type='text'>Entorno No Integrado de Desarrollo (UDE)</title><content type='html'>&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;Casi todos los desarrolladores que conozco acostumbran utilizar herramientas pesadas para hacer su trabajo.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;Una de dichas herramientas, el IDE (entorno de desarrollo integrado) suele ser un programa grande que incluye en un sólo paquete las herramientas más comunes que un desarrollador puede llegar a necesitar.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhn-8i07zZxR6US8GdvyncOaU6GfzDro7AW75cpK8yCPYv68kczuW0y3bSdOru1GCKs8sBU8-KSCSbxxJArtq_ZCz5C13WhEC6_ZFWbkXtAlxt3HSjLjxx_0kjZZgD9rAB9z3r-Z8dnrA0/s1600/1269363823_82393795_1-Pictures-of--The-Computer-Geek.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhn-8i07zZxR6US8GdvyncOaU6GfzDro7AW75cpK8yCPYv68kczuW0y3bSdOru1GCKs8sBU8-KSCSbxxJArtq_ZCz5C13WhEC6_ZFWbkXtAlxt3HSjLjxx_0kjZZgD9rAB9z3r-Z8dnrA0/s1600/1269363823_82393795_1-Pictures-of--The-Computer-Geek.jpg&quot; /&gt;&lt;/a&gt;&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;Ese es el problema: asumir que el desarrollador VA a necesitar las herramientas, cuando en realidad sólo PUEDE que las necesite.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;Por esa razón, tiene un tiempo ya que no utilizo IDEs para mi trabajo. O como leí alguna vez, utilizo un entorno NoIntegrado de Desarrollo (Unintegrated Development Environment).&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;Armar un entorno así no es nada difícil, y sólo requiere de un conocimiento concisio de las herramientas que en realidad tiene a su disposición un programador para hacer su trabajo, según el sistema sobre el que trabaje.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;El primer elemento, el&amp;nbsp;&lt;b&gt;editor de texto&lt;/b&gt;, debe ser una herramienta sencilla y a la vez eficaz, que haga bien su trabajo. Suele ser una herramienta muy especializada, y aunque para muchos pueda parecer trivial, la realidad es que es la más importante de todas. Ideal que cuente con resaltado de sintaxis, y si es posible, integración con algunas de las otras herramientas (lo que haría del editor de textos, para efectos prácticos, un mini-IDE, pero eso es otro asunto). En gustos se rompen géneros, los hay para entornos gráficos de escritorio como para entornos de consola. Mi favorito, Emacs, tiene la posibilidad de integrarse con muchísimas herramientas más, además de poder ser programado y extendido (usando Lisp) para hacer mejor las labores que un editor de textos potente (propio de un programador) debe realizar. Claro, también está vim, gedit, en windows está notepad++, y un largo etcétera...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;Anexo al editor de textos, no viene nada mal alguna herramienta para&amp;nbsp;&lt;b&gt;búsqueda de declaraciones&lt;/b&gt;, para localizar fácilmente los encabezados y declaraciones de funciones, clases y demás bichos que viven en un programa común. En Unix existen ctags y etags, que generan un pequeño archivo con las referencias para localizar estas declaraciones y que puede integrarse fácilmente a Emacs o vim.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;Dependiendo el lenguaje de programación utilizado, por supuesto que se tiene que tener el&amp;nbsp;&lt;b&gt;compilador o intérprete&lt;/b&gt;&amp;nbsp;adecuado al lenguaje en cuestión. Incluso los IDEs dependen de esta herramienta externa, pues los lenguajes de programación son algo tan vasto, que incluye librerías y extensiones por sí mismas, e incluirlas en un mismo paquete ya sería una exageración para el de por sí exagerado tamaño de los IDEs. No entraré en detalles de esta herramienta, ya que depende siempre del lenguaje en cuestión el tener el compilador o intérprete y las librerías adecuadas correctamente instaladas para su uso.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;Y si el desarrollo que se está haciendo implica alguna plataforma específica, por ejemplo web, además se requerirá de algún entorno de desarrollo bien armado que incluya un servidor web, con cgi bien configurado, de forma que no sólo se escriba texto, sino que también se puedan hacer las pruebas adecuadas accediendo, por lo menos, a http://localhost , es decir a la propia máquina. Lo mismo aplica para motores de bases de datos y cualquier otro recurso del que haga uso el proyecto en el que se esté trabajando.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;De la mano del proceso de compilación y lanzamiento para pruebas (o incluso a producción o &#39;deploy&#39;) del proyecto en que se esté trabajando, está la herramienta de&amp;nbsp;&lt;b&gt;generación y automatización de código&lt;/b&gt;. Compilar todo un proyecto puede ser un proceso complejo que incluya no solamente generar el código objeto (o como se llame en el lenguaje en particular que se use) de un archivo modificado, sino también puede haber dependencias entre los otros archivos, generación de código (por ejemplo para analizadores léxicos y gramaticales), producción de archivos de otros tipos (imágenes, documentación, etc.) que dependan directamente de otros archivos del proyecto. ¿Cómo hacer la vida sencilla a un desarrollador ante esta complejidad? La herramienta por antonomasia es make, que aunque se originó para proyectos en lenguaje C, es tan potente que puede ser usado para prácticamente cualquier proyecto de cualquier lenguaje, e incluso para cualquier otro proyecto que no sea de programación pero que requiera de la producción de archivos con base en dependencias.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;Hablando del&amp;nbsp;&lt;b&gt;deploy&lt;/b&gt;, incluso este puede automatizarse de manera eficiente. Depende mucho del entorno en que el proyecto vaya a ser lanzado. Pensando por ejemplo en un proyecto web, si se cuenta con acceso SSH o FTP al servidor en donde será lanzado, se puede utilizar rsync. Algunos utilizan el versionador para estas labores, pero yo no lo recomiendo. Un versionador además de que incluye archivos ajenos al proyecto final ya lanzado, tiene un propósito específico. Recuerda: no uses un desarmador como martillo. Otros proyectos se lanzan en otros entornos o con otras condiciones. La idea en sí es encontrar las herramientas adecuadas que permitan estos procesos de manera sencilla, eficiente y precisa. Incluso simplemente copiar y pegar archivos puede servir, pero si se puede contar con una herramienta más avanzada (que mantenga por ejemplo un log del proceso del deploy, con capacidades de deshacer y revertir el proceso en casos de emergencia), mejor. Aquí, como en los otros casos, aplica también el principio básico de que, si no se cuentan con las herramientas adecuadas, habrá que crearlas. Por algo somos programadores, y por lo menos para el caso del deploy, algunos scripts en bash, sql, python y demás pueden bastar para lo que se requiere.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg81YHvblnMHUEBNBd10K9TOApXnrsEhccslLzOkQzhNhr2HsIwixSFDe4VGbi5Vnxzn_O-7CDyagLUmEvxYMvFtgTU9wwmcmjjBGoQJBIbO9OZ-hlSBsLFGbMzxAe9o6T9Rla9fj31dPA/s1600/Tag01.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;180&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg81YHvblnMHUEBNBd10K9TOApXnrsEhccslLzOkQzhNhr2HsIwixSFDe4VGbi5Vnxzn_O-7CDyagLUmEvxYMvFtgTU9wwmcmjjBGoQJBIbO9OZ-hlSBsLFGbMzxAe9o6T9Rla9fj31dPA/s200/Tag01.png&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;Una de las herramientas más útiles que conozco para el desarrollo es el&amp;nbsp;&lt;b&gt;versionador&lt;/b&gt;. Con un versionador se puede, como su nombre lo indica, mantener versiones del código de un proyecto. ¿Para qué mantener versiones del código si de todas maneras lo que importa es el producto final? Por mil razones: a veces el desarrollo toma un camino que ya no agrada (porque funciona mal o porque cambian los objetivos) y es bueno poder regresar a una versión del código que no incluya esos últimos cambios; organizar equipos de desarrollo es muchísimo más fácil (en varios órdenes de magnitud) usando versionadores que administrándose como se pueda y dejando que todos hagan lo que deseen; los versionadores proporcionan la posibilidad de ramificar el desarrollo, dirigiéndolo hacia distintos objetivos cada rama, y posteriormente unificarlas de regreso, con los distintos desarrollos ya hechos de manera independiente. Hay muchos versionadores, pero los que valen la pena hoy en día son los llamados distribuidos, como Git (mi favorito) o Mercurial.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgD-49FDfbc2pPOSrRn2NqewfRYmI4BxhGShH7kCg_IaNyUbS5jnOuoC33gazRBQUdFLE_YpvWMgSl4zIYwcFRFaEKBlRdWEIXOCV0Gf4UaF_zrnWvVmwKdSYu8ExkpC4q0s1HfyS0PfZE/s1600/BUG.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgD-49FDfbc2pPOSrRn2NqewfRYmI4BxhGShH7kCg_IaNyUbS5jnOuoC33gazRBQUdFLE_YpvWMgSl4zIYwcFRFaEKBlRdWEIXOCV0Gf4UaF_zrnWvVmwKdSYu8ExkpC4q0s1HfyS0PfZE/s200/BUG.jpg&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;Y ¿qué desarrollo está completo sin un ciclo de&amp;nbsp;&lt;b&gt;depuración de errores&lt;/b&gt;? Alguna vez leí un artículo donde se mencionaba que el proceso de depuración (o debuggeo) conlleva cerca del 80% del tiempo de desarrollo de un proyecto. Así que más vale agarrarle el gusto a esta etapa del desarrollo, que está embebida dentro de todo el proceso, no es que vaya a encontrarse en algún lugar específico, al inicio o al final. Y se puede depurar haciendo simples prints de mensajes a consola, pero es mejor utilizar un debugger simbólico, como el que los IDEs acostumbran incluir. Claro está, dependiendo el lenguaje de programación usado, serán las herramientas de depuración con que se cuenten. Los proyectos en C y C++ pueden utilizar fácilmente gdb. Java cuenta con jdb. Python con pdb...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;Dependiendo del lenguaje, sobre todo los interpretados, estos llegan a contar con una herramienta que a mi en lo particular me es muy útil. El&amp;nbsp;&lt;b&gt;shell del lenguaje&lt;/b&gt;&amp;nbsp;donde se puede jugar libremente con el mismo, experimentar, probar cosas e investigar también. Python y Ruby, por ejemplo, tienen uno.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;Y así puedo seguir enumerando más herramientas. Las que ya mencioné son las que más utilizo yo, pero existen otras. Por ejemplo,&amp;nbsp;&lt;b&gt;perfiladores de consumo de recursos&lt;/b&gt;&amp;nbsp;(para la labor de optimización que, recuérdese, SIEMPRE se debe hacer hasta el final, y solamente una vez que ya se midió. El perfilador sirve precisamente para este propósito), o &lt;b&gt;herramientas para armar pruebas&lt;/b&gt; (unitarias, funcionales, de estrés). Múltiples herramientas del sistema pueden aprovecharse para el desarrollo:&amp;nbsp;&lt;b&gt;buscadores de textos y de archivos&lt;/b&gt;,&amp;nbsp;&lt;b&gt;herramientas de diagnóstico&lt;/b&gt;,&amp;nbsp;&lt;b&gt;documentación&lt;/b&gt;, etc.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;El punto es, como dije al principio, conocer todas y cada una de las herramientas individuales que suelen venir empaquetadas en un IDE, y así desmenuzadas, aprovecharlas al máximo y sin la obligación de tenerlas para no usarlas, con el consecuente consumo de recursos excesivo que los IDEs plantean. ¿O a poco no es cierto que Eclipse o Netbeans llegan a alentar tu máquina muchas veces?&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;Y además, se tiene la GRANDÍSIMA ventaja de poder elegir. Si un editor no te gusta eliges otro, si un debugger no te satisface, probablemente existan muchos más. Yo por ejemplo, cuando desarrollo en python, no utilizo el shell y el debugger por default que se incluyen con el lenguaje. Yo utilizo, como buen fan de la consola que soy, ipython como shell y ipdb (muy relacionado con ipython) como debugger. Es cosa de buscar, probar y elegir.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;¡Ah! y no quiero terminar este post sin antes mencionar otro par de detalles de los UDEs (Unintegrated Development Environments). Conforme se quiera contar con más y mejores herramientas, se dará uno cuenta que el sistema sobre el que se trabaje también hará la diferencia entre PODER elegir, y TENER que elegir. Es decir, que la libertad que se tenga entre elegir por separado las herramientas para hacer un mejor trabajo de desarrollo, depende muy directamente del sistema sobre el que se trabaje. Y en algunos sistemas desafortunadamente, tanto la cantidad y disponibilidad de herramientas es más bien escasa (tanto que en muchos sistemas así a veces no queda de otra más que usar a fuerzas o a fuerzas un IDE), pero también las interfaces de desarrollo entre el proyecto y el sistema suelen ser pobres, defectuosas, mal documentadas, nada compatibles entre versiones diferentes del mismo sistema, en fin, que hacen de la labor de desarrollo lo que en inglés se conoce coloquialmente como un &#39;&lt;i&gt;pain in the ass&lt;/i&gt;&#39;. Yo por eso prefiero trabajar en un ambiente Unix. Es mi eleccion personal, sí, pero no sólo es mía, muchos desarrolladores estarán de acuerdo conmigo que trabajar en un sistema Unix es muchísimo más productivo, y hasta relajante, que trabajando en un Windows. Y claro, al decir Unix, abarco no sólo Linux o los BSDs, incluso Mac podría caer en esta categoría, lo malo es que no todos tenemos tanto dinero para pagarnos las herramientas, y además, en mi opinión, no es tan buen sistema para desarrollar: menos documentación, creo yo que menos gente en internet ayudando, más restricciones; es un entorno que, según leí alguna vez, podría compararse con un jardín amplio, grande y bello, pero que al final tiene bardas en los límites.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjagWCNtJq9WHILfexv12HRUFuvyE5FCr_BVS7125z3USLTRpj3TtJ8BfN1CREaVZtvT0lxrupW2Ek8lZyX4HLcFBKH-u3_-3vlogg-U9OxD_m1OB23tXxriLBaBg3O-cMNymIaT9PRw3Q/s1600/internet.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjagWCNtJq9WHILfexv12HRUFuvyE5FCr_BVS7125z3USLTRpj3TtJ8BfN1CREaVZtvT0lxrupW2Ek8lZyX4HLcFBKH-u3_-3vlogg-U9OxD_m1OB23tXxriLBaBg3O-cMNymIaT9PRw3Q/s200/internet.jpg&quot; width=&quot;196&quot; /&gt;&lt;/a&gt;&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;Y por cierto, acabo de mencionar casi por accidente el último recurso importante: internet. ¿Qué desarrollador puede preciarse de llamarse así si no sabe dónde y cómo buscar la información y documentos, ejemplos, ayuda que necesita entre otros desarrolladores (por ejemplo en foros o sitios dedicados a la consulta como stackoverflow) y que han enfrentado problemas similares? Simplemente para conocer más herramientas que cumplan las funciones ya enlistadas y otras, internet es fundamental. Yo soy de la opinión que un desarrollador no lo es más sólo por saberse un lenguaje o una tecnología de memoria al derecho y al revés. Esa función ya la cumple internet. Lo que se necesita es muchísima creatividad, y por supuesto un conocimiento y uso adecuado de las herramientas que convengan en el momento.&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://micro-howto.blogspot.com/feeds/162460109090162042/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://micro-howto.blogspot.com/2012/06/entorno-no-integrado-de-desarrollo-ude.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/162460109090162042'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/162460109090162042'/><link rel='alternate' type='text/html' href='http://micro-howto.blogspot.com/2012/06/entorno-no-integrado-de-desarrollo-ude.html' title='Entorno No Integrado de Desarrollo (UDE)'/><author><name>Javier Novoa C. (Stitch)</name><uri>http://www.blogger.com/profile/13132360799518616672</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_Hp7QjnMlZmKlVQDHZsaIQ9YnmWC4sel26ibs9FHig1ffPukjGQKgnGf4o6JV5MJYRfqEo5UmWmd3VQj0ZkCTBv1muBIu3QTs5jCkZ2_DD7GPa_x32zdIT0oFvFRLmrU/s220/55857695_2385261704837842_7917967493749014528_n.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhn-8i07zZxR6US8GdvyncOaU6GfzDro7AW75cpK8yCPYv68kczuW0y3bSdOru1GCKs8sBU8-KSCSbxxJArtq_ZCz5C13WhEC6_ZFWbkXtAlxt3HSjLjxx_0kjZZgD9rAB9z3r-Z8dnrA0/s72-c/1269363823_82393795_1-Pictures-of--The-Computer-Geek.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8587897704769639737.post-1098755226756178017</id><published>2012-05-16T09:30:00.003-07:00</published><updated>2013-09-20T10:24:19.192-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="branch"/><category scheme="http://www.blogger.com/atom/ns#" term="control de versiones"/><category scheme="http://www.blogger.com/atom/ns#" term="git"/><category scheme="http://www.blogger.com/atom/ns#" term="google"/><category scheme="http://www.blogger.com/atom/ns#" term="tag"/><title type='text'>Como subir un proyecto con GIT a GitHub</title><content type='html'>Para subir un proyecto a &lt;a href=&quot;https://github.com/&quot; target=&quot;_blank&quot;&gt;gitHub&lt;/a&gt; no hay mas que seguir los mismos &lt;a href=&quot;http://help.github.com/&quot; target=&quot;_blank&quot;&gt;tutoriales&lt;/a&gt; que te proveen pero a resumidas cuentas tienes que hacer lo siguiente:&lt;br /&gt;
&lt;h4&gt;




1.- Crear una cuenta en GitHub &lt;/h4&gt;
&amp;nbsp;Tienes que ir a la liga : &lt;a href=&quot;https://github.com/plans&quot;&gt;https://github.com/plans&lt;/a&gt; y darle en el botón de &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;Create a free Account&lt;/span&gt;, una cuenta libre te permite tener tantos repositorios públicos y colaboradores públicos como quieras, pero ninguno privado, si quieres esto, tienes que pagar.&lt;br /&gt;
&lt;br /&gt;
Este paso es muy rápido y obvio, después de ingresar tus datos recibirás un mail de confirmación y listo, regresas a la página para entrar a tu cuenta.&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;




2.- Instalar Git en tu equipo&amp;nbsp; &lt;/h4&gt;
En windows puedes descargar una versión de Git desde : &lt;a href=&quot;http://code.google.com/p/msysgit/&quot;&gt;http://code.google.com/p/msysgit/&lt;/a&gt;, pero para los que usamos linux Mint y similares a Ubuntu lo que tienes que hacer es:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;b&gt;sudo apt-get install&lt;/b&gt; git &lt;b&gt;git-core&lt;/b&gt; git-gui git-doc&lt;/span&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;(lo que está en negritas es lo esencial, lo demás son agregados y puedes no indicarlos) &lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
luego debes crear la configuración global de git para que se puede rastrear los cambios que tu haces y diferenciarlos con respecto a los demás integrantes del proyecto.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;git config --global user.name &quot;Nombres Apellidos&quot;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;git config --global user.mail &quot;tunick@gmail.com&quot; &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Para establecer una conexión segura entre tu máquina y el servicio de gitHub debes crear una llave SSH que se almacena en la carpta &lt;i&gt;.ssh&lt;/i&gt; de tu &lt;i&gt;home&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;mkdir respaldo&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;mv ~/.ssh/id_rsa* respaldo&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;ssh-keygen -t rsa -C &quot;cuenta@gmail.com&quot;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Después lo que nos pedirá será la ruta donde almacenar la llave que por defecto es .ssh de tu home, basta con darle Enter y luego una frase tipo password que hay que indicar dos veces&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: black; color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Generating public/private rsa key pair. &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: black; color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: black; color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Enter file in which to save the key (/home/&lt;i&gt;tu_directorio&lt;/i&gt;/.ssh/id_rsa):&lt;i style=&quot;color: orange;&quot;&gt;&amp;lt;presiona enter&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: black; color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: black; color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;Enter passphrase (empty for no passphrase): &lt;span style=&quot;color: orange;&quot;&gt;&amp;lt;ingresa una contraseña&amp;gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt; &lt;/div&gt;
&lt;div style=&quot;background-color: black; color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;Enter same passphrase again:&lt;/i&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt; &lt;span style=&quot;color: orange;&quot;&gt;&amp;lt;repite la contraseña&amp;gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt; &lt;/div&gt;
&lt;br /&gt;
El resultado sería algo como esto:&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: black; color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Your identification has been saved in /home/tu_directorio/.ssh/id_rsa&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: black; color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Your public key has been saved in &lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;/home/tu_directorio/.ssh/id_rsa.pub&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: black; color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;The key fingerprint is:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: black; color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;01:ff:f4:2a:ca:37:dd:aa:a1:bb:f0:cc:08:f0:23:dc&amp;nbsp; &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: orange; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;tunick@gmail.com&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: black; color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;The key&#39;s randomart image is:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: black; color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;+--[ RSA 2048]----+&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: black; color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .+&amp;nbsp;&amp;nbsp; +&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: black; color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; o o =&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: black; color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = o O .&amp;nbsp;&amp;nbsp; |&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: black; color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; o = +&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: black; color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; o o =&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: black; color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; o S .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: black; color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; o . E&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: black; color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; o o =&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: black; color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: black; color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: black; color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;+-----------------+&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
Puedes ver el contenido del archivo que se acaba de generar (&lt;span style=&quot;font-size: x-small;&quot;&gt;/home/tu_directorio/.ssh/id_rsa.pub&lt;/span&gt;):&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;ssh-rsa AAAAB3NzaC1yc2EAAAADQAERYSFVDGoORPfVQ5kX3gdW08/2Qi8za7p9W4UQH7VOVb84sWlPcIehA+9WUlah1elxT8Img4LNmloUY6rccRcoTWBaqyL8AbhNtEKD3EylNqK4uLF3Omm/QcXphjDpsb5HKl00nVAdhprvogAgCp98743ERT#$MyWRR+PnDW8KJvOKt+EJ8RD2Dhk5WEYp3GsN4MHxF/eUDOlwnJx58d7UmdyDz74rDB3v4NqQKk+KvTjPtG2yI3K4gDCLp/+XfwkjGw0+sOwnuRNlurb0joZv3h2qWJRj5RhWk1Wel+hCOGfXXc0A0TaX3Eim9L415bZg9QHQEmXK5QgvZO7H8YsdN &lt;i&gt;&lt;span style=&quot;color: orange;&quot;&gt;tunick@gmail.com&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Ahora vete a la configuración de la cuenta, SSH Keys y da clic en agregar una nueva llave.&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;http://help.github.com/images/ssh_key_add.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;182&quot; src=&quot;http://help.github.com/images/ssh_key_add.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://github.com/settings/ssh&quot; target=&quot;_blank&quot;&gt;https://github.com/settings/ssh&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
En la ventana que aparece, coloca un titulo para darle un nombre a la llave y en el contenido pega todo el texto que se encuentra dentro de&lt;span style=&quot;font-size: x-small;&quot;&gt; /home/tu_directorio/.ssh/id_rsa.pub&lt;/span&gt; y luego da clic en Agregar.&lt;br /&gt;
&lt;br /&gt;
Para comprobar que te puedas conectar con gitHub debes ejecutar el comando de abajo y cuando te pregunte si desas seguir conectando, respondes con &quot;&lt;i&gt;yes&lt;/i&gt;&quot;.&amp;nbsp; Deberás recibir una respuesta como la que sigue.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;ssh -T git@github.com&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Hi &lt;span style=&quot;color: orange;&quot;&gt;nick&lt;/span&gt; ! You&#39;ve successfully authenticated, but GitHub does not provide shell access.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h4&gt;


&amp;nbsp;3.- Crear un repositorio&lt;/h4&gt;
Es muy sencillo, basta ir a &lt;a href=&quot;https://github.com/new&quot;&gt;https://github.com/new&lt;/a&gt; e indicar un nombre para repositorio que no haya usado nadie más, agregar una descripción del proyecto, indicar que será público y luego dar clic en &quot;Crear repositorio&quot;.&lt;br /&gt;
&lt;br /&gt;
Como resultado tendrás una página donde te muestra una liga parecida a la de abajo y usando el nombre del proyecto que acabas de agregar&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #274e13;&quot;&gt;git@github.com:tu_nick/tu_proyecto.git&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;h4&gt;




4.- Subir tu proyecto&lt;/h4&gt;
Debes crear una carpeta nueva para tu proyecto y luego iniciarlizarlo con git.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;$ mkdir miProyecto&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;$ cd miProyecto&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;$ git init&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Initialized empty Git repository in &lt;span style=&quot;color: orange;&quot;&gt;../miProyecto/.git&lt;/span&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;$ git remote add origin git@github.com:tu_nick/tu_proyecto.git&lt;/span&gt; remote add origin dasdfasdfasdfgit@github.com:username/Hello-World.git&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
La última línea relaciona tu actual directorio con la ruta de repositorio que acabas de crear y le agrega el alias &quot;origin&quot;.&amp;nbsp; Por defecto, todos los cambios que hagas con commit se agregarán a la copia del repositorio local (llamado &lt;b&gt;&lt;span style=&quot;color: #274e13;&quot;&gt;master&lt;/span&gt;&lt;/b&gt;) pero si quieres ver reflejados los cambios en el repositorio remoto deberás usar push.&lt;br /&gt;
Ejemplo:&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;$ echo &quot;Este proyecto es una prueba del uso de gitHub&quot; &amp;gt; README&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;$ git add README&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;$ git commit README -m&quot;Este es mi primer archivo que agrego&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;$ git push origin master&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
De esta manera puedes ir agregando elementos a tu proyecto y subiendolos al repositorio.&lt;br /&gt;
&lt;h4&gt;


5.- Otros comandos que debes saber&lt;/h4&gt;
Para descargar una copia del repositorio remoto (como hacer un checkout en SVN):&lt;br /&gt;
&lt;div style=&quot;background-color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;$ git clone usuario@192.168.0.1:/ruta/al/proyecto&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&amp;nbsp;que sería lo mismo con un proyecto en gitHub&lt;br /&gt;
&lt;div style=&quot;background-color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;$ git clone git@github.com:tu_nick/tu_proyecto.git
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Para actualizar el repositorio (&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;envia los cambios de &lt;/i&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;master&lt;/span&gt;&lt;i&gt; a &lt;/i&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;origin&lt;/span&gt;&lt;/span&gt;):&lt;br /&gt;
&lt;div style=&quot;background-color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;$ git push -u origin master&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
Para ver todos los cambios, ver el log:&lt;br /&gt;
&lt;div style=&quot;background-color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;$ git log &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&amp;nbsp; &lt;br /&gt;
Para ver los cambios entre la version anterior y la actual:&lt;br /&gt;
&lt;div style=&quot;background-color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;$ git show &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
Para ver todos los archivos con cambios y pendientes de subir:&lt;br /&gt;
&lt;div style=&quot;background-color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;$ git status &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
Para crear un branch&lt;br /&gt;
&lt;div style=&quot;background-color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;$ git branch &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;nombreBranch -m&quot;Un mensaje descriptivo&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
Para crear un tag &lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #274e13;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #274e13;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;i&gt;cuando se hace un&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #274e13;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;push&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;i&gt;&lt;span style=&quot;color: #274e13;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;para subir los cambios al repositorio remoto, no toma en cuenta los tags creados, es un comportamiento por defecto, por lo que si queremos subir un tag hay que usar el parametro&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;b&gt;&lt;span style=&quot;color: #274e13;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;--tags&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;:&lt;br /&gt;
&lt;div style=&quot;background-color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;$ git tag -a nombreTag -m&quot;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Un mensaje descriptivo&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&quot; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
Para hacer un switch a otro branch:&lt;br /&gt;
&lt;div style=&quot;background-color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;$ git checkout nombreBranch&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h4&gt;





Fuentes:&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://rogerdudler.github.com/git-guide/index.es.html&quot; target=&quot;_blank&quot;&gt;Ayuda básica de GitHub&lt;/a&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://learn.github.com/p/tagging.html&quot; target=&quot;_blank&quot;&gt;Aprender Git&lt;/a&gt; (inglés) &lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://git.or.cz/course/svn.html&quot; target=&quot;_blank&quot;&gt;Curso de GIT&lt;/a&gt; (inglés)&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://gitref.org/&quot; target=&quot;_blank&quot;&gt;Referencia de Git&lt;/a&gt; (inglés)&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://git-scm.com/docs&quot; target=&quot;_blank&quot;&gt;Referencia 2 de Git&lt;/a&gt; (inglés) &lt;/li&gt;
&lt;/ul&gt;
</content><link rel='replies' type='application/atom+xml' href='http://micro-howto.blogspot.com/feeds/1098755226756178017/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://micro-howto.blogspot.com/2012/05/como-subir-un-proyecto-con-git-github.html#comment-form' title='2 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/1098755226756178017'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/1098755226756178017'/><link rel='alternate' type='text/html' href='http://micro-howto.blogspot.com/2012/05/como-subir-un-proyecto-con-git-github.html' title='Como subir un proyecto con GIT a GitHub'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05477259225859568605</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total><georss:featurename>Constitución de 1917, Los Angeles, Iztapalapa, 09830 Ciudad de México, DF, México</georss:featurename><georss:point>19.3459804 -99.0638816</georss:point><georss:box>19.3459804 -99.0638816 19.3459804 -99.0638816</georss:box></entry><entry><id>tag:blogger.com,1999:blog-8587897704769639737.post-480131568010119007</id><published>2012-05-04T11:04:00.002-07:00</published><updated>2012-08-24T13:45:27.001-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="desarrollo"/><category scheme="http://www.blogger.com/atom/ns#" term="grails"/><category scheme="http://www.blogger.com/atom/ns#" term="groovy"/><category scheme="http://www.blogger.com/atom/ns#" term="programacion"/><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><title type='text'>Creacion de un proyecto base con Grails 2.0.3</title><content type='html'>Vamos a crear un proyecto web base para una aplicación que podría usar un &lt;b&gt;&lt;span style=&quot;color: #660000;&quot;&gt;kinder&lt;/span&gt;&lt;/b&gt; considerando solo poder hacer Altas Bajas y Cambios (ABC) de dos entidades Tutores y Alumnos.&amp;nbsp; Yo trabajaré en un &lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;a href=&quot;http://www.linuxmint.com/&quot; target=&quot;_blank&quot;&gt;Linux Mint&lt;/a&gt;&lt;/span&gt;, las instrucciones en consola son similares en cualquier distribución derivada de Debian o Ubuntu, para &lt;a href=&quot;http://www.grailsexample.net/installing-a-grails-development-environment-on-windows/&quot; target=&quot;_blank&quot;&gt;windows&lt;/a&gt; solo cambiarían las carpetas y las variables de entorno.&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;














Empecemos &lt;b&gt;instalando Grails&lt;/b&gt;.&lt;/h4&gt;
Necesitamos tener instalado java y haber definido nuestra variable de entorno JAVA_HOME.&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://grails.org/Download&quot; target=&quot;_blank&quot;&gt;Descargar grails&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Descomprimir ZIP en una carpeta (la mia será /opt )&lt;/li&gt;
&lt;li&gt;Crear las variables de entorno GRAILS_HOME y JAVA_HOME (si no existe)&lt;/li&gt;
&lt;/ol&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;export GRAILS_HOME=/opt/grails-2.0.3&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;export PATH=$PATH:/opt/grails-2.0.3/bin&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Para comprobar que nuestra instalación está completa debemos ejecutar el comando grails para obtener la versión.&amp;nbsp; En algunos sistemas como el mío se requiere reiniciar la sesión de usuario para que se apliquen los cambios en las variables de entorno.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;$ &lt;span style=&quot;color: #0c343d;&quot;&gt;grails -version&lt;/span&gt;&lt;br /&gt;Grails version: 2.0.3&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Ahora creamos nuestra aplicación, se genera una carpeta con el nombre de la aplicación, ingresamos a dicha carpeta y luego abrimos la consola de grails.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;$ grails create-app kinder&lt;/span&gt;&lt;br /&gt;| Created Grails Application at /home/wdonet/branches/grails/kinder&lt;br /&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;$ cd kinder/&lt;/span&gt;&lt;br style=&quot;color: #0c343d;&quot; /&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;$ ls&lt;/span&gt;&lt;br /&gt;application.properties&amp;nbsp; grails-app&amp;nbsp; lib&amp;nbsp; scripts&amp;nbsp; src&amp;nbsp; test&amp;nbsp; web-app&lt;br /&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;$ grails&lt;/span&gt;&lt;br /&gt;| Downloading: plugins-list.xml&lt;br /&gt;&lt;span style=&quot;color: #660000;&quot;&gt;grails&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #0c343d;&quot;&gt;help&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
Podemos usar el comando help para ver todos los comandos que tenemos disponibles en la consola de grails, incluso puedes obtener ayuda de un comando en especifico escribiendo por ejemplo : &lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;help create-app&lt;/span&gt;&lt;/span&gt;.&amp;nbsp; &lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #660000;&quot;&gt;Pero toma nota que la consola de grails es una forma para jugar con el ambiente de tu proyecto, si quieres ejecutar tu aplicación es mejor usar el comando grails (fuera de la consola).&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
Como yo utilizo &lt;a href=&quot;http://www.jetbrains.com/idea/&quot; target=&quot;_blank&quot;&gt;IntelliJIDEA&lt;/a&gt; como IDE para desarrollo, le voy a agregar el soporte para este IDE al proyecto, pero no es necesario, si usas &lt;a href=&quot;http://www.eclipse.org/&quot; target=&quot;_blank&quot;&gt;eclipse&lt;/a&gt;, &lt;a href=&quot;http://www.springsource.com/products/sts&quot; target=&quot;_blank&quot;&gt;STS&lt;/a&gt; u otro, este paso no es necesario &lt;i&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;ya que Grails genera por defecto el archivo de configuración para abrir el proyecto en eclipse&lt;/span&gt;&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;grails&amp;gt; integrate-with --intellij&lt;/span&gt;&lt;br /&gt;| Created IntelliJ project files..&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
























&lt;b&gt;Convención sobre la configuración&lt;/b&gt;&lt;/h4&gt;
&lt;div class=&quot;paragraph&quot;&gt;
Algo que debemos entender antes de continuar, por si no lo sabías, es el concepto de &quot;Convention over configuration&quot;.&amp;nbsp; Grails usa esta convención para configurarse a sí mismo, en otras palabras, cada nombre y ubicación de los archivos es usado como parte de la configuración de la aplicación en lugar de explicitamente declararlo en algun lado.&amp;nbsp; Por tanto, es necesario que te familiarises con la estructura de directorios que se generó en el proyecto que acabamos de crear.&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
Los elementos dentro de la carpeta kinder son:
&lt;/div&gt;
&lt;ul class=&quot;star&quot;&gt;
&lt;li&gt;&lt;code&gt;grails-app&lt;/code&gt; - el directorio más alto que contiene todas tus fuentes&lt;/li&gt;
&lt;ul class=&quot;star&quot;&gt;
&lt;li&gt;&lt;code&gt;conf&lt;/code&gt; - &lt;a class=&quot;guide&quot; href=&quot;http://grails.org/doc/latest/guide/single.html#conf&quot;&gt;configuración en general&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;controllers&lt;/code&gt; - aquí se guardan los &lt;a class=&quot;guide&quot; href=&quot;http://grails.org/doc/latest/guide/single.html#controllers&quot;&gt;controladores web&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;domain&lt;/code&gt; - las clases de&amp;nbsp; &lt;a class=&quot;guide&quot; href=&quot;http://grails.org/doc/latest/guide/single.html#GORM&quot;&gt;dominio&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;i18n&lt;/code&gt; - soporte para la&lt;a class=&quot;guide&quot; href=&quot;http://grails.org/doc/latest/guide/single.html#i18n&quot;&gt; internacionalización (i18n)&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;services&lt;/code&gt; - la &lt;a class=&quot;guide&quot; href=&quot;http://grails.org/doc/latest/guide/single.html#services&quot;&gt;capa de servicios&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;taglib&lt;/code&gt; - &lt;a class=&quot;guide&quot; href=&quot;http://grails.org/doc/latest/guide/single.html#taglibs&quot;&gt;librerías de etiquetas o (tag libraries)&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;utils&lt;/code&gt; - utilerías específicas de Grails.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;views&lt;/code&gt; - la configuración de las vistas ó &lt;a class=&quot;guide&quot; href=&quot;http://grails.org/doc/latest/guide/single.html#gsp&quot;&gt;Groovy Server Pages&lt;/a&gt; (.gsp).&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;code&gt;scripts&lt;/code&gt; - &lt;a class=&quot;guide&quot; href=&quot;http://grails.org/doc/latest/guide/single.html#commandLine&quot;&gt;scripts de Gant&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;src&lt;/code&gt; - tu código fuente&lt;/li&gt;
&lt;ul class=&quot;star&quot;&gt;
&lt;li&gt;&lt;code&gt;groovy&lt;/code&gt; - fuentes en lenguaje Groovy&lt;/li&gt;
&lt;li&gt;&lt;code&gt;java&lt;/code&gt; - fuentes en lenguaje Java&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;code&gt;test&lt;/code&gt;  - &lt;a class=&quot;guide&quot; href=&quot;http://grails.org/doc/latest/guide/single.html#testing&quot;&gt;Pruebas unitarias y de integración&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;ul class=&quot;star&quot;&gt;
&lt;/ul&gt;
&lt;h4&gt;























Configurar la Base de Datos&lt;/h4&gt;
Como todo sistema, necesitamos de un lugar donde almacenar nuestros datos y en este caso usaremos MySQL con el driver 5.1.18.&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Debes editar el archivo &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;kinder/grails-app/conf/BuildConfig.groovy&lt;/span&gt;.&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;(optativo) Descomentar, en &lt;i&gt;repositorios&lt;/i&gt;, la linea &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;mavenLocal()&lt;/span&gt; si ya tienes instalado maven en tu equipo, Grails se beneficia del repositorio local en tu máquina, sino usa por defecto los repositorios centrales de Grails y Maven.&lt;/li&gt;
&lt;li&gt;Descomentar, dentro de las &lt;i&gt;dependencias&lt;/i&gt;, la linea &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;runtime &#39;mysql:mysql-connector-java:X.X.X&#39;&lt;/span&gt; y sustituir la versión actual por la 5.1.18.&lt;/li&gt;
&lt;/ol&gt;
&lt;li&gt;Debes editar el archivo &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;kinder/grails-app/conf/DataSource.groovy&lt;/span&gt;.&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;&amp;nbsp;Agregar los datos de conexión a tu base de datos&lt;/li&gt;
&lt;/ol&gt;
&lt;/ol&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;dataSource {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbCreate = &quot;update&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; driverClassName = &quot;com.mysql.jdbc.Driver&quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; username = &quot;root&quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; password = &quot;admin&quot;&lt;br /&gt;}&lt;/span&gt;
 &lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;environments {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; development {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dataSource {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url = &quot;jdbc:mysql://localhost/kinder&quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; test {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dataSource {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url = &quot;jdbc:mysql://pruebas/kinder&quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; production {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dataSource {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url = &quot;jdbc:mysql://produccion/kinder&quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; username = &quot;usuario_produccion&quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; password = &quot;pass_produccion&quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;
Como solamente usaremos el ambiente desarrollo (el default), basta con dejar toda la configuración en &lt;i&gt;datasource&lt;/i&gt; o &lt;i&gt;development&lt;/i&gt;.&amp;nbsp; Pero el ejemplo muestra que el datasource externo define las propiedades comunes y los datasource internos de &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;development&lt;/span&gt;, &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;test&lt;/span&gt; y &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;production&lt;/span&gt; sobreescriben la configuración externa, por ejemplo la url del ambiente donde se va a conectar.&lt;br /&gt;
&lt;br /&gt;
La propiedad dbCreate puede tener cualquiera de los siguientes valores:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;create&lt;/span&gt;, elimina el esquema actual y luego lo crea cuando levanta la aplicación.&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;create-drop&lt;/span&gt;, igual que la anterior solo que elimina el esquema al terminar la aplicación.&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;update&lt;/span&gt;, crea nuevas tablas, agrega indices o columnas que falten, no borra tablas, columnas, ni datos.&amp;nbsp; Pero toma en cuenta que no soportara muchos cambios y ahí convendria un &lt;span style=&quot;font-size: x-small;&quot;&gt;create&lt;/span&gt; primero.&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;validate&lt;/span&gt;, no crea nada ni borra nada, pero valida la similitud de tu configuración con lo que ya existe en la BD.&amp;nbsp; Si hay diferencias envía &lt;i&gt;warnings!&lt;/i&gt;.&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;cualquier otro valor&lt;/i&gt;&lt;/span&gt;, no hace nada.&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;/ol&gt;
&lt;ul class=&quot;star&quot;&gt;
&lt;/ul&gt;
&lt;h4&gt;
























A programar !&lt;/h4&gt;
La parte central de la mayoría de proyectos Grails es su modelo de dominio el cual representa la capa de persistencia de los datos y esto es tan sencillo como crear clases de dominio que mapean las tablas en una Base de Datos.&lt;br /&gt;
&lt;br /&gt;
Por esa razón vamos a crear las clases de dominio principales: Alumno, Tutor y un par de catalogos: Grupo, Estado, Municipio y Postal.&amp;nbsp; Las instrucciones se vuelven repetitivas para cada clase así que es probable que no las coloque en todas las secciones pero sin duda debes considerarlas.&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKtK9lmQgtMDzw2rPxsciflr2Mh2tOLmG-ApLvAmMjpesN3JhA8mujrNEhQusYWjzALnTV7BDGHV5Fq8XTDbyiVE5d0CMHpnb0syz3M8B48RexETn3tZKCSDjtaeLTXFUopLyfQ1m5Cys/s1600/DiagramaClases.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;257&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKtK9lmQgtMDzw2rPxsciflr2Mh2tOLmG-ApLvAmMjpesN3JhA8mujrNEhQusYWjzALnTV7BDGHV5Fq8XTDbyiVE5d0CMHpnb0syz3M8B48RexETn3tZKCSDjtaeLTXFUopLyfQ1m5Cys/s400/DiagramaClases.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;i&gt;Diagrama de Clases y sus relaciones entre sí&lt;/i&gt;. &lt;i&gt;&lt;span style=&quot;color: #660000;&quot;&gt;Da clic para ver en grande&lt;/span&gt;&lt;/i&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #0c343d;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;$ grails create-domain-class mx.com.kinder.Alumno&lt;/span&gt;&lt;br /&gt;| Created file grails-app/domain/mx/com/kinder/Alumno.groovy&lt;br /&gt;| Created file test/unit/&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;mx/com/kinder/&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;AlumnoTests.groovy&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;$ grails create-domain-class Tutor&lt;/span&gt;&lt;br /&gt;| Created file grails-app/domain/&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;mx/com/kinder/&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;Tutor.groovy&lt;br /&gt;| Created file test/unit/&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;mx/com/kinder/&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;Tutor&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;Tests.groovy&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;Hacer lo mismo para el resto de clases y luego agregar sus propiedades a mano.&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Agrega a la clase &lt;b&gt;&lt;span style=&quot;color: #660000;&quot;&gt;Tutor&lt;/span&gt;:&lt;/b&gt;&lt;br /&gt;
&lt;pre&gt;package mx.com.kinder

import mx.com.kinder.dto.Nombre
import mx.com.kinder.dto.Direccion

class Tutor {
    Nombre nombre
    Estado estado
    Municipio municipio
    Postal postal
    Direccion direccion
    Date fechaNacimiento
    String mail
    String telefonoCasa
    String telefonoOficina
    String telefonoCelular

    //para embeber los tres campos de nombres, paterno y materno en un DTO
    // o todos los campos de la direccion en un solo DTO
    static embedded = [&#39;nombre&#39;, &#39;direccion&#39;]

    //el orden de los campos en constraints define el orden de los
    // elementos en la vista que se generara después.
    static constraints = {
        nombre()
        direccion(nullable: false)
        estado(nullable: false)
        municipio(nullable: false)
        postal(nullable: false)
        fechaNacimiento nullable: false
        mail email: true, blank: false, nullable: true
        telefonoCasa()
        telefonoOficina()
        telefonoCelular()
    }

}
&lt;/pre&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Observa que los atributos de la clase en realidad son propiedades dado que Grails le inyecta automáticamente sus métodos &lt;a href=&quot;http://www.slideshare.net/e1da4/mtodos-poo&quot; target=&quot;_blank&quot;&gt;getters y setters&lt;/a&gt; correspondientes, además se determina el nombre de la Tabla como el nombre de la clase y el nombre de las columnas como el nombre de cada propiedad.&amp;nbsp; La creación de estos elementos en la Base de Datos se hace de manera automática cuando se levante la aplicación.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Los constraints son validaciones que se ejecutan antes de la persistencia de los datos, para el caso de Tutor por ejemplo, ningún elemento de la dirección puede ser nulo; el mail si puede ser nulo pero no debe tener solo espacios, además se valida que la estructura del mail sea la de un correo con &lt;span style=&quot;font-size: x-small;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;email: true&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&quot;&lt;/span&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Agrega a la clase &lt;b&gt;&lt;span style=&quot;color: #660000;&quot;&gt;Alumno&lt;/span&gt;:&lt;/b&gt;&lt;br /&gt;
&lt;pre&gt;package mx.com.kinder

import mx.com.kinder.dto.Nombre
import mx.com.kinder.dto.Direccion

class Alumno {

    Nombre nombre
    Date fechaNacimiento
    Grupo grupo
    Tutor papa
    Tutor mama
    Direccion direccion

    static embedded = [&#39;nombre&#39;, &#39;direccion&#39;]

    static constraints = {
        nombre()
        grupo()
        fechaNacimiento()
        papa()
        mama()
        direccion()
    }
}&amp;nbsp; &lt;/pre&gt;
&lt;pre&gt;&lt;/pre&gt;
&lt;br /&gt;
Debemos crear ahora los controladores (capa de clases que sirven de interfaz entre la vista web y la capa de persistencia - base de datos).&amp;nbsp; Grails puede generar los metodos del controller de forma automática a manera que queden programadas como servicios REST que se pueden exponer via web.&amp;nbsp; Toma en cuenta que el controlador se genera con base en las propiedades de la entidad.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;color: #0c343d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;$ grails create-controller mx.com.kinder.Alumno&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;color: #0c343d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;$ grails create-controller mx.com.kinder.Tutor&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;color: #0c343d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;$ grails create-controller mx.com.kinder.Estado&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;color: #0c343d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;$ grails create-controller mx.com.kinder.Municipio&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;color: #0c343d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;$ grails create-controller mx.com.kinder.Postal&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
, o bien, usar una funcionalidad denominada &lt;i&gt;scaffolding&lt;/i&gt;, que se encarga de crear en tiempo de ejecución una interfaz web tipo ABC (vista con Altas, Bajas y Cambios) para la clase de dominio indicada.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;color: #0c343d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;$ &lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;grails create-scaffold-controller mx.com.kinder.Estado&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;color: #0c343d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/pre&gt;
Esto generará la clase como sigue &lt;span style=&quot;font-size: x-small;&quot;&gt;(Ojo, solo escoge uno de los dos comandos: &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;create-controller&lt;/span&gt; ó &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;create-scaffold-controller&lt;/span&gt;)&lt;/span&gt;:&lt;br /&gt;
&lt;pre style=&quot;color: #0c343d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;package mx.com.kinder

class EstadoController {

    static scaffold = Estado  //tambien funciona si colocas el valor: true
}
&lt;/pre&gt;
&lt;br /&gt;
Esta funcionalidad se encargará de generar las operaciones abajo listadas para manipular los datos de esa entidad en la Base de Datos.&amp;nbsp; Es de notar que el controlador se llama igual que la clase de dominio, salvo por la terminación &quot;&lt;i&gt;Controller&lt;/i&gt;&quot;, esto es importante ya que se usa para determinar que esta clase es un controlador de la clase de dominio.&amp;nbsp; A pesar de que se tenga el scaffolding activado, se pueden sobreescribir los métodos para afinar su comportamiento.&lt;br /&gt;
&lt;ul class=&quot;star&quot;&gt;
&lt;li&gt;list&lt;/li&gt;
&lt;li&gt;show&lt;/li&gt;
&lt;li&gt;edit&lt;/li&gt;
&lt;li&gt;delete&lt;/li&gt;
&lt;li&gt;create&lt;/li&gt;
&lt;li&gt;save&lt;/li&gt;
&lt;li&gt;update&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;ul class=&quot;star&quot;&gt;
&lt;/ul&gt;
&lt;br /&gt;
Por último y antes de levantar nuestra aplicación quizá nos ayude tener algunos datos iniciales, por ejemplo de Catalogos como el de Estado (el cual solo contiene dos elementos ademas del identificador: el nombre y si esta activo).&amp;nbsp; Existe una clase Groovy que podemos usar para tal efecto: BootStrap.groovy y se implementaría mas o menos así:&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;pre&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;import mx.com.kinder.Estado
class &lt;span style=&quot;color: red;&quot;&gt;BootStrap&lt;/span&gt; {
  def init = { servletContext -&amp;gt;
    &lt;span style=&quot;color: red;&quot;&gt;environments&lt;/span&gt; {
      &lt;span style=&quot;color: red;&quot;&gt;development&lt;/span&gt; {
        if (!Estado.count()) {
          [&quot;Aguascalientes&quot;, &quot;Baja California&quot;, &quot;Baja California Sur&quot;, &quot;Campeche&quot;,
           &quot;Coahuila de Zaragoza&quot;, &quot;Colima&quot;, &quot;Chiapas&quot;, &quot;Chihuahua&quot;, &quot;Distrito Federal&quot;,
           &quot;Durango&quot;, &quot;Guanajuato&quot;, &quot;Guerrero&quot;, &quot;Hidalgo&quot;, &quot;Jalisco&quot;, &quot;Mexico&quot;,
           &quot;Michoacan de Ocampo&quot;, &quot;Morelos&quot;, &quot;Nayarit&quot;, &quot;Nuevo Leon&quot;, &quot;Oaxaca&quot;, &quot;Puebla&quot;,
           &quot;Queretaro de Arteaga&quot;, &quot;Quintana Roo&quot;, &quot;San Luis Potosi&quot;, &quot;Sinaloa&quot;, &quot;Sonora&quot;,
           &quot;Tabasco&quot;, &quot;Tamaulipas&quot;, &quot;Tlaxcala&quot;, &quot;Veracruz&quot;, &quot;Yucatan&quot;, &quot;Zacatecas&quot;].each {
              new Estado(nombre: it, activo: true).save(failOnError: true)
           }
        }
      }
    }
  }
  def destroy = {}
}
&lt;/span&gt;&lt;/pre&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
Como ven, tiene dos fases; &lt;b&gt;init&lt;/b&gt; se encarga de ejecutar el codigo dependiendo el ambiente indicado al levantar la aplicación y &lt;b&gt;destroy&lt;/b&gt; trata de ejectuar algun proceso cuando la aplicación se dé de baja o por terminada.&amp;nbsp; En este caso estamos llenando de datos el catalogo de Estado solo si no existiese ningun dato en la tabla.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #660000;&quot;&gt;Si no se desea especificar ambiente, se puede prescindir de &lt;/span&gt;&lt;b&gt;&lt;i style=&quot;color: #660000;&quot;&gt;environments&lt;/i&gt;&lt;/b&gt;&lt;span style=&quot;color: #660000;&quot;&gt; y el proceso lo ejecutará cuando levante para cualquier ambiente. &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Casi&amp;nbsp; hemos terminado esta base de proyecto, tan solo falta generar las vistas, podemos hacer uso del comando &lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;generate-views&lt;/span&gt;&lt;/span&gt; para generar los archivos .gsp que hacen uso de jquery y hacen la funcion del Front (vista) al usuario de la aplicación.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;color: #0c343d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;$ &lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;grails generate-views mx.com.kinder.Estado&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;color: #0c343d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;$ &lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;grails generate-views mx.com.kinder.Municipio&lt;/span&gt; &lt;/pre&gt;
&lt;pre style=&quot;color: #0c343d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;$ &lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;grails generate-views mx.com.kinder.Postal&lt;/span&gt; &lt;/pre&gt;
&lt;pre style=&quot;color: #0c343d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;$ &lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;grails generate-views mx.com.kinder.Alumno&lt;/span&gt; &lt;/pre&gt;
&lt;pre style=&quot;color: #0c343d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;$ &lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;grails generate-views mx.com.kinder.Tutor&lt;/span&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;
Cada comando generará una carpeta dentro de views con el nombre de cada clase de dominio y adentro 5 archivos &lt;b&gt;.gsp&lt;/b&gt;: un template (&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;_form.gsp&lt;/span&gt;), y cuatro paginas &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;create.gsp&lt;/span&gt;, &lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;edit.gsp&lt;/span&gt;&lt;/span&gt;, &lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;list.gsp&lt;/span&gt;&lt;/span&gt; y &lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;show.gsp&lt;/span&gt;&lt;/span&gt; con el fin de lograr la funcionalidad ABC de cada clase de dominio.&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;













JQuery&lt;/h4&gt;
Si quieres jugar con este script, Grails 2.0.3 incluye como plugin por defecto la version 1.7.1 de jquery.&amp;nbsp; Pero para poder&amp;nbsp; acceder a sus funciones debes incluir la linea siguiente en el archivo &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;/grails-app/views/layouts/main.gsp&lt;/span&gt;, dentro de la etiqueta &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;  y antes de la línea que dice &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;lt;r:layoutresources/&amp;gt;&lt;/span&gt; :&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #0c343d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;
&amp;lt;g:javascript library=&quot;jquery&quot; plugin=&quot;jquery&quot;/&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0c343d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;
&lt;br /&gt;
Luego, en cada página gsp donde quieras ejecutar codigo de jQuery debes incluir el siguiente script dentro de la etiqueta &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;, &lt;span style=&quot;font-size: small;&quot;&gt;&lt;i style=&quot;color: #660000;&quot;&gt;(si usas el clasico tag &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;lt;script&amp;gt;
&lt;/span&gt;
 no funcionará porque al momento de que Grails renderea la página, coloca este tag antes del include de la librería de jQuery, por lo que el código que coloques aquí no funcionará - por tanto es forzoso usar &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;lt;g:javascript&amp;gt;&lt;/span&gt;)&lt;/i&gt;&lt;/span&gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:html;&quot;&gt;    &amp;lt;g:javascript&amp;gt;
        $(document).ready(function() {
            alert(&#39;si funciona mi codigo de JQuery&#39;)
        })
    &amp;lt;/g:javascript&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
O la otra alternativa es:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:html;&quot;&gt;    &amp;lt;r:script disposition=&#39;head&#39;&amp;gt;
    &amp;lt;/r:script&amp;gt;
&lt;/pre&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Ambos scripts renderean a una etiqueta &lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;lt;script&amp;gt;&lt;/span&gt;&lt;/span&gt;, solo que &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;lt;g:javascript&amp;gt;&lt;/span&gt;&lt;/span&gt; coloca el código dentro y al final de la etiqueta &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;lt;body&amp;gt;&lt;/span&gt;, mientras que &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;lt;r:script&amp;gt;&lt;/span&gt; lo coloca dentro de la etiqueta .&lt;/div&gt;
&lt;h4 style=&quot;color: black;&quot;&gt;






&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;Ejecutar la aplicación&lt;/b&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;El comando &lt;i&gt;run-app&lt;/i&gt; levanta la aplicación usando un tomcat con el puerto 8080 por defecto, pero se lo podemos cambiar si especificamos la variable &quot;&lt;i&gt;server.port&lt;/i&gt;&quot;.&amp;nbsp; Para salir debes dar CTL+C.&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #0c343d;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;pre style=&quot;color: #0c343d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/pre&gt;
&lt;pre style=&quot;color: #0c343d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;$ grails -Dserver.port=8090 run-app&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/pre&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i style=&quot;color: #660000;&quot;&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;
&lt;i style=&quot;color: #660000;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: black; font-size: small;&quot;&gt;Pero como esto no es lo óptimo para un ambiente de producción, sino instalarlo en un servidor aparte, podemos usar el comando war para generar el WAR con la configuración de producción por defecto y luego montarlo manualmente en cualquier servidor que soporte la version 2.5 de servlets&lt;/span&gt; &lt;span style=&quot;color: #274e13; font-size: x-small;&quot;&gt;(Por ejemplo: Tomcat,6,7; GlasFish 2,3; Resin 3,4; JBoss 5,6; Jetty 6,7; Websphere 6.1,7; Weblogic 9,10,10.3; SpringSourc tc Server)&lt;/span&gt;.&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;Para ver la aplicación ejecutándose ve a la siguiente url:&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;i style=&quot;color: #660000;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;i style=&quot;color: #660000;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;a href=&quot;http://localhost:8080/kinder&quot;&gt;http://localhost:8080/kinder&lt;/a&gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqP-NTUpI2d7Y78AW3aJpmlA4Vw-843CnrIDlmFcS6PuPYndgvLaX9MVf9Zn3j2oxxoGqh1M4DiLPLzbOgQMEWs3dDFjXl24YlX5u24Wd2bjc5AR7dnqtnvea-1DSlwhvZ2s0ui7G5czk/s1600/grailsScreenShot.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;335&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqP-NTUpI2d7Y78AW3aJpmlA4Vw-843CnrIDlmFcS6PuPYndgvLaX9MVf9Zn3j2oxxoGqh1M4DiLPLzbOgQMEWs3dDFjXl24YlX5u24Wd2bjc5AR7dnqtnvea-1DSlwhvZ2s0ui7G5czk/s400/grailsScreenShot.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;i&gt;Se debería ver algo como esto.&lt;/i&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;i style=&quot;color: #660000;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;h4 style=&quot;color: black;&quot;&gt;











&lt;span style=&quot;font-size: small;&quot;&gt;












&lt;b&gt;Fuentes:&lt;/b&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;ul&gt;&lt;i style=&quot;color: #660000;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;
&lt;li&gt;&lt;a href=&quot;http://grails.org/&quot; target=&quot;_blank&quot;&gt;Sitio oficial de Grails&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://grails.org/doc/latest&quot; target=&quot;_blank&quot;&gt;Documentos de referencia&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://grails.org/Quick+Start&quot; target=&quot;_blank&quot;&gt;The Quick Start&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://grails.org/doc/2.0.3/ref/&quot; target=&quot;_blank&quot;&gt;http://grails.org/doc/2.0.3/ref/&lt;/a&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://api.jquery.com/&quot; target=&quot;_blank&quot;&gt;API jQuery &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/wdonet/kinder/zipball/proyectoBase&quot; target=&quot;_blank&quot;&gt;Descargar el código fuente de esta demo&lt;/a&gt;&lt;/li&gt;
&lt;/span&gt;&lt;/i&gt;&lt;/ul&gt;
</content><link rel='replies' type='application/atom+xml' href='http://micro-howto.blogspot.com/feeds/480131568010119007/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://micro-howto.blogspot.com/2012/05/creacion-de-un-proyecto-con-grails-203.html#comment-form' title='3 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/480131568010119007'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/480131568010119007'/><link rel='alternate' type='text/html' href='http://micro-howto.blogspot.com/2012/05/creacion-de-un-proyecto-con-grails-203.html' title='Creacion de un proyecto base con Grails 2.0.3'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05477259225859568605</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKtK9lmQgtMDzw2rPxsciflr2Mh2tOLmG-ApLvAmMjpesN3JhA8mujrNEhQusYWjzALnTV7BDGHV5Fq8XTDbyiVE5d0CMHpnb0syz3M8B48RexETn3tZKCSDjtaeLTXFUopLyfQ1m5Cys/s72-c/DiagramaClases.jpg" height="72" width="72"/><thr:total>3</thr:total><georss:featurename>Pachuca 19, Condesa, Cuauhtémoc, 06140 Ciudad de México, DF, México</georss:featurename><georss:point>19.4142212 -99.1782311</georss:point><georss:box>19.4123492 -99.1806986 19.4160932 -99.17576360000001</georss:box></entry><entry><id>tag:blogger.com,1999:blog-8587897704769639737.post-8873364880117080815</id><published>2012-04-30T15:57:00.001-07:00</published><updated>2012-08-24T13:42:55.663-07:00</updated><title type='text'>Clases embebidas en Grails</title><content type='html'>En &lt;a href=&quot;http://grails.org/&quot; target=&quot;_blank&quot;&gt;Grails&lt;/a&gt; se pueden mapear clases a entidades simplemente ubicándolas en un paquete dentro de la carpeta &lt;i&gt;/grails-app/domain&lt;/i&gt; como se muestra abajo.&amp;nbsp; Mapeando la clase y atributos a una tabla y columnas con un mismo nombre si no se le especifica otra cosa con la propiedad &lt;i&gt;mapping&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;import mx.com.proyecto
class Tutor {
    String nombres
    String paterno
    String materno
    Integer edad
    static constraints = {
        nombres maxSize: 150, nullable: false, blank: false
        paterno maxSize: 80, nullable: false, blank: false
        materno maxSize: 80, nullable: true, blank: false
    }
}
&lt;/pre&gt;
&lt;br /&gt;
Pero quizá nos interese tener nuestra entidad un poco mas amigable y legible agrupando los tres elementos nombres, paterno y materno dentro de un mismo POJO y seguirla mapeando a las mismas columnas de una sola tabla.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #990000;&quot;&gt;
La regla de oro está en definir el POJO en el mismo archivo Tutor.groovy o en un archivo separado pero dentro de la carpeta &lt;i&gt;/src/groovy/&lt;/i&gt; (Nombre.groovy).&lt;/div&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;i&gt;/grails-app/domain/Tutor.groovy&lt;/i&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;pre&gt;import mx.com.proyecto
class Tutor {
    Nombre nombre
    Integer edad
}
&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;i&gt;/src/groovy/Nombre.groovy&lt;/i&gt;&lt;/div&gt;
&lt;pre&gt;import mx.com.proyecto
class Nombre {
    String nombres
    String paterno
    String materno
    static constraints = {
        nombres maxSize: 150, nullable: false, blank: false
        paterno maxSize: 80, nullable: false, blank: false
        materno maxSize: 80, nullable: true, blank: false
    }
    static mapping = {
        nombres column: &#39;nombres&#39;
        paterno column: &#39;paterno&#39;
        materno column: &#39;materno&#39;
    }
}
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
Si no colocamos el apartado &lt;i&gt;mapping&lt;/i&gt; en la nueva clase Nombre e indicando como se mapearían las propiedades a las columnas de la tabla, los nombres de columna que tendríamos en la tabla serían:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;[nombreDePropiedadTutor] + _ + [nombreDePropiedadNombre]&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Esto es: &lt;i&gt;nombre_&lt;b&gt;nombres&lt;/b&gt;&lt;/i&gt;, &lt;i&gt;nombre_&lt;b&gt;paterno&lt;/b&gt;&lt;/i&gt; y &lt;i&gt;nombre_&lt;b&gt;materno&lt;/b&gt;&lt;/i&gt;, lo cual funcionaría solo para cuando quieras embeber el mismo POJO varias veces en la misma entidad.&lt;br /&gt;
&lt;br /&gt;
Tu puedes seguir haciendo búsquedas con las propiedades de ese objeto, instanciando un objeto y asignando el valor en la propiedad que te interesa usar para buscar en la tabla Tutor.&amp;nbsp; Por ejemplo:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;    Nombre rebeca = new Nombre()
    rebeca.setNombres(&#39;rebeca&#39;)
    Tutor.findAllByNombre(rebeca)
&lt;/pre&gt;
&lt;br /&gt;
También puedes agregar métodos que te permita operar con las columnas de Nombre, ejemplo:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;    String obtenerPorNombre() {
        return nombres + &#39; &#39; + paterno + &#39; &#39; + materno
    }

    String obtenerPorPaterno() {
        return paterno + &#39; &#39; + materno + &#39; &#39; + nombres
    }
&lt;/pre&gt;
&lt;br /&gt;
&lt;h4&gt;



Fuentes:&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://grails.org/doc/latest/ref/Domain%20Classes/embedded.html&quot; target=&quot;_blank&quot;&gt;Sitio oficial Grails&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content><link rel='replies' type='application/atom+xml' href='http://micro-howto.blogspot.com/feeds/8873364880117080815/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://micro-howto.blogspot.com/2012/04/clases-embebidas-en-grails.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/8873364880117080815'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/8873364880117080815'/><link rel='alternate' type='text/html' href='http://micro-howto.blogspot.com/2012/04/clases-embebidas-en-grails.html' title='Clases embebidas en Grails'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05477259225859568605</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8587897704769639737.post-5548657370815161706</id><published>2012-04-26T17:56:00.000-07:00</published><updated>2012-04-27T07:25:51.453-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="base de datos"/><category scheme="http://www.blogger.com/atom/ns#" term="datos"/><category scheme="http://www.blogger.com/atom/ns#" term="db"/><category scheme="http://www.blogger.com/atom/ns#" term="mongoDB"/><category scheme="http://www.blogger.com/atom/ns#" term="no-sql"/><category scheme="http://www.blogger.com/atom/ns#" term="servidores"/><category scheme="http://www.blogger.com/atom/ns#" term="sql"/><title type='text'>Introducción a MongoDB</title><content type='html'>&lt;br /&gt;
Me metí un poco a ver como funcionaba &lt;a href=&quot;http://wiki.apache.org/couchdb/CouchIn15Minutes&quot; target=&quot;_blank&quot;&gt;CouchDB&lt;/a&gt; pero entre revisiones y vistas rápidas a referencias aquí y allá llegue a MongoDB, ambas son alternativas &lt;i&gt;&lt;b&gt;No-SQL&lt;/b&gt;&lt;/i&gt; (termino que empezó a agarrar fama desde 2009) y que su almacenamiento de datos está orientado a documentos &lt;a href=&quot;http://www.json.org/&quot; target=&quot;_blank&quot;&gt;JSON&lt;/a&gt; y &lt;a href=&quot;http://bsonspec.org/&quot; target=&quot;_blank&quot;&gt;BSON (Bynary JSON)&lt;/a&gt; para ofrecer sistemas flexibles, rápidos, ligeros, potentes y fáciles de usar.&lt;br /&gt;
&lt;br /&gt;
Según &lt;i&gt;Eliot Horowitz,&lt;/i&gt; &lt;span style=&quot;font-size: x-small;&quot;&gt;10gen CTO y co-fundador de mongoDB&lt;/span&gt;, prácticamente podrías tomar una base de datos hecha en MySQL, cambias el modelo relacional a uno basado en documentos y obtendrías varias mejoras como:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Documentos embebidos para mejorar la velocidad&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;El uso de json es más amigables con objetos en lenguajes de programación &lt;/li&gt;
&lt;li&gt;El meter documentos embebidos y arreglos reduce la necesidad de hacer joins&lt;/li&gt;
&lt;/ol&gt;
&lt;li&gt;Manejabilidad&lt;/li&gt;
&lt;li&gt;Desarrollo ágil con base de datos sin esquemas&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;Al usar JSON/BSON es fácil de codificar y administrar &lt;/li&gt;
&lt;/ol&gt;
&lt;li&gt;Escalabilidad horizontal más facil&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;Es una solución para sistemas que requieren escalar horizontalmente sobre varios servidores.&lt;/li&gt;
&lt;li&gt;La funcionalidad de autosharding permite escalar tu cluster agregando mas equipos sin necesidad de dar de baja el servicio.&lt;/li&gt;
&lt;/ol&gt;
&lt;/ol&gt;
&lt;br /&gt;
En realidad no estamos quitando todo el trabajo que ya se ha hecho con las bases de datos relacionales porque en muchas cosas como la creación de indices, llaves primarias, consultas dinámicas y actualizaciones, por mencionar algunas,&amp;nbsp; se tiene que hacer los mismo, salvo que se busca tener las ventajas arriba descritas.&lt;br /&gt;
&lt;br /&gt;
La gente de apache que desarrolla CouchDB mencionan que los esquemas relacionales funcionarán en algunos casos mientras que los esquemas no-SQL funcionarán en otros.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;El modelo de datos de MongoDB&lt;/b&gt; considera lo siguiente:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Un &lt;b&gt;sistema mongo&lt;/b&gt; contiene un conjunto de bases de datos.&lt;/li&gt;
&lt;li&gt;Una &lt;b&gt;base de datos&lt;/b&gt; &lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;(database)&lt;/span&gt; contiene un conjunto de colecciones.&lt;/li&gt;
&lt;li&gt;Una &lt;b&gt;colección&lt;/b&gt; &lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;(collection)&lt;/span&gt; contiene un conjunto de documentos.&lt;/li&gt;
&lt;li&gt;Un &lt;b&gt;documento&lt;/b&gt; &lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;(document)&lt;/span&gt; es un conjunto de campos.&lt;/li&gt;
&lt;li&gt;Un &lt;b&gt;campo&lt;/b&gt; &lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;(field)&lt;/span&gt; es un par llave - valor.&lt;/li&gt;
&lt;li&gt;Una &lt;b&gt;llave&lt;/b&gt; &lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;(key)&lt;/span&gt; es un nombre en forma de cadena.&lt;/li&gt;
&lt;li&gt;Un &lt;b&gt;valor&lt;/b&gt; &lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;(value)&lt;/span&gt; es:&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;un tipo de dato básico, &lt;i&gt;string&lt;/i&gt;, &lt;i&gt;integer&lt;/i&gt;, &lt;i&gt;float&lt;/i&gt;, &lt;i&gt;timestamp&lt;/i&gt;, &lt;i&gt;binary&lt;/i&gt;, etc.,&lt;/li&gt;
&lt;li&gt;otro &lt;i&gt;documento&lt;/i&gt;, ó &lt;/li&gt;
&lt;li&gt;un &lt;i&gt;arreglo&lt;/i&gt; de valores&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;b&gt;El lenguaje de consulta&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Al tratar con objetos json la estructura de un nombre podria ser: &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;{nombre: &#39;Sebastian&#39;, paterno: &#39;Morales&#39;}&lt;/span&gt;, esta estructura se puede usar por ejemplo para buscar todos los documentos (registros) de una colección (tabla) que empaten con el nombre &lt;i&gt;&quot;Sebastian Morales&quot;&lt;/i&gt;, pero también podemos hacer lo siguiente:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;{nombre.paterno: &#39;Morales&#39;}&lt;/span&gt;, para obtener los que tengan apellidos &#39;Morales&#39;.&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;{nombre.paterno: /^M/}&lt;/span&gt;, para obtener los que tengan apellidos que inicien con &#39;M&#39; &lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;{keywords: &#39;tecnico&#39;}&lt;/span&gt;, para los documentos con &#39;tecnico&#39; dentro del contenido del arreglo&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;{keywords: {$in:[&#39;tecnico&#39;, &#39;licenciado&#39;]}&lt;/span&gt;, para los documentos con &#39;tecnico&#39; o licenciado dentro del contenido del arreglo.&lt;/li&gt;
&lt;/ul&gt;
Si tenemos muchos documentos en una colección y queremos mejorar la velocidad de búsqueda de las consultas, crearemos índices comose muestra abajo, pero hay que tomar en cuenta que se ocupa mas espacio y reduce la velocidad de los &lt;i&gt;&#39;update&#39;&lt;/i&gt;.&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;ensureIndex({nombre.apellido:1})&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;ensureIndex({keywords: 1})&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;b&gt;Instalación y primeros ejemplos&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Aunque los &lt;a href=&quot;http://www.mongodb.org/display/DOCS/Quickstart+Unix&quot; target=&quot;_blank&quot;&gt;procesos de instalación&lt;/a&gt; son diferentes para cada S.O. yo presentaré el que realicé en Linux Mint.&amp;nbsp; Debo comentar que el sitio de &lt;a href=&quot;http://www.mongodb.org/display/DOCS/Ubuntu+and+Debian+packages&quot; target=&quot;_blank&quot;&gt;MongoDB&lt;/a&gt; recomienda que se descargue la última version de sus servidores ya que los repositorios de Debian o Ubuntu no se encuentran del todo actualizados, no obstante para propositos de esta entrada nos basta seguir lo siguiente:&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
sudo apt-get install mongodb&lt;/div&gt;
&lt;br /&gt;
Entre los comandos que se instalarán se encuentran &lt;b&gt;mongod&lt;/b&gt; (servidor) y &lt;b&gt;mongo&lt;/b&gt; (cliente).&amp;nbsp; Este último debe ser el usado para entrar a la consola y ejecutar consultas al servidor.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;mongo&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;gt; &lt;span style=&quot;color: #0c343d;&quot;&gt;db.alumno.save&lt;/span&gt;({nombre:&#39;julian&#39;, paterno:&#39;rodriguez&#39;, edad:12, grupo:&#39;2A&#39;})&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;gt; &lt;span style=&quot;color: #0c343d;&quot;&gt;db.alumno.find&lt;/span&gt;()&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;{ &quot;_id&quot; : ObjectId(&quot;4f99d713b16869a4f4d5abd9&quot;), &quot;nombre&quot; : &quot;julian&quot;, &quot;paterno&quot; : &quot;rodriguez&quot;, &quot;edad&quot; : 12, &quot;grupo&quot; : &quot;2A&quot; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;gt; &lt;span style=&quot;color: #0c343d;&quot;&gt;help &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Con &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;db.alumno.save()&lt;/span&gt;&lt;/span&gt; creamos la colección alumno y agregamos el primer documento con el nombre de julian, luego lo consultamos con &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;db.alumno.find() &lt;/span&gt;&lt;/span&gt;y para ver mas ayuda sobre los comandos ejecuta &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;help&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;/span&gt;&lt;/span&gt;.&lt;br /&gt;
&lt;br /&gt;
Por defecto, el comando mongo se conecta a una base de datos llamada &quot;test&quot; en localhost, por eso al ejecutar el comando mongo, verían algo como esto:&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;wdonet@wdonet-mint12 ~ $ mongo&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;MongoDB shell version: 1.8.2&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;Thu Apr 26 17:06:35 *** warning: spider monkey build without utf8 support.&amp;nbsp; consider rebuilding with utf8 support&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;connecting to: test&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;gt; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;db&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;test&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;gt; &lt;span style=&quot;color: #0c343d;&quot;&gt;use miPropiaBD&lt;/span&gt;&lt;br /&gt;switched to db miBD&lt;br /&gt;&amp;gt; &lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;db&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;miPropiaBD&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Usamos el comando &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;use&lt;/span&gt;&lt;/span&gt; para poder cambiar la base de datos y lo comprobamos con el comando &lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;db&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt; &lt;/span&gt;&lt;/span&gt;o con &lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;show dbs&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;/span&gt;.&amp;nbsp; Esto no crea inmediatamente la BD, sino hasta que por primera vez le insertas datos. El comando show no mostrará la nueva BD hasta que insertes datos.&amp;nbsp; Lo mismo sucede con las colecciones.&lt;br /&gt;
&lt;br /&gt;
En MongoDB no hay campos predefinidos (lo que serían columnas en un RDBMS), tampoco hay esquemas definidos para dichos campos por lo que sus tipos de dato pueden variar y las colecciones pueden guardar diferenets campos.&lt;br /&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;gt; &lt;span style=&quot;color: #0c343d;&quot;&gt;j = { nombre : &quot;roberto&quot;};&lt;/span&gt;&lt;br /&gt;{ &quot;nombre&quot; : &quot;roberto&quot; }&lt;br /&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&amp;gt; t = {edad : 30}&lt;/span&gt;&lt;br /&gt;{ &quot;edad&quot; : 30 }&lt;br /&gt;&amp;gt; &lt;span style=&quot;color: #0c343d;&quot;&gt;db.nuevaColeccion.save({j, t})&lt;/span&gt;&lt;br /&gt;Thu Apr 26 19:25:15 SyntaxError: invalid object initializer (shell):1&lt;br /&gt;&amp;gt; &lt;span style=&quot;color: #0c343d;&quot;&gt;db.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #0c343d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;nuevaColeccion&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;.save(j)&lt;/span&gt;&lt;br /&gt;&amp;gt;&lt;span style=&quot;color: #0c343d;&quot;&gt; db.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #0c343d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;nuevaColeccion&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;.save(t)&lt;/span&gt;&lt;br /&gt;&amp;gt; &lt;span style=&quot;color: #0c343d;&quot;&gt;db.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #0c343d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;nuevaColeccion&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;.find()&lt;/span&gt;&lt;br /&gt;{ &quot;_id&quot; : ObjectId(&quot;4f99e77c00745aa18f47cb08&quot;), &quot;nombre&quot; : &quot;oswaldo&quot; }&lt;br /&gt;{ &quot;_id&quot; : ObjectId(&quot;4f99e77e00745aa18f47cb09&quot;), &quot;edad&quot; : 30 }&lt;br /&gt;&amp;gt; &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cada vez que se inserta un documento en la colleccion, se crea un identificador del objeto &quot;_id&quot; que es diferente para cada documento, funciona como una llave primaria.&lt;br /&gt;
&lt;br /&gt;
También es de observar que los &#39;;&#39; son para terminar una instrucción, pero si solo es una por línea, no son necesarios.&amp;nbsp; Otro conveniente es que podemos usar ciclos y operaciones matemáticas como el que sigue:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;gt; &lt;span style=&quot;color: #0c343d;&quot;&gt;for (var i = 0; i &amp;lt;= 5; i++) db.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #0c343d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;nuevaColeccion&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;.save({x: i*i, y: i+i});&lt;/span&gt;&lt;br /&gt;&amp;gt; &lt;span style=&quot;color: #0c343d;&quot;&gt;db.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #0c343d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;nuevaColeccion&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;.find()&lt;/span&gt;&lt;br /&gt;{ &quot;_id&quot; : ObjectId(&quot;4f99e77c00745aa18f47cb08&quot;), &quot;nombre&quot; : &quot;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;roberto&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&quot; }&lt;br /&gt;{ &quot;_id&quot; : ObjectId(&quot;4f99e77e00745aa18f47cb09&quot;), &quot;edad&quot; : 30 }&lt;br /&gt;{ &quot;_id&quot; : ObjectId(&quot;4f99e96600745aa18f47cb0a&quot;), &quot;x&quot; : 0, &quot;y&quot; : 0 }&lt;br /&gt;{ &quot;_id&quot; : ObjectId(&quot;4f99e96600745aa18f47cb0b&quot;), &quot;x&quot; : 1, &quot;y&quot; : 2 }&lt;br /&gt;{ &quot;_id&quot; : ObjectId(&quot;4f99e96600745aa18f47cb0c&quot;), &quot;x&quot; : 4, &quot;y&quot; : 4 }&lt;br /&gt;{ &quot;_id&quot; : ObjectId(&quot;4f99e96600745aa18f47cb0d&quot;), &quot;x&quot; : 9, &quot;y&quot; : 6 }&lt;br /&gt;{ &quot;_id&quot; : ObjectId(&quot;4f99e96600745aa18f47cb0e&quot;), &quot;x&quot; : 16, &quot;y&quot; : 8 }&lt;br /&gt;{ &quot;_id&quot; : ObjectId(&quot;4f99e96600745aa18f47cb0f&quot;), &quot;x&quot; : 25, &quot;y&quot; : 10 }&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
El comando find() devuelve un objeto cursor, pero esta limitado a 20 resultados por pagina, si tuvieramos más de 20 documentos y quisieramos ver la siguiente página de resultados, deberíamos ejecutar &quot;it&quot; para que el shell itere automáticamente sobre el cursor&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;gt; &lt;span style=&quot;color: #0c343d;&quot;&gt;it&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
Podemos jugar un poco con un cursor mediante metodos &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;hasNext()&lt;/span&gt;&lt;/span&gt; o &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;forEach()&lt;/span&gt;&lt;/span&gt;, e imprimimos con el método printjson().&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;gt; &lt;span style=&quot;color: #0c343d;&quot;&gt;var cursor = db.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #0c343d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;nuevaColeccion&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;.find();&lt;/span&gt;&lt;br /&gt;&amp;gt; &lt;span style=&quot;color: #0c343d;&quot;&gt;while (cursor.hasNext()) printjson(cursor.next())&lt;/span&gt;&lt;br /&gt;{ &quot;_id&quot; : ObjectId(&quot;4f99e77c00745aa18f47cb08&quot;), &quot;nombre&quot; : &quot;roberto&quot; }&lt;br /&gt;{ &quot;_id&quot; : ObjectId(&quot;4f99e77e00745aa18f47cb09&quot;), &quot;edad&quot; : 30 }&lt;br /&gt;{ &quot;_id&quot; : ObjectId(&quot;4f99e96600745aa18f47cb0a&quot;), &quot;x&quot; : 0, &quot;y&quot; : 0 }&lt;br /&gt;{ &quot;_id&quot; : ObjectId(&quot;4f99e96600745aa18f47cb0b&quot;), &quot;x&quot; : 1, &quot;y&quot; : 2 }&lt;br /&gt;{ &quot;_id&quot; : ObjectId(&quot;4f99e96600745aa18f47cb0c&quot;), &quot;x&quot; : 4, &quot;y&quot; : 4 }&lt;br /&gt;{ &quot;_id&quot; : ObjectId(&quot;4f99e96600745aa18f47cb0d&quot;), &quot;x&quot; : 9, &quot;y&quot; : 6 }&lt;br /&gt;{ &quot;_id&quot; : ObjectId(&quot;4f99e96600745aa18f47cb0e&quot;), &quot;x&quot; : 16, &quot;y&quot; : 8 }&lt;br /&gt;{ &quot;_id&quot; : ObjectId(&quot;4f99e96600745aa18f47cb0f&quot;), &quot;x&quot; : 25, &quot;y&quot; : 10 }&lt;br /&gt;&amp;gt; &lt;br /&gt;&amp;gt; &lt;span style=&quot;color: #0c343d;&quot;&gt;db.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #0c343d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;nuevaColeccion&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;.find().forEach(printjson);&lt;/span&gt;&lt;br /&gt;{ &quot;_id&quot; : ObjectId(&quot;4f99e77c00745aa18f47cb08&quot;), &quot;nombre&quot; : &quot;roberto&quot; }&lt;br /&gt;{ &quot;_id&quot; : ObjectId(&quot;4f99e77e00745aa18f47cb09&quot;), &quot;edad&quot; : 30 }&lt;br /&gt;{ &quot;_id&quot; : ObjectId(&quot;4f99e96600745aa18f47cb0a&quot;), &quot;x&quot; : 0, &quot;y&quot; : 0 }&lt;br /&gt;{ &quot;_id&quot; : ObjectId(&quot;4f99e96600745aa18f47cb0b&quot;), &quot;x&quot; : 1, &quot;y&quot; : 2 }&lt;br /&gt;{ &quot;_id&quot; : ObjectId(&quot;4f99e96600745aa18f47cb0c&quot;), &quot;x&quot; : 4, &quot;y&quot; : 4 }&lt;br /&gt;{ &quot;_id&quot; : ObjectId(&quot;4f99e96600745aa18f47cb0d&quot;), &quot;x&quot; : 9, &quot;y&quot; : 6 }&lt;br /&gt;{ &quot;_id&quot; : ObjectId(&quot;4f99e96600745aa18f47cb0e&quot;), &quot;x&quot; : 16, &quot;y&quot; : 8 }&lt;br /&gt;{ &quot;_id&quot; : ObjectId(&quot;4f99e96600745aa18f47cb0f&quot;), &quot;x&quot; : 25, &quot;y&quot; : 10 }&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;gt; &lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;gt; &lt;span style=&quot;color: #0c343d;&quot;&gt;var cursor = db.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #0c343d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;nuevaColeccion&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;.find();&lt;/span&gt;&lt;br /&gt;&amp;gt; &lt;span style=&quot;color: #0c343d;&quot;&gt;printjson(cursor[1])&lt;/span&gt;&lt;br /&gt;{ &quot;_id&quot; : ObjectId(&quot;4f99e77e00745aa18f47cb09&quot;), &quot;edad&quot; : 30 }&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;
&lt;br /&gt;
&lt;br /&gt;
Los resultados del cursor se almacenan en memoria, por lo que hay que tener cuidado con resultados con muchos documentos.&lt;br /&gt;
&lt;br /&gt;
Por último, para el propósito de introducción de esta entrada, podemos convertirlo en un verdadero arreglo como sigue: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;gt; &lt;span style=&quot;color: #0c343d;&quot;&gt;var arreglo = db.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #0c343d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;nuevaColeccion&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;.find().toArray();&lt;/span&gt;&lt;br /&gt;
&amp;gt; &lt;span style=&quot;color: #0c343d;&quot;&gt;printjson(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;arreglo&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;[1])&lt;/span&gt;&lt;br /&gt;
{ &quot;_id&quot; : ObjectId(&quot;4f99e77e00745aa18f47cb09&quot;), &quot;edad&quot; : 30 }&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Para salir:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;gt; &lt;span style=&quot;color: #0c343d;&quot;&gt;exit&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Fuentes: &lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.mongodb.org/&quot;&gt;www.mongodb.org&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://api.mongodb.org/js/&quot; target=&quot;_blank&quot;&gt;Api para js&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.mongodb.org/display/DOCS/SQL+to+Mongo+Mapping+Chart&quot; target=&quot;_blank&quot;&gt;Mapeo SQL - MongoDB&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://edgytech.com/jmongobrowser/&quot; target=&quot;_blank&quot;&gt;Cliente Grafico JMongoBrowser&lt;/a&gt; (linux/windows/mac)&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.mongodb.org/display/DOCS/Comparing+Mongo+DB+and+Couch+DB&quot; target=&quot;_blank&quot;&gt;MongoDB&amp;nbsp; vs CouchDB&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><link rel='replies' type='application/atom+xml' href='http://micro-howto.blogspot.com/feeds/5548657370815161706/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://micro-howto.blogspot.com/2012/04/introduccion-mongodb.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/5548657370815161706'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/5548657370815161706'/><link rel='alternate' type='text/html' href='http://micro-howto.blogspot.com/2012/04/introduccion-mongodb.html' title='Introducción a MongoDB'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05477259225859568605</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total><georss:featurename>Pachuca 19, Condesa, Cuauhtémoc, 06140 Ciudad de México, DF, México</georss:featurename><georss:point>19.4185466 -99.1758458</georss:point><georss:box>19.4166746 -99.1783133 19.420418599999998 -99.17337830000001</georss:box></entry><entry><id>tag:blogger.com,1999:blog-8587897704769639737.post-6893128957383669088</id><published>2012-04-25T17:04:00.001-07:00</published><updated>2013-09-19T09:39:08.699-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="datos"/><category scheme="http://www.blogger.com/atom/ns#" term="servidores"/><category scheme="http://www.blogger.com/atom/ns#" term="sql"/><title type='text'>Introducción a PostgreSQL</title><content type='html'>Hace un par de días me tuve que meter con PostgreSQL (&lt;b style=&quot;background-color: white; color: #666666; font-family: verdana, sans-serif; font-size: 10px; text-align: left;&quot;&gt;versión 9.1.3&lt;/b&gt;) a manera de conocerlo un poquito ya que no sabía nada y me encontré con algunos detalles.&lt;br /&gt;
&lt;br /&gt;
Para su &lt;b&gt;instalación en Linux Mint o Ubuntu&lt;/b&gt;&amp;nbsp;debemos hacer lo siguiente.&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style=&quot;color: #073763;&quot;&gt;sudo apt-get install postgresql libpq-dev&lt;/span&gt; &lt;i&gt;(instala el motor y un usuario postgress con todos los privilegios para operar sobre el servidor)&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #073763;&quot;&gt;sudo su postgress&lt;/span&gt; &lt;i&gt;(esto te permite abrir una sesion con el nuevo usuario postgress)&lt;/i&gt;&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style=&quot;color: #073763;&quot;&gt;createuser -d -s -P usuario&lt;/span&gt; &lt;i&gt;, creamos un usuario donde:&lt;/i&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;&lt;i&gt;-d es para darle permisos de creación de base de datos&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;-s es para darle permisos de superusuario&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;-P para poderle indicar un password al usuario&lt;/i&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;span style=&quot;color: #073763;&quot;&gt;exit&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;li&gt;&lt;span style=&quot;color: #073763;&quot;&gt;sudo apt-get install pgadmin3&lt;/span&gt;&lt;i&gt;&amp;nbsp;- para instalar el &lt;a href=&quot;http://www.google.com/url?q=http://www.pgadmin.org/&amp;amp;sa=U&amp;amp;ei=R4yYT_23Does9ATBz5DtBQ&amp;amp;ved=0CAUQFjAA&amp;amp;client=internal-uds-cse&amp;amp;usg=AFQjCNGCZ_mJ7OhfCAG6iMQNgB4J09Dz0A&quot; target=&quot;_blank&quot;&gt;cliente gráfico&lt;/a&gt; (opcional)&lt;/i&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;Detalles de interés&lt;/b&gt; que se podrán observar en las instrucciones de ejemplo que copio mas adelante:&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;La diferencia contra otros manejadores de Base de Datos es que se puede hacer herencia entre tablas.&lt;/li&gt;
&lt;li&gt;Cuando se heredan las tablas, las llaves primarias se tienen que redefinir dado que estas no se heredan.&lt;/li&gt;
&lt;li&gt;Cuando se borran las tablas, los índices también se eliminan de forma automática.&lt;/li&gt;
&lt;li&gt;Cuando se hacen muchas operaciones de creación/borrado en la base de datos, es necesario darle mantenimiento (&lt;i&gt;opción vacuum en el pgadmin3&lt;/i&gt;).&lt;/li&gt;
&lt;li&gt;La sintaxis para las fechas siempre es:&amp;nbsp;&lt;i&gt;YYYY-MM-DD&lt;/i&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
Vamos a los ejemplos ahora sí:&lt;/div&gt;
&lt;pre class=&quot;brush:sql;&quot;&gt;﻿-- Eliminamos la vista
DROP VIEW if exists dime_sus_tutores, dime_personas_sin_cel;

-- Eliminamos indices primero (aunque cuando se borran las tablas estos ya se eliminan)
DROP INDEX if exists idx_clave_escolar;

-- Eliminamos las tablas
drop table if exists
 tutores, personas, alumnos, tutores_alumnos;
 
-- Tabla personas PADRE
create table personas (
 id integer PRIMARY KEY,
 nombres varchar(75) not null,
 genero varchar(1),
 fecha_nacimiento date,
 lugar_nacimiento varchar(150),
 curp varchar(18) unique,
 tel varchar(20),
 cel varchar(20),
 email varchar(50),
 cuando date default current_date
);

-- Tabla hija de personas
create table tutores(
 id integer primary key,
 ocupacion varchar(100)
) inherits (personas);

-- Tutores
insert into tutores (id, nombres, genero, fecha_nacimiento, lugar_nacimiento, cel, ocupacion) values
 (1, &#39;Ricardo Rogers&#39;, &#39;m&#39;, &#39;1970-01-10&#39;, &#39;Ciudad de México&#39;, &#39;0445554374879&#39;, &#39;Musico&#39;),
 (2, &#39;Guillermo Garcia&#39;, &#39;m&#39;, &#39;1971-04-12&#39;, &#39;Tlaxcala&#39;, &#39;044 55 94637383&#39;, &#39;Contador&#39;),
 (3, &#39;Pita Perez&#39;, &#39;f&#39;, &#39;1964-05-22&#39;, &#39;Ciudad de México&#39;, null, &#39;Ama de casa&#39;);

-- Tabla hija de personas
create table alumnos (
 id integer primary key,
 clave_escolar varchar(25),
 fecha_ingreso date,
 carrera varchar(50)
) inherits (personas);

-- Creacion de un indice
create unique index idx_clave_escolar on alumnos(clave_escolar);

insert into alumnos
 (id, nombres, genero, fecha_nacimiento, lugar_nacimiento, cel, clave_escolar, fecha_ingreso, carrera) values
 (4, &#39;Leonora Rogers Mendoza&#39;, &#39;f&#39;, &#39;1994-01-10&#39;, &#39;Ciudad de México&#39;, &#39;044 55 12345678&#39;, &#39;a100-101&#39;, &#39;2011-08-14&#39;, &#39;informatica&#39;),
 (5, &#39;Maximiliano Hotel&#39;, &#39;m&#39;, &#39;1993-04-12&#39;, &#39;Tlaxcala&#39;, &#39;044 55 87654321&#39;, &#39;b200-202&#39;, &#39;2011-07-13&#39;, &#39;contaduría&#39;),
 (6, &#39;Lupita Gómez Pérez&#39;, &#39;f&#39;, &#39;1993-02-22&#39;, &#39;Ciudad de México&#39;, null, &#39;c300-303&#39;, &#39;2011-06-12&#39;, &#39;contaduría&#39;),
 (7, &#39;Arturo Gómez Pérez&#39;, &#39;m&#39;, &#39;1994-05-22&#39;, &#39;Ciudad de México&#39;, null, &#39;d400-404&#39;, &#39;2011-05-11&#39;, &#39;administración&#39;)
 ;

-- Tabla que relaciona personas y tutores
create table tutores_alumnos (
 id_tutor integer REFERENCES tutores(id),
 id_alumno integer references alumnos(id),
 primary key (id_tutor, id_alumno)
);

-- relaciones
insert into tutores_alumnos values (1,4),(2,5),(3,6),(3,7);


-- una vista
create view dime_sus_tutores as
 select a.nombres as Alumno, a.clave_escolar as Clave, t.nombres as Tutor, t.cel
 from tutores_alumnos ta
 left join alumnos a on ta.id_alumno = a.id
 right join tutores t on ta.id_tutor = t.id
 order by a.nombres
;

-- otra vista
create view dime_personas_sin_cel as
 select p.id, p.nombres, p.tableoid, c.relname
 from personas p, pg_class c
 where cel is null
 and p.tableoid = c.oid
;
&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Fuentes: &amp;nbsp; &amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://www.twitter.com/mromtz&quot; target=&quot;_blank&quot;&gt;@mromtz&lt;/a&gt; - Mario Martinez -- Taller de PostgreSQL --&lt;/li&gt;
&lt;li&gt;2 módulos de un &lt;a href=&quot;http://www.efaber.net/formacion/fp/curso_acs/index.html#sql&quot; target=&quot;_blank&quot;&gt;curso en línea&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.thegeekstuff.com/2009/04/15-practical-postgresql-database-adminstration-commands/&quot;&gt;Comandos de administracion&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.postgresql.org/&quot;&gt;www.postgresql.org&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://micro-howto.blogspot.com/feeds/6893128957383669088/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://micro-howto.blogspot.com/2012/04/introduccion-postgresql.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/6893128957383669088'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/6893128957383669088'/><link rel='alternate' type='text/html' href='http://micro-howto.blogspot.com/2012/04/introduccion-postgresql.html' title='Introducción a PostgreSQL'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05477259225859568605</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total><georss:featurename>Pachuca 19, Condesa, Cuauhtémoc, Ciudad de México, DF, México</georss:featurename><georss:point>19.4185466 -99.1758458</georss:point><georss:box>19.4166746 -99.1783133 19.420418599999998 -99.17337830000001</georss:box></entry><entry><id>tag:blogger.com,1999:blog-8587897704769639737.post-1513658033754174132</id><published>2012-03-06T20:04:00.002-08:00</published><updated>2012-03-06T20:04:58.438-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="jasper"/><title type='text'>Usando una conexión a base de datos distinta en un subreporte de JasperReports</title><content type='html'>&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Al incluir un subreporte en JasperReports por default éste utiliza la misma conexión a base de datos que el reporte maestro que contiene el subreporte.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Sin embargo, a veces es deseable que el subreporte se conecte a una base de datos diferente.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Una manera de lograrlo es la siguiente:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Incluir el subreporte como cualquier otro&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Agregar un parametro, que en este ejemplo llamaré &lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SUBREPORT_CONNECTION&lt;/span&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;, con&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Parameter Class = java.sql.Connection&lt;/span&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt; , no usar prompt,&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Default value expression = java.sql.DriverManager.getConnection(&quot;jdbc:mysql://localhost:3306/base_de_datos&quot;, &quot;usuario&quot;, &quot;password&quot;)&lt;/span&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;[Obviamente, editar la url para que coincida con el motor de BD usado, nombre de base, puerto, host y demas datos]&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;En las propiedades del subreporte,&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Connection type = Use a connection expression&lt;/span&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Connection expression = $P{SUBREPORT_CONNECTION}&lt;/span&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;(o como sea que se le haya nombrado al parámetro del inciso anterior)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Si al intentar generar el reporte, aparece un error del tipo &quot;&lt;/span&gt;&lt;span style=&quot;background-color: white; line-height: 19px; text-align: left;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;No&amp;nbsp;suitable&amp;nbsp;driver&amp;nbsp;found&amp;nbsp;for&amp;nbsp;jdbc:mysql://localhost:3306/base_de_datos&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&quot;, puede funcionar agregar un parametro mas, que se cargue antes del de &lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SUBREPORT_CONNECTION&lt;/span&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt; (en iReport se pueden acomodar el orden de los parámetros y ese es el orden de carga también), que no use prompt, que&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Parameter Class = java.lang.Class&lt;/span&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;y con&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Default value expression = Class.forName(&quot;com.mysql.jdbc.Driver&quot;).getName()&lt;/span&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;[O como sea que se llame la clase Driver del manejador de BD utilizado...]&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Por último, si aún con esto surge una excepción &lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;ClassNotFoundException&lt;/span&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt; para, en este ejemplo, &lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;com.mysql.jdbc.Driver&lt;/span&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;, se puede copiar el jar al subdirectorio &lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;jre/lib/ext&lt;/span&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt; de donde se encuentre instalada la máquina virtual que use JasperReports para compilar los reportes.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://micro-howto.blogspot.com/feeds/1513658033754174132/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://micro-howto.blogspot.com/2012/03/usando-una-conexion-base-de-datos.html#comment-form' title='1 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/1513658033754174132'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/1513658033754174132'/><link rel='alternate' type='text/html' href='http://micro-howto.blogspot.com/2012/03/usando-una-conexion-base-de-datos.html' title='Usando una conexión a base de datos distinta en un subreporte de JasperReports'/><author><name>Javier Novoa C. (Stitch)</name><uri>http://www.blogger.com/profile/13132360799518616672</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_Hp7QjnMlZmKlVQDHZsaIQ9YnmWC4sel26ibs9FHig1ffPukjGQKgnGf4o6JV5MJYRfqEo5UmWmd3VQj0ZkCTBv1muBIu3QTs5jCkZ2_DD7GPa_x32zdIT0oFvFRLmrU/s220/55857695_2385261704837842_7917967493749014528_n.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8587897704769639737.post-4981502972725213099</id><published>2012-03-03T19:01:00.003-08:00</published><updated>2012-03-03T19:02:28.258-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="framework"/><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="symfony"/><title type='text'>Usando una base de datos SQLite en un proyecto de Symfony2</title><content type='html'>&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Para configurar una base de datos en un proyecto de Symfony2, se edita el archivo app/config/parameters.ini:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;[parameters]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; database_driver &amp;nbsp; = pdo_sqlite&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; database_host &amp;nbsp; &amp;nbsp; = localhost&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; database_port &amp;nbsp; &amp;nbsp; =&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; database_name &amp;nbsp; &amp;nbsp; = test_project.db&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; database_user &amp;nbsp; &amp;nbsp; = root&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; database_password =&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Sin embargo, con esta configuración, que es la default para usar cualquier otro motor de base de datos con Doctrine2 (incluido en cualquier instalación estándar de Symfony2), una base de datos SQLite no funciona.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Lo correcto es, primero, editar y agregar una línea en app/config/config.yml:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;doctrine:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; dbal:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; driver: &amp;nbsp; %database_driver%&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; host: &amp;nbsp; &amp;nbsp; %database_host%&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; port: &amp;nbsp; &amp;nbsp; %database_port%&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dbname: &amp;nbsp; %database_name%&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; user: &amp;nbsp; &amp;nbsp; %database_user%&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; password: %database_password%&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: yellow;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; path: &amp;nbsp; &amp;nbsp; %database_path%&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; charset: &amp;nbsp;UTF8&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
Esta línea no se encuentra originalmente en el archivo, se agrega para que Doctrine utilice el parámetro &#39;database_path&#39;, que ahora se agrega a parameters.ini:&lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;[parameters]&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; database_driver &amp;nbsp; = pdo_sqlite&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; database_host &amp;nbsp; &amp;nbsp; = localhost&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; database_port &amp;nbsp; &amp;nbsp; =&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; database_name &amp;nbsp; &amp;nbsp; = test_project.db&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; database_user &amp;nbsp; &amp;nbsp; =&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; database_password =&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;background-color: yellow;&quot;&gt;database_path &amp;nbsp; &amp;nbsp; = /path_to_my_project/app/db/test_project.db&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Y con eso, la base de datos queda creada en el path establecido. Notar que para servidores Unix (Linux por ejemplo), este archivo debe quedar con permisos de lectura/escritura por parte del usuario que utilice el servidor web (cualquiera que este sea, http, www-data o lo que sea): Y el directorio donde reside el archivo tambien debe tener permisos de lectura, escritura y ejecución para este mismo usuario (en este caso, el subdirectorio db que yo puse aquí dentro de app/, pero en realidad podría residir donde más nos convenga).&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://micro-howto.blogspot.com/feeds/4981502972725213099/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://micro-howto.blogspot.com/2012/03/usando-una-base-de-datos-sqlite-en-un.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/4981502972725213099'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/4981502972725213099'/><link rel='alternate' type='text/html' href='http://micro-howto.blogspot.com/2012/03/usando-una-base-de-datos-sqlite-en-un.html' title='Usando una base de datos SQLite en un proyecto de Symfony2'/><author><name>Javier Novoa C. (Stitch)</name><uri>http://www.blogger.com/profile/13132360799518616672</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_Hp7QjnMlZmKlVQDHZsaIQ9YnmWC4sel26ibs9FHig1ffPukjGQKgnGf4o6JV5MJYRfqEo5UmWmd3VQj0ZkCTBv1muBIu3QTs5jCkZ2_DD7GPa_x32zdIT0oFvFRLmrU/s220/55857695_2385261704837842_7917967493749014528_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8587897704769639737.post-6281377440402179340</id><published>2011-01-31T12:44:00.000-08:00</published><updated>2011-01-31T12:48:31.105-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="anotacion"/><category scheme="http://www.blogger.com/atom/ns#" term="autowiring"/><category scheme="http://www.blogger.com/atom/ns#" term="framework"/><category scheme="http://www.blogger.com/atom/ns#" term="spring"/><title type='text'>Autowiring basado en anotaciones con Spring Framework</title><content type='html'>Autowiring se un método que tiene Spring Framework para inyectar de forma automática las dependencias entre clases (servicios, daos, controllers, etc). &lt;br /&gt;
Para cada DAO, agrega una anotación de nivel clase &lt;b&gt;@Repository&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
Estas anotaciones van en la clase de implementación y no en la intefaz.&lt;br /&gt;
import org.sringframework.stereotype.Repository;&lt;br /&gt;
&lt;pre class=&quot;brush:java;&quot;&gt;@Repository(&quot;parametroDao&quot;)
public class ParametroDaoImpl implements ParametroDao {
&amp;nbsp;&amp;nbsp;&amp;nbsp; // ...
}
&lt;/pre&gt;Para cada componente Servicio, agrega una anotacion de nivel clase &lt;b&gt;@Service&lt;/b&gt;.&lt;br /&gt;
import org.springframework.stereotype.Service;&lt;br /&gt;
&lt;pre class=&quot;brush:java;&quot;&gt;@Service(&quot;parametroService&quot;)
public class ParametroServiceImpl implements ParametroService {
&amp;nbsp;&amp;nbsp;&amp;nbsp; // ...
}
&lt;/pre&gt;Para cada controller en Spring MVC, agrega una anotacion de nivel clase &lt;b&gt;@Controller&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
No te preocupes de proveer el nombre, no se necesita.&lt;br /&gt;
import org.springframework.stereotype.Controller;&lt;br /&gt;
&lt;pre class=&quot;brush:java;&quot;&gt;@Controller
public class ParametroServiceImpl implements ParametroController {
&amp;nbsp;&amp;nbsp;&amp;nbsp; // ...
}
&lt;/pre&gt;Hasta ahora no se ha cambiado nada a la aplicación, se pueden seguir teniendo los nombres de beans usados en la configuración manual, pero es recomendable compilar y construir el proyecto para revisar que no se haya afectado algo.&lt;br /&gt;
&lt;br /&gt;
Una vez hecho lo anterior, hay que decirle a Spring dos cosas: dónde encontrar los nombres para nuestros beans y que estrategia usar para el autowiring.&lt;br /&gt;
&lt;br /&gt;
Para definir donde encontrar los nombres de beans debemos usar el tag &amp;lt;context:component-scan&amp;gt; en el archivo de configuración del contexto de Spring.&amp;nbsp; Se debe declarar el namespace y schema location:&lt;br /&gt;
&lt;pre class=&quot;brush:xml;&quot;&gt;&amp;lt;beans xmlns=&quot;&lt;a href=&quot;http://www.springframework.org/schema/beans&quot;&gt;http://www.springframework.org/schema/beans&lt;/a&gt;&quot;
&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:xsi=&quot;&lt;a href=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&gt;http://www.w3.org/2001/XMLSchema-instance&lt;/a&gt;&quot;
&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:context=&quot;&lt;a href=&quot;http://www.springframework.org/schema/context&quot;&gt;http://www.springframework.org/schema/context&lt;/a&gt;&quot;
&amp;nbsp;&amp;nbsp;&amp;nbsp; xsi:schemaLocation=&quot;&lt;a href=&quot;http://www.springframework.org/schema/aop&quot;&gt;http://www.springframework.org/schema/aop&lt;/a&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;a href=&quot;http://www.springframework.org/schema/aop/spring-aop-3.0.xsd&quot;&gt;http://www.springframework.org/schema/aop/spring-aop-3.0.xsd&lt;/a&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;a href=&quot;http://www.springframework.org/schema/beans&quot;&gt;http://www.springframework.org/schema/beans&lt;/a&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;a href=&quot;http://www.springframework.org/schema/beans/spring-beans-3.0.xsd&quot;&gt;http://www.springframework.org/schema/beans/spring-beans-3.0.xsd&lt;/a&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;a href=&quot;http://www.springframework.org/schema/context&quot;&gt;http://www.springframework.org/schema/context&lt;/a&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;a href=&quot;http://www.springframework.org/schema/context/spring-context-3.0.xsd&quot;&gt;http://www.springframework.org/schema/context/spring-context-3.0.xsd&lt;/a&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;a href=&quot;http://www.springframework.org/schema/jee&quot;&gt;http://www.springframework.org/schema/jee&lt;/a&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;a href=&quot;http://www.springframework.org/schema/jee/spring-jee-3.0.xsd&quot;&gt;http://www.springframework.org/schema/jee/spring-jee-3.0.xsd&lt;/a&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;a href=&quot;http://www.springframework.org/schema/tx&quot;&gt;http://www.springframework.org/schema/tx&lt;/a&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;a href=&quot;http://www.springframework.org/schema/tx/spring-tx-3.0.xsd&quot;&gt;http://www.springframework.org/schema/tx/spring-tx-3.0.xsd&lt;/a&gt;&quot;&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;context:component-scan base-package=&quot;x.y.dao&quot;&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;context:include-filter type=&quot;annotation&quot;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; expression=&quot;org.springframework.stereotype.Repository&quot;/&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/context:component-scan&amp;gt;
&amp;lt;/beans&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
Las piezas importantes del xml anterior son &lt;span style=&quot;background-color: #ffff99;&quot;&gt;xmlns:context&lt;/span&gt;, &lt;span style=&quot;background-color: #ffff99;&quot;&gt;xsi_schemaLocation&lt;/span&gt; y &lt;span style=&quot;background-color: #ffff99;&quot;&gt;&amp;lt;context:component-scan&amp;gt;&lt;/span&gt;.&amp;nbsp; Se le está diciendo a Spring que haga un escaneo (búsqueda) de componentes que tengan la aotación @Repository sobre el paquete x.y.dao y si a la anotacion usada se le coloca un valor textual, como en en nuestros casos anteriores del @Repository y el @Service, ése será el nombre a utlilizar como bean para el autowiring&lt;br /&gt;
&lt;br /&gt;
Con la anotacion @Autowired aplicada a los atributos de las clases, se pueden evitar tener setters de dicho atributo, pero si tienes clases unitarias, necesitaríamos setter para inyectar mocks u otras implementaciones.&lt;br /&gt;
&lt;br /&gt;
La convención es utilizar, como nombres de las propiedades que se pretende auto-inyectar, los mismos nombre del componente, lo cual nos permite eliminar los componentes Dao, Service y Controller del archivo de configuracion del contexto de Spring (xml) dado que la configuración ya se está dando en la misma clasa, mediante las anotaciones.&lt;br /&gt;
&lt;br /&gt;
No obstante, sigue siendo recomendable configurar dentro del XML los objetos DataSource (la configuración del orígen de datos, es decir, la Base de Datos), SessionFactory (Hibernate o algún otro ORM) y TransactioManager (Para el control de las transacciones).</content><link rel='replies' type='application/atom+xml' href='http://micro-howto.blogspot.com/feeds/6281377440402179340/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://micro-howto.blogspot.com/2011/01/autowiring-basado-en-anotaciones-con.html#comment-form' title='4 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/6281377440402179340'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/6281377440402179340'/><link rel='alternate' type='text/html' href='http://micro-howto.blogspot.com/2011/01/autowiring-basado-en-anotaciones-con.html' title='Autowiring basado en anotaciones con Spring Framework'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05477259225859568605</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8587897704769639737.post-1943133448482837756</id><published>2011-01-04T09:49:00.000-08:00</published><updated>2014-01-05T09:35:27.556-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="book"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="pdf"/><category scheme="http://www.blogger.com/atom/ns#" term="unix"/><title type='text'>Updated: Referencia del entorno de programación en Unix</title><content type='html'>Resulta que recomendando un libro sobre programación en Unix, me encontré con :&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;a href=&quot;https://encrypted.google.com/books?id=TXI2QQAACAAJ&quot;&gt;El entorno de programación UNIX&lt;/a&gt;&amp;nbsp;(&lt;a href=&quot;http://www.amazon.com/Unix-Entorno-Programacion-Spanish-Edition/dp/9688800678&quot;&gt;o en amazon&lt;/a&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;Kernighan, Brian W.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;Pike, Rob&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;Editorial Pearson&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Anteriormente lo vi en mediafire pero ya no esta y yo no lo tengo lamentablemente pero si les es posible comprarlo, se los recomiendo ampliamente.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Otra referencia de Fernando Bellas Permuy esta en &lt;a href=&quot;http://www.tic.udc.es/~fbellas/&quot;&gt;PDF&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
</content><link rel='replies' type='application/atom+xml' href='http://micro-howto.blogspot.com/feeds/1943133448482837756/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://micro-howto.blogspot.com/2011/01/referencia-del-entorno-de-programacion.html#comment-form' title='2 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/1943133448482837756'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/1943133448482837756'/><link rel='alternate' type='text/html' href='http://micro-howto.blogspot.com/2011/01/referencia-del-entorno-de-programacion.html' title='Updated: Referencia del entorno de programación en Unix'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05477259225859568605</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8587897704769639737.post-4153547164214150165</id><published>2011-01-04T08:44:00.000-08:00</published><updated>2011-01-04T08:45:38.507-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="comando"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="programacion"/><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><category scheme="http://www.blogger.com/atom/ns#" term="sed"/><category scheme="http://www.blogger.com/atom/ns#" term="shell"/><title type='text'>Manual de introducción al comando sed</title><content type='html'>&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Se trata de un editor de cadenas, que deriva directamente del comando ed, por lo cual es fácil de aprender, una vez conocido el propio comando ed.&amp;nbsp; Un editor de cadenas es usado para realizar transformaciones de texto básicas de una cadena de entrada (un archivo o la salida de un pipe). A diferencia de otros editores comunes, sed hace solo una revisión sobre cada entrada, por lo cual es mas eficiente, en especial lo es, cuando filtra texto que pasa por una unión pipe.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Cuando sed filtra un archivo, no altera su contenido, todos los cambios los realiza sobre la salida que imprime. Sed despliega cada renglón automáticamente y por ello &lt;b&gt;p&lt;/b&gt; no se necesita después del comando de sustitución (&lt;b&gt;s&lt;/b&gt;, por ejemplo &lt;b&gt;s/old/new/&lt;/b&gt;). Las comillas son indispensables pues existen metacaracters de sed que tienen significado especial para el shell sobre el cual se ejecuta.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;El comando sed tiene una limitación que no se encuentra en ed: no maneja números relativos de renglón. En particular, + y - no son entendidos como expresiones para indicar números de renglón, por lo cual resulta imposible de retroceder a uno o mas renglones anteriores o hacer direccionamientos relativos hacia adelante. Esto se debe a que una vez leído un renglón, el anterior se pierde para siempre; no hay manera de identificar el penúltimo renglón.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;En la lista de comandos puede existir cualquiera de los listados más adelante. Cuando se hace uso de uno solo, basta con encerrarlo entre comillas simples como sigue:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;sed &#39;s/old/new/&#39; archivo&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Pero en el caso de que necesitemos ejecutar varios comandos sobre un mismo archivo, es necesario que estos se encuentren en diferentes lineas, por ejemplo:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;sed &#39;s/^/ /&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;3q&#39; archivo&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;No hay que olvidar que antes de escribir el primer comando, se deben abrir las comillas simples y las mismas se deben cerrar después de teclear el último comando. También es posible almacenar los comandos dentro de un archivo y llamarlo a la hora de que se ejecute sed con el parámetro -f.&amp;nbsp; Por ejemplo:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;sed -f cmdarchivo archivo_texto&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Se pueden utilizar otros selectores o patrones antes de cada comando, por ejemplo:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;sed &#39;/patron/q&#39;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt; &lt;i&gt;Imprime cada linea de archivo hasta encontrar aquella que contenga el patron&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;sed &#39;/patron/d&#39;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt; &lt;i&gt;Cancela todas las lineas que contengan el patron y no se imprimen&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Incluso si se desea el resultado inverso a lo que realiza un comando, basta con agregar un &lt;b&gt;&#39;!&#39;&lt;/b&gt; antes&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;del comando. Por ejemplo, para los dos ejemplos anteriores se prosigue como sigue:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;sed &#39;/patron/!q&#39;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt; &lt;i&gt;No imprime c/línea de archivo hasta encontrar aquella que contenga el patron&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;sed &#39;/patron/!d&#39;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt; &lt;i&gt;No cancela todas las lineas que contengan el patron y no se imprimen&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Sintaxis&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;La sintaxis de sed es la siguiente&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;sed&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt; [-n] [-V] [--quiet] [--silent] [--version] [--help]&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;[-e script] [--expression=script]&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;[-f script-file] [--file=script-file]&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;[script-if-no-other-script]&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;[file...]&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;-----------------------------------------------------------------------------------------------&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;-V ó --version&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Imprime la versiòn de sed y nota de copyright.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;-h ó --help&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Imprime un resumen de todas las opciones de sed.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;-n ó --quiet ó --silent&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Por defecto, sed imprime cada linea cuando termina de editarla. Esta opciòn deshabilita la impresiòn automàtica y no se produce ninguna salida, excepto que se incluya el comando p.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;-e script ó --expression=script&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Agrega los comandos de la cadena script, encerrada entre comillas simples, a la lista de comandos para ser ejecutados mientras se procesa la entrada. &lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;-f script-file ó --file=script-file&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Agrega los comandos contenidos en el archivo script para ser procesados sobre la entrada.&amp;nbsp; Si ninguno de los dos parámetros anteriores es utilizado, en cualquiera de sus formas, sed tomará como comandos la primer expresión que no sea opción de sed como argumento para ejecutar como si fuera script.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Comandos ================================================&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;A continuación se presenta una lista de comandos que se pueden utilizar para filtrar una entrada con sed, así mismo se incluyen algunos ejemplos para una mayor comprensión.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&amp;nbsp;** Sustitución **&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Su función es sustituir una cadena old por una nueva new en cada linea que procese. Su sintaxis&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;es la siguiente:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;s/old/new/&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Ejemplo:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;sed &#39;s/casa/carro/&#39;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;b&gt; contrato.txt&lt;/b&gt; &lt;i&gt;Sustituye la cadena &#39;casa&#39; por &#39;carro&#39; en contrato.txt&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;sed &#39;s/^/.-/&#39; arch.txt&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt; &lt;i&gt;Agrega la cadena &#39;.-&#39; al inicio de cada linea de arch.txt&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;sed &#39;s/^/\&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;/&#39; arch.txt&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt; &lt;i&gt;Agrega un salto de linea al final de cada linea de arch.txt&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Otro comando que puede ser útil es y, el cual remplaza cada caracter procedente de old con el caracter correspondiente proveniente de new. Aqui no se admiten rangos. Su sintaxis es:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;y/old/new/&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&amp;nbsp;** Borrado **&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Su función es borrar a la salida, las lineas que correspondan al patrón escrito. Su sintaxis es la&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;siguiente:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;/patron/d&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Ejemplo:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;sed &#39;/calvo/d&#39; arch.txt&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt; &lt;i&gt;Elimina las lineas que contienen la cadena &#39;calvo&#39; en arch.txt&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;sed &#39;/amor/!d&#39; carta.txt&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt; &lt;i&gt;Elimina las lineas que no tengan la palabra amor en carta.txt&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;sed &#39;3d&#39; forma.txt&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt; &lt;i&gt;Elimina la linea 3 del archivo forma.txt&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&amp;nbsp;** Impresión **&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Su función es imprimir la salida de sed. En realidad, sed imprime automáticamente la entrada filtrada, entonces si se agrega el comando &lt;b&gt;p&lt;/b&gt;, cada linea de salida se imprimirá doble. En caso de que se agregue el parámetro -n a sed, pero se quiera imprimir la salida, se agrega el comando p. Su sintaxis es la siguiente:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;/patron/p&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Ejemplo:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;who | sed -n &#39;/root/p&#39;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt; &lt;i&gt;Imprime solamente las sesiones de root&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;who | sed &#39;/root/p&#39;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt; &lt;i&gt;Imprime dos veces cada sesion abierta de root&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;who | sed -n &#39;2p&#39;&lt;/span&gt;&lt;/b&gt;&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt; Imprime solamente la segunda sesion que se inició en el sistema&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&amp;nbsp;** Abandonar filtrado **&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Otro comando útil para imprimir una parte de la entrada es q. Este comando termina inmediatamente las operaciones de sed, en base a la correspondencia del patrón con las líneas que este procesando. Su sintaxis es la siguiente:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;/patron/q&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Ejemplo:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;sed &#39;3q&#39; forma.txt&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt; &lt;i&gt;Imprime hasta la linea 3 del archivo forma.txt&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;sed &#39;/clavo/q&#39; arch.txt&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt; &lt;i&gt;Imprime desde la línea 1 de arch.txt hasta encontrar aquella que contiene la palabra &#39;clavo&#39;.&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&amp;nbsp;** Inserción de texto **&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Este comando inserta o agrega texto a cada línea que procesa sed. El texto debe estar localizado&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;en las siguientes lineas que proceden después del caracter &#39;\&#39;. Su sintaxis es la siguiente:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;i \ y a\&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;[ texto a agregar ]&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Ejemplo:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;sed &#39;i \&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;.&#39; oraciones.txt&lt;/span&gt;&lt;/b&gt;&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt; Agrega un punto final a cada linea de oraciones.txt&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;sed &#39;a \&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&#39; doble.txt&lt;/span&gt;&lt;/b&gt;&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt; Agrega un salto de linea al final de cada linea de doble.txt&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&amp;nbsp;** Guardar la entrada filtrada en un archivo **&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Este comando permite salvar la entrada filtrada en otro archivo. Su sintaxis es la siguiente:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;/patron/w archivo&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Ejemplo:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;sed &#39;/pat/w patos.txt&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;/pat/!w otros.txt animales.txt&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Guarda las lineas que concuerden con &#39;pat&#39; en un archivo llamado patos.txt y los que no&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;concuerden en el archivo otros.txt&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;sed &#39;s/UNIX/UNIX(TM)/gw u.out&#39; libros.txt &amp;gt; salida.out&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Almacena toda la salida en el archivo salida.out, pero las líneas que fueron modificadas, se&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;almacenan en u.out&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Funciones =================================================&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&amp;nbsp;** Etiqueta **&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Permite identificar una etiqueta label, si se realiza un cambio en la línea actual. Esta es&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;especificada por &#39;:&#39; y seguida del nombre de la etiqueta. Su sintaxis es como sigue:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;: label&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&amp;nbsp;** Grupo **&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Indica un grupo de comandos, que inicia con un carácter &#39;{&#39; y termina con un &#39;}&#39;.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&amp;nbsp;** Lectura de archivos **&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Con el comando &lt;b&gt;r&lt;/b&gt;, lee un archivo y agrega todo su contenido al final de cada línea de entrada de&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;sed. Su sintaxis es:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;nr archivo&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;, donde n es el número de línea donde pegar el texto de archivo.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&amp;nbsp;** Listar línea **&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;El comando es &lt;b&gt;l&lt;/b&gt; y su función es hacer visibles todos los caracteres no imprimibles de cada línea de&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;entrada.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&amp;nbsp;** Linea actual **&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Se puede imprimir el número de la línea actual, si se agrega el comando &#39;=&#39;. Su sintaxis es:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;/patron/=&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&amp;nbsp;** Salto **&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Permite saltar o ir a la línea donde se encuentra una etiqueta label definida y continuar la ejecución&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;de sed desde ese comando. Su sintaxis es:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;b label&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Conclusión sobre los usos de sed. ==========================================&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;En realidad sed tiene bastante utilidad como la comprobación de condiciones, creación de ciclos y ramificaciones, retención de líneas precedentes y muchos de los comandos de ed. Su uso es&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;similar al que se ha descrito en este manual, comandos sencillos de edición y no tanto de&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;secuencias largas o complejas.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Sed es adecuado para manejar entradas arbitrariamente grandes de forma rápida, pero ofrece una&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;forma bastante reducida de memoria, puesto que al filtrar una siguiente línea, ya no recuerda la&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;anterior, por lo que no se puede regresar a filtrar la anterior y tampoco proporciona recursos para&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;manipular números. &lt;i&gt;&lt;u&gt;Solo es un editor de texto&lt;/u&gt;&lt;/i&gt;.&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://micro-howto.blogspot.com/feeds/4153547164214150165/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://micro-howto.blogspot.com/2011/01/manual-de-introduccion-al-comando-sed.html#comment-form' title='2 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/4153547164214150165'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/4153547164214150165'/><link rel='alternate' type='text/html' href='http://micro-howto.blogspot.com/2011/01/manual-de-introduccion-al-comando-sed.html' title='Manual de introducción al comando sed'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05477259225859568605</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8587897704769639737.post-4403195221680375226</id><published>2010-12-16T11:22:00.000-08:00</published><updated>2010-12-16T11:25:38.788-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="debugging"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>debugging remoto de scripts Python con winpdb</title><content type='html'>Usando el programa winpdb se pueden debuggear scripts en Python de manera mas intuitiva que con el clásico pdb.&lt;br /&gt;
&lt;br /&gt;
Una de las ventajas que tiene winpdb es la posibilidad de debuggear scripts que esten ejecutandose en remoto en algun servidor. De esta manera, se pueden debuggear no solo scripts en servidores de producción, por poner un ejemplo, sino también scripts que utilicen curses para manipular la pantalla.&lt;br /&gt;
&lt;br /&gt;
winpdb se basa en una arquitectura de cliente-servidor que comunica al servidor (el cual ejecuta el script a debuggear en sí) a través de sockets con el cliente (el cual ejecuta la interfaz del debugger).&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
winpdb cuenta con dos programas para poder hacer el debuggeo:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;rpdb2 - que es la interfaz de consola o modo texto, y que puede ser usada como servidor del debugger también.&lt;/li&gt;
&lt;li&gt;winpdb - que es la interfaz gráfica&lt;/li&gt;
&lt;/ul&gt;Para debuggear un script en remoto, hay que ejecutar lo siguiente en el servidor:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt; screen rpdb2 -s -d -r script.py&lt;/blockquote&gt;&lt;br /&gt;
El cual utiliza el programa &#39;screen&#39; para tener la salida del script python a debuggear en una pantalla dedicada.&lt;br /&gt;
&lt;br /&gt;
El parámetro -s se usa en conjunto con screen.&lt;br /&gt;
&lt;br /&gt;
El parámetro -d le indica a rpbd2 que se ejecute en modo servidor solamente, esperando a que algún cliente se conecte para poder hacer el debuggeo.&lt;br /&gt;
&lt;br /&gt;
El parámetro -r permite conexiones remotas.&lt;br /&gt;
&lt;br /&gt;
script.py es simplemente el path y nombre del script a debuggear.&lt;br /&gt;
&lt;br /&gt;
Al ejecutar esta línea, el programa rpdb2 solicitará un password que deberá introducir el cliente también, y con eso asegurar la comunicación entre el cliente y el servidor.&lt;br /&gt;
&lt;br /&gt;
Hecho esto, rpdb2 queda en espera de alguna conexión.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
En el lado del cliente, se puede ejecutar rpdb2 para debuggear con la consola, o si se prefiere winpdb para hacerlo con una interfaz gráfica:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;winpdb -oserverhost -a script.py&lt;/blockquote&gt;&lt;br /&gt;
El parámetro -o va seguido de la dirección IP o nombre del servidor&lt;br /&gt;
&lt;br /&gt;
El parámetro -a le indica a winpdb que al conectarse al servidor, adjunte el script script.py que se debe estar ya ejecutando en el servidor para poder debuggear con rpdb2.&lt;br /&gt;
&lt;br /&gt;
Hecho esto, se solicitará el password que se indicó en rpdb2 y con eso la interfaz inicializará y conectará con el servidor y cargará el código fuente del script solicitado, con lo que ya puede comenzar a debuggearse...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Links:&lt;br /&gt;
&lt;a href=&quot;http://winpdb.org/&quot;&gt;winpdb&lt;/a&gt; - sitio oficial de winpdb, con el código fuente del programa, para instalarlo, y documentación.</content><link rel='replies' type='application/atom+xml' href='http://micro-howto.blogspot.com/feeds/4403195221680375226/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://micro-howto.blogspot.com/2010/12/debugging-remoto-de-scripts-python-con.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/4403195221680375226'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/4403195221680375226'/><link rel='alternate' type='text/html' href='http://micro-howto.blogspot.com/2010/12/debugging-remoto-de-scripts-python-con.html' title='debugging remoto de scripts Python con winpdb'/><author><name>Javier Novoa C. (Stitch)</name><uri>http://www.blogger.com/profile/13132360799518616672</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_Hp7QjnMlZmKlVQDHZsaIQ9YnmWC4sel26ibs9FHig1ffPukjGQKgnGf4o6JV5MJYRfqEo5UmWmd3VQj0ZkCTBv1muBIu3QTs5jCkZ2_DD7GPa_x32zdIT0oFvFRLmrU/s220/55857695_2385261704837842_7917967493749014528_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8587897704769639737.post-4245415715650752681</id><published>2010-12-03T12:17:00.000-08:00</published><updated>2010-12-03T12:29:56.947-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="excel"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="POI"/><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><category scheme="http://www.blogger.com/atom/ns#" term="spring"/><title type='text'>Configurar POI en Spring 3 para generar archivos Excel</title><content type='html'>He decidido registrar el proceso de como generar archivos Excel con POI mediante Spring 3 para que no se me olvide (aunque es bastante sencillo).  &lt;font size=&quot;1&quot;&gt;&lt;i&gt;Me sorprendí de terminarlo en tan sólo 3 pasos!&lt;/i&gt;&lt;/font&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1) Generar un controller &lt;/b&gt;que obtiene los valores que se pretenden mostrar en la vista, los agrega al modelmap de MVC que maneja Spring y luego devuelva el nombre de la vista encargada de generar el excel.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:java;&quot;&gt;@Controller
@RequestMapping(&amp;quot;/excel&amp;quot;)
public class ExcelController {

    @Autowired
    private Servicio servicio;

    @RequestMapping(value = &amp;quot;/{parametro}&amp;quot;, method = RequestMethod.GET)
    public String generarExcelByParametro(
            ModelMap modelMap, HttpServletResponse response,
            @PathVariable(&amp;quot;parametro&amp;quot;) String nombreVista) {
        modelMap.put(&amp;quot;datos&amp;quot;, servicio.obtenerDatos(parametro));

        response.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/vnd.ms-excel&amp;quot;);
        response.setHeader(&amp;quot;Content-Disposition&amp;quot;,&amp;quot;attachment; filename=\&amp;quot;excel.xls\&amp;quot;&amp;quot;);
        return &amp;quot;reporteExcel&amp;quot;;
    }

}
&lt;/pre&gt;&lt;br /&gt;
Observa que el método generarExcelByParametro() del controller responde a una petición http://{servidor:puerto}/{contexto}/excel/{parametro} y realiza algo en un servicio que devuelve cierta información que se espera administrar de lado de la vista (más adelante lo vemos) y lo guarda dentro del ModelMap de spring con el identificador &amp;quot;datos&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Los headers que se agregan al response, son solo para asegurar que cuando se genere el archivo .xls, se identifique como tal y se obligue al usuario a descargarlo.&lt;br /&gt;
&lt;br /&gt;
Finalmente la cadena (&amp;quot;reporteExcel&amp;quot;) que se devuelve determina el nombre de la vista que interpretara los datos para generar el documento.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;b&gt;2) Configurar la vista&lt;br /&gt;
&lt;/b&gt;Es necesario generar un archivo de nombre &lt;i&gt;views.properties&lt;/i&gt; o agregar al que ya exista en el classpath del proyecto, algo como lo siguiente:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:text;&quot;&gt;reporteExcel.(class)=mx.com.empresa.miproyecto.web.view.ExcelView
&lt;/pre&gt;&lt;br /&gt;
La linea comienza con el nombre de la vista, que es el nombre de la cadena que se devuelve en el controller; no olviden encerrar el .class entre paréntesis.  La clase (junto con el paquete) que se asigna como valor indica la ubicacion de la View (o vista), misma que interpretará los datos y los plasmará sobre el Excel.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;3) Generar la View (vista)&lt;/b&gt; que interpreta los datos del controller.  Se debe generar una clase que herede de &lt;i&gt;org.springframework.web.servlet.view.document.AbstractExcelView&lt;/i&gt; e implemente el metodo &lt;i&gt;buildExcelDocument()&lt;/i&gt;. En dicho método es donde se debe recuperar los datos que se involucraron en el ModelMap desde el controller.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:java;&quot;&gt;public class ExcelView extends AbstractExcelView {
    @Override
    protected void buildExcelDocument(
            Map&amp;lt;String, Object&amp;gt; model, HSSFWorkbook book,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        //recuperar datos
        List reporte = (List&amp;lt;Map&amp;lt;String, Object&amp;gt;&amp;gt;) model.get(&amp;quot;datos&amp;quot;);
        //crear la hoja
        HSSFSheet hoja = book.createSheet(&amp;quot;nombre de la hoja&amp;quot;);

        //generar un estilo para la celda
        HSSFCellStyle estiloCelda = obtenerEstiloCelda(book);

        //guardar valores en toda la hoja
        HSSFCell celda;
        int row = 0;
        int col;
        for (Map m : (List&amp;lt;Map&amp;lt;String, Object&amp;gt;&amp;gt;) reporte){
            col = 0;
            // guarda valores en una fila de la hoja
            for (Object o : m.keySet()) {
                celda = getCell(hoja, row, col++);
                celda.setCellStyle(estiloCelda);
                setText(celda, null == m.get(o) ? &amp;quot;[nulo]&amp;quot; : m.get(o).toString());
            }
        row++;
        }
}
&lt;/pre&gt;&lt;br /&gt;
La información a utilizar, según el controller que hicimos antes, se obtiene del ModelMap con el identificador &amp;quot;datos&amp;quot;.  Para este caso se está obteniendo una lista de registros devueltos comúnmente por la ejecucion de un &lt;i&gt;jdbcTemplate.queryForList(&amp;quot;... mi query sql ...&amp;quot;)&lt;/i&gt; de Spring.&lt;br /&gt;
&lt;br /&gt;
Es necesario crerar una hoja mediante &lt;i&gt;createSheet()&lt;/i&gt; y usar el valor devuelto (HSSFSheet) para agregar contenido, diseño, colores de fondo y bordes, agregar registros o contenido en celdas específicas con coordenadas (fila, columna), rotar texto, fuente, tamaño, forma de texto y clasificación de contenido de la celda, entre otros muchos más.&lt;br /&gt;
&lt;br /&gt;
Por ejemplo puedes utilizar la instancia de la hoja (HSSFSheet) y el metodo &lt;i&gt;autoSizeColumn((short) 1)&lt;/i&gt; para configurar una columna (este caso la B) como autoajustable a lo ancho, de acuerdo al texto que contenga.  Para modificar el alto de la primera fila, hacer:&lt;br /&gt;
&lt;pre class=&quot;brush:java;&quot;&gt;        HSSFRow primerRegistro = hoja.createRow(0);
        primerRegistro.setHeight((short) 1200);  //es una altura de 60.00 cuando lo ves desde el Excel
&lt;/pre&gt;&lt;br /&gt;
Observa que utilizas dos métodos básicamente: &lt;i&gt;getCell()&lt;/i&gt; para obtener una celda (HSSFCell) de una hoja determinada en una ubicación con la combinación fila, columna; y &lt;i&gt;setText()&lt;/i&gt; para asignarle un valor de texto a dicha celda.&lt;br /&gt;
&lt;br /&gt;
También puedes crear templates de estilos de celda para luego aplicarlos a un grupo de ellas.  En el código siguiente se esta definiendo un tipo de letra (HSSFFont) de ancho normal, con tamaño 8 y un estilo (HSSFCellStyle) con alineación a la izquierda y borde inferior con pequeños puntos consecutivos(BORDER_DOTTED).&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:java;&quot;&gt;    private static HSSFCellStyle obtenerEstiloCelda(HSSFWorkbook book) {
        HSSFFont fuente = book.createFont();
        fuente.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);
        fuente.setFontHeightInPoints((short)8);
        HSSFCellStyle estilo = book.createCellStyle();
        estilo.setFont(fuente);
        //alineacion
        estilo.setAlignment(HSSFCellStyle.ALIGN_LEFT);
        estilo.setVerticalAlignment(HSSFCellStyle.VERTICAL_TOP);
        //border
        estilo.setBorderBottom(HSSFCellStyle.BORDER_DOTTED);
        return estilo;
    }
&lt;/pre&gt;&lt;br /&gt;
Existen muchas más alternativas para los estilos pero para no volver a escribir lo que ya está publicado en otros lados, debes revisar las ligas siguientes para abundar más sobre el tema:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://www.docstoc.com/docs/271809/Java---C%C3%B3mo-generar-Hojas-de-Excel-con-Apache-POI&quot;&gt;http://www.docstoc.com/docs/271809/Java---C%C3%B3mo-generar-Hojas-de-Excel-con-Apache-POI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://apiconz.wordpress.com/2007/10/22/como-generar-hojas-de-excel-en-una-aplicacion-java-usando-apache-poi/&quot;&gt;http://apiconz.wordpress.com/2007/10/22/como-generar-hojas-de-excel-en-una-aplicacion-java-usando-apache-poi/&lt;/a&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;/ul&gt;Aunque puedes realizar un montón de ajustes en el estilo de tu hoja, básicamente, tu hoja la diseñas en la vista (View) que hereda de la &lt;i&gt;AbstractExcelView&lt;/i&gt; y Spring hace todo el resto del trabajo. Sencillo no ?</content><link rel='replies' type='application/atom+xml' href='http://micro-howto.blogspot.com/feeds/4245415715650752681/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://micro-howto.blogspot.com/2010/12/configurar-poi-en-spring-3-para-generar.html#comment-form' title='3 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/4245415715650752681'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/4245415715650752681'/><link rel='alternate' type='text/html' href='http://micro-howto.blogspot.com/2010/12/configurar-poi-en-spring-3-para-generar.html' title='Configurar POI en Spring 3 para generar archivos Excel'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05477259225859568605</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8587897704769639737.post-4129492143159952459</id><published>2010-11-30T11:12:00.000-08:00</published><updated>2010-11-30T14:03:50.055-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="escritorio remoto"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="servidores"/><title type='text'>Servidor VNC para sesiones de escritorios remotos</title><content type='html'>&lt;b&gt;Introducción&lt;/b&gt; &lt;br /&gt;
&lt;a href=&quot;http://es.wikipedia.org/wiki/VNC&quot;&gt;VNC (Virtual Network Computer)&lt;/a&gt; es el software a través del cual se puede iniciar sesión en &lt;a href=&quot;http://es.wikipedia.org/wiki/Escritorio_remoto&quot;&gt;escritorio remoto&lt;/a&gt; con GNU/Linux.&lt;br /&gt;
&lt;br /&gt;
Otra opción es el &lt;a href=&quot;http://es.wikipedia.org/wiki/Remote_Desktop_Protocol&quot;&gt;RDP&lt;/a&gt; de Windows, sin embargo aquí explicaremos únicamente como configurar el servidor para el caso de VNC.&lt;br /&gt;
&lt;br /&gt;
Lo primero que hay que saber es que VNC funciona para controlar escritorios remotos que utilizan el servidor gráfico &lt;a href=&quot;http://es.wikipedia.org/wiki/X_Window_System&quot;&gt;X-Window&lt;/a&gt; , el default de GNU/Linux hasta ahora. Sin entrar en detalles de cómo funciona X-Window, basta saber que en este tutorial explicaremos dos opciones:&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;controlar el escritorio X real que se tenga en el escritorio remoto&lt;/li&gt;
&lt;li&gt;controlar un escritorio X virtual que se crea a demanda en dicho escritorio remoto&lt;/li&gt;
&lt;/ol&gt;Ambas opciones tienen posibilidades de aplicación.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.blogger.com/post-edit.g?blogID=8587897704769639737&amp;amp;postID=4129492143159952459&quot; name=&quot;more&quot;&gt;&lt;/a&gt;&lt;br /&gt;
Por ejemplo, si lo que deseamos es que otras personas vean mi escritorio mientras yo lo manipulo, puedo levantar VNC usando la opción 1 y permitiendo que los demás se conecten sólo en escucha (sin posibilidad de intervenir en mi sesión). Y  de esta manera se pueden impartir cursos o hacer demostraciones en vivo.&lt;br /&gt;
&lt;br /&gt;
Si lo que deseamos es acceder a sesión remota del escritorio para poder acceder como si se tratara de estar sentado físicamente frente a la máquina, pero sin estarlo, y que no importe (o no se requiera) manipular directametne la terminal real de X, sino sólo iniciar sesión, puedo levantar VNC usando la opción 2.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cabe entonces mencionar que en X se tiene siempre asociada una &#39;pantalla&#39; (display) real con la terminal física. Normalmente se le asigna el número 0 como identificador. A partir de ahí, el programa Xserver permite levantar nuevas &#39;pantallas&#39; virtuales (displays) no relacionadas con la terminal física. Es decir que si usamos la pantalla #1, al no ser la física, podemos acceder a ella a través de VNC, pero en la pantalla física no se verá nada (pues esta es la 0, no la 1).&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Requisitos&lt;/b&gt; &lt;b&gt;previos&lt;/b&gt;&lt;br /&gt;
Los programas en cuestión que necesitamos instalar son los siguientes:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;opción 1: &lt;a href=&quot;http://www.karlrunge.com/x11vnc/&quot;&gt;x11vnc&lt;/a&gt; en el servidor&lt;/li&gt;
&lt;li&gt;opción 2: &lt;a href=&quot;http://www.tightvnc.com/&quot;&gt;TightVNC&lt;/a&gt; , &lt;a href=&quot;http://www.realvnc.com/&quot;&gt;RealVNC&lt;/a&gt;, &lt;a href=&quot;http://www.ultravnc.net/&quot;&gt;UltraVNC&lt;/a&gt; o cualquier otro que permita VNC en el servidor&lt;/li&gt;
&lt;li&gt;clientes: cualquier visor de VNC, como &lt;a href=&quot;http://www.kde.org/applications/internet/krdc/&quot;&gt;krdc&lt;/a&gt;, &lt;a href=&quot;http://www.realvnc.com/&quot;&gt;realvnc vncviewer&lt;/a&gt;, etc.  No entraremos en detalle sobre el uso de los clientes, ya que se trata de algo muy intuitivo, bastará conectarse al servidor VNC una vez que esté levantado en el puerto que se haya configurado para lo mismo. Cabe anotar que los clientes pueden correr en cualquier plataforma independientemente de que el servidor sea GNU/Linux u otro. Por ejemplo, se puede iniciar sesión remota con un cliente en Windows, a pesar de que el servidor sea GNU/Linux. Otra anotación interesante sobre los clientes es que algunos servidores de VNC (por ejemplo TightVNC) permiten levantar el servidor a través de una interfaz en Java para que el escritorio remoto pueda ser accedido a través de un navegador web con soporte para Java, utilizando un applet específico para lo mismo.&lt;/li&gt;
&lt;li&gt;configurar XDMCP en el escritorio remoto para permitir el incio de sesión.&lt;/li&gt;
&lt;/ul&gt;También hay que asegurarse de tener instalado en el servidor el programa Xserver, y de preferencia el superservidor xinetd, que permitirá conectarse a pantallas virtuales sin consumir recursos del servidor cuando no se esté utilizando VNC y a la vez permitir a más de una persona conectarse a su propia sesión con VNC sin que el servidor bloquee puertos ni nada por el estilo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Inicio de sesión remoto&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://es.wikipedia.org/wiki/XDMCP&quot;&gt;XDMCP&lt;/a&gt; es un protocolo que, en resumen, permite el incio de sesión remoto en terminales X de cualquier índole.&lt;br /&gt;
&lt;br /&gt;
Si no configuramos XDMCP, entonces solamente podremos acceder a pantallas que ya tengan la sesión iniciada. Puesto que esto sólo es posible en pantallas físicas, nos veríamos restringidos a la opción #1, sin posibilidad de utilizar la pantalla de inicio de sesión de la pantalla que quisiéramos controlar, por lo que sólo sesiones previamente iniciadas podrían ser controladas. Esto no es ni práctico, ni mucho menos seguro, lo recomendable es que podamos iniciar sesión en modo gráfico en el escritorio remoto a partir de un prompt de nombre de usuario y password por validar.&lt;br /&gt;
&lt;br /&gt;
XDMCP se configura de manera diferente, dependiendo el &lt;a href=&quot;http://es.wikipedia.org/wiki/X_Display_Manager&quot;&gt;manejador de pantalla&lt;/a&gt; que estemos utilizando. Físicamente, sin importar el tipo de manejador de escritorio que estemos utilizando (GNOME, KDE, XFCE, etc.), se utiliza un manejador de pantalla para poder iniciar sesión en nuestro escritorio remoto, incluso cuando estamos sentados físicamente frente a él. Las opciones más comunes son: gdm, kdm y xdm. (Normlamente GNOME utiliza gdm, pero podría utilizar otro; KDE utiliza kdm pero podría ser otro, y así...)&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;xdm&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Debe abrirse el archivo xdm-config y comentarse la línea con el texto&lt;br /&gt;
&lt;blockquote&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;DisplayManager.requestPort :0 &lt;/div&gt;&lt;/blockquote&gt;insertando un ! al inicio.&lt;br /&gt;
&lt;br /&gt;
El usuario &#39;nobody&#39; debería de tener asociada una terminal shell válida para poder iniciar sesión, por lo que hay que ejecutar:&lt;br /&gt;
&lt;blockquote&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;usermod -s /bin/bash nobody&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;i&gt;gdm&lt;/i&gt;&lt;br /&gt;
Debe ejecutarse gdmconfig, encontrar la pestaña llamada &#39;XDMCP&#39; y habilitar esta opción.&lt;br /&gt;
&lt;br /&gt;
En escritorios como XFCE, que a veces usan también gdm, la opción se encuentra, dentro del menú &#39;Configuración&#39;, en la pantalla &#39;Ventana de entrada&#39;, en la pestaña &#39;Remota&#39; hasta abajo se encuentra el botón &#39;Configurar XDMCP&#39; (obviamente hay que empezar por habilitar la pestaña Remota en los permisos de inicio de sesión dentro de esta misma pantalla).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;kdm&lt;/i&gt;&lt;br /&gt;
Debe editarse el archivo kdmrc y habilitar XDMCP en el puerto 177:&lt;br /&gt;
&lt;blockquote&gt;&lt;pre&gt;[Xdmcp]
Enable=true
Willing=/etc/X11/xdm/Xwilling
Xaccess=/etc/X11/xdm/Xaccess
Port=177&lt;/pre&gt;&lt;/blockquote&gt;&lt;i&gt; &lt;/i&gt;&lt;br /&gt;
&lt;i&gt;seguridad&lt;/i&gt; &lt;br /&gt;
En caso de soportarlo, lo recomendable también es configurar quiénes pueden acceder a sesión. Esta configuración depende completamente del manejador de pantalla que se tenga pero no entraremos en detalle en este caso. &lt;br /&gt;
&lt;br /&gt;
Más información &lt;a href=&quot;http://linuxreviews.org/howtos/xvnc/#toc3&quot;&gt;aquí&lt;/a&gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Opción 1 (x11vnc , control directo de la terminal física remota)&lt;/b&gt;&lt;br /&gt;
Como dijimos, se trata de manipular remotamente la pantalla 0, la cual X asocia por default a la terminal física de la máquina que llamaremos en adelante &#39;escritorio remoto&#39;.&lt;br /&gt;
&lt;br /&gt;
En &#39;escritorio remoto&#39; hay que instalar entonces x11vnc y Xserver.&lt;br /&gt;
&lt;br /&gt;
Hecho eso, se puede lanzar una línea como la siguiente:&lt;br /&gt;
&lt;blockquote style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;x11vnc&lt;/blockquote&gt;&lt;br /&gt;
Lo cual nos brindará información adicional sobre los parámetros que deberíamos de lanzar para autenticar nuestra sesión, entre otros.&lt;br /&gt;
&lt;br /&gt;
Yo uso normalmente la siguiente línea:&lt;br /&gt;
&lt;blockquote&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;x11vnc -auth /var/lib/gdm/:0.Xauth -display :0 -shared -forever -ncache -rfbport 5901  -rfbauth ./.vnc/passwd_x11vnc&lt;/div&gt;&lt;/blockquote&gt;&lt;br /&gt;
En donde el parámetro &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;-auth&lt;/span&gt; asocia el archivo :0.Xauth (que hay que localizar en el &#39;escritorio remoto&#39; para cada caso particular) y de esa manera si mi escritorio remoto se quedó en la pantalla de login, poder hacer uso de la autenticación y así poder iniciar sesión. Si no se usa este parámetro, se tendría que tener la pantalla 0 ya dentro de sesión en el escritorio remoto para poder hacer uso del acceso remoto.&lt;br /&gt;
&lt;br /&gt;
El parámetro &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;-forever&lt;/span&gt; permite escuchar constantemente conexiones aunque estas se terminen, siempre y cuando no se cierre la sesión gráfica en 0&lt;br /&gt;
&lt;br /&gt;
El parámetro &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;-rfbport&lt;/span&gt; indica el número de puerto en que estará escuchando el &#39;escritorio remoto&#39; para aceptar conexiones. 5901 es el puerto por default para VNC. Por cierto, no hay que olvidar abrir este puerto en el firewall del escritorio remoto.&lt;br /&gt;
&lt;br /&gt;
El parámetro &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;-rfbauth&lt;/span&gt; apunta a un archvio en el que previamente almacené un password para autenticar el acceso a mi servidor y así evitar que cualquiera que conozca la dirección IP de mi escritorio remoto se pueda conectar a mi terminal gráfica física 0 y por lo tanto ver o intervenir en mis sesiones directamente (este riesgo es MUY REAL, hay que generar el password siempre). Para generar el archivo del password, x11vnc debe ejecutarse con el parámetro -storepassword, por ejemplo:&lt;br /&gt;
&lt;blockquote style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;x11vnc -storepassword /path/al/archivo_de_password&lt;/blockquote&gt;Aquí no entraremos en detalle para levantar x11vnc usando xinetd, pero el &lt;a href=&quot;http://www.karlrunge.com/x11vnc/&quot;&gt;sitio oficial de x11vnc&lt;/a&gt; da más información. Además, traspolando un poco la información que daremos para la opción #2, se puede lograr levantar un servidor así.&lt;br /&gt;
&lt;br /&gt;
Antes de concluir con x11vnc, hay que aclarar también que para poder inciar sesión remota también es necesario configurar el protocolo XDMCP como se explicó anteriormente...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Opción 2 (vnc, control de pantallas virtuales remotas)&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
En este caso se manipularán pantallas virtuales no directamente relacionadas con la terminal física del escritorio remoto. La idea será que dichas pantallas se creen a demanda también.&lt;br /&gt;
&lt;br /&gt;
En el escritorio remoto habrá que tener instalado tanto el software que se usará como servidor VNC (tightvnc, ultravnc, realvnc, etc.) y Xserver.&lt;br /&gt;
&lt;br /&gt;
Hecho eso se puede ejecutar la siguiente línea de comandos:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;vncserver -query localhost -once -geometry 1024x768 -depth 16 :1&lt;/div&gt;&lt;/blockquote&gt;&lt;br /&gt;
Con lo que se tendrá un servidor VNC en la pantalla virtual #1, y si esta no estuviera disponible, buscaría en la 2, y así sucesivamente.&lt;br /&gt;
&lt;br /&gt;
El parámetro&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt; -once&lt;/span&gt; indica que sólo permitirá el inicio de sesión una vez, luego de terminar la cual cerrará el servidor. Esta opción es más útil aún usando un superservidor como se explica más adelante.&lt;br /&gt;
&lt;br /&gt;
El parámetro &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;-geometry 1024x768&lt;/span&gt; define la resolución que tendrá la sesión en el escritorio remoto.&lt;br /&gt;
&lt;br /&gt;
El parámetro &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;-depth 16&lt;/span&gt; indica la profundidad de color a obtener en la sesión remota, en este caso a 16 colores.&lt;br /&gt;
&lt;br /&gt;
El parámetro &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;:1&lt;/span&gt; indica el número de pantalla virtual que se desea utilizar.&lt;br /&gt;
&lt;br /&gt;
El parámetro &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;-query localhost&lt;/span&gt; indica que se desea iniciar sesión en el escritorio remoto a través de XDMCP.&lt;br /&gt;
&lt;br /&gt;
Para que se autentique a los usuarios, es necesario crear previamente el archivo de passwords con el programa &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;vncpasswd&lt;/span&gt;. Por default, vncserver busca en &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;$HOME/.vnc/passwd&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Superservidor xinetd&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Sin embargo, levantar manualmente un servidor de pantallas virtuales VNC no es la forma más óptima, ya que se tienen estos inconvenientes:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;hay que levantar nuevamente el servidor cada vez que se termine de usar&lt;/li&gt;
&lt;li&gt;solamente podrá entrar a sesión por VNC una persona, y si se tiene más de un usuario que pudiera iniciar sesión en el escritorio remoto (cada uno a su propia sesión), no se les permitiría.&lt;/li&gt;
&lt;li&gt;además si no se está utilizando el servicio VNC en un momento dado, aún así se está consumiendo memoria en el servidor, con el programa a la escucha de posibles conexiones. &lt;/li&gt;
&lt;/ul&gt;La solución implica levantar algo conocido como un &lt;a href=&quot;http://en.wikipedia.org/wiki/Super-server&quot;&gt;superservidor&lt;/a&gt;, de los cuales &lt;a href=&quot;http://es.wikipedia.org/wiki/Xinetd&quot;&gt;xinetd&lt;/a&gt; es el más popular en GNU/Linux. El superservidor permite levantar a demanda instancias de los servidores configurados en él. Esto trae ventajas de menor consumo de memoria, además de permitir levantar instancias múltiples del servidor escuchando un sólo puerto (que atiende el superservidor). Y en cuanto se termine de usar el servidor en cuestión, el superservidor sigue atento para nuevas solicitudes. Un superservidor es útil para servidores que no están en constante uso o que no requieren de alta disponibilidad, podría ser (dependiendo las circunstancias, claro): telnet, ftp, o en nuestro caso vnc.&lt;br /&gt;
&lt;br /&gt;
Una vez instalado xinetd, lo único que debe hacerse es agregar la configuración adecuada para utilizar VNC a través del mismo. Esta configuración se puede escribir en un archivo exclusivo para VNC, pero debe asegurarse de guardarse en donde xinetd lo lea, por lo regular en&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt; /etc/xinetd.d&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
El siguiente es un ejemplo de un servidor VNC levantado a  través de xinetd:&lt;br /&gt;
&lt;blockquote&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;service vnc&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;{                                                                                                              &lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  protocol = tcp&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  socket_type = stream&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  wait = no&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  user = user_name&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  server = /usr/bin/Xvnc&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  server_args = -inetd -query localhost -once -geometry 1024x768 -depth 16 -rfbauth=/home/user_name/.vnc/passwd&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  disable = no&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;Antes de utilizarlo, explicaré algunos detalles:&lt;br /&gt;
&lt;br /&gt;
-El servidor que se mandó llamar utiliza el programa &#39;Xvnc&#39;, en vez de &#39;vncserver&#39;. Leyendo la página del manual de vncserver (&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;man vncserver&lt;/span&gt;), se puede constatar que en realidad vncserver es un wrapper que manda llamar en el fondo a Xvnc, por lo que este último programa será el indicado para llamar en las instancias que genere el superservidor.&lt;br /&gt;
&lt;br /&gt;
-Los argumentos incluyen el parámetro &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;-inetd&lt;/span&gt; que es necesario para que el servidor VNC sepa que fue mandado llamar desde un superservidor.&lt;br /&gt;
&lt;br /&gt;
-Se incluye el parámetro&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt; -rfbauth=/path/passwd&lt;/span&gt; , el cual es la ruta al archivo de password a utilizar.&lt;br /&gt;
&lt;br /&gt;
-El nombre de usuario &#39;user_name&#39; se utilizó en este caso para que el servidor se ejecute a nombre de este usuario. Normalmente se utiliza el usuario &#39;nobody&#39;, pero este debe de tener permisos de lectura al archivo de password, por lo que otra opción implica ejecutar el servidor como otro usuario, con acceso al archivo de password en una ruta particular.&lt;br /&gt;
&lt;br /&gt;
-Si se utiliza TightVNC, las opciones de configuracion no deben incluir el caracter &#39;=&#39;, sino que hay que sustituirlos por espacios &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Una vez configurado el servicio, hay que reiniciar xinetd:&lt;br /&gt;
&lt;blockquote&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;/etc/init.d/xinetd restart&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;
(o cualquiera que sea la manera de hacerlo en tu distribución en particular).&lt;br /&gt;
&lt;br /&gt;
No hay que olvidar abrir el puerto 5901 (que es el default de VNC, en realidad es el puerto 5900 + N, donde N será el número de pantalla virtual que se utilice) para escuchar las peticiones a conectarse.&lt;br /&gt;
&lt;br /&gt;
Igualmente no olvidar que aunque muchos usuarios se puedan conectar al servidor VNC, sólo una persona a la vez podrá entrar a una sesión en particular. Si hay más de una sesión disponible en el servidor, cada una podrá ser iniciada una vez, pero no pueden entrar a sesión más de una vez por nombre de usuario.&lt;br /&gt;
&lt;br /&gt;
En &lt;a href=&quot;http://linuxreviews.org/howtos/xvnc&quot;&gt;este link&lt;/a&gt;, se da más información y la posibilidad de levantar más de un servidor con xinetd para escuchar en distintos puertos, para tener la posibilidad de conectarse con distintas resoluciones al mismo servidor VNC.&lt;br /&gt;
&lt;br /&gt;
Algunos servidores VNC (como Tight VNC) permiten conectarse también vía http en un navegador web, utilizando un applet de Java. Hay que consultar la documentación de cada caso particular para poder lograr esto. De entrada, lo que normalmente se hace es utilizar el puerto 5800 + N para obtener esta conexión.</content><link rel='replies' type='application/atom+xml' href='http://micro-howto.blogspot.com/feeds/4129492143159952459/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://micro-howto.blogspot.com/2010/11/servidor-vnc-para-sesiones-de.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/4129492143159952459'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/4129492143159952459'/><link rel='alternate' type='text/html' href='http://micro-howto.blogspot.com/2010/11/servidor-vnc-para-sesiones-de.html' title='Servidor VNC para sesiones de escritorios remotos'/><author><name>Javier Novoa C. (Stitch)</name><uri>http://www.blogger.com/profile/13132360799518616672</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_Hp7QjnMlZmKlVQDHZsaIQ9YnmWC4sel26ibs9FHig1ffPukjGQKgnGf4o6JV5MJYRfqEo5UmWmd3VQj0ZkCTBv1muBIu3QTs5jCkZ2_DD7GPa_x32zdIT0oFvFRLmrU/s220/55857695_2385261704837842_7917967493749014528_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8587897704769639737.post-2110654876249916135</id><published>2010-08-26T01:56:00.000-07:00</published><updated>2010-08-31T09:52:10.786-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="dataset"/><category scheme="http://www.blogger.com/atom/ns#" term="datos"/><category scheme="http://www.blogger.com/atom/ns#" term="dbunit"/><category scheme="http://www.blogger.com/atom/ns#" term="junit"/><title type='text'>DBUnit lo hace facil</title><content type='html'>Dado que he trabajado con JUnit y DBUnit y he encontrado en ellos unas buenas herramientas para probar el codigo de las aplicaciones en java, pues me d&amp;#237; a la tarea de investigar un poquito sobre como obtener datasets desde una BD, y como cargarlos para realizar pruebas espec&amp;#237;ficas.&amp;#160; Fue entonces cuando me encontr&amp;#233; con este art&amp;#237;culo de Bill Siggelkow y me d&amp;#237; a la tarea de traducir una parte, tambi&amp;#233;n he agregado notas m&amp;#237;as, pero pueden encontrar el original en enlace al final del post.&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Y dice as&amp;iacute;:&lt;br /&gt;
Si desarrollas aplicaciones que acceden a datos relacionales necesitas verificar el c&amp;#243;digo de tu aplicaci&amp;#243;n trabaje con los datos, como fue dise&amp;#241;ado.&amp;#160; Cuando usas Hibernate o alg&amp;#250;n otro framework que implemente JPA, deber&amp;#237;as confirmar que tus mapeos dirijan a Hibernate para almacenar y recuperar la informaci&amp;#243;n correctamente.&amp;#160; Yo implemento este tipo de pruebas usando JUnit.&amp;#160; Nadie puede refutar que las pruebas contra una base de datos activa es fundamental - no hay una mejor forma para verificar tus mapeos.&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Pero para probar contra la base de datos se requiere que los datos se encuentren en un estado inicial.&amp;#160; Puedes cargar la base de datos manualmente antes de correr tu prueba pero eso se vuelve monotono y propenso a errores. &lt;a href=&quot;http://dbunit.sourceforge.net/&quot;&gt;DBUnit&lt;/a&gt; resuelve este problema.&amp;#160; Este puede precargar la base de datos para cada una de tus pruebas, basado en un grupo de datos dentro de un xml (com&amp;#250;nmente llamado dataset).&amp;#160; El formato de este dataset es sencillo de entender; aqu&amp;#237; hay un ejemplo de tres tablas de una base de datos MySQL.&amp;#160; Los nombres de los elementos empatan con los nombres de las tablas y sus atributos con los nombres de sus columnas. Cada elemento implica un registro en esa tabla.&lt;p&gt;&lt;pre class=&quot;brush:xml;&quot;&gt;&amp;lt;dataset&amp;gt;
&amp;#160;&amp;#160;&amp;#160; &amp;lt;cliente id_cliente=&amp;quot;778899&amp;quot; id_estatus = &amp;quot;1&amp;quot; id_sucursal=&amp;quot;98765&amp;quot;/&amp;gt;
&amp;#160;&amp;#160;&amp;#160; &amp;lt;banco id_banco=&amp;quot;1&amp;quot; nombre=&amp;quot;BNMX&amp;quot; descripcion=&amp;quot;Banamex&amp;quot; activo=&amp;quot;1&amp;quot;
valor=&amp;quot;0&amp;quot;/&amp;gt;
&amp;#160;&amp;#160;&amp;#160; &amp;lt;pago id_cliente = &amp;quot;778899&amp;quot; id_estatus = &amp;quot;1&amp;quot; id_tipo_producto =
&amp;quot;1&amp;quot; id_promotor = &amp;quot;1&amp;quot; id_sucursal = &amp;quot;58&amp;quot; /&amp;gt;
&amp;lt;/dataset&amp;gt;
&lt;/pre&gt;&lt;p&gt;Para una base de datos peque&amp;#241;a donde solo necesitas cargar unas pocas tablas con unos pocos registros puedes crear el dataset manualmente.  Pero seguramente no quer&amp;#225;s hacerlo con una base de datos empresarial compleja que contiene cientos de tablas con nombres de columnas complejas.&amp;#160; Es m&amp;#225;s facil si le permites a DbUnit extraer los datos por ti.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Aqu&amp;#237; esta un proceso t&amp;#237;pico que sigues cuando usas DBUnit:&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Poblar las tablas de tu base de datos como sea necesario para ejecutar tu prueba.&lt;br /&gt;
Extraer los datos desde esas tablas hacia un dataset XML. En el m&amp;#233;todo setUp de tu prueba unitaria, llamar a DBUnit para cargar la base de datos desde los dataset&amp;#39;s recientement creados.&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Puedes extraer los datos usando una clase como esta:&lt;p&gt;&lt;pre class=&quot;brush:java;&quot;&gt;import java.io.FileOutputStream;
import java.sql.Connection;
import java.sql.DriverManager;

import org.dbunit.database.DatabaseConnection;
import org.dbunit.database.IDatabaseConnection;
import org.dbunit.database.QueryDataSet;
import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.xml.FlatXmlDataSet;

public class ExtractTestDataSet {
&amp;#160;&amp;#160;&amp;#160; public static void main(String[] args) throws Exception {
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // conexion a la base de datos
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Class driverClass = Class.forName(&amp;quot;com.mysql.jdbc.Driver&amp;quot;);
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Connection jdbcConnection = DriverManager.getConnection(
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;quot;jdbc:mysql://localhost/bon_app&amp;quot;, &amp;quot;scott&amp;quot;, &amp;quot;tiger&amp;quot;);
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; IDatabaseConnection connection = new DatabaseConnection(jdbcConnection);
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // exportar un dataset parcial
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; QueryDataSet partialDataSet = new QueryDataSet(connection);
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; partialDataSet.addTable(&amp;quot;recipe&amp;quot;, &amp;quot;SELECT * FROM recipe where
is_deleted != &amp;#39;Y&amp;#39;&amp;quot;);
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; partialDataSet.addTable(&amp;quot;recipe_ext_xref&amp;quot;);
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; FlatXmlDataSet.write(partialDataSet,
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; new FileOutputStream(&amp;quot;partial-dataset.xml&amp;quot;));
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // exportacion de la base de datos completa!!
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; IDataSet fullDataSet = connection.createDataSet();
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; FlatXmlDataSet.write(fullDataSet, new
FileOutputStream(&amp;quot;full-dataset.xml&amp;quot;));
&amp;#160;&amp;#160;&amp;#160; }
}
&lt;/pre&gt;&lt;p&gt;DBUnit puede crear un dataset con todos los datos en tu base de datos configur&amp;#225;ndole solamente una conecci&amp;#243;n JDBC abierta  En la pr&amp;#225;ctica, probablemente quer&amp;#225; limitar el dataset a tablas espec&amp;#237;ficas y datos usados por tu prueba unitaria.  En el ejemplo anterior se esta creando dos archivos dataset.  El primero como partial-dataset.xml, representa solo una porcion de la base de datos. DBUnit pobla el dataset basado en tablas y queries especificados.  Si solo indicas el nombre de una tabla, el dataset se llenar&amp;#225; de todos los registros y columnas en esa tabla.  Especifia una tabla y un query y DBUnit solo extraer&amp;#225; los datos devueltos por el query.  Si quieres la base de datos completa en el dataset, simplemente llama el metodo IDatabaseConnection.createDataSet().&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;En el m&amp;#233;todo setUp() de tu prueba unitaria, usas el dataset como entrada para una operacion DBUnit.  DBUnit soporta varias combinaciones de operacion para borrar, insetar y ctualizar la base de datos usando un dataset.  Las operaciones m&amp;#225;s comunes son CLEAN_INSERT (limpia toda la tabla e inserta los registros del dataset) y REFRESH (solo agrega los registros del dataset a la tabla y si estos ya existen, los actualiza - con base en el id de la tabla).  CLEAN_INSERT es la opcion a usar si tienes tu propia instancia de base de datos y no necesitas preocuparte por ponerle el pie a alguien m&amp;#225;s del equipo de desarrollo.  Por otro lado, si compartes tu base de datos con el equipo, tu mejor amigo es REFRESH.&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;En el siguiente fragmento de una prueba unitaria, se est&amp;#225; usando CLEAN_INSERT para reinicializar la base de datos antes de cada m&amp;#233;todo de prueba.&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;&lt;pre class=&quot;brush:java;&quot;&gt;protected void setUp() throws Exception {
    setUpDatabase();
}

private void setUpDatabase() throws Exception {
    // Inicializa tu base de datos aqu&amp;#237;
    Class driverClass = Class.forName(&amp;quot;com.mysql.jdbc.Driver&amp;quot;);
    Connection jdbcConnection = DriverManager.getConnection(
&amp;quot;jdbc:mysql://localhost/bon_app&amp;quot;, &amp;quot;scott&amp;quot;, &amp;quot;tiger&amp;quot;);
    IDatabaseConnection connection = new DatabaseConnection(jdbcConnection);

// inicializa tu dataset aqu&amp;#237;
    IDataSet dataSet = new FlatXmlDataSet(new File(&amp;quot;full-dataset.xml&amp;quot;));
    try {
        DatabaseOperation.CLEAN_INSERT.execute(connection, dataSet);
    } finally {
        connection.close();
    }
}
&lt;/pre&gt;&lt;p&gt;Esta forma trabaja bien pero es algo molesto que tengas que hacer c&amp;#243;digo a  mano y recompilar la clase que extrae cuando sea necesariocambiar como DBUnit crea los dataset.  Usando Spring se le puede delegar el trabajo de configurar la clase de extracci&amp;#243;n de datos y esto salvar&amp;#237;a un mont&amp;#243;n de c&amp;#243;digo hecho a mano.  Esto resulta en la siguiente clase:&lt;p&gt;&lt;pre class=&quot;brush:java;&quot;&gt;package com.jadecove.bonappetit.test;
import java.io.FileOutputStream;
import java.sql.Connection;

import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.sql.DataSource;

import org.apache.log4j.Logger;
import org.dbunit.database.DatabaseConfig;
import org.dbunit.database.DatabaseConnection;
import org.dbunit.database.IDatabaseConnection;
import org.dbunit.database.QueryDataSet;
import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.xml.FlatXmlDataSet;

/**
* Extracts a DBUnit flat XML dataset from a database.
*
* @author Bill Siggelkow
*/
public class DBUnitDataExtractor {
    private DataSource dataSource;
    private String dataSetName = &amp;quot;dbunit-dataset.xml&amp;quot;;
    private List queryList;
    private List tableList;
    private Map dbUnitProperties;
    private Map dbUnitFeatures;
    private String schema;

    /**
    * A regular expression that is used to get the table name
    * from a SQL &amp;#39;select&amp;#39; statement.
    * This  pattern matches a string that starts with any characters,
    * followed by the case-insensitive word &amp;#39;from&amp;#39;,
    * followed by a table name of the form &amp;#39;foo&amp;#39; or &amp;#39;schema.foo&amp;#39;,
    * followed by any number of remaining characters.
    */
    private static final Pattern TABLE_MATCH_PATTERN = Pattern.compile(&amp;quot;.*\s+from\s+(\w+(\.\w+)?).*&amp;quot;, Pattern.CASE_INSENSITIVE);
    private static final Logger log = Logger.getLogger(DBUnitDataExtractor.class);

    /**
    * The data source of the database from which the data will be
    extracted. This property
    * is required.
    *
    * @param ds
    */
    public void setDataSource(DataSource ds) {
        dataSource = ds;
    }

    /**
    * Set the schema.
    * @param schema
    */
    public void setSchema(String schema) {
        this.schema = schema;
    }

    /**
    * Name of the XML file that will be created. Defaults to
    &amp;lt;code&amp;gt;dbunit-dataset.xml&amp;lt;/code&amp;gt;.
    *
    * @param name file name.
    */
    public void setDataSetName(String name) {
        dataSetName = name;
    }

    /**
    * Performs the extraction. If no tables or queries are specified,
    data from entire database
    * will be extracted. Otherwise, a partial extraction will be performed.
    * @throws Exception
    */
    public void extract() throws Exception {
        Connection conn = null;
        try {
            conn = dataSource.getConnection();
            log.info(&amp;quot;Beginning extraction from &amp;#39;&amp;quot;+conn.toString()+&amp;quot;&amp;#39;.&amp;quot;);
            IDatabaseConnection connection = new DatabaseConnection(conn, schema);
            configConnection((DatabaseConnection) connection);
            if (tableList != null || queryList != null) {
                // partial database export
                QueryDataSet partialDataSet = new QueryDataSet(connection);
                addTables(partialDataSet);
                addQueries(partialDataSet);
                FlatXmlDataSet.write(partialDataSet, new FileOutputStream(dataSetName));
            } else {
                // full database export
                IDataSet fullDataSet = connection.createDataSet();
                FlatXmlDataSet.write(fullDataSet, new
                FileOutputStream(dataSetName));
            }
        }
        finally {
            if (conn != null) conn.close();
        }
        log.info(&amp;quot;Completed extraction to &amp;#39;&amp;quot;+dataSetName+&amp;quot;&amp;#39;.&amp;quot;);
    }

    /**
    * List of table names to extract data from.
    *
    * @param list of table names.
    */
    public void setTableList(List list) {
        tableList = list;
    }

    /**
    * List of SQL queries (i.e. &amp;#39;select&amp;#39; statements) that will be used executed to retrieve
    * the data to be extracted. If the table being queried is also specified in the &amp;lt;code&amp;gt;tableList&amp;lt;/code&amp;gt;
    * property, the query will be ignored and all rows will be extracted from that table.
    *
    * @param list of SQL queries.
    */
    public void setQueryList(List list) {
        queryList = list;
    }

    public void setDbUnitFeatures(Map dbUnitFeatures) {
        this.dbUnitFeatures = dbUnitFeatures;
    }

    public void setDbUnitProperties(Map dbUnitProperties) {
        this.dbUnitProperties = dbUnitProperties;
    }

    private void configConnection(DatabaseConnection conn) {
        DatabaseConfig config = conn.getConfig();
        if (dbUnitProperties != null) {
            for (Iterator k=dbUnitProperties.entrySet().iterator(); k.hasNext(); ) {
                Map.Entry entry = (Map.Entry) k.next();
                String name = (String) entry.getKey();
                Object value = entry.getValue();
                config.setProperty(name, value);
            }
        }
        if (dbUnitFeatures != null) {
            for (Iterator k=dbUnitFeatures.entrySet().iterator(); k.hasNext(); ) {
                Map.Entry entry = (Map.Entry) k.next();
                String name = (String) entry.getKey();
                boolean value = Boolean.valueOf((String)entry.getValue()).booleanValue();
                config.setFeature(name, value);
            }
        }
    }

    private void addTables(QueryDataSet dataSet) {
        if (tableList == null) return;
        for (Iterator k = tableList.iterator(); k.hasNext(); ) {
            String table = (String) k.next();
            dataSet.addTable(table);
        }
    }

    private void addQueries(QueryDataSet dataSet) {
        if (queryList == null) return;
        for (Iterator k = queryList.iterator(); k.hasNext(); ) {
            String query = (String) k.next();
            Matcher m = TABLE_MATCH_PATTERN.matcher(query);
            if (!m.matches()) {
                log.warn(&amp;quot;Unable to parse query. Ignoring &amp;#39;&amp;quot; + query +&amp;quot;&amp;#39;.&amp;quot;);
            }
            else {
                String table = m.group(1);
                // only add if the table has not been added
                if (tableList != null &amp;amp;&amp;amp; tableList.contains(table)) {
                    log.warn(&amp;quot;Table &amp;#39;&amp;quot;+table+&amp;quot;&amp;#39; already added. Ignoring &amp;#39;&amp;quot; + query + &amp;quot;&amp;#39;.&amp;quot;);
                } else {
                    dataSet.addTable(table, query);
                }
            }
        }
    }
}
&lt;/pre&gt;&lt;p&gt;Esta clase sirve como una envoltura compatible con Spring sobre el proceso de extracci&amp;#243;n de DBUnit, aunque no tenga dependencia con Spring (eso es lo bonito de Spring).  Aqu&amp;#237; esta como puedes configurar el extractor en un archivo de beans de Spring.&lt;p&gt;&lt;pre class=&quot;brush:xml;&quot;&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;
&amp;lt;!DOCTYPE beans PUBLIC &amp;quot;-//SPRING//DTD BEAN//EN&amp;quot; &amp;quot;http://www.springframework.org/dtd/spring-beans.dtd&amp;quot;&amp;gt;&lt;p&gt;&amp;lt;beans&amp;gt;
    &amp;lt;bean id=&amp;quot;dataSource&amp;quot; class=&amp;quot;org.springframework.jdbc.datasource.DriverManagerDataSource&amp;quot;&amp;gt;
        &amp;lt;property name=&amp;quot;driverClassName&amp;quot;&amp;gt;&amp;lt;value&amp;gt;com.mysql.jdbc.Driver&amp;lt;/value&amp;gt;&amp;lt;/property&amp;gt;
        &amp;lt;property name=&amp;quot;url&amp;quot;&amp;gt;&amp;lt;value&amp;gt;jdbc:mysql://localhost/bon_app&amp;lt;/value&amp;gt;&amp;lt;/property&amp;gt;
        &amp;lt;property name=&amp;quot;username&amp;quot;&amp;gt;&amp;lt;value&amp;gt;scott&amp;lt;/value&amp;gt;&amp;lt;/property&amp;gt;
        &amp;lt;property name=&amp;quot;password&amp;quot;&amp;gt;&amp;lt;value&amp;gt;tiger&amp;lt;/value&amp;gt;&amp;lt;/property&amp;gt;
    &amp;lt;/bean&amp;gt;

    &amp;lt;bean id=&amp;quot;dbUnitDataExtractor&amp;quot; class=&amp;quot;com.jadecove.bonappetit.test.DBUnitDataExtractor&amp;quot;&amp;gt;
        &amp;lt;property name=&amp;quot;dataSource&amp;quot; ref=&amp;quot;dataSource&amp;quot;/&amp;gt;
        &amp;lt;property name=&amp;quot;dataSetName&amp;quot; value=&amp;quot;dbunit-dataset.xml&amp;quot;/&amp;gt;
        &amp;lt;property name=&amp;quot;tableList&amp;quot;&amp;gt;
            &amp;lt;list&amp;gt;
                &amp;lt;value&amp;gt;recipe&amp;lt;/value&amp;gt;
                &amp;lt;value&amp;gt;recipe_ext_xref&amp;lt;/value&amp;gt;
            &amp;lt;/list&amp;gt;
        &amp;lt;/property&amp;gt;
        &amp;lt;property name=&amp;quot;queryList&amp;quot;&amp;gt;
            &amp;lt;list&amp;gt;
                &amp;lt;value&amp;gt;select * from bon_app_ext.person where first_name = &amp;#39;Bill&amp;#39;&amp;lt;/value&amp;gt;
            &amp;lt;/list&amp;gt;
        &amp;lt;/property&amp;gt;
    &amp;lt;/bean&amp;gt;
&amp;lt;/beans&amp;gt;
&lt;/pre&gt;&lt;p&gt;Ahora puedes extraer datasets de DBUnit recuperando un extractor configurado v&amp;#237;a Spring y llamando al m&amp;#233;todo extract().  La &amp;#250;nica propiedad requerida es la fuente de datos. Haciendolo as&amp;#237; puedes obtener la base de datos completa, pero tambi&amp;#233;n puedes listar tablas y queries espec&amp;#237;ficos. Adem&amp;#225;s, la configuraci&amp;#243;n de Spring te permite agregar otros elementos y propiedades que configuren a DBUnit de diferentes maneras, revisa la API de DBUnit para saber qu&amp;#233; m&amp;#225;s cosas puedes usar al respecto.&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Cuando estas usando queries, DBUnit requiere que se especifique ambos, el nombre de la tabla y el query  Para hacer una configuraci&amp;#243;n m&amp;#225;s sencilla, este extractor usa una expresi&amp;#243;n regular que determina el nombre de la tabla.&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Este extractor se ha usado con una base de datos empresarial compleja local MySQL, pero a trav&amp;#233;s de la configuraci&amp;#243;n de la conexi&amp;#243;n, esquema y caracter&amp;#237;sticas de DBUnit puedes extraer los datos desde la mayor&amp;#237;a de bases de datos.  En mi actual trabajo de consultor&amp;#237;a, yo uso este extractor para obtener datos desde algunas bases de datos complejtas DB2 corriendo en un AS-400 de IBM.&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Este ejercicio no solo ayud&amp;#243; a hacer la vida m&amp;#225;s f&amp;#225;cil con DBUnit, esto me ayud&amp;#243; a entender que tan f&amp;#225;cil es delegar estas tareas mundanas a Spring.&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;&lt;b&gt;Fuente:&lt;/b&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.oreillynet.com/onjava/blog/2005/10/dbunit_made_easy.html&quot;&gt;http://www.oreillynet.com/onjava/blog/2005/10/dbunit_made_easy.html&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://micro-howto.blogspot.com/feeds/2110654876249916135/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://micro-howto.blogspot.com/2010/08/dbunit-lo-hace-facil.html#comment-form' title='1 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/2110654876249916135'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/2110654876249916135'/><link rel='alternate' type='text/html' href='http://micro-howto.blogspot.com/2010/08/dbunit-lo-hace-facil.html' title='DBUnit lo hace facil'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05477259225859568605</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8587897704769639737.post-8236338058667751026</id><published>2010-08-25T12:59:00.000-07:00</published><updated>2011-10-11T09:03:39.198-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="jasper"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="report"/><title type='text'>Configurar JasperReports en Spring 3.0</title><content type='html'>&lt;div&gt;
Cada vez es más sencillo realizar las configuraciones en Spring. &amp;nbsp;A pesar de que la configuración se puede seguir usando de diferentes maneras, en la documentación de referencia de &lt;a href=&quot;http://static.springsource.org/spring/docs/3.0.2.RELEASE/spring-framework-reference/&quot; target=&quot;_blank&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;spring 3&lt;/span&gt;&lt;/a&gt;&amp;nbsp;indica lo siguiente de forma general:&lt;/div&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;Agregar dependencias a tu proyecto&lt;/li&gt;
&lt;li&gt;Configurar el&amp;nbsp;ViewResolver&lt;/li&gt;
&lt;li&gt;Crear el template con iReports&lt;/li&gt;
&lt;li&gt;Configurar las vistas&lt;/li&gt;
&lt;li&gt;Crear el controller&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Ahora vamos a los detalles.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;1. Las dependencias&lt;/span&gt; que nos dice debemos tener son las siguientes:&lt;/div&gt;
&lt;div&gt;
Obviamente el Jasper&lt;/div&gt;
&lt;pre class=&quot;brush:xml;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;dependency&amp;gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;groupId&amp;gt;jasperreports&amp;lt;/groupId&amp;gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;artifactId&amp;gt;jasperreports&amp;lt;/artifactId&amp;gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;version&amp;gt;3.5.3&amp;lt;/version&amp;gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/dependency&amp;gt;
&lt;/pre&gt;
&lt;div&gt;
&lt;div&gt;
•&amp;nbsp;BeanShell (esta no la ocupe)&lt;/div&gt;
&lt;div&gt;
• Commons BeanUtils (esta no la ocupe)&lt;/div&gt;
&lt;div&gt;
• Commons Collections (esta es requerida)&lt;/div&gt;
&lt;pre class=&quot;brush:xml;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;dependency&amp;gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;groupId&amp;gt;commons-collections&amp;lt;/groupId&amp;gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;artifactId&amp;gt;commons-collections&amp;lt;/artifactId&amp;gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;version&amp;gt;3.2.1&amp;lt;/version&amp;gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/dependency&amp;gt;
&lt;/pre&gt;
&lt;div&gt;
• Commons Digester (esta no la ocupe)&lt;/div&gt;
&lt;div&gt;
• Commons Logging (esta es para logear, si ya usas otra, puedes omitirla)&lt;/div&gt;
&lt;div&gt;
• iText (esta es por si generas PDF pero yo no la ocupe)&lt;/div&gt;
&lt;div&gt;
• POI (esta es para generar archivox XLS)&lt;/div&gt;
&lt;/div&gt;
&lt;pre class=&quot;brush:xml;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;dependency&amp;gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;groupId&amp;gt;org.apache.poi&amp;lt;/groupId&amp;gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;artifactId&amp;gt;poi&amp;lt;/artifactId&amp;gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;version&amp;gt;3.2-FINAL&amp;lt;/version&amp;gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/dependency&amp;gt;
&lt;/pre&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;2. Configurar el ViewResolver&lt;/span&gt; via un &lt;u&gt;properties&lt;/u&gt;&lt;/div&gt;
&lt;div&gt;
Antes ya lo había hecho mediante la clase de spring XmlViewResolver para configurar las vistas en un archivo xml (views.xml) pero me pareció más sencillo mediante un archivo properties y por eso difundo esta alternativa.&lt;/div&gt;
&lt;pre class=&quot;brush:xml;&quot;&gt;&amp;lt;bean id=&quot;viewResolver&quot; class=&quot;org.springframework.web.servlet.view.ResourceBundleViewResolver&quot;&amp;gt;
&amp;lt;property name=&quot;basename&quot; value=&quot;views&quot;/&amp;gt;
&amp;lt;/bean&amp;gt;
&lt;/pre&gt;
&lt;div&gt;
Se esta configurando una instancia de ResourceBundleViewResolver que busca por los mapeos de las vistas en un archivo properties con el nombre indicado por la propiedad basename, en este caso views.properties. &amp;nbsp;Donde colocarlo? en el classpath de la aplicación.&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;El contenido del archivo views.properties se explica en el punto 4.&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;3. Crear el Template con &lt;a href=&quot;http://jasperforge.org//website/ireportwebsite/IR%20Website/ir_download.html?header=project&amp;amp;target=ireport&quot;&gt;iReports&lt;/a&gt;&lt;/span&gt;&amp;nbsp;(yo trabajé con la version 3.5.3)&lt;/div&gt;
&lt;div&gt;
Una cosa que se debe tomar en cuenta es que se debe usar la &lt;u&gt;misma version de &lt;b&gt;iReports &lt;/b&gt;que la que se esta usando en el &lt;b&gt;jar&lt;/b&gt;&lt;/u&gt;&lt;b&gt; &lt;/b&gt;como dependencia.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Descarga la aplicacion iReports desde la pagina. &amp;nbsp;Luego instalala y cuando la abras basta con que crees un proyecto en blanco. Este se guarda como un archivo .jrxml que básicamente es un xml plano.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Puedes encontrar un buen manual de uso de iReports &lt;a href=&quot;http://www.adictosaltrabajo.com/tutoriales/tutoriales.php?pagina=ireport&quot;&gt;aqui&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Cuando se compila un archivo jrxml, se genera otro con el mismo nombre .jasper, el cual es necesario indicar en la configuración de spring para que se genere el reporte en el formato deseado.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;4. Configurar las vistas&lt;/span&gt; en el archivo properties.&lt;/div&gt;
&lt;div&gt;
El framework de spring contiene 5 diferentes implementaciones para crear reportes con Jasper, cuatro de ellas corresponden a formatos específios (csv, pdf, html y xls) y una que permite determinar una de las anteriores en tiempo de ejecución (&lt;i&gt;JasperReportsMultiFormatView&lt;/i&gt;).&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Para generar un reporte en pdf, por ejemplo, vamos usar el siguiente contenido en nuestro archivo views.properties:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre class=&quot;brush:plain;&quot;&gt;reciboPago.(class)=org.springframework.web.servlet.view.jasperreports.JasperReportsPdfView
reciboPago.url=/WEB-INF/jasperTemplates/recibo.jasper
reciboPago.reportDataKey=reciboKey
&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
El nombre de la vista es&amp;nbsp;&quot;&lt;b&gt;reciboPago&lt;/b&gt;&quot;, su propiedad &lt;b&gt;class &lt;/b&gt;define la clase de jasper que la mapea, en este caso es la clase que genera PDFs. &amp;nbsp;Es importante que esta propiedad esté configurada como .(class) y no .class debido a que spring busca este valor vía la propiedad y no usando el acostumbrado getter/setter. &amp;nbsp;De esta manera se entiende que si no usamos los paréntesis, spring lo interpreta como el hecho que debe usar el getter/setter de dicha propiedad para acceder a su valor.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
La propiedad &lt;b&gt;url &lt;/b&gt;se utiliza para definir la ruta de acceso al archivo compilado por el programa iReports, en este caso se esta colocando dentro de la carpeta WEB-INF de la aplicación.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Finalmente &lt;b&gt;reportDataKey &lt;/b&gt;define el nombre llave para obtener de un mapa el POJO o DTO que contiene cada valor a mostrar en el reporte. En este caso, se le esta diciendo a spring que su fuente de datos se encuentra en la llave &quot;reciboKey&quot; del mapa a recibir (ver punto 5, sobre el controller).&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;5. Crear el controller.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
Es sumamente sencillo generar un controller en spring mediante las anotaciones:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre class=&quot;brush:java;&quot;&gt;@Controller
@RequestMapping(&quot;/pago&quot;)
public class PagoController {
&amp;nbsp;&amp;nbsp; &amp;nbsp;@RequestMapping(value=&quot;/recibo&quot;, method=RequestMethod.GET)
&amp;nbsp;&amp;nbsp; &amp;nbsp;public String generarReciboPago(ModelMap modelMap, HttpServletResponse response) {
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;List&amp;lt;ReciboDTO&amp;gt; lista = new ArrayList&amp;lt;ReciboDTO&amp;gt;(1);
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ReciboPagoJasperDTO dto = new ReciboDTO();
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dto.setMonto(&quot;6789.0&quot;);
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dto.setNombre(&quot;Pedro Romero&quot;);
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;lista.add(dto);
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;response.setHeader(&quot;Content-type&quot;, &quot;application/pdf&quot;);
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;response.setHeader(&quot;Content-Disposition&quot;,&quot;attachment; filename=\&quot;recibo.pdf\&quot;&quot;);
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;JRBeanCollectionDataSource jrbean = new JRBeanCollectionDataSource(lista, false);
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;modelMap.put(&quot;reciboKey&quot;, jrbean);
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return(&quot;reciboPago&quot;);
&amp;nbsp;&amp;nbsp; &amp;nbsp;}
}
&lt;/pre&gt;
&lt;br /&gt;
&lt;div&gt;
@Controller define a la clase como un controller y @RequestMapping define una uri desde la cual se puede acceder a nuestro controller cuando nuesta aplicación ya está montada en un server. &amp;nbsp;Si la aplicacion levanta en un contexto &quot;proyecto&quot; y el servidor levanta en un puerto local 8080, podriamos acceder a nuestro controller anterior como: &quot;&lt;a href=&quot;http://localhost:8080/proyecto/pago/recibo&quot;&gt;http://localhost:8080/proyecto/pago/recibo&lt;/a&gt;&quot;, aunque esto es asunto de otro tema, basta con observar como se concatenan los valores del contexto de la aplicación, y de las anotaciones @RequestMapping de clase y método usado. &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
En este caso&amp;nbsp;ReciboDTO es el pojo usado para portar los valores que alimentaran el reporte, se inserta en una instancia de JRBeanCollectionDataSource y luego se agrega al mapa del modelo con el key:&amp;nbsp;reciboKey (observa que es el mismo metodo que usamos en el properties.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Finalmente se devuelve una cadena que indica el nombre de la vista configurada en el properties, la cual esta mapeada a la clase jasper:&amp;nbsp;JasperReportsPdfView.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Notas importantes:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
Spring nos provee de la capacidad de agregar elementos dentro de una Collection, dado que internamente Spring los envuelve dentro de un objeto JRBeanCollecionDataSource &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;(implementa interface JRDataSource)&lt;/span&gt;, también nos da la capacidad de agregar mas beans al modelo en diferentes llaves del mapa, ejemplo:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre class=&quot;brush:java;&quot;&gt;modelMap.put(&quot;reciboKey&quot;, jrbean);
modelMap.put(&quot;myKey1&quot;, jrbean1);
modelMap.put(&quot;personal2&quot;, jrbean2);
&lt;/pre&gt;
&lt;div&gt;
El punto está en que si la vista no esta apuntando a uno de estas llaves en particular (mediante la propiedad de la vista:&amp;nbsp;reportDataKey), usará la primera instancia de&amp;nbsp;JRDataSource que encuentre.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://micro-howto.blogspot.com/feeds/8236338058667751026/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://micro-howto.blogspot.com/2010/08/configurar-jasperreports-en-spring-30.html#comment-form' title='11 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/8236338058667751026'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/8236338058667751026'/><link rel='alternate' type='text/html' href='http://micro-howto.blogspot.com/2010/08/configurar-jasperreports-en-spring-30.html' title='Configurar JasperReports en Spring 3.0'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05477259225859568605</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8587897704769639737.post-3215266206695009247</id><published>2010-08-24T11:38:00.001-07:00</published><updated>2010-08-24T13:27:48.104-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="email"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="servidores"/><title type='text'>Servidor de correos personal con postfix - Spambayes</title><content type='html'>Éste es el último post de &#39;&lt;a href=&quot;http://micro-howto.blogspot.com/2010/08/servidor-de-correo-personal-con-postfix.html&quot;&gt;Servidor de correos personal con postfix&lt;/a&gt;&#39;. Ya configurado el mismo (&lt;a href=&quot;http://micro-howto.blogspot.com/2010/08/servidor-de-correo-personal-con-postfix_24.html&quot;&gt;MTA&lt;/a&gt;, &lt;a href=&quot;http://micro-howto.blogspot.com/2010/08/servidor-de-correo-personal-con-postfix_9223.html&quot;&gt;MDA&lt;/a&gt;, &lt;a href=&quot;http://micro-howto.blogspot.com/2010/08/servidor-de-correos-personal-con.html&quot;&gt;MUA&lt;/a&gt;) y recuperando automáticamente correos con &lt;a href=&quot;http://micro-howto.blogspot.com/2010/08/servidor-de-correos-personal-con_24.html&quot;&gt;Fetchmail&lt;/a&gt;, sólo queda velar por la seguridad del servidor...&lt;br /&gt;
&lt;br /&gt;
Se llama spam o correo basura a los mensajes no solicitados, no deseados o de remitente desconocido, habitualmente de tipo publicitario, enviados en grandes cantidades (incluso masivas) que perjudican de alguna o varias maneras al receptor.&lt;br /&gt;
&lt;br /&gt;
El spam se puede convertir en una incidencia de seguridad por varias razones:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;ocupa espacio en las bandejas de entrada de los receptores. En los casos de cuentas con tamaño limitado esto es un problema.&lt;/li&gt;
&lt;li&gt;en sistemas vulnerables, el spam suele llegar también acompañado de scripts perniciosos, a ejecutar en el sistema receptor, o un link engañoso para infectar la máquina cliente.&lt;/li&gt;
&lt;li&gt;también puede incluir información engañosa con la cual realizar un robo de información confidencial, engañando al usuario incauto&lt;/li&gt;
&lt;/ul&gt;Claro está, la mejor política de seguridad en estos casos es ser prudente y no dar click y descargar todo lo que llegue a la bandeja de entrada del correo.&lt;br /&gt;
&lt;br /&gt;
Sin embargo, los servidores de correo también cuentan con protección extra ante esta problemática. En nuestro caso, vamos a configurar Spambayes como detector de spam. Existen muchos otros programas que realizan funciones similares, el más famoso es Spamassasin. Sin embargo en este tutorial nos enfocaremos en Spambayes.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Instalación&lt;/b&gt;&lt;br /&gt;
Spambayes se puede descargar desde su &lt;a href=&quot;http://spambayes.sourceforge.net/&quot;&gt;sitio oficial&lt;/a&gt;, o puede instalarse con la distribución. En Debian el paquete se llama &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;spambayes&lt;/span&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Configuración&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Spambayes es una serie de scripts en Python que utilizan algoritmos de probabilidad para clasificar el correo, si es spam (correo no deseado), ham (correo seguro) o inseguro (no se sabe si es o no spam). Debe entrenarse constantemente la red bayesiana en la que se basa el software para refinar cada vez más su comportamiento.&lt;br /&gt;
&lt;br /&gt;
En la sección del MDA (Procmail) ya creamos los subdirectorios necesarios para que funcione Spambayes, así que continuaremos con la configuración. Como parte de la configuración, es necesario configurar Spambayes, pero también Procmail para que sepa dónde colocar los correos identificados, y además mutt para agregar unas cuantas utilidades que pueden servir para tratar con los distintos tipos de mensajes.&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&lt;i&gt;&lt;b&gt;1) Spambayes&lt;/b&gt;&lt;/i&gt;&lt;/blockquote&gt;&lt;ul&gt;&lt;li&gt;El subdirectorio ~/Mail contendrá nuestro correo seguro.&lt;/li&gt;
&lt;li&gt;El subdirectorio ~/.CaughtSpam contendrá el correo que Procmail defina como Spam de acuerdo a lo que Spambayes le indique.&lt;/li&gt;
&lt;li&gt;El subdirectorio ~/.Unsure contendrá correo que Spambayes no sepa clasificar.&lt;/li&gt;
&lt;li&gt;Para propósitos de entrenamiento, en ~/Mail/.MissedHam y ~/Mail/.MissedSpam iremos colocando correos que lleguen a las bandejas equivocadas, de forma que a la siguiente ronda de entrenamiento de Spambayes, sepa en adelante como clasificar dichos correos.&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
El script de entrenamiento es el siguiente: ~/Mail/train_spambayes&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;pre&gt;&lt;span style=&quot;font-size: small;&quot;&gt;#!/bin/sh
# Script to copy mail missed spam and ham into correct folders
# and run sb_mboxtrain.py to train spambayes
# Training will be done only on missed spam and ham

# Files we saved or bounced may be in the new directory
# We want them in cur for training
mv /home/usuario/Mail/.MissedSpam/new/* \
 /home/usuario/Mail/.MissedSpam/cur 2&amp;gt;/dev/null
mv /home/usuario/Mail/.MissedHam/new/* \
 /home/usuario/Mail/.MissedHam/cur 2&amp;gt;/dev/null
/usr/bin/sb_mboxtrain.py -d /home/usuario/.hammie.db \
 -g /home/usuario/Mail/.MissedHam \
 -s /home/usuario/Mail/.MissedSpam&lt;/span&gt;&lt;/pre&gt;&lt;/blockquote&gt;Obviamente, hay que editarlo según la cuenta de usuario y directorios usados en el servidor. Este script debe ser ejecutable:&lt;br /&gt;
&lt;blockquote&gt;&lt;div style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;$ chmod +x ~/Mail/train_spambayes &lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;Además hay que crear la base de datos en donde Spambayes se entrenará:&lt;br /&gt;
&lt;blockquote&gt;&lt;div style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;$ /usr/bin/sb_filter.py -d $HOME/.hammie.db -n      &lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;lo cual creará el archivo &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;.hammie.db&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Por último, será útil que el servidor se dedique automáticamente a entrenar la red bayesiana cada cierto tiempo sin intervención del usuario, para lo que creamos un cronjob con&lt;br /&gt;
&lt;blockquote&gt;&lt;div style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;$ crontab -e&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;y colocamos el cronjob: &lt;br /&gt;
&lt;blockquote&gt;&lt;div style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;21 3 * * * ~/Mail/train_spambayes&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;que entrenará a las 3:21am de todos los días.&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&lt;b&gt;&lt;i&gt;2) Procmail&lt;/i&gt;&lt;/b&gt;&lt;/blockquote&gt;Ahora hay que decirle a Procmail que, dependiendo lo que diga la base de datos con la red bayesiana entrenada, clasifique los correos entrantes en los subdirectorios que creamos previamente. Editar &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;.procmailrc&lt;/span&gt; para que quede así (editarlo para que coincida con los directorios y usuario en el servidor):&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&lt;pre style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;SHELL=/bin/sh
MAILDIR=$HOME/Mail
DEFAULT=$HOME/Mail/
CAUGHT_SPAM=$MAILDIR/.CaughtSpam/
UNSURE=$MAILDIR/.Unsure/
  
#Spambayes process
:0fw:hamlock
| /usr/bin/sb_filter.py -d /home/usuario/.hammie.db

:0
* ^X-Spambayes-Classification: spam
${CAUGHT_SPAM}

:0
* ^X-Spambayes-Classification: unsure
${UNSURE}

# Catches everything else.
# Anything left over goes into the DEFAULT folder
:0:
${DEFAULT}&lt;/span&gt;&lt;/pre&gt;&lt;/blockquote&gt;Lo que hicimos fue decirle a Procmail que con el script &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;sb_filter.py&lt;/span&gt; clasifique el correo, y lo mande a los directorios de &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;CaughtSpam&lt;/span&gt;, &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;Unsure&lt;/span&gt; o el &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;Default&lt;/span&gt; (&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;~/Mail&lt;/span&gt;).&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&lt;i&gt;&lt;b&gt;3) mutt&lt;/b&gt;&lt;/i&gt;&lt;/blockquote&gt;Por último, si observamos la bandeja de entrada con mutt, es probable que encontremos correo que deseemos clasificar como Spam. La opción manual sería mover manualmente estos correos a los directorios creados, a través de los comandos de mutt.&lt;br /&gt;
&lt;br /&gt;
Sin embargo, esto no es funcional, por lo que editaremos el archivo &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;.muttrc&lt;/span&gt; para agregar un poco de automatización que facilite este proceso.Editarlo para que quede así:&lt;br /&gt;
&lt;blockquote&gt;&lt;pre&gt;&lt;span style=&quot;background-color: #eeeeee; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;set editor=&quot;emacs&quot;&lt;/span&gt;
set folder = /home/usuario/Mail
&lt;/span&gt;&lt;span style=&quot;background-color: #eeeeee; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;set signature=&quot;~/.signature&quot;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;my_hdr From: Nombre Usuario&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: #eeeeee; font-size: small;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;background-color: #eeeeee; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;# Don&#39;t ask to move read message&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;set move=no&lt;/span&gt;

&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;# Header control   h displays header when in pager&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;# I want to only see the unignored by default&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;ignore *                                        # weed out all headers&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;unignored date from: to cc subject organization  # now show me these...&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: #eeeeee; font-size: small;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;# Setting these macros is going to save us all of that time I was&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;#  talking about.  Now instead of having to type all of those&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;#  characters to move the mail around we will can just tag the messages&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;#  and, for the instance of spam in your inbox, hit &#39;S&#39;.&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  &lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;# Move mail to correct directories&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;macro   index   S       &quot;;s~/Mail/.MissedSpam\r\r$\r&quot;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;macro   pager   S       &quot;;s~/Mail/.MissedSpam\r\r$\r&quot;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;macro   index   H       &quot;;C~/Mail/.MissedHam\r\r;s~/Mail\r\r$\r&quot;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;macro   pager   H       &quot;;C~/Mail/.MissedHam\r\r;s~/Mail\r\r$\r&quot;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;macro   index   M       &quot;;s~/Mail/\r&quot;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;macro   pager   M       &quot;;s~/Mail/\r&quot;&lt;/span&gt;

&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;# This is how we are going to move around to the different&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;#  mailboxes.  Hitting &#39;alt-1&#39; will take us to our inbox&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;#  &#39;alt-2&#39; and we are looking at the mail Spambayes classified&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;#  as spam.  etc.&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;#  The extra mailboxes I have in here are for mailing lists I am on.&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;#  I will show the procmail recipe that automatically puts&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;#  the mailing list mail into its correct mailbox further down.&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  &lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;# Move to mailboxes quickly&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;macro   index   &lt;esc&gt;1  &quot;c~/Maildir\r&quot;&lt;/esc&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;macro   pager   &lt;esc&gt;1  &quot;c~/Maildir\r&quot;&lt;/esc&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;macro   index   &lt;esc&gt;2  &quot;c~/Maildir/.CaughtSpam\r&quot;&lt;/esc&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;macro   pager   &lt;esc&gt;2  &quot;c~/Maildir/.CaughtSpam\r&quot;&lt;/esc&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;macro   index   &lt;esc&gt;3  &quot;c~/Maildir/.Unsure\r&quot;&lt;/esc&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;macro   pager   &lt;esc&gt;3  &quot;c~/Maildir/.Unsure\r&quot;&lt;/esc&gt;&lt;/span&gt;

&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;# Training Maildirs for Spam and Ham&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;macro   index   &lt;esc&gt;8  &quot;c~/Maildir/.MissedSpam\r&quot;&lt;/esc&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;macro   pager   &lt;esc&gt;8  &quot;c~/Maildir/.MissedSpam\r&quot;&lt;/esc&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;macro   index   &lt;esc&gt;9  &quot;c~/Maildir/.MissedHam\r&quot;&lt;/esc&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;macro   pager   &lt;esc&gt;9  &quot;c~/Maildir/.MissedHam\r&quot;&lt;/esc&gt;&lt;/span&gt;

&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;# Setting these colors makes it easy to tell which emails&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;#  Spambayes has missed.&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;# Turn spam red and unsure green&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;color index red default &quot;~h &#39;^X-Spambayes-Classification: spam&#39;&quot;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;color index green default &quot;~h &#39;^X-Spambayes-Classification: unsure&#39;&quot;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;# Turn gmail mail brightblue&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;#  (My regular expression is not correct here.  I think that it&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;#   is looking anywhere in the header for my gmail address&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;#   instead of what I wanted..  Just in the &#39;To:&#39;.&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;#   It still works for the most part)&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;color index brightblue default &quot;~h &#39;(^)*my_name@gmail.com&#39;&lt;/span&gt;

&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;# Lets set more colors to make things look beautiful.  Judging by&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;#  my title for this section I must have had bad feelings towards&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;#  colors when I added this.&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;#Color crap&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;color index brightwhite default ~N       # color for new messages&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;color status black yellow&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;color attachment brightyellow default    # file attachments&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;color search brightred default           # search matches&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;color quoted brightyellow default        # quoted text in replies&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;color quoted1 magenta default            # quoted text in replies&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;color body cyan default &quot;((ftp|http|https)://|news:)[^ &amp;gt;)\&quot;\t]+&quot;   # URLs&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;color body cyan default &quot;[-a-z_0-9.+]+@[-a-z_0-9.]+&quot;               # email&lt;/span&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;Con esto conseguimos que mutt nos proporcione lo siguiente:&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;Si estamos ante un mensaje que debió clasificarse como Spam y no lo fue (en la bandeja de entrada o en Unsure), tecleando &#39;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;S&lt;/span&gt;&#39; se mueve a los directorios correctos (CaughtSpam y MissedSpam) en espera del siguiente entrenamiento.&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/li&gt;
&lt;li&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;Si estamos ante un mensaje que debió clasificarse como Ham y no lo fue (en la bandeja de Spam o en Unsure), tecleando &#39;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;H&lt;/span&gt;&#39; se mueve a los directorios correcots (bandeja de entrada y MissedHam) en espera del siguiente entrenamiento.&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/li&gt;
&lt;li&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;Podemos seleccionar varios mensajes a la vez con el comando &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&#39;&lt;/span&gt;t&lt;/span&gt;&#39;. &lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/li&gt;
&lt;li&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;Esc + 1&lt;/span&gt; nos lleva directamente a la bandeja de entrada.&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/li&gt;
&lt;li&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;Esc + 2&lt;/span&gt; al spam&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/li&gt;
&lt;li&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;Esc + 3&lt;/span&gt; a Unsure&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/li&gt;
&lt;li&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;Esc + 8&lt;/span&gt; a MissedSpam&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/li&gt;
&lt;li&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;Esc + 9&lt;/span&gt; a MissedHam&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/li&gt;
&lt;li&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;Además, dependiendo el tipo de correo, mutt utilizará colores (si la consola los soporta) para mostrar los distintos tipos de mensajes.&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt; &lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;Spambayes es una herramienta bastante poderosa, que también permite entrenar para clasificar correos con base en otros criterios, por ejemplo si estuviéramos suscritos a un mailing list, colocar los correos de dicha lista de correos en un directorio particular; o si recibiéramos correos de ofertas de trabajo para colocar todos ellos en otro subdirectorio, etc. &lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;br /&gt;
&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;br /&gt;
&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;br /&gt;
&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;br /&gt;
&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;br /&gt;
&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;br /&gt;
&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;br /&gt;
&lt;b&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;Notas Finales&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/b&gt;&lt;br /&gt;
&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;Con esto damos por terminado el tutorial para levantar un servidor de correos personal utilizando Postfix.&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;br /&gt;
&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;br /&gt;
&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;br /&gt;
&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;Aún quedan detalles por afinar, que podrían investigarse. Si algún día tengo el tiempo, tal vez haga tutoriales para los mismos:&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;Levantar un servidor de correos que pueda usar en una organización, a través de una LAN o internet, es cuestión que debe configurarse en Postfix. La documentación del sitio oficial de este programa ofrece varios escenarios para lograr distintas configuraciones deseadas.&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/li&gt;
&lt;li&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;Levantar servidores POP e IMAP, con Courier por ejemplo, para poder leer los correos que lleguen a la cuenta en el servidor a través de internet, con Squirrelmail, con un dispositivo móvil, con un cliente convencional en otra máquina, o con Fetchmail en otra máquina cliente.&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/li&gt;
&lt;li&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;Ampliar el funcionamiento de Spambayes para que clasifique correos con base en criterios como el uso de mailing lists o aquellos que pertenezcan a mis búsquedas de empleo, por ejemplo.&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;&lt;esc&gt;Espero hayas disfrutado siguiendo este tutorial, como yo haciéndolo. Y sobre todo, levantando tu propio servidor de correos. A mi me llevó meses enterarme bien de cómo funciona todo esto, y lograr que funcionara correctamente. Ojalá esta pequeña guía sirva de ayuda para el que se aventure en un camino similar...&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;&lt;/esc&gt;</content><link rel='replies' type='application/atom+xml' href='http://micro-howto.blogspot.com/feeds/3215266206695009247/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://micro-howto.blogspot.com/2010/08/servidor-de-correos-personal-con_9803.html#comment-form' title='8 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/3215266206695009247'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/3215266206695009247'/><link rel='alternate' type='text/html' href='http://micro-howto.blogspot.com/2010/08/servidor-de-correos-personal-con_9803.html' title='Servidor de correos personal con postfix - Spambayes'/><author><name>Javier Novoa C. (Stitch)</name><uri>http://www.blogger.com/profile/13132360799518616672</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_Hp7QjnMlZmKlVQDHZsaIQ9YnmWC4sel26ibs9FHig1ffPukjGQKgnGf4o6JV5MJYRfqEo5UmWmd3VQj0ZkCTBv1muBIu3QTs5jCkZ2_DD7GPa_x32zdIT0oFvFRLmrU/s220/55857695_2385261704837842_7917967493749014528_n.jpg'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8587897704769639737.post-1404924402978019601</id><published>2010-08-24T11:38:00.000-07:00</published><updated>2010-08-24T13:27:48.105-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="email"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="servidores"/><title type='text'>Servidor de correos personal con postfix - Fetchmail</title><content type='html'>Con este post continuamos con el &#39;&lt;a href=&quot;http://micro-howto.blogspot.com/2010/08/servidor-de-correo-personal-con-postfix.html&quot;&gt;Servidor de correos personal con postfix&lt;/a&gt;&#39;. Una vez configurados el &lt;a href=&quot;http://micro-howto.blogspot.com/2010/08/servidor-de-correo-personal-con-postfix_24.html&quot;&gt;MTA&lt;/a&gt;, el &lt;a href=&quot;http://micro-howto.blogspot.com/2010/08/servidor-de-correo-personal-con-postfix_9223.html&quot;&gt;MDA&lt;/a&gt; y el &lt;a href=&quot;http://micro-howto.blogspot.com/2010/08/servidor-de-correos-personal-con.html&quot;&gt;MUA&lt;/a&gt;, quedan detalles por afinar...&lt;br /&gt;
&lt;br /&gt;
Fetchmail es un programa para recuperar correos desde servidores remotos. En realidad no es más que un cliente para los protocolos POP, IMAP, entre otros, que en lugar de desplegar los mensajes de correo (como cualquier cliente convencional de estos protocolos) los descarga para que sean recibidos en la máquina especificada y leídos posteriormente.&lt;br /&gt;
&lt;br /&gt;
Es útil para conexiones de internet intermitentes (que no siempre están en línea), o para mantener una bandeja de entrada sincronizada con un servicio de correo remoto, como será el caso de este tutorial. &lt;br /&gt;
&lt;br /&gt;
Obra del renombrado hacker Eric S. Raymond, Fetchmail es incluso el ejemplo clásico utilizado en su escrito &#39;La Catedral y el Bazar&#39; para ilustrar cómo el proceso de desarrollo open source es un éxito, y no un caso aislado como se pensaba hasta el momento del kernel Linux. Este escrito fue de hecho la chispa que encendió el furor por el open source en el mundo empresarial, con lo que Netscape liberó el código fuente de su navegador (del que Mozilla Firefox es su heredero), y demás aventuras y desventuras del mundo del open source y el software libre desde entonces (1998)...&lt;br /&gt;
&lt;br /&gt;
Aquí lo vamos a utilizar para recuperar los correos de una cuenta de Gmail (aunque podría ser cualquier otra, ¡o varias! siempre y cuando acepten los protocolos POP, IMAP o similares) cada cierto tiempo.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Instalación&lt;/b&gt;&lt;br /&gt;
Fetchmail se puede descargar desde su &lt;a href=&quot;http://fetchmail.berlios.de/&quot;&gt;sitio oficial&lt;/a&gt;. O como siempre, puede instalarse desde la distribución de GNU/Linux que se tenga. En el caso de Debian el paquete es &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;fetchmail&lt;/span&gt;.&lt;br /&gt;
&lt;br /&gt;
Si se desea también se puede instalar el paquete &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;fetchmailconf&lt;/span&gt; que es un script en Python, modo gráfico, para configurar fácilmente el programa.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Configuración&lt;/b&gt;&lt;br /&gt;
Aunque se utilice fetchmailconf, aquí describiremos el tras bambalinas de la configuración de Fetchmail, para entender cómo funciona.&lt;br /&gt;
&lt;br /&gt;
Todo se hace en archivos RC, que pueden ser por usuario (&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;~/.fetchmailrc&lt;/span&gt;) o de todo el sistema (&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;/etc/fetchmailrc&lt;/span&gt;).&lt;br /&gt;
&lt;br /&gt;
El archivo deberá contener las siguientes líneas:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&lt;span style=&quot;background-color: #eeeeee; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;set postmaster &quot;postmaster&quot;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #eeeeee; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;set bouncemail&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #eeeeee; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;set no spambounce&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #eeeeee; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;set properties &quot;&quot;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #eeeeee; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;set daemon 600&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: #eeeeee; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;poll pop.gmail.com with proto POP3 port 995&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #eeeeee; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; user &#39;gmailuser@gmail.com&#39; there with ssl with&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; password &#39;password&#39; is &#39;usuarioservidor&#39; here options &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; keep&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;Obviamente, hay que editar la información pertinente para la cuenta de Gmail, el password y el nombre de usuario del sistema.&lt;br /&gt;
&lt;br /&gt;
La línea &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;daemon&lt;/span&gt; establece que fetchmail quedará ejecutándose en segundo plano, y que revisará por nuevos correos en la o las cuentas especificadas cada 600 segundos (10 minutos).&lt;br /&gt;
&lt;br /&gt;
Se pueden tener tantas líneas &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;poll&lt;/span&gt; como se desee, una por cuenta de correo que se desee sincronizar.&lt;br /&gt;
&lt;br /&gt;
Más información se encuentra en la documentación de Fetchmail.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Uso&lt;/b&gt;&lt;br /&gt;
Bastará habilitar el script de inicio del servicio de Fetchmail en &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;/etc/init.d&lt;/span&gt; para comenzar a ejecutarlo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
¡Listo! el servidor de correo personal ya está tomando forma. Cada 600 segundos (o el tiempo que se hubiera especifidado), Fetchmail debería de revisar la bandeja de la cuenta establecida, y en caso de encontrar nuevos correos, descargarlos. De hecho en el archivo de log de Postfix (&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;/var/log/mail.info&lt;/span&gt;) debería de observarse actividad, cada 600 segundos cuando se despierte Fetchmail y se vuelva a dormir, además de cuando llegue a descargar correos.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Por último, vamos a enfocarnos en la seguridad, en el caso particular de este tutorial, a &lt;a href=&quot;http://micro-howto.blogspot.com/2010/08/servidor-de-correos-personal-con_9803.html&quot;&gt;protegernos del spam&lt;/a&gt;...</content><link rel='replies' type='application/atom+xml' href='http://micro-howto.blogspot.com/feeds/1404924402978019601/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://micro-howto.blogspot.com/2010/08/servidor-de-correos-personal-con_24.html#comment-form' title='2 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/1404924402978019601'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/1404924402978019601'/><link rel='alternate' type='text/html' href='http://micro-howto.blogspot.com/2010/08/servidor-de-correos-personal-con_24.html' title='Servidor de correos personal con postfix - Fetchmail'/><author><name>Javier Novoa C. (Stitch)</name><uri>http://www.blogger.com/profile/13132360799518616672</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_Hp7QjnMlZmKlVQDHZsaIQ9YnmWC4sel26ibs9FHig1ffPukjGQKgnGf4o6JV5MJYRfqEo5UmWmd3VQj0ZkCTBv1muBIu3QTs5jCkZ2_DD7GPa_x32zdIT0oFvFRLmrU/s220/55857695_2385261704837842_7917967493749014528_n.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8587897704769639737.post-2517629732287405323</id><published>2010-08-24T11:37:00.002-07:00</published><updated>2010-08-24T13:27:48.106-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="email"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="servidores"/><title type='text'>Servidor de correos personal con postfix - MUA</title><content type='html'>Continuamos con los posts dedicados a configurar un &#39;&lt;a href=&quot;http://micro-howto.blogspot.com/2010/08/servidor-de-correo-personal-con-postfix.html&quot;&gt;Servidor de correo personal con postfix&lt;/a&gt;&#39;.&lt;br /&gt;
&lt;br /&gt;
Previamente ya configuramos el &lt;a href=&quot;http://micro-howto.blogspot.com/2010/08/servidor-de-correo-personal-con-postfix_24.html&quot;&gt;MTA, Mail Transfer Agent&lt;/a&gt; y el &lt;a href=&quot;http://micro-howto.blogspot.com/2010/08/servidor-de-correo-personal-con-postfix_9223.html&quot;&gt;MDA, Mail Delivery Agent&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Ahora vamos por el MUA, Mail User Agent, el cliente para leer y enviar correos. Normalmente esta parte es la que la gente toma como si fuera todo el sistema de correo, pero como ya hemos podido ver se trata de toda una infraestructura de sistemas.&lt;br /&gt;
&lt;br /&gt;
En este tutorial vamos a configurar mutt como cliente de correo. Se trata de un cliente de consola muy sencillo pero muy completo a la vez. La razón es que su configuración es sencilla para los propósitos de este tutorial. Además, su sencillez permite entender un poco más cómo funciona el correo electrónico, que es de lo que se trata aquí.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Si lo que se pretende es utilizar algún otro software como cliente de email, habrá que hacer un poco de investigación para, por ejemplo, acceder al buzón desde Thunderbird, Evolution, Outlook, etc. Sin embargo, el proceso no debe de ser complicado.&lt;br /&gt;
&lt;br /&gt;
En algún tutorial posterior, hablaremos de los protocolos POP e IMAP, que permitirán ver el correo de nuestro servidor personal desde cualquier cliente conectado a internet, desde clientes web (como Squirrelmail) hasta el uso de cualquier cliente que soporte estos protocolos (como en un dispositivo móvil), pasando también, claro, por los clientes convencionales ya mencionados, pero conectándose vía internet al servidor.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Instalación&lt;/b&gt;&lt;br /&gt;
mutt se instala en Debian con el paquete &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;mutt&lt;/span&gt;. También puede descargarse desde su &lt;a href=&quot;http://www.mutt.org/&quot;&gt;sitio oficial&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Configuración&lt;/b&gt;&lt;br /&gt;
Lo primero es establecer una variable de entorno para que mutt sepa en donde buscar el email a leer:&lt;br /&gt;
&lt;blockquote style=&quot;background-color: #eeeeee;&quot;&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;$ export MAIL=&#39;~/Mail&#39;&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;obviamente, el nombre del subdirectorio cambia de acuerdo a lo configurado en Postfix. Esta línea no basta con ejecutarla y ya, debería de colocarse en algún script, como &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;~/.bashrc&lt;/span&gt; para que se ejecute cada vez que se inicia una nueva sesión de consola, de lo contrario sólo durará mientras dure la sesión actual.&lt;br /&gt;
&lt;br /&gt;
Otra manera de configurarlo es através de un archivo de configuración por usuario: ~/.muttrc&lt;br /&gt;
que debería de incluir esta línea:&lt;br /&gt;
&lt;blockquote&gt;&lt;span style=&quot;background-color: #eeeeee; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;set folder = /home/jstitch/Mail&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;Si somos usuarios adictos a la consola, seguramente tendremos un editor de preferencia... En mi caso uso Emacs. El editor de preferencia se configura con la siguiente línea: &lt;br /&gt;
&lt;blockquote&gt;&lt;span style=&quot;background-color: #eeeeee; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;set editor=emacs&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;
Esto es importante: como todos los buenos programas que siguen la filosofía Unix, mutt se especializa en una sola cosa: es un MUA, un cliente de correo. ¡Ni siquiera cuenta con su propio editor de texto! De esta forma delega la responsabilidad de redactar un correo al editor que se defina, o al que esté definido por defecto en el sistema. Con esto además, el usuario será libre de elegir su propio editor, para que se sienta más a gusto. En un cliente de correo convencional por lo general se cuenta con el editor que proporcione el cliente, ¡que poca libertad de elección!&lt;br /&gt;
&lt;br /&gt;
Otras configuraciones interesantes para mutt (¡y hay muchas más! basta ver la documentación en el sitio oficial...)&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&lt;div style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;set signature=&quot;~/.signature&quot;&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;br /&gt;
establece el archivo que contiene la firma predefinida para los correos enviados. Habrá que crear dicho archivo y ponerle algún contenido. Como todos los verdaderos buenos clientes de correo, mutt agrega un par de guiones &#39;--&#39; antes de la firma para que quien lea los correos sepa que se trata de la firma, y no más del cuerpo del correo.&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&lt;span style=&quot;background-color: #eeeeee; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;my_hdr From: Javier Novoa C. &lt;jstitch@invernalia.homelinux.net&gt;&lt;/jstitch@invernalia.homelinux.net&gt;&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;/blockquote&gt;&lt;br /&gt;
&lt;br /&gt;
establece el header From que llevarán los correos a enviar con mutt&lt;br /&gt;
&lt;br /&gt;
Además, mutt puede utilizar con el archivo &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;~/.muttprintrc&lt;/span&gt; que permite definir instrucciones para imprimir los correos.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Uso&lt;/b&gt;&lt;br /&gt;
mutt se ejecuta en consola. Para lanzarlo hay que teclear&lt;br /&gt;
&lt;blockquote&gt;&lt;div style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;mutt&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;aparecerá una pantalla ocupando toda la consola, pues mutt utiliza &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;ncurses&lt;/span&gt;.&lt;br /&gt;
&lt;br /&gt;
Los comandos que acepta mutt son básicamente letras para realizar acciones.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;m&lt;/span&gt; permite enviar un mail, solicitará el destino, el asunto y luego abrirá el editor para redactar el mensaje. Basta guardarlo en donde lo haya solicitado mutt y salir para que se tenga el email redactado. Luego con &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;Y&lt;/span&gt; se enviará el correo.&lt;br /&gt;
&lt;br /&gt;
La pantalla está casi totalmente ocupada por la bandeja de entrada en &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;~/Mail&lt;/span&gt; (o donde sea que se haya configurado). Si hay correos, estos aparecerán aquí. Con las flechas se puede navegar para seleccionar un mensaje, y con INTRO para verlo.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;D&lt;/span&gt; permite borrar el mensaje seleccionado&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;q&lt;/span&gt; permite salir&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;?&lt;/span&gt; proporciona la ayuda, más completa que esta, del programa.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Notas finales&lt;/b&gt;&lt;br /&gt;
Y ahora es tiempo de terminar de configurar el MTA, como se había dicho en el post correspondiente. Aún faltaba el detalle de permitir que Gmail enviara correos a nombre del servidor, sin usar el remitente con la dirección de Gmail.&lt;br /&gt;
&lt;br /&gt;
Ya se explicó cómo configurar Gmail para esto, pero faltaba validar el proceso.&lt;br /&gt;
Si todo se realizó correctamente, tuvo que haber llegado a la bandeja de entrada un correo de parte de Gmail para validar. Habrá que acceder a una URL para terminar la validación, o copiar un código de verificación y usarlo en la misma configuración de Gmail para terminar.&lt;br /&gt;
&lt;br /&gt;
Hecho esto, la dirección de correo especificada, usuario@dominio, deberá de aparecer en la lista de orígenes válidos de Gmail, y en adelante los correos enviados desde el servidor deberían de llegar a sus destinos como proviniendo del servidor, no de Gmail (aún cuando Gmail se siga usando como relay para poder enviar dichos correos).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Y listo, con esto ya se tiene un sistema de correo funcional para enviar y recibir correos. Aún vamos a configurar un par de programas que resultarán muy útiles para terminar este tutorial.&lt;br /&gt;
&lt;br /&gt;
Empecemos con &lt;a href=&quot;http://micro-howto.blogspot.com/2010/08/servidor-de-correos-personal-con_24.html&quot;&gt;Fetchmail&lt;/a&gt;...</content><link rel='replies' type='application/atom+xml' href='http://micro-howto.blogspot.com/feeds/2517629732287405323/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://micro-howto.blogspot.com/2010/08/servidor-de-correos-personal-con.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/2517629732287405323'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8587897704769639737/posts/default/2517629732287405323'/><link rel='alternate' type='text/html' href='http://micro-howto.blogspot.com/2010/08/servidor-de-correos-personal-con.html' title='Servidor de correos personal con postfix - MUA'/><author><name>Javier Novoa C. (Stitch)</name><uri>http://www.blogger.com/profile/13132360799518616672</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_Hp7QjnMlZmKlVQDHZsaIQ9YnmWC4sel26ibs9FHig1ffPukjGQKgnGf4o6JV5MJYRfqEo5UmWmd3VQj0ZkCTBv1muBIu3QTs5jCkZ2_DD7GPa_x32zdIT0oFvFRLmrU/s220/55857695_2385261704837842_7917967493749014528_n.jpg'/></author><thr:total>0</thr:total></entry></feed>