<?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-498680930346631562</id><updated>2024-10-04T21:03:19.951-07:00</updated><category term="Programación"/><category term="JAVA"/><category term="WEB"/><category term="Tutorial"/><category term="Framework"/><category term="Swing"/><category term="Encriptación"/><category term="Google"/><category term="Hibernate"/><category term="JAR"/><category term="JSF"/><category term="JSP"/><category term="JavaScript"/><category term="Libro"/><category term="Python"/><category term="SEO"/><category term="SWT"/><category term="AJAX"/><category term="API"/><category term="AdSense"/><category term="AdWords"/><category term="Admob"/><category term="Android"/><category term="Aplicación"/><category term="BAT"/><category term="Control de versiones"/><category term="Directorio de enlaces"/><category term="Exclusión mutua"/><category term="GIT"/><category term="IDE"/><category term="JMX"/><category term="MX4J"/><category term="Node.js"/><category term="Primefaces"/><category term="Solucion"/><category term="Spring"/><category term="Subversion"/><category term="Ubuntu"/><category term="log4j"/><title type='text'>User Exception</title><subtitle type='html'>Página web sobre la informática, la programación en general: tutoriales, documentación, comparativas y noticias sobre lenguajes de programación, seo y diferentes tencologías. Expongo todo lo que sé.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://userexception.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://userexception.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/01681511949016485084</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>28</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-498680930346631562.post-543361321326691705</id><published>2013-02-09T10:38:00.000-08:00</published><updated>2013-02-09T10:38:06.192-08:00</updated><title type='text'>League of Legends LCS app for android</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://1.bp.blogspot.com/YYMNAuoSl_Kdif_GCPSgvQAGyPEe-DJPSMrsX4nZQxOzNH13_AwPNr3P1WdccRajGw=w705&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;156&quot; src=&quot;http://1.bp.blogspot.com/YYMNAuoSl_Kdif_GCPSgvQAGyPEe-DJPSMrsX4nZQxOzNH13_AwPNr3P1WdccRajGw=w705&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Hi !&lt;br /&gt;
&lt;br /&gt;
I am very proud to announce that we have launched an application for android called League of stars.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://play.google.com/store/apps/details?id=com.xplosivelabs.leagueoflegends.championshipseries&quot;&gt;https://play.google.com/store/apps/details?id=com.xplosivelabs.leagueoflegends.championshipseries&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
With this application will be able to follow all the League of Legends championship series from your cellphone with no worries.&lt;br /&gt;
&lt;br /&gt;
Download it now!</content><link rel='replies' type='application/atom+xml' href='http://userexception.blogspot.com/feeds/543361321326691705/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://userexception.blogspot.com/2013/02/league-of-legends-lcs-app-for-android.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/543361321326691705'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/543361321326691705'/><link rel='alternate' type='text/html' href='http://userexception.blogspot.com/2013/02/league-of-legends-lcs-app-for-android.html' title='League of Legends LCS app for android'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/01681511949016485084</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="http://1.bp.blogspot.com/YYMNAuoSl_Kdif_GCPSgvQAGyPEe-DJPSMrsX4nZQxOzNH13_AwPNr3P1WdccRajGw=s72-w705-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-498680930346631562.post-5787969819583078142</id><published>2012-05-28T01:32:00.001-07:00</published><updated>2012-05-28T05:46:35.762-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Aplicación"/><category scheme="http://www.blogger.com/atom/ns#" term="Programación"/><title type='text'>Aplicaciones Android &quot;The Pichulabs&quot; &quot;PicShake!&quot;</title><content type='html'>Buenos días.&lt;br /&gt;
&lt;br /&gt;
Hoy voy a publicitar nuestra nueva cuenta de android developer llamado &quot;The PichuLabs&quot; y las aplicaciones que hemos lanzado:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;PicShake! Fail Edition&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Es un visor de comics de FailBlog y otros blogs de viñetas de comics sobre fails y wins. Está en inglés y tiene la peculiaridad de que agitando el móvil te carga una viñeta random desde su extensa base de datos. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;PicShake! Desmotivaciones&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Tiene la misma funcionalidad y el mismo diseño que PicShake! Fail Edition solo que éste está en castellano y las viñetas tratan, como el nombre bien lo indica, sobre desmotivaciones.&lt;br /&gt;
&lt;br /&gt;
Podéis descargaros las dos aplicaciones y futuras aplicaciones que lancemos en &lt;a href=&quot;https://play.google.com/store/search?q=the+pichulabs&amp;amp;c=apps%20&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Google Play&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
No dudéis en comentar las aplicaciones y enviar un mensaje indicando sugerencias, mejoras o errores que hayáis podido apreciar.&lt;br /&gt;
&lt;br /&gt;
Muchas gracias&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://userexception.blogspot.com/feeds/5787969819583078142/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://userexception.blogspot.com/2012/05/aplicaciones-android-pichulabs-picshake.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/5787969819583078142'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/5787969819583078142'/><link rel='alternate' type='text/html' href='http://userexception.blogspot.com/2012/05/aplicaciones-android-pichulabs-picshake.html' title='Aplicaciones Android &quot;The Pichulabs&quot; &quot;PicShake!&quot;'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/01681511949016485084</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-498680930346631562.post-5977754339142916887</id><published>2012-03-28T01:42:00.001-07:00</published><updated>2012-03-28T01:42:49.680-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><category scheme="http://www.blogger.com/atom/ns#" term="log4j"/><category scheme="http://www.blogger.com/atom/ns#" term="Programación"/><title type='text'>Añadir la fecha en ficheros de trazas log4j</title><content type='html'>Si queremos añadir la fecha a nuestros ficheros de trazas en log4j tenemos dos opciones.&lt;br /&gt;
&lt;br /&gt;
Si nuestros programa va a estar constantemente en ejecución, queremos que cada día, hora o minuto se genere otro fichero log, para ello podemos usar el &lt;b&gt;DailyRollingFileAppender. &lt;/b&gt;El properties que tendríamos que escribir sería el siguiente:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;log4j.appender.diario = org.apache.log4j.DailyRollingFileAppender
log4j.appender.diario.File = diario.log
log4j.appender.diario.Append = true
log4j.appender.diario.DatePattern = &#39;.&#39;yyy-MM-dd
log4j.appender.diario.layout = org.apache.log4j.PatternLayout
log4j.appender.diario.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss,SSS}%m%n&amp;nbsp;&lt;/pre&gt;

&lt;div style=&quot;text-align: justify;&quot;&gt;
De esta forma generaremos ficheros cada día. El problema de esto es que el fichero
de hoy no tendría fecha, puesto que los ficheros se renombran al pasar cada día,
almacenando las trazas de el mismo día en diario.log.

Si queremos ponerle fecha a nuestro fichero de trazas de hoy esclusivamente,
usando un &lt;b&gt;RollingFileAppender&lt;/b&gt; u otro appender por ejemplo, podemos crearnos una
variable de sistema de esta forma:

&lt;/div&gt;

&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt; static{
  SimpleDateFormat dateFormat = new SimpleDateFormat(&quot;yyyyMMdd&quot;);
     System.setProperty(&quot;current.date&quot;, dateFormat.format(new Date()));
    }&lt;/pre&gt;

escribimos esas líneas de código en nuestro fichero java, nada más ejecutar el
programa. Después, nuestro properties de log4j tendría esta forma:

&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;log4j.appender.Pesado=org.apache.log4j.RollingFileAppender
log4j.appender.Pesado.file=registroHerramientaQJMT.${current.date}.log
log4j.appender.Pesado.layout=org.apache.log4j.PatternLayout
log4j.appender.Pesado.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS}%m%n&lt;/pre&gt;

Ahora ya tenemos la fecha de hoy en nuestro fichero de trazas.</content><link rel='replies' type='application/atom+xml' href='http://userexception.blogspot.com/feeds/5977754339142916887/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://userexception.blogspot.com/2012/03/anadir-la-fecha-en-ficheros-de-trazas.html#comment-form' title='2 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/5977754339142916887'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/5977754339142916887'/><link rel='alternate' type='text/html' href='http://userexception.blogspot.com/2012/03/anadir-la-fecha-en-ficheros-de-trazas.html' title='Añadir la fecha en ficheros de trazas log4j'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/01681511949016485084</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-498680930346631562.post-5102611863214968015</id><published>2012-03-14T06:12:00.000-07:00</published><updated>2012-03-14T06:12:04.756-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JAR"/><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><category scheme="http://www.blogger.com/atom/ns#" term="Programación"/><title type='text'>Convertir jar en exe</title><content type='html'>Se puede generar un &lt;b&gt;exe&lt;/b&gt; a partir de un &lt;b&gt;jar &lt;/b&gt;con un montón de programas. Yo os comentaré como hacerlo usando el programa &lt;b&gt;Autoit&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
Primero generamos el script que ejecutará el programa para crear el exe. Podemos usar el programa &lt;b&gt;Scite&lt;/b&gt; que viene con el &lt;b&gt;Autoit&lt;/b&gt;, o podemos crear el script a mano. Basta con abrir un documento de texto y cambiar la extensión a &lt;b&gt;.au3&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
En mi caso, he generado un jar ejecutable que se llama&amp;nbsp; &lt;i&gt;MiAplicacion.jar&lt;/i&gt;. Eso lo podemos generar con el eclipse, por ejemplo, exportando el proyecto. Es tan sencillo como:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt; &lt;/b&gt;&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;Run (&quot;java -jar MiAplicacion.jar&quot;)&lt;/pre&gt;
&lt;br /&gt;
Si tenemos que pasarle a nuestra aplicación parámetros, bastan con añadir los parámetros al final:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;Run (&quot;java -jar MiAplicacion.jar parametro1&quot;)&lt;/pre&gt;
&lt;br /&gt;
Y si deseamos que la consola de java no aparezca usaremos javaw en vez de java:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;Run (&quot;javaw -jar MiAplicacion.jar parametro1&quot;)&lt;/pre&gt;
&lt;br /&gt;
Podemos leer sobre esto en :&lt;a href=&quot;http://docs.oracle.com/javase/6/docs/technotes/tools/windows/java.html&quot;&gt;&lt;/a&gt;

&lt;br /&gt;
&lt;b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;blockquote&gt;
&lt;b&gt;The javaw command is identical to java, except that with javaw there is no associated console window. Use javaw when you don&#39;t want a command prompt window to appear. The javaw launcher will, however, display a dialog box with error information if a launch fails for some reason. &lt;/b&gt;&lt;/blockquote&gt;
&lt;br /&gt;
Ahora arrancamos el programa Aut2exe.exe y nos pedirá el archivo &lt;b&gt;au3&lt;/b&gt; y la ruta donde generar el &lt;b&gt;exe&lt;/b&gt;.</content><link rel='replies' type='application/atom+xml' href='http://userexception.blogspot.com/feeds/5102611863214968015/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://userexception.blogspot.com/2012/03/convertir-jar-en-exe.html#comment-form' title='1 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/5102611863214968015'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/5102611863214968015'/><link rel='alternate' type='text/html' href='http://userexception.blogspot.com/2012/03/convertir-jar-en-exe.html' title='Convertir jar en exe'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/01681511949016485084</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-498680930346631562.post-265500188824738445</id><published>2012-02-22T04:08:00.000-08:00</published><updated>2012-02-22T04:08:59.840-08:00</updated><title type='text'>Luchando por una educación pública</title><content type='html'>Esta entrada no tiene nada que ver con la programación pero aprovecha este blog para poneros un corto que trata sobre la educación pública. Un tema que está en boca de todos estos días y que peligra a no ser que reaccionemos.&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&lt;iframe src=&quot;http://www.youtube.com/embed/cscOrR-dUow?fs=1&quot; allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;344&quot; width=&quot;459&quot;&gt;&lt;/iframe&gt;
&lt;br /&gt;
&lt;br /&gt;
Me gustaría también pediros, si fuerais tan amables, de votar positivamente el video. Muchas gracias.</content><link rel='replies' type='application/atom+xml' href='http://userexception.blogspot.com/feeds/265500188824738445/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://userexception.blogspot.com/2012/02/luchando-por-una-educacion-publica.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/265500188824738445'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/265500188824738445'/><link rel='alternate' type='text/html' href='http://userexception.blogspot.com/2012/02/luchando-por-una-educacion-publica.html' title='Luchando por una educación pública'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/01681511949016485084</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://img.youtube.com/vi/cscOrR-dUow/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-498680930346631562.post-3518263646868430101</id><published>2012-02-22T03:48:00.000-08:00</published><updated>2012-02-22T03:48:28.934-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><category scheme="http://www.blogger.com/atom/ns#" term="Programación"/><title type='text'>Internalización en Java</title><content type='html'>Podemos hacer que nuestros textos en nuestro programa sean traducidos de una manera muy fácil. De esta forma, si el sistema operativo está en español, los textos aparecerán en español y aparecerán en ingles si tenemos el sistema operativo en ingles. &lt;br /&gt;
&lt;br /&gt;
Para conseguir esto debemos seguir varios pasos.&lt;br /&gt;
&lt;br /&gt;
Primero creamos un archivo properties. Lo llamaremos recursos.properties Este archivo contendrá las traducciones.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;MENU_INICIO=Inicio
MENU_PAGINA_INICIO=Página de inicio
MENU_SALIR=Salir&lt;/pre&gt;
&lt;br /&gt;
Ahora crearemos ficheros properties iguales pero que contienen las traducciones.  Los archivos se llamarán  llamarse igual que este, pero añadiendo &lt;i&gt;_xx&lt;/i&gt; o bien &lt;i&gt;_xx_YY&lt;/i&gt; donde &lt;i&gt;xx&lt;/i&gt; son dos letras que hacen referencia al idioma e &lt;i&gt;YY&lt;/i&gt; dos letras que hace referencia al país donde se habla idioma.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
Por ejemplo: recursos_es_AR.properties para español en Argentina o recursos_en_US para ingles en Estados Uunidos. Si no importa el país pondríamos recursos_en.properties&lt;br /&gt;
&lt;br /&gt;
Ahora vamos a escribir el siguiente código:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;Locale localeDefecto = Locale.getDefault();
recursos = ResourceBundle.getBundle(&quot;recursos&quot;,localeDefecto);

btnInicio.setText(recursos.getString(&quot;MENU_INICIO&quot;));
&lt;/pre&gt;
&lt;br /&gt;
De esta forma, nuestro botón estará internacionalizado.</content><link rel='replies' type='application/atom+xml' href='http://userexception.blogspot.com/feeds/3518263646868430101/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://userexception.blogspot.com/2012/02/internalizacion-en-java.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/3518263646868430101'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/3518263646868430101'/><link rel='alternate' type='text/html' href='http://userexception.blogspot.com/2012/02/internalizacion-en-java.html' title='Internalización en Java'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/01681511949016485084</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-498680930346631562.post-7242236458618849667</id><published>2012-02-08T05:59:00.000-08:00</published><updated>2012-02-08T05:59:19.027-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><category scheme="http://www.blogger.com/atom/ns#" term="Programación"/><title type='text'>Crear directorios en Java</title><content type='html'>Si queremos crear un directorio con Java, podemos usar la clase File. Después llamaremos a los metodos mkdir() o mkdirs().&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;File directorio = new File(&quot;c:\\Programas\\directorio&quot;);
directorio.mkdir();&lt;/pre&gt;
&lt;br /&gt;
Si únicamente ponemos el nombre de la carpeta a crear, deberemos de hacerlo sin barras. Son barras dobles porque sino java interpreta como un signo de escape.
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;mkdir() &lt;/b&gt;asume que la ruta de directorios existe y creará el último directorio.&lt;br /&gt;
&lt;b&gt;mkdirs()&lt;/b&gt;, todos los directorios anteriores a la carpeta se crearán, existan o no. De este modo no saltará ninguna   excepción si es que los directorios no existen. 
&lt;br /&gt;
&lt;br /&gt;
Estos metodos lanzan &lt;b&gt;SecurityException &lt;/b&gt;si es que existe un administrador de seguridad y no permite los nombres de los directorios.</content><link rel='replies' type='application/atom+xml' href='http://userexception.blogspot.com/feeds/7242236458618849667/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://userexception.blogspot.com/2012/02/crear-directorios-en-java.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/7242236458618849667'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/7242236458618849667'/><link rel='alternate' type='text/html' href='http://userexception.blogspot.com/2012/02/crear-directorios-en-java.html' title='Crear directorios en Java'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/01681511949016485084</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-498680930346631562.post-7260651066610133702</id><published>2012-01-17T01:27:00.000-08:00</published><updated>2012-01-17T01:30:41.418-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Encriptación"/><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><category scheme="http://www.blogger.com/atom/ns#" term="Programación"/><title type='text'>Criptografía simétrica y asimétrica</title><content type='html'>La criptografía se usa para ntercambiar mensajes que sólo puedan ser leídos por usuarios a las que
 van dirigidos y que poseen los medios para descifrarlos.&lt;br /&gt;
&lt;br /&gt;
Mediante una clave secreta, ciframos un mensaje y después podemos descrifrar el mensaje con la misma clave u otra distinta. De esta forma hay dos tipos de algoritmos, según cantidad de claves:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Critografía simétrica&lt;/li&gt;
&lt;li&gt;Criptografía asimétrica&lt;/li&gt;
&lt;/ul&gt;
Ahora os voy a explicar brevemente cada uno y al final tenéis una comparativa entra las dos.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&amp;nbsp;&lt;b&gt;Criptografía simétrica&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Se usa una única clave para cifrar y descifrar los mensajes. Las dos partes tienen que ponerse de acuerdo de antemano.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Criptografía asimétrica&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
La criptografía asimétrica usa dos claves para el envío de mensajes: una clave pública y una clave privada.&lt;br /&gt;
&lt;br /&gt;
Cada usuario tiene una clave pública y una privada que son propias. El
 usuario debe mantener en secreto la privada y distribuir la pública a 
todos los receptores con los que desea comunicarse.&lt;br /&gt;
En este sistema, lo que cifra la clave pública sólo puede ser 
descifrado con la privada y lo que cifra la clave privada sólo lo 
descifra la pública.&lt;br /&gt;
&lt;br /&gt;
El funcionamiento es el siguiente:&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/AVvXsEhSBIVdV1YENAcgW_KhNm8-4LpkQA5ex2mPfocboaNDPTrXm5BK7Bv9HKDZUYQXEy5zLySZyjYjA093rblO00kz8dyYyJmqA-2lfUcbZiXUKEw-S7qXia-0x4_FVxPcW1UqJStmWwhXSno/s1600/paso+1.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Criptografía asimétrica paso 1&quot; border=&quot;0&quot; height=&quot;290&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSBIVdV1YENAcgW_KhNm8-4LpkQA5ex2mPfocboaNDPTrXm5BK7Bv9HKDZUYQXEy5zLySZyjYjA093rblO00kz8dyYyJmqA-2lfUcbZiXUKEw-S7qXia-0x4_FVxPcW1UqJStmWwhXSno/s640/paso+1.PNG&quot; title=&quot;Criptografía asimétrica paso 1&quot; width=&quot;580&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Los usuarios que quieren comunicarse con el usuario 1, le piden su clave pública y éste les envía.&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/AVvXsEjzHRw4-hbTz6Bs8vQan2VymqCz7kXE2UkSjDap6yyu1S3k2Ra5fbMLaEVJux427K43A-MSErsufAGjZQ0k4iRxeyMTNDVspjW89h-jNR780E3w_K1gj_HWXG4mOOG3Jd0H5m7QaGc2Lqo/s1600/paso+2.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Criptografía asimétrica paso 2&quot; border=&quot;0&quot; height=&quot;290&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzHRw4-hbTz6Bs8vQan2VymqCz7kXE2UkSjDap6yyu1S3k2Ra5fbMLaEVJux427K43A-MSErsufAGjZQ0k4iRxeyMTNDVspjW89h-jNR780E3w_K1gj_HWXG4mOOG3Jd0H5m7QaGc2Lqo/s640/paso+2.PNG&quot; title=&quot;Criptografía asimétrica paso 2&quot; width=&quot;580&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Estos usuarios, encriptan el mensaje usando la clave pública y envían el mensaje al usuario 1. El usuario 1 desencriptará los mensaje usando su clave privada. EL usuario 1 será el único que podrá leer el mensaje enviado por usuarios 3 y 4 puesto que el usuario 1 es el único con la clave privada 1.&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/AVvXsEj4enTG9vpHlM7J-pb4qeews38xroqwRXPpW2eAtD82S4qLChz2uc3zSsLCFG7dFKzJeMtAiWsSjZt3qlrN7HMfdzLQ9OrSHKi1D_rDDKZAx_2LchrcZzHzdNku5uFWlHRWjds2klNWy70/s1600/paso+3.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Criptografía asimétrica paso 3&quot; border=&quot;0&quot; height=&quot;290&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4enTG9vpHlM7J-pb4qeews38xroqwRXPpW2eAtD82S4qLChz2uc3zSsLCFG7dFKzJeMtAiWsSjZt3qlrN7HMfdzLQ9OrSHKi1D_rDDKZAx_2LchrcZzHzdNku5uFWlHRWjds2klNWy70/s640/paso+3.PNG&quot; title=&quot;Criptografía asimétrica paso 3&quot; width=&quot;580&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Si se desea tener una conversación segura entre dos usuarios, primero tendrán que intercambiar sus claves públicas y después usarán esta claves para encriptar los mensajes.&lt;br /&gt;
&lt;br /&gt;
Aquí os muestro una tabla con las ventajas y desventajas de los dos algoritmos:&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/AVvXsEg7DnwVAU-nsFFo4mmB90Aee2pXuIaXDTyiuai6O4NqiyN6rdZ8ZxZZS3Y3Y_ufSUJpbwN9qDOkJjT8jFaV6UWZkYoVzKZexiQMjGTAZ_IAMxgBNXnSm40ntYF_ZAH7713RvbgS0VA5I_k/s1600/paso+4.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Comparación criptografía asimétrica y simétrica&quot; border=&quot;0&quot; height=&quot;390&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7DnwVAU-nsFFo4mmB90Aee2pXuIaXDTyiuai6O4NqiyN6rdZ8ZxZZS3Y3Y_ufSUJpbwN9qDOkJjT8jFaV6UWZkYoVzKZexiQMjGTAZ_IAMxgBNXnSm40ntYF_ZAH7713RvbgS0VA5I_k/s640/paso+4.PNG&quot; title=&quot;Comparación criptografía asimétrica y simétrica&quot; width=&quot;580&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Aquí os dejo código Java que encripta un mensaje con el método XOR. EL método recibe el texto a encriptar y la clave con la que se quiere encriptar. Para desencriptar el mensaje lo único que tenemos que hacer es volver a utilizar el método pero metiendo el texto encriptado en el lugar del mensaje original.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;public class Encriptador {
   public static final String DEFAULT_ENCODING=&quot;UTF-8&quot;; 
   static BASE64Encoder enc=new BASE64Encoder();
   static BASE64Decoder dec=new BASE64Decoder();

   public static String base64encode(String text){
      try {
         String rez = enc.encode( text.getBytes( DEFAULT_ENCODING ) );
         return rez;         
      }
      catch ( UnsupportedEncodingException e ) {
         return null;
      }
   }

   public static String base64decode(String text){

         try {
            return new String(dec.decodeBuffer( text ),DEFAULT_ENCODING);
         }
         catch ( IOException e ) {
           return null;
         }

      }

      public static void main(String[] args){
       String txt=&quot;Texto para encriptar&quot; ;
       String key=&quot;clave&quot;;
       System.out.println(txt+&quot; con XOR es: &quot;+(txt=xorMessage( txt, key )));
       String encoded=base64encode( txt );       
       System.out.println( &quot; codificado en: &quot;+encoded+&quot; y esto se decodifica en: &quot;+ (txt=base64decode( encoded )));
       System.out.print( &quot;Mensaje original conseguido aplicando XOR: &quot;+xorMessage( txt, key ) );

      }

      public static String xorMessage(String message, String key){
       try {
          if (message==null || key==null ) return null;

         char[] keys=key.toCharArray();
         char[] mesg=message.toCharArray();

         int ml=mesg.length;
         int kl=keys.length;
         char[] newmsg=new char[ml];

         for (int i=0; i&amp;lt;ml; i++){
            newmsg[i]=(char)(mesg[i]^keys[i%kl]);
         }//for i
         mesg=null; keys=null;
         return new String(newmsg);
      }
      catch ( Exception e ) {
         return null;
       }  
      }
}&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://userexception.blogspot.com/feeds/7260651066610133702/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://userexception.blogspot.com/2012/01/criptografia-simetrica-y-asimetrica.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/7260651066610133702'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/7260651066610133702'/><link rel='alternate' type='text/html' href='http://userexception.blogspot.com/2012/01/criptografia-simetrica-y-asimetrica.html' title='Criptografía simétrica y asimétrica'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/01681511949016485084</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/AVvXsEhSBIVdV1YENAcgW_KhNm8-4LpkQA5ex2mPfocboaNDPTrXm5BK7Bv9HKDZUYQXEy5zLySZyjYjA093rblO00kz8dyYyJmqA-2lfUcbZiXUKEw-S7qXia-0x4_FVxPcW1UqJStmWwhXSno/s72-c/paso+1.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-498680930346631562.post-8157878239431134052</id><published>2012-01-16T23:52:00.000-08:00</published><updated>2012-01-16T23:53:59.910-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Exclusión mutua"/><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><category scheme="http://www.blogger.com/atom/ns#" term="Programación"/><title type='text'>Exclusión mutua en Java con Lock</title><content type='html'>java.util.concurrent.locks.ReentrantLock es una clase en Java para la exclusión mutua, con el mismo comportamiento que los monitores Synchronized pero con más funciones. Entre ellas podemos encontrar:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;1. tryLock(): coger el cerrojo si es posible, sino devuelve false.&lt;/li&gt;
&lt;li&gt;2. tryLock(long timeout, TimeUnit unit): coger el cerrojo antes del timeout y devuelve false después del timeout.&lt;/li&gt;
&lt;li&gt;3. lockInterruptibly():intenta coger el cerrojo y entrar en el estado wait, pero puede ser interrumpido por otro hilos.
&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
Para iniciarlo:&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;private Lock cerrojo = new ReentrantLock();&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
Un ejemplo de como asegurar una variable:&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;dialog.addWindowListener(new WindowAdapter(){
    publicvoid windowClosing(WindowEvent we){
        cerrojo.lock();
        desconectando = true;
        cerrojo.unlock();
    }

});&lt;/pre&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;Aquí tenéis la documentación: &lt;a href=&quot;http://docs.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/locks/ReentrantLock.html&quot; target=&quot;_blank&quot;&gt;Enlace&lt;/a&gt;. &lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://userexception.blogspot.com/feeds/8157878239431134052/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://userexception.blogspot.com/2012/01/exclusion-mutua-en-java-con-lock.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/8157878239431134052'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/8157878239431134052'/><link rel='alternate' type='text/html' href='http://userexception.blogspot.com/2012/01/exclusion-mutua-en-java-con-lock.html' title='Exclusión mutua en Java con Lock'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/01681511949016485084</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-498680930346631562.post-4731596496967871205</id><published>2012-01-11T05:19:00.000-08:00</published><updated>2012-01-11T05:54:02.093-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Encriptación"/><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><category scheme="http://www.blogger.com/atom/ns#" term="Programación"/><title type='text'>Ejemplo MD5 en Java</title><content type='html'>&lt;b&gt;MD5 &lt;/b&gt;es uno algoritmo de reducción criptográfico. &lt;br /&gt;
&lt;br /&gt;
MD5 se utiliza para comprobar que lo que descargamos de internet es el archivo original y no un &lt;i&gt;troyano&lt;/i&gt;. También se utiliza para comprobar claves guardando el valor hash en disco y comparando con éste. Aplicando MD5 obtenemos un valor hash de 32 dígitos hexadecimales. Este valor se envía junto con el archivo. El usuario compara el valor hash del archivo obtenido con el valor hash que le han proporcionado y si no son iguales estamos seguros que el archivo ha sufrido un cambio y no es el original. &lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;import java.io.FileInputStream;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
 
public class MD5 {
    public static String getMD5(String entrada) {
        try {
            MessageDigest md = MessageDigest.getInstance(&quot;MD5&quot;);
            byte[] messageDigest = md.digest(entrada.getBytes());
            BigInteger number = new BigInteger(1, messageDigest);
            String hashtext = number.toString(16);
            while (hashtext.length() &amp;lt; 32) {
                hashtext = &quot;0&quot; + hashtext;
            }
            return hashtext;
        }
        catch (NoSuchAlgorithmException e) {
            throw new RuntimeException(e);
        }
    }
 
    public static void main(String[] args) throws NoSuchAlgorithmException {
        System.out.println(getMD5(&quot;Nuestra Clave&quot;));
    }
}
&lt;/pre&gt;
&lt;br /&gt;
Podemos cambiar el algoritmo MD5 por MD2, MD4, SHA...
&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
No podemos desencriptar un valor hash porque es un acción de una única dirección. Lo que debemos de hacer es comparar el valor hash obtenido con otro valor hash previamente obtenido y guardado.&lt;br /&gt;
&lt;br /&gt;
Lo más parecido a desencriptar sería probar todas las posibles entradas y aplicarles el algoritmo hasta coincidir con el guardado.</content><link rel='replies' type='application/atom+xml' href='http://userexception.blogspot.com/feeds/4731596496967871205/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://userexception.blogspot.com/2012/01/ejemplo-md5-en-java.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/4731596496967871205'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/4731596496967871205'/><link rel='alternate' type='text/html' href='http://userexception.blogspot.com/2012/01/ejemplo-md5-en-java.html' title='Ejemplo MD5 en Java'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/01681511949016485084</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-498680930346631562.post-5714492417222945506</id><published>2012-01-11T03:44:00.000-08:00</published><updated>2012-01-16T23:52:23.077-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><category scheme="http://www.blogger.com/atom/ns#" term="Programación"/><category scheme="http://www.blogger.com/atom/ns#" term="Swing"/><title type='text'>Añadir un evento a un botón Swing</title><content type='html'>Éste es el código para añadir un evento a un botón Swing en Java.&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;   private JButton boton = new JButton(&quot;Botón&quot;);

   boton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent arg0) {
         System.out.println(&quot;Click!&quot;);
      }
   });&amp;nbsp;&lt;/pre&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;Aquí tenéis la documentación: &lt;a href=&quot;http://docs.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/locks/ReentrantLock.html&quot; target=&quot;_blank&quot;&gt;Enlace&lt;/a&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://userexception.blogspot.com/feeds/5714492417222945506/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://userexception.blogspot.com/2012/01/anadir-un-evento-un-boton-swing.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/5714492417222945506'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/5714492417222945506'/><link rel='alternate' type='text/html' href='http://userexception.blogspot.com/2012/01/anadir-un-evento-un-boton-swing.html' title='Añadir un evento a un botón Swing'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/01681511949016485084</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-498680930346631562.post-3358147282024918865</id><published>2012-01-11T03:39:00.000-08:00</published><updated>2012-01-11T03:39:15.450-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><category scheme="http://www.blogger.com/atom/ns#" term="Programación"/><category scheme="http://www.blogger.com/atom/ns#" term="Swing"/><category scheme="http://www.blogger.com/atom/ns#" term="SWT"/><title type='text'>No dejar redimensionar una ventana SWT</title><content type='html'>&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;
shell = new Shell(SWT.DIALOG_TRIM | SWT.MIN); 
&lt;/pre&gt;
&lt;br /&gt;
De esta forma bloqueamos el redimensionamiento de una ventana(shell) en SWT. Sería el equivalente en swing de &lt;br /&gt;&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;
frame.setResizable(false);
&lt;/pre&gt;
&lt;br /&gt;&lt;br /&gt;
Escribimos en el constructor del shell las propiedades y listo.&lt;br /&gt;
Si queremos añadir más restricciones a la ventana podemos concatenar cualesquiera de esta lista: &lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;
SWT.BORDER 
SWT.CLOSE 
SWT.MIN 
SWT.MAX 
SWT.RESIZE 
SWT.TITLE 
SWT.NO_TRIM 
SWT.SHELL_TRIM 
SWT.DIALOG_TRIM 
SWT.MODELESS 
SWT.PRIMARY_MODAL 
SWT.APPLICATION_MODAL 
SWT.SYSTEM_MODAL 
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://userexception.blogspot.com/feeds/3358147282024918865/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://userexception.blogspot.com/2012/01/no-dejar-redimensionar-una-ventana-swt.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/3358147282024918865'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/3358147282024918865'/><link rel='alternate' type='text/html' href='http://userexception.blogspot.com/2012/01/no-dejar-redimensionar-una-ventana-swt.html' title='No dejar redimensionar una ventana SWT'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/01681511949016485084</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-498680930346631562.post-2140689728405981513</id><published>2012-01-11T03:32:00.000-08:00</published><updated>2012-01-11T03:32:43.565-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><category scheme="http://www.blogger.com/atom/ns#" term="Programación"/><category scheme="http://www.blogger.com/atom/ns#" term="SWT"/><title type='text'>Añadir una barra de progreso a un navegador embebido</title><content type='html'>Aquí os dejo el código para poder añadir una barra de de progreso a un navegador embebido que está incrustado en un &lt;b&gt;composite &lt;/b&gt;de &lt;b&gt;SWT&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;public class NavegadorEmbebidoSWT extends Composite {
  private Browser browser;
  ProgressBar progressBar;
  boolean busy;
  int index;

  public NavegadorEmbebidoSWT(Composite parent, String urlEntorno) {
    super(parent, SWT.NONE);

    GridLayout layout = new GridLayout(2, true);
    setLayout(layout);

    browser = new Browser(this, SWT.NONE);
    GridData layoutData = new GridData(GridData.FILL_BOTH);
    layoutData.horizontalSpan = 2;
    layoutData.verticalSpan = 2;
    browser.setLayoutData(layoutData);
    
    //Barra de progreso
    progressBar = new ProgressBar(this, SWT.NONE);
 progressBar.setLocation(600, 5);
 progressBar.setSize(108, 23);
 
 browser.addProgressListener(new ProgressListener() {
      public void changed(ProgressEvent event) {
          if (event.total == 0)
            return;
          int ratio = event.current * 100 / event.total;
          if (progressBar != null)
            progressBar.setSelection(ratio);
          busy = event.current != event.total;
          if (!busy) {
            index = 0;
          }
        }

        public void completed(ProgressEvent event) {
          if (progressBar != null)
            progressBar.setSelection(0);
          busy = false;
          index = 0;
        }
      });
    
    browser.setUrl(urlEntorno);
 
  }
  
}
&lt;/pre&gt;
&lt;br /&gt;
Simplemente instanciáis un &lt;b&gt;composite &lt;/b&gt;de este tipo y ya tenéis un navegador con su barra de progreso embebido. Con el método &lt;i&gt;browser.setUrl&lt;/i&gt; podéis poner la url que queráis cargar.</content><link rel='replies' type='application/atom+xml' href='http://userexception.blogspot.com/feeds/2140689728405981513/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://userexception.blogspot.com/2012/01/anadir-una-barra-de-progreso-un.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/2140689728405981513'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/2140689728405981513'/><link rel='alternate' type='text/html' href='http://userexception.blogspot.com/2012/01/anadir-una-barra-de-progreso-un.html' title='Añadir una barra de progreso a un navegador embebido'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/01681511949016485084</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-498680930346631562.post-874516689584801290</id><published>2012-01-10T08:22:00.000-08:00</published><updated>2012-01-11T03:32:52.791-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="BAT"/><category scheme="http://www.blogger.com/atom/ns#" term="IDE"/><category scheme="http://www.blogger.com/atom/ns#" term="JAR"/><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><category scheme="http://www.blogger.com/atom/ns#" term="Programación"/><title type='text'>Referenciar librerías jar en un ejecutable .bat</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
Esta mañana he estado intentando crear un ejecutable &lt;b&gt;.bat&lt;/b&gt; en windows donde ejecutaba un fichero jar. He tenido problemas a la hora de referenciar las librerías. El error que me daba era: &lt;/div&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;exception in thread main java.lang.noclassdeffounderror
&lt;/pre&gt;
&lt;br /&gt;
Ahora os voy a explicar como lo he solucionado.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
Hay dos formas de referencias las librerías: una es escribiendo por comando en nuestro fichero &lt;b&gt;.bat &lt;/b&gt;y la otra, que es la recomendada, referenciándolo en nuestro &lt;b&gt;manifest.&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Si queremos escribirlo por comando podemos hacer de la siguiente forma:&lt;/div&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;REM Classpath 

set JAR=D:\MiProyecto\lib
set CP=%JAR%\conn.jar
set CP=%CP%;%JAR%\plaf.jar
set CP=%CP%;%JAR%\adaptadorjvm.jar
...

java -classpath &quot;%CP%&quot; -jar miPrograma.jar
&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Ésto sería para &lt;b&gt;Windows&lt;/b&gt;. En &lt;b&gt;Linux &lt;/b&gt;sería con la otra barra.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Y si tenemos la &lt;b&gt;versión 6&lt;/b&gt; de &lt;b&gt;java &lt;/b&gt;en adelante, es tan simple como: &lt;/div&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;java -classpath lib\* -jar miPrograma.jar
&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
La otra forma y la recomendada es editando nuestro archivo &lt;b&gt;META-INF\manifest.mf&lt;/b&gt;. Para ello escribimos: &lt;/div&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;Manifest-Version: 1.0
Class-Path: lib\librería1.jar lib\librería2.jar lib\librería3.jar
Main-Class: miPrograma.interfaz.VentanaPrincipal
&lt;/pre&gt;
&lt;br /&gt;
Y escribimos esto en el ejecutable &lt;b&gt;.bat &lt;/b&gt;para lanzarlo:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;java -jar miPrograma.jar 
&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Si estamos trabajando con &lt;b&gt;IDE&lt;/b&gt;&#39;s, éstos, al crear el ejecutable jar nos pedirán si queremos crear el &lt;b&gt;manifest &lt;/b&gt;o cargar uno. Si elegimos cargar uno, creamos un &lt;b&gt;manifest.txt&lt;/b&gt;, escribimos lo anterior, y el &lt;b&gt;IDE &lt;/b&gt;nos creará automáticamente el &lt;b&gt;manifest.mf.&lt;/b&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://userexception.blogspot.com/feeds/874516689584801290/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://userexception.blogspot.com/2012/01/referenciar-librerias-jar-en-un.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/874516689584801290'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/874516689584801290'/><link rel='alternate' type='text/html' href='http://userexception.blogspot.com/2012/01/referenciar-librerias-jar-en-un.html' title='Referenciar librerías jar en un ejecutable .bat'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/01681511949016485084</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-498680930346631562.post-8956638878697600192</id><published>2011-12-27T01:13:00.000-08:00</published><updated>2011-12-27T01:16:36.018-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><category scheme="http://www.blogger.com/atom/ns#" term="Programación"/><category scheme="http://www.blogger.com/atom/ns#" term="Swing"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorial"/><title type='text'>Tutorial: Ventana con Java Swing</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;El paquete &lt;b&gt;Swing&lt;/b&gt; es parte de &quot;Java Foundation Classes&quot; que provee facilidades a los programadores a la hora de construir una interfaz gráfica o GUI. Swing abarca componentes como tablas, marcos, etiquetas, botones... Se les llama componentes Swing porque pertenecen al paquete javax.swing. Antes de la JDK 1.1 las interfaces gráficas se realizaban a través de AWT o Abstract Window Toolkit, de donde Swing ha heredado todo el manejo de eventos.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&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/AVvXsEg-FfdhSxfdyDIUs6IwnunyCinlBD6aYv57VJEl7zfV9_lSB3kAqnMYJFn3oPbG5YNXLydqBroEASMnTYGvUZRpI8e2P2fv3hWTAvOqDbT-uJ06F2Ta3f9CWaHFZ_5uJgOvJu9dV98-fXI/s1600/Dibujo.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-FfdhSxfdyDIUs6IwnunyCinlBD6aYv57VJEl7zfV9_lSB3kAqnMYJFn3oPbG5YNXLydqBroEASMnTYGvUZRpI8e2P2fv3hWTAvOqDbT-uJ06F2Ta3f9CWaHFZ_5uJgOvJu9dV98-fXI/s1600/Dibujo.PNG&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif; font-weight: normal;&quot;&gt;Una aplicación Swing se consigue mezclando componentes que siguen estas reglas:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Debe existir, al menos, un contenedor de alto nivel (Top-Level Container), que provee el soporte a los componentes Swing para que estas se pinten y puedan manejar eventos.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Habrá más componentes colgando de este contenedor de alto nivel, bien sean contenedores o componentes simples.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
 
public class HolaMundoSwing {
    public static void main(String[] args) {
        JFrame frame = new JFrame(&quot;HolaMundoSwing&quot;);
        frame.getContentPane().setLayout(new FlowLayout());
        final JLabel label = new JLabel(&quot;Hola Mundo&quot;);
        frame.getContentPane().add(label);
 
        //frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 
        frame.addWindowListener(new java.awt.event.WindowAdapter(){
           public void windowClosing(WindowEvent e){
             System.exit(0);
           }
        }
        );
 
        frame.pack();
        frame.setVisible(true);
    }
}       
&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Este ejemplo contiene un contenedor de alto nivel, que es el JFrame. El Jframe es una ventana. En java existen dos tipos de ventana, el &lt;b&gt;JFrame &lt;/b&gt;y el &lt;b&gt;JDialog&lt;/b&gt;. Lo ideal es usar un único Jframe como ventana principal de nuestra aplicación y si usamos más ventanas crearlas mediante JDialog.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Tanto el JFrame como el JDialog tienen dentro una clase llamada &lt;b&gt;Container&lt;/b&gt;.&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 21px;&quot;&gt;Esta clase es la encargada de &quot;contener&quot; los botones, campos de texto y otros componentes que queramos añadir.&amp;nbsp;&lt;/span&gt;Para añadir componentes, debemos pedir el&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;Container&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;a la ventana y añadirle el componente. Para obtener el&amp;nbsp;Container&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;se llama al método&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;getContentPane()&lt;/strong&gt;&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;de la ventana. Luego, llamamos al método&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;add()&lt;/strong&gt;&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;de ese&amp;nbsp;Container.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;A la hora de colocar estos componentes en la ventana, debemos fijarnos bien en el tipo de layout que estamos usando. El Container lleva dentro una clase llamada &lt;b&gt;Layout&lt;/b&gt;. Según el tipo de layout podemos colocar los componentes en fila, verticales o de forma cuadriculada. En esta página podemos ver los &lt;a href=&quot;http://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html&quot; target=&quot;_blank&quot;&gt;distintos tipos de Layout&lt;/a&gt; que hay.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Para añadir los componentes simplemente creamos el componente que queramos, sea un TextField o un botón y lo añadimos con el método add.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Times, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;frame.getContentPane().add(label);
&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;line-height: 15.75pt;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 14px;&quot;&gt;Con el método&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 14px;&quot;&gt;&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;setDefaultCloseOperation()&lt;/strong&gt;&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;indicamos a la ventana qué debe hacer
cuando se cierre pulsando la X. Pero en nuestro caso le hemos añadido un evento a la ventana que cierra dicha ventana pulsando la X. Las dos formas son válidas. Los eventos los podemos añadir a botones y otros componentes para que realicen distintas acciones al interactuar con éllos.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: 14px;&quot;&gt;Con el método &lt;b&gt;pack()&lt;/b&gt; conseguimos que la ventana coja el tamaño mínimo para que se puedan ver todos los componentes. Después para que la ventana sea visible, añadimos el método &lt;b&gt;setVisible(True)&lt;/b&gt;.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Times, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://userexception.blogspot.com/feeds/8956638878697600192/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://userexception.blogspot.com/2011/12/tutorial-ventana-con-java-swing.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/8956638878697600192'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/8956638878697600192'/><link rel='alternate' type='text/html' href='http://userexception.blogspot.com/2011/12/tutorial-ventana-con-java-swing.html' title='Tutorial: Ventana con Java Swing'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/01681511949016485084</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/AVvXsEg-FfdhSxfdyDIUs6IwnunyCinlBD6aYv57VJEl7zfV9_lSB3kAqnMYJFn3oPbG5YNXLydqBroEASMnTYGvUZRpI8e2P2fv3hWTAvOqDbT-uJ06F2Ta3f9CWaHFZ_5uJgOvJu9dV98-fXI/s72-c/Dibujo.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-498680930346631562.post-5655550538082346739</id><published>2011-12-19T05:29:00.000-08:00</published><updated>2011-12-19T05:29:31.467-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Framework"/><category scheme="http://www.blogger.com/atom/ns#" term="Hibernate"/><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><category scheme="http://www.blogger.com/atom/ns#" term="JSF"/><category scheme="http://www.blogger.com/atom/ns#" term="Primefaces"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorial"/><category scheme="http://www.blogger.com/atom/ns#" term="WEB"/><title type='text'>Tutorial Hibernate y JavaServer Faces (JSF)</title><content type='html'>En este tutorial usaremos NetBeans para crear una aplicación web que recoja datos de una base de datos y los enseñe en una página web mediante java Server faces (JSF).
La aplicación web usa el Framework Hibernate como capa de persistencia para la recuperación y el almacenamiento de Plain Old Java Objects (POJO).&lt;br /&gt;
&lt;br /&gt;
Requerimientos mínimos:&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/AVvXsEgAHV5I5xFK5Grh-K6kuW8XZcwjsjrcuVhAUpHvPh_SNNjea4iy_OjVz_dWeev1sjgo-uCXy_E5jR9tVe53fyvY4pD40uzjnJG0CCFefsUEkJow_9Q3iwWHB6uvwh2JgypqVFUZsN79qH8/s1600/Dibujo1.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/AVvXsEgAHV5I5xFK5Grh-K6kuW8XZcwjsjrcuVhAUpHvPh_SNNjea4iy_OjVz_dWeev1sjgo-uCXy_E5jR9tVe53fyvY4pD40uzjnJG0CCFefsUEkJow_9Q3iwWHB6uvwh2JgypqVFUZsN79qH8/s1600/Dibujo1.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Creando la base de datos&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Creamos una base de datos con el dump “sakila”, un ejemplo gratuito que esta disponible en la página de MySQL. Podéis usar cualquier herramienta para administrar la base de datos como  phpMyAdmin, MySQL Administrator, Emma…&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Creando el proyecto de la aplicación web&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Ahora crearemos una aplicación web. Añadiremos las librerías de Hibernate y JSF.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Creamos un nuevo proyecto. Elegimos aplicación web desde la categoría Java web.&lt;/li&gt;
&lt;li&gt;Escribimos el nombre del proyecto.&lt;/li&gt;
&lt;li&gt;Deseleccionamos la opción de carpetas dedicadas.&lt;/li&gt;
&lt;li&gt;Servidor Glassfish 3 y Java EE 6&lt;/li&gt;
&lt;li&gt;Seleccionamos Java Server faces y podemos escoger la librería por defecto o PrimeFaces. Recomiendo PrimeFaces para una apariencia más elegante.&lt;/li&gt;
&lt;li&gt;Seleccionamos Hibernate y configuramos la base de datos.&lt;/li&gt;
&lt;/ol&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/AVvXsEhuxmWVFwIPYVpctRXHppl6pmQfrST6rUQfC4JmWWP6g5YWbENso3J__rYct5WtnMayRmkGQqkbhmMTkChnLn6BpDPd22o0AfOWi1YNH4bKJNhHQodAdGFeaSwTWDhxFXpE5ThjFz3Y5EE/s1600/Dibujo2.PNG&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/AVvXsEhuxmWVFwIPYVpctRXHppl6pmQfrST6rUQfC4JmWWP6g5YWbENso3J__rYct5WtnMayRmkGQqkbhmMTkChnLn6BpDPd22o0AfOWi1YNH4bKJNhHQodAdGFeaSwTWDhxFXpE5ThjFz3Y5EE/s1600/Dibujo2.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Modificando el fichero de configuración de Hibernate&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Cuando creamos un proyecto que usa el Framework de Hibernate, se genera automáticamente un fichero llamado “hibernate.cfg.xml” que contiene información sobre la conexión a la base de datos, mapeo de recursos y otras propiedades. Podemos editar este fichero mediante el editor multi vista o el editor xml.&lt;br /&gt;
Vamos a editarlo para trabajar con hibernate.&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Abrimos el archivo hibernate.cfg.xml con doble click. Se abrirá en el modo multi vista.&lt;/li&gt;
&lt;li&gt;Dentro de propiedades opcionales expandimos las propiedades de configuración&lt;/li&gt;
&lt;li&gt;Añadimos una propiedad hibernate: hibernate.show_sql = true&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJZiqnaHBsGnyNTe3I2y1KFn5N4nXMPPiYhSI7I7N7sQGEg59m6HQTi1ulzMld5yGPp2XAomiTh4kRw-d8ZjLekmHpKCIjnqD8sU1AGnXVUu_TUxiDuC_ATDZuP6RmENwJGZXUlidZr6c/s1600/Dibujo3.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/AVvXsEiJZiqnaHBsGnyNTe3I2y1KFn5N4nXMPPiYhSI7I7N7sQGEg59m6HQTi1ulzMld5yGPp2XAomiTh4kRw-d8ZjLekmHpKCIjnqD8sU1AGnXVUu_TUxiDuC_ATDZuP6RmENwJGZXUlidZr6c/s1600/Dibujo3.PNG&quot; /&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Expandimos el nodo propiedades miscelánea y añadimos: properties hibernate.current_session_context_class = thread&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHFyTLME8GpYSp2u4bdnStwe8006g_s8H-TvqHsfTWWaqn9jMnY2Acz3Q4-oAeo7qXrMQuzowKriOeh13pFnsdUy4QxyNGxTchqnRk__uP6d0wdpAmRx4xt7eXgTnsRRoVLUSMwoygZDM/s1600/Dibujo4.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/AVvXsEgHFyTLME8GpYSp2u4bdnStwe8006g_s8H-TvqHsfTWWaqn9jMnY2Acz3Q4-oAeo7qXrMQuzowKriOeh13pFnsdUy4QxyNGxTchqnRk__uP6d0wdpAmRx4xt7eXgTnsRRoVLUSMwoygZDM/s1600/Dibujo4.PNG&quot; /&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Volvemos a añadir en miscelánea: hibernate.query.factory_class = org.hibernate.hql.classic.ClassicQueryTranslatorFactory&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCQ4rbxUSG5Gll08MiHoeYfpYZicRtlcRHM7MLWvVCL2Ds5A3Fz-BE2mFobgUm6fiRmKmtbZV29ojiRHeQRmRMr9IqgvdmrmQLw1JVbUAL65clLVtBobdBE58BUcQfleBOs74jbYVKMJU/s1600/Dibujo5.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/AVvXsEjCQ4rbxUSG5Gll08MiHoeYfpYZicRtlcRHM7MLWvVCL2Ds5A3Fz-BE2mFobgUm6fiRmKmtbZV29ojiRHeQRmRMr9IqgvdmrmQLw1JVbUAL65clLVtBobdBE58BUcQfleBOs74jbYVKMJU/s1600/Dibujo5.PNG&quot; /&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
Ahora el fichero en XML debería de ser algo como:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;xml:nogutter:nocontrols&quot; name=&quot;code&quot;&gt;&lt;hibernate-configuration&gt;
    &lt;session-factory name=&quot;session1&quot;&gt;
        &lt;property name=&quot;hibernate.dialect&quot;&gt;org.hibernate.dialect.MySQLDialect&lt;/property&gt;
        &lt;property name=&quot;hibernate.connection.driver_class&quot;&gt;com.mysql.jdbc.Driver&lt;/property&gt;
        &lt;property name=&quot;hibernate.connection.url&quot;&gt;jdbc:mysql://localhost:3306/sakila&lt;/property&gt;
        &lt;property name=&quot;hibernate.connection.username&quot;&gt;root&lt;/property&gt;
        &lt;property name=&quot;hibernate.connection.password&quot;&gt;######&lt;/property&gt;
        &lt;property name=&quot;hibernate.show_sql&quot;&gt;true&lt;/property&gt;
        &lt;property name=&quot;hibernate.current_session_context_class&quot;&gt;thread&lt;/property&gt;
        &lt;property name=&quot;hibernate.query.factory_class&quot;&gt;org.hibernate.hql.classic.ClassicQueryTranslatorFactory&lt;/property&gt;
    &lt;/session-factory&gt;
&lt;/hibernate-configuration&gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;Creando un archivo HibernateUtil.java Helper&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Para utilizar Hibernate tienes que crear una clase auxiliar que se encarga de la puesta en marcha y que accede a SessionFactory de Hibernate para obtener un objeto Session. La clase activa la función configure() y carga el archivo de configuración hibernate.cfg.xml y luego construye el SessionFactory para obtener el objeto Session.&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Abrimos el asistente y creamos un HibernateUtil.java en la categoría Hibernate&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;b&gt;Generación de archivos de mapeo Hibernate y las clases Java&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
En este tutorial se utiliza un POJO (plain old objeto Java) para representar los datos en cada una de las tablas de la base de datos que se va a utilizar. La clase Java especifica los campos de las columnas en las tablas y utiliza setters y getters simples para recuperar y escribir los datos. &lt;br /&gt;
&lt;i&gt;Creando un archivo Hibernate Reverse Engineering&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Igual que antes abrimos el asistente, categoría Hibernate, archivo hibernate.reveng&lt;/li&gt;
&lt;li&gt;Seleccionamos hibernate.cfg.xml en el combo&lt;/li&gt;
&lt;li&gt;Seleccionamos las tablas que usaremos en la aplicación web y le damos a finish. (seleccionar todas)&lt;/li&gt;
&lt;/ol&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/AVvXsEh94EVNQqC27zXEDkEvcMpz0v0y9Pj1yxENEy_QIpJj3oB3-MrHn59N99TasmHjUJliqz2r3isv7x3BlSk-WM4ZI3kFztdEImwKC-R_Fu8REMnTbrimiQSd0ImWGGj8JvDlxR41TFFdnUA/s1600/Dibujo6.PNG&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/AVvXsEh94EVNQqC27zXEDkEvcMpz0v0y9Pj1yxENEy_QIpJj3oB3-MrHn59N99TasmHjUJliqz2r3isv7x3BlSk-WM4ZI3kFztdEImwKC-R_Fu8REMnTbrimiQSd0ImWGGj8JvDlxR41TFFdnUA/s1600/Dibujo6.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Creando Los archivos de mapeo de Hibernate y los POJOs&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Nuevo archivo, categoría Hibernate.&lt;/li&gt;
&lt;li&gt;Seleccionar Hibernate Mapping Files and POJOs&lt;/li&gt;
&lt;li&gt;Seleccionar en los combos hibernate.cfg.xml y hibernate.reveng.xml&lt;/li&gt;
&lt;li&gt;Seleccionamos JDK5, Domain Code y Hibernate Xml Mappings&lt;/li&gt;
&lt;/ol&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/AVvXsEjQCzsLgHxP4ezKolSP5FXlPTCC60HbOLU5tBRSlaMaCrMcVnJqOG-t_XmkaV0cUqAdcf28k_xgDsMrSuY7NuJ1DURbnEsY5FJB3iqLrZnN1yAx2-usUXP-n8aYVPp18oZox-6OJA9QOgQ/s1600/Dibujo7.PNG&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/AVvXsEjQCzsLgHxP4ezKolSP5FXlPTCC60HbOLU5tBRSlaMaCrMcVnJqOG-t_XmkaV0cUqAdcf28k_xgDsMrSuY7NuJ1DURbnEsY5FJB3iqLrZnN1yAx2-usUXP-n8aYVPp18oZox-6OJA9QOgQ/s1600/Dibujo7.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
El aspecto de hibernate.cfg.xml es el siguiente:&lt;br /&gt;
&lt;pre class=&quot;xml:nogutter:nocontrols&quot; name=&quot;code&quot;&gt;&lt;hibernate-configuration&gt;
  &lt;session-factory&gt;
    &lt;property name=&quot;hibernate.dialect&quot;&gt;org.hibernate.dialect.MySQLDialect&lt;/property&gt;
    &lt;property name=&quot;hibernate.connection.driver_class&quot;&gt;com.mysql.jdbc.Driver&lt;/property&gt;
    &lt;property name=&quot;hibernate.connection.url&quot;&gt;jdbc:mysql://localhost:3306/sakila&lt;/property&gt;
    &lt;property name=&quot;hibernate.connection.username&quot;&gt;myusername&lt;/property&gt;
    &lt;property name=&quot;hibernate.connection.password&quot;&gt;mypassword&lt;/property&gt;
    &lt;property name=&quot;hibernate.show_sql&quot;&gt;true&lt;/property&gt;
    &lt;property name=&quot;hibernate.current_session_context_class&quot;&gt;thread&lt;/property&gt;
    &lt;property name=&quot;hibernate.query.factory_class&quot;&gt;org.hibernate.hql.classic.ClassicQueryTranslatorFactory&lt;/property&gt;
    &lt;mapping resource=&quot;dvdrental/FilmActor.hbm.xml&quot;&gt;
    &lt;mapping resource=&quot;dvdrental/Language.hbm.xml&quot;&gt;
    &lt;mapping resource=&quot;dvdrental/Film.hbm.xml&quot;&gt;
    &lt;mapping resource=&quot;dvdrental/Category.hbm.xml&quot;&gt;
    &lt;mapping resource=&quot;dvdrental/Actor.hbm.xml&quot;&gt;
    &lt;mapping resource=&quot;dvdrental/FilmCategory.hbm.xml&quot;&gt;
  &lt;/mapping&gt;&lt;/mapping&gt;&lt;/mapping&gt;&lt;/mapping&gt;&lt;/mapping&gt;&lt;/mapping&gt;&lt;/session-factory&gt;
&lt;/hibernate-configuration&gt;
&lt;/pre&gt;
&lt;br /&gt;
Y los paquetes:&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/AVvXsEiFiFUGZmDxdUR0slc96ueyYrhhlWRawCO6IptNbodBNCFqisgJ8vhXqmoRb_NiAkq7475ix8pM8QbI38PwFaA5bFllc_WgfyUEd_MEr9JGIRwvAHYAZSNbeeH01N5YyKyusm86CE6Sc5M/s1600/Dibujo8.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/AVvXsEiFiFUGZmDxdUR0slc96ueyYrhhlWRawCO6IptNbodBNCFqisgJ8vhXqmoRb_NiAkq7475ix8pM8QbI38PwFaA5bFllc_WgfyUEd_MEr9JGIRwvAHYAZSNbeeH01N5YyKyusm86CE6Sc5M/s1600/Dibujo8.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Creando el FilmHelper.java Helper class&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Esta clase se utiliza para realizar consultas de Hibernate en la base de datos. Se utiliza el editor de Hibernate query language (HQL)  para probar las consultas y recuperar los datos.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Creando la clase&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Nuevo archivo Java class&lt;/li&gt;
&lt;li&gt;Nombre: FilmHelper&lt;/li&gt;
&lt;li&gt;Añadimos este código:&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;public class FilmHelper {

    Session session = null;

    public FilmHelper() {
        this.session = HibernateUtil.getSessionFactory().getCurrentSession();
    }

}
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; 4. Corregir los imports&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Usando HQL query&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
1- Click derecho en el proyecto y le damos a Clean and Build&lt;br /&gt;
2- Click derecho en hibernate.cfg.xml y le accedemos a HQL query editor&lt;br /&gt;
3- Seleccionamos hibernate.cfg.xml en el combo &lt;br /&gt;
4- Testeamos la conexión escribiendo&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;from Film&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
y clicando en:&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/AVvXsEgzM0dtUFBZPh4I3YvY81-R0s6afPdkh2FiaKXRkWzjGwanyzuFZjkX3NWv7ZimYFKCH_9EywIFTlxZe3J_NJ7FpewZFt6YdMQgaghR3GB7YED3XKNYt0hiY3MCWPkLs6IupRprin-qits/s1600/Dibujo.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/AVvXsEgzM0dtUFBZPh4I3YvY81-R0s6afPdkh2FiaKXRkWzjGwanyzuFZjkX3NWv7ZimYFKCH_9EywIFTlxZe3J_NJ7FpewZFt6YdMQgaghR3GB7YED3XKNYt0hiY3MCWPkLs6IupRprin-qits/s1600/Dibujo.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Nos mostrará lo siguiente:&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/AVvXsEjapxA1ppFPAre0THosFa5eEjp85tvcpATduo38AxD-d6oIxdwPQRNbaeY5Z1z12X7Rd7CxzmOBPwrvMtcv-B32UxRw0Xjr4EDRwp2u8DDy002LbW2DrP_FouT1ErxJtoKF2t6nWm0yQZY/s1600/Dibujo9.PNG&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/AVvXsEjapxA1ppFPAre0THosFa5eEjp85tvcpATduo38AxD-d6oIxdwPQRNbaeY5Z1z12X7Rd7CxzmOBPwrvMtcv-B32UxRw0Xjr4EDRwp2u8DDy002LbW2DrP_FouT1ErxJtoKF2t6nWm0yQZY/s1600/Dibujo9.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Ahora podemos añadir el código que queramos. Por ejemplo añadimos el método getFilmTitles a FilmHelper.java para recuperar las películas con ID dentro de un rango específico:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;public List getFilmTitles(int startID, int endID) {
    List&lt;film&gt; filmList = null;
    try {
        org.hibernate.Transaction tx = session.beginTransaction();
        Query q = session.createQuery (&quot;from Film as film where film.filmId between &#39;&quot;+startID+&quot;&#39; and &#39;&quot;+endID+&quot;&#39;&quot;);
        filmList = (List&lt;film&gt;) q.list();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return filmList;
}
&lt;/film&gt;&lt;/film&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
Y ahora añadimos este otro método getActorsByID para recuperar los actores:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;public List getActorsByID(int filmId){
    List&lt;actor&gt; actorList = null;
    try {
        org.hibernate.Transaction tx = session.beginTransaction();
        Query q = session.createQuery (&quot;from Actor as actor where actor.actorId in (select filmActor.actor.actorId from FilmActor as filmActor where filmActor.film.filmId=&#39;&quot; + filmId + &quot;&#39;)&quot;);
        actorList = (List&lt;actor&gt;) q.list();

    } catch (Exception e) {
        e.printStackTrace();
    }

    return actorList;
}
&lt;/actor&gt;&lt;/actor&gt;&lt;/pre&gt;
&lt;br /&gt;
Podemos añadir los métodos que queramos aquí, dependiendo la información que queramos recuperar de la base datos.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Creando el JSF Managed Bean&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Los métodos en el managed bean se utilizan para mostrar los datos en las páginas JSF y para acceder a los métodos de la clase helper para recuperar los registros.&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Pinchamos dentro del paquete con el botón derecho y seleccionamos nuevo -&amp;gt; otros &lt;/li&gt;
&lt;li&gt;Seleccionamos JSF Managed Bean&lt;/li&gt;
&lt;li&gt;Nombre: FilmController&lt;/li&gt;
&lt;li&gt;Nombre que usará el managed Bean: filmController&lt;/li&gt;
&lt;li&gt;Scoper = session&lt;/li&gt;
&lt;/ol&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/AVvXsEgA4LdtrvgmEtv14uho-R6Kwa2Z1zbkzrXuyVeDH0-YzlFh3uxIEDqHMsZOwO_t6_iEYkMKX70nluV0u4BubHDmMf5nBb4TMmVOceID2Fmlnk-bTKVhLiIeSfeAGzkKtyOfIEDaSfmZOpQ/s1600/Dibujo10.PNG&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/AVvXsEgA4LdtrvgmEtv14uho-R6Kwa2Z1zbkzrXuyVeDH0-YzlFh3uxIEDqHMsZOwO_t6_iEYkMKX70nluV0u4BubHDmMf5nBb4TMmVOceID2Fmlnk-bTKVhLiIeSfeAGzkKtyOfIEDaSfmZOpQ/s1600/Dibujo10.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Al darle a Finalizar, el IDE agregará las anotaciones @ManagedBean y @SessionScoped.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;@ManagedBean
@SessionScoped
public class FilmController {

    /** Creates a new instance of FilmController */
    public FilmController() {
    }

}
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Ahora añadimos: &lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;@ManagedBean
@SessionScoped
public class FilmController {
    int startId;
    int endId;
    DataModel filmTitles;
    FilmHelper helper;
    private int recordCount = 1000;
    private int pageSize = 10;

    private Film current;
    private int selectedItemIndex;
}
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Añadimos el siguiente código para crear un FilmController y recuperar películas&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;/** Creates a new instance of FilmController */
    public FilmController() {
        helper = new FilmHelper();
        startId = 1;
        endId = 10;
    }

    public FilmController(int startId, int endId) {
        helper = new FilmHelper();
        this.startId = startId;
        this.endId = endId;
    }

    public Film getSelected() {
        if (current == null) {
            current = new Film();
            selectedItemIndex = -1;
        }
        return current;
    }


    public DataModel getFilmTitles() {
        if (filmTitles == null) {
            filmTitles = new ListDataModel(helper.getFilmTitles(startId, endId));
        }
        return filmTitles;
    }

    void recreateModel() {
        filmTitles = null;
    }
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Podemos añadir los métodos que queramos para recuperar más datos de la base de datos, si quisieramos.&lt;br /&gt;
4. Arreglamos los imports y guardamos.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Creando las páginas web &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
En este ejercicio crearán dos páginas web para la visualización de los datos. Se modificará el index.xhtml generado por el IDE para agregar una tabla que muestra las películas en la base de datos. A continuación, crearemos browse.xhtml para mostrar los detalles de una película cuando haga clic en el enlace &quot;Ver&quot; en la tabla. También se creará una plantilla de página JSF que es utilizado por index.xhtml y browse.xhtml.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Creando template.xhtml&lt;/i&gt;&lt;br /&gt;
Primero crearemos el template que usaremos en el index.xhtml y en Browne.xhtml&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Click derecho en el proyecto: nuevo-&amp;gt;otros y en la categoría JavaServer Faces clicamos en Facelets template&lt;/li&gt;
&lt;li&gt;Nombre: template&lt;/li&gt;
&lt;li&gt;Al finalizar modificamos el código:&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;pre class=&quot;xml:nogutter:nocontrols&quot; name=&quot;code&quot;&gt;&lt;h:body&gt;
    &lt;div class=&quot;top&quot; id=&quot;top&quot;&gt;
&lt;ui:insert name=&quot;top&quot;&gt;Top&lt;/ui:insert&gt;
    &lt;/div&gt;
&lt;div class=&quot;center_content&quot; id=&quot;content&quot;&gt;
&lt;ui:insert name=&quot;content&quot;&gt;Content&lt;/ui:insert&gt;
    &lt;/div&gt;
&lt;/h:body&gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
Y cambiamos lo que esta en negrita:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;&lt;div class=&quot;center_content&quot; id=&quot;content&quot;&gt;
&lt;ui:insert name=&quot;body&quot;&gt;Content&lt;/ui:insert&gt;
&lt;/div&gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Modificando index.xhtml&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Cuando se crea la aplicación web, el IDE genera automáticamente el index.xhtml. Ahora lo modificaremos para que muestre una lista de títulos de películas. La JSF llama a los métodos del Managed Bean para que muestre una tabla con los títulos y descripciones. &lt;br /&gt;
&lt;br /&gt;
1.&amp;nbsp; Esto es lo que contiene index.xhtml:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;&lt;h:head&gt;
        &lt;title&gt;&amp;lt;span style=&quot;background: none repeat scroll 0% 0% yellow;&quot; class=&quot;goog-spellcheck-word&quot;&amp;gt;Facelet&amp;lt;/span&amp;gt; &amp;lt;span style=&quot;background: none repeat scroll 0% 0% yellow;&quot; class=&quot;goog-spellcheck-word&quot;&amp;gt;Title&amp;lt;/span&amp;gt;&lt;/title&gt;
    &lt;/h:head&gt;
    &lt;h:body&gt;
        Hello from Facelets
    &lt;/h:body&gt;

Lo modificaremos de esta manera: 

    &lt;ui:composition template=&quot;./template.xhtml&quot;&gt;
        &lt;ui:define name=&quot;body&quot;&gt;
            &lt;h:form&gt;

            &lt;/h:form&gt;
        &lt;/ui:define&gt;
    &lt;/ui:composition&gt;

&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
2.&amp;nbsp; Añadimos el siguiente código para que se muestren las películas:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;html&quot; name=&quot;code&quot;&gt;&lt;h:form styleclass=&quot;jsfcrud_list_form&quot;&gt;
                &lt;h:commandlink action=&quot;#{filmController.previous}&quot; rendered=&quot;#{filmController.hasPreviousPage}&quot; value=&quot;Previous #{filmController.pageSize}&quot;&gt; 
                &lt;h:commandlink action=&quot;#{filmController.next}&quot; rendered=&quot;#{filmController.hasNextPage}&quot; value=&quot;Next #{filmController.pageSize}&quot;&gt; 
                &lt;h:datatable border=&quot;0&quot; cellpadding=&quot;2&quot; cellspacing=&quot;0&quot; rowclasses=&quot;jsfcrud_odd_row,jsfcrud_even_row&quot; rules=&quot;all&quot; style=&quot;border: solid 1px;&quot; value=&quot;#{filmController.filmTitles}&quot; var=&quot;item&quot;&gt;
                    &lt;h:column&gt;
                        &lt;f:facet name=&quot;header&quot;&gt;
                            &lt;h:outputtext value=&quot;Title&quot;&gt;
                        &lt;/h:outputtext&gt;&lt;/f:facet&gt;
                        &lt;h:outputtext value=&quot;#{item.title}&quot;&gt;
                    &lt;/h:outputtext&gt;&lt;/h:column&gt;
                    &lt;h:column&gt;
                        &lt;f:facet name=&quot;header&quot;&gt;
                            &lt;h:outputtext value=&quot;Description&quot;&gt;
                        &lt;/h:outputtext&gt;&lt;/f:facet&gt;
                        &lt;h:outputtext value=&quot;#{item.description}&quot;&gt;
                    &lt;/h:outputtext&gt;&lt;/h:column&gt;
                    &lt;h:column&gt;
                        &lt;f:facet name=&quot;header&quot;&gt;
                            &lt;h:outputtext value=&quot; &quot;&gt;
                        &lt;/h:outputtext&gt;&lt;/f:facet&gt;
                        &lt;h:commandlink action=&quot;#{filmController.prepareView}&quot; value=&quot;View&quot;&gt;
                    &lt;/h:commandlink&gt;&lt;/h:column&gt;
                &lt;/h:datatable&gt;
                

            &lt;/h:commandlink&gt;&lt;/h:commandlink&gt;&lt;/h:form&gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Ahora generamos el browse.xhtml. Nuevo archivo -&amp;gt; java Server faces -&amp;gt; facelets template cliente&lt;br /&gt;
4. Seleccionamos template.xhtml como template&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/AVvXsEhQX9r8_BQhZqV7234cIaZLXtlgCOE3Hay-iZEByputOaMD_Xclzjqi4CMdHDD26_qBwWb6KkT4E1IlGSm2exr4hhMh7Fq4bn9MZ5bxshFw_fLdYKxIf1aLcvjsRc_-ZTGFGPHfLmKoWXc/s1600/Dibujo11.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/AVvXsEhQX9r8_BQhZqV7234cIaZLXtlgCOE3Hay-iZEByputOaMD_Xclzjqi4CMdHDD26_qBwWb6KkT4E1IlGSm2exr4hhMh7Fq4bn9MZ5bxshFw_fLdYKxIf1aLcvjsRc_-ZTGFGPHfLmKoWXc/s1600/Dibujo11.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Y añadimos este código en Browse.xhtml:&lt;br /&gt;
&lt;pre class=&quot;html&quot; name=&quot;code&quot;&gt;&lt;ui:composition template=&quot;./template.xhtml&quot; xmlns:f=&quot;http://java.sun.com/jsf/core&quot; xmlns:h=&quot;http://java.sun.com/jsf/html&quot; xmlns:ui=&quot;http://java.sun.com/jsf/facelets&quot;&gt;

        &lt;ui:define name=&quot;top&quot;&gt;
            top
        &lt;/ui:define&gt;

        &lt;ui:define name=&quot;body&quot;&gt;
        
            &lt;h:form&gt;
                &lt;h:panelgrid columns=&quot;2&quot;&gt;
                    &lt;h:outputtext value=&quot;Title:&quot;&gt;
                    &lt;h:outputtext title=&quot;Title&quot; value=&quot;#{filmController.selected.title}&quot;&gt;
                    &lt;h:outputtext value=&quot;Description&quot;&gt;
                    &lt;h:outputtext title=&quot;Description&quot; value=&quot;#{filmController.selected.description}&quot;&gt;
                    &lt;h:outputtext value=&quot;Genre&quot;&gt;
                    &lt;h:outputtext value=&quot;#{filmController.category}&quot;&gt;

                    &lt;h:outputtext value=&quot;Cast&quot;&gt;
                    &lt;h:outputtext value=&quot;#{filmController.actors}&quot;&gt;


                    &lt;h:outputtext value=&quot;Film Length&quot;&gt;
                    &lt;h:outputtext title=&quot;Film Length&quot; value=&quot;#{filmController.selected.length} min&quot;&gt;

                    &lt;h:outputtext value=&quot;Language&quot;&gt;
                    &lt;h:outputtext title=&quot;Film Length&quot; value=&quot;#{filmController.language}&quot;&gt;

                    &lt;h:outputtext value=&quot;Release Year&quot;&gt;
                    &lt;h:outputtext title=&quot;Release Year&quot; value=&quot;#{filmController.selected.releaseYear}&quot;&gt;
                        &lt;f:convertdatetime pattern=&quot;MM/dd/yyyy&quot;&gt;
                    &lt;/f:convertdatetime&gt;&lt;/h:outputtext&gt;
                    &lt;h:outputtext value=&quot;Rental Duration&quot;&gt;
                    &lt;h:outputtext title=&quot;Rental DUration&quot; value=&quot;#{filmController.selected.rentalDuration}&quot;&gt;
                    &lt;h:outputtext value=&quot;Rental Rate&quot;&gt;
                    &lt;h:outputtext title=&quot;Rental Rate&quot; value=&quot;#{filmController.selected.rentalRate}&quot;&gt;
                    &lt;h:outputtext value=&quot;Replacement Cost&quot;&gt;
                    &lt;h:outputtext title=&quot;Replacement Cost&quot; value=&quot;#{filmController.selected.replacementCost}&quot;&gt;
                    &lt;h:outputtext value=&quot;Rating&quot;&gt;
                    &lt;h:outputtext title=&quot;Rating&quot; value=&quot;#{filmController.selected.rating}&quot;&gt;
                    &lt;h:outputtext value=&quot;Special Features&quot;&gt;
                    &lt;h:outputtext title=&quot;Special Features&quot; value=&quot;#{filmController.selected.specialFeatures}&quot;&gt;
                    &lt;h:outputtext value=&quot;Last Update&quot;&gt;
                    &lt;h:outputtext title=&quot;Last Update&quot; value=&quot;#{filmController.selected.lastUpdate}&quot;&gt;
                        &lt;f:convertdatetime pattern=&quot;MM/dd/yyyy HH:mm:ss&quot;&gt;
                    &lt;/f:convertdatetime&gt;&lt;/h:outputtext&gt;
                &lt;/h:outputtext&gt;&lt;/h:outputtext&gt;&lt;/h:outputtext&gt;&lt;/h:outputtext&gt;&lt;/h:outputtext&gt;&lt;/h:outputtext&gt;&lt;/h:outputtext&gt;&lt;/h:outputtext&gt;&lt;/h:outputtext&gt;&lt;/h:outputtext&gt;&lt;/h:outputtext&gt;&lt;/h:outputtext&gt;&lt;/h:outputtext&gt;&lt;/h:outputtext&gt;&lt;/h:outputtext&gt;&lt;/h:outputtext&gt;&lt;/h:outputtext&gt;&lt;/h:outputtext&gt;&lt;/h:outputtext&gt;&lt;/h:outputtext&gt;&lt;/h:outputtext&gt;&lt;/h:outputtext&gt;&lt;/h:outputtext&gt;&lt;/h:outputtext&gt;&lt;/h:panelgrid&gt;
                

                

                &lt;h:commandlink action=&quot;#{filmController.prepareList}&quot; value=&quot;View All List&quot;&gt;
                

            &lt;/h:commandlink&gt;&lt;/h:form&gt;

        &lt;/ui:define&gt;
    &lt;/ui:composition&gt;

&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
Ahora solo falta ejecutar la aplicación.</content><link rel='replies' type='application/atom+xml' href='http://userexception.blogspot.com/feeds/5655550538082346739/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://userexception.blogspot.com/2011/12/tutorial-hibernate-y-javaserver-faces.html#comment-form' title='4 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/5655550538082346739'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/5655550538082346739'/><link rel='alternate' type='text/html' href='http://userexception.blogspot.com/2011/12/tutorial-hibernate-y-javaserver-faces.html' title='Tutorial Hibernate y JavaServer Faces (JSF)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/01681511949016485084</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/AVvXsEgAHV5I5xFK5Grh-K6kuW8XZcwjsjrcuVhAUpHvPh_SNNjea4iy_OjVz_dWeev1sjgo-uCXy_E5jR9tVe53fyvY4pD40uzjnJG0CCFefsUEkJow_9Q3iwWHB6uvwh2JgypqVFUZsN79qH8/s72-c/Dibujo1.PNG" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-498680930346631562.post-5779102508351156580</id><published>2011-11-28T23:57:00.001-08:00</published><updated>2011-11-30T02:23:20.935-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Admob"/><category scheme="http://www.blogger.com/atom/ns#" term="AdSense"/><category scheme="http://www.blogger.com/atom/ns#" term="Google"/><title type='text'>Ganar dinero con Google AdSense y Admob</title><content type='html'>&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/AVvXsEiIHmKq0f5peQ9iPi84PZAw7D6r_tplZt-VllR-5JvkOwTSSEScd9LlUnrwNrCWQvpZVHgVHaw6Obm9UKGptybeb0SOLcPyYtCxNM7FKtyiz_zUIkFDYhdJu1P0cMpNgQB6cJdwDjzsiRg/s1600/ad.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Google AdSense Admob&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIHmKq0f5peQ9iPi84PZAw7D6r_tplZt-VllR-5JvkOwTSSEScd9LlUnrwNrCWQvpZVHgVHaw6Obm9UKGptybeb0SOLcPyYtCxNM7FKtyiz_zUIkFDYhdJu1P0cMpNgQB6cJdwDjzsiRg/s1600/ad.PNG&quot; title=&quot;Google AdSense Admob&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
La forma más normal de ganar dinero en Internet es poniendo publicidad en tus sitios web. Se pueden publicar anuncios de todo tipo pero cada vez es más normal utilizar los servicios de Google AdSense y Google Admob.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;Google AdSense&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Google AdSense es un servicio de Google donde el webmaster inserta anuncios basados en texto o con imágenes y recibe una cantidad de dinero por cada click que el visitante haga en el anuncio o visite la página con el anuncio.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Para empezar ha ganar dinero hay que hacer una petición al equipo de &lt;a href=&quot;https://www.google.com/adsense&quot; target=&quot;_blank&quot;&gt;Google&lt;/a&gt; e insertar un código Javascript que te ofrecerán. Tu página no puede tener contenido pornográfico ni &quot;pop-up&quot;s o &quot;dialers&quot;. Si tu web ha sido aceptado en unos instantes podrás empezar a poner anuncios y ha ganar dinero. Si los anuncios no son visibles no hay que alarmarse, hay que darles tiempo.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Google pondrá los anuncios en tu página web dependiendo del tipo de página web que tengas. Si es una página web muy específica sobre un tema como la informática, Google te insertará anuncios más específicos y ganarás más dinero que si tu página fuera sobre un tema variado. Estos anuncios puedes personalizarlos de la manera que más te convenga, siempre y cuando no haya más de 3 anuncios en cada página.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Si quieres ganar dinero de esta forma hay que tener paciencia y hacer las cosas bien. No esperes ganar 100 euros tu primer mes con una página o blog que acabas de crear, pero puede que en algunos meses empieces a generar tráfico y empieces a ganar algún dinerillo.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Te pueden pagar por click (CPC, coste por click) o por impresiones (CPM, coste por mil impresiones). Esto dependerá del anunciante que contrató Google Adsense. Para que te paguen por CPM los anunciantes se tiene que interesar por tu página y pedir exclusivamente que aparezcan en tu página. Esto sucede cuando la página genera un gran tráfico.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Con el CTR y el CPM se calcula el CTR (Porcentaje de clicks).&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Ejemplo: CTR= 1.5% = 15 clicks / 1000 impresiones.&amp;nbsp;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Lo normal es que el CTR sea bajo pero puede que en algunos casos sea muy alto. No hay que preocuparse si no se están haciendo &quot;trampas&quot; para ganar los clicks.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Resumiendo, el precio que te pagarán por click o visitas dependerá del tamaño del anuncio, su ubicación, la temática de tu página, el lugar y la hora. Google paga por transferencia bancaria siempre y cuando se haya alcanzado la cifra de 100 dolares. &lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;Google Admob&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Admob es una empresa de gestión de anuncios para móviles que fue comprado por el gigante informático. Google Admob trabaja de manera muy similar a Google AdSense, solo que sus anuncios no solo están destinados a las páginas web, también podemos publicar anuncios en nuestras aplicaciones móviles. &lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Google Admob está integrado con Google y podemos acceder a él desde nuestra cuenta de gmail, sin tener que registrarnos aparte. Para empezar a hagar dinero con nuestras aplicaciones o páginas web que se visualicen desde móviles o smartphones basta con registrarse en &lt;a href=&quot;http://es.admob.com/&quot; target=&quot;_blank&quot;&gt;Google Admob&lt;/a&gt; e insertar el código que nos faciliten.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://userexception.blogspot.com/feeds/5779102508351156580/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://userexception.blogspot.com/2011/11/ganar-dinero-con-google-adsense-y-admob.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/5779102508351156580'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/5779102508351156580'/><link rel='alternate' type='text/html' href='http://userexception.blogspot.com/2011/11/ganar-dinero-con-google-adsense-y-admob.html' title='Ganar dinero con Google AdSense y Admob'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/01681511949016485084</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/AVvXsEiIHmKq0f5peQ9iPi84PZAw7D6r_tplZt-VllR-5JvkOwTSSEScd9LlUnrwNrCWQvpZVHgVHaw6Obm9UKGptybeb0SOLcPyYtCxNM7FKtyiz_zUIkFDYhdJu1P0cMpNgQB6cJdwDjzsiRg/s72-c/ad.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-498680930346631562.post-1293148157377001546</id><published>2011-11-25T07:26:00.001-08:00</published><updated>2011-11-27T02:53:23.883-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Solucion"/><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><title type='text'>Error Ubuntu. No init fount. Try passing init = bootarg.</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
El anterior día al iniciar Ubuntu me apareció el siguiente error antes de iniciar el sistema operativo:
&lt;/div&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;No init fount. Try passing init = bootarg.&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Esto error puede surgir por apagar o hibernar de malas maneras el ordenador.
Busqué en internet para ver como se solucionaba e hice lo siguiente:
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Para empezar necesitamos un live cd o un usb con la ISO de Ubuntu. Para conseguir el usb nos bajamos el programa &quot;unetbootin&quot;, lo ejecutamos y elegimos la imagen ISO de nuestra versión de Ubuntu. Ésto lo podemos hacer bien en Windows o Linux. Al grabar la imagen reiniciamos el ordenador e iniciamos desde el el live cd o presionando f12 o f10 iniciamos desde el usb.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Una vez iniciado para ejecutar el &quot;disc check&quot; y reiniciamos. Ya podemos iniciar de forma habitual nuestro sistema operativo. Ubuntu, abrimos el terminal y tecleamos los siguiente comandos:
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Buscamos la partición donde está nuestro sistema operativo ubuntu.
&lt;/div&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;sudo fdisk -l&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
en mi caso es /dev/sda6
Después tecleamos:
&lt;/div&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;sudo fsck /dev/sda7&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
para ejecutar el &quot;disc check&quot; y reiniciamos. Ya podemos iniciar de forma habitual nuestro sistema operativo.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://userexception.blogspot.com/feeds/1293148157377001546/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://userexception.blogspot.com/2011/11/error-ubuntu-no-init-fount-try-passing.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/1293148157377001546'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/1293148157377001546'/><link rel='alternate' type='text/html' href='http://userexception.blogspot.com/2011/11/error-ubuntu-no-init-fount-try-passing.html' title='Error Ubuntu. No init fount. Try passing init = bootarg.'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/01681511949016485084</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-498680930346631562.post-4823692446787682579</id><published>2011-11-24T23:59:00.001-08:00</published><updated>2011-11-27T02:53:06.077-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><category scheme="http://www.blogger.com/atom/ns#" term="JSP"/><category scheme="http://www.blogger.com/atom/ns#" term="Programación"/><category scheme="http://www.blogger.com/atom/ns#" term="WEB"/><title type='text'>Leer un archivo property desde Java</title><content type='html'>Los ficheros .properties de Java son unos ficheros que nos permiten almacenar variables de configuración de nustra aplicación. Son ficheros de texto que almacenan un par clave valor, de esta forma:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;###################################################
# Configuración Aplicación                        #
###################################################
#Esta variable en blanco para pruebas en local:
APP.PRUEBA=
#Ruta donde se encuentra el fichero de topología
APP.RUTA_FICHERO_TOPOLOGIAS=D:/MisProyectos/lecturapuertos
&lt;/pre&gt;
&lt;br /&gt;
Para cargar un fichero y leer una propiedad haremos lo siguiente:&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;Properties misPropiedades = new Properties();
FileInputStream in = new FileInputStream(&quot;misPropiedades.properties&quot;);
misPropiedades.load(in);
String p = misPropiedades.getProperty(&quot;miClave&quot;);
&lt;/pre&gt;
&lt;br /&gt;
Para guardar un valor en un fichero properties en cambio se hace así:&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;misPropiedades.setProperty(&quot;miClave&quot;, &quot;valor&quot;);
&lt;/pre&gt;
&lt;br /&gt;
Si queremos acceder a estos valores en un proyecto WEB, es decir, desde una Jsp, podemos hacerlo de esta forma, usando la clase ResourceBoundle:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;ResourceBundle rb = new ResourceBoundle.getBundle(&quot;misPropiedades.properties&quot;);
String miValor = rb.getString(&quot;APP.RUTA_FICHERO_TOPOLOGIAS&quot;);
&lt;/pre&gt;
o de la forma tradicional:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;URL url = application.getResource(&quot;/WEB-INF/misPropiedades.properties&quot;);
InputStream in = url.openStream();
Properties p = new Properties();  
p.load(in);
out.println(p.getProperty(&quot;APP.RUTA_FICHERO_TOPOLOGIAS&quot;));
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://userexception.blogspot.com/feeds/4823692446787682579/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://userexception.blogspot.com/2011/11/leer-un-archivo-property-desde-java.html#comment-form' title='1 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/4823692446787682579'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/4823692446787682579'/><link rel='alternate' type='text/html' href='http://userexception.blogspot.com/2011/11/leer-un-archivo-property-desde-java.html' title='Leer un archivo property desde Java'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/01681511949016485084</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-498680930346631562.post-7079388776248737853</id><published>2011-11-24T00:09:00.001-08:00</published><updated>2011-12-27T01:26:55.176-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Programación"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorial"/><title type='text'>Tutorial rápido de Python</title><content type='html'>Lo primero que debemos de hacer es descargarnos el interprete de Python e instalarlo. Lo podemos conseguir desde la &lt;a href=&quot;http://www.python.org/download/&quot; target=&quot;_blank&quot;&gt;página oficial de Python&lt;/a&gt;. El Ubuntu actual trae por defecto Python, pero si no es así podemos instalarlo desde la linea de comandos. Abrimos el terminal y tecleamos:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;code&gt;sudo apt-get install python&lt;/code&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Ya tenemos instalado la última versión de Python.&lt;br /&gt;
Es recomendable que instalemos PIP, una herramienta para instalar y administrar paquetes de Python, para ello tecleamos en la linea de comandos:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;code class=&quot;cpp plain&quot;&gt;sudo apt-get install python-pip&lt;/code&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Para usarlo escribimos esto:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;literal-block&quot;&gt;&lt;b&gt;pip install SomePackage&lt;/b&gt;&lt;/pre&gt;
&lt;br /&gt;
Donde &quot;SomePackage&quot; sería la librería a instalar.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
Ahora vamos a escribir un mítico &quot;Hello world!&quot;. Para ello abrimos nuestro editor de texto preferido y escribimos:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;b&gt;#!/usr/bin/python&lt;/b&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;b&gt;# Programa Hello World&amp;nbsp;
&lt;/b&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;b&gt;&lt;code&gt;print &quot;Hello world!&quot;&lt;/code&gt;&lt;/b&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;b&gt;&lt;code&gt;&amp;nbsp;&lt;/code&gt;&lt;/b&gt;&lt;/pre&gt;
Para ejecutarlo lo guardamos con el sufijo &quot;.py&quot;, por ejemplo &quot;HelloWorld.py&quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;b&gt;&lt;code&gt;&amp;gt; python HelloWorld.py&amp;nbsp;&lt;/code&gt;&lt;/b&gt;&lt;/pre&gt;
&lt;br /&gt;
Para Ejecutar el mismo programa en Windows, debemos de saber dónde está el ejecutable python.exe. Si lo instalamos en c:\python23 escribimos lo siguiente:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b&gt;PATH C:\Python23;%PATH%&lt;/b&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Ahora windows ya sabe dónde se encuentra el intérprete. Acto seguido escribimos:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;b&gt;&lt;code&gt;C:\&amp;gt;; python &lt;/code&gt;&lt;code&gt;\Mis proyectos\HelloWorld.py&lt;/code&gt;&lt;/b&gt;&lt;/pre&gt;
&lt;br /&gt;
En un anterior &lt;a href=&quot;http://userexception.blogspot.com/2011/11/desarrollando-aplicaciones-con-python.html&quot; target=&quot;_blank&quot;&gt;post sobre Python&lt;/a&gt; indico dónde descargarse un tutorial muy bueno sobre Python para novatos. Os recomiendo que os lo leáis. También contiene enlaces e información sobre diferentes frameworks e IDE-s.</content><link rel='replies' type='application/atom+xml' href='http://userexception.blogspot.com/feeds/7079388776248737853/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://userexception.blogspot.com/2011/11/tutorial-rapido-de-python.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/7079388776248737853'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/7079388776248737853'/><link rel='alternate' type='text/html' href='http://userexception.blogspot.com/2011/11/tutorial-rapido-de-python.html' title='Tutorial rápido de Python'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/01681511949016485084</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-498680930346631562.post-7638099432606970258</id><published>2011-11-23T00:18:00.001-08:00</published><updated>2011-11-23T01:58:04.370-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="AJAX"/><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript"/><category scheme="http://www.blogger.com/atom/ns#" term="JSP"/><category scheme="http://www.blogger.com/atom/ns#" term="Programación"/><category scheme="http://www.blogger.com/atom/ns#" term="WEB"/><title type='text'>Pasar una variable de JavaScript a Jsp</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
Hace unos días, mientras programaba tuve un escenario inusual. Si buscamos en internet sobre el asunto, llegamos a la conclusión de que para pasar una variable de JavaScript a Jsp necesitamos AJAX. Ésto es debido a que la página Jsp se interpreta en el servidor y el JavaScript se interpreta en el lado del cliente, es imposible asignar una variable de JavaScript a una de Jsp, puesto que la respuesta del servidor al cliente ya llegó y el código que se ejecuta en el servidor ya terminó, por eso, la única forma es hacerlo vía AJAX.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Dicho esto pongámonos en situación: Necesitaba pasar un objeto Java creado en una Jsp a otra Jsp vía AJAX para generar contenido dinámico y devolver a la página principal. Ésto quiere decir que el &lt;b&gt;objeto Java&lt;/b&gt; lo tendría que &lt;b&gt;pasar a JavaScript &lt;/b&gt;y mandarlo por AJAX para que luego &lt;b&gt;volviera a convertirlo en objeto Java&lt;/b&gt;. Para pasar el objeto Java a Javascript no hay problema. Por ejemplo, podemos hacer:&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&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/AVvXsEj9kvZ4FY-NKuHtnc3bhFvrlSRvADxt-aLZEVdAI2mvG_7x2T8GHgndewEBMcHQH4WXRujXYnQmvIZrOyOVbgFXUGGgA6I9wP-429Ub3aypmidwzibmzLRw_fzfCcOUjgc5tOYSC4mTwc8/s1600/1.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;80&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9kvZ4FY-NKuHtnc3bhFvrlSRvADxt-aLZEVdAI2mvG_7x2T8GHgndewEBMcHQH4WXRujXYnQmvIZrOyOVbgFXUGGgA6I9wP-429Ub3aypmidwzibmzLRw_fzfCcOUjgc5tOYSC4mTwc8/s320/1.JPG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
y después:&lt;/div&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/AVvXsEh7XSq83hBAGYwM5Vw5IqqIgWEV4ApiAF1Hta90IOL1e87rNBXCXCBYenXdjjh2hu3SKzwpAYPg_n5F-DxVj0_LTi_rNWbKjpDy8tbbcm4w1aZTy9ReORlqkpG1i55fbfEfAT0h1-u6_GE/s1600/2.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;82&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7XSq83hBAGYwM5Vw5IqqIgWEV4ApiAF1Hta90IOL1e87rNBXCXCBYenXdjjh2hu3SKzwpAYPg_n5F-DxVj0_LTi_rNWbKjpDy8tbbcm4w1aZTy9ReORlqkpG1i55fbfEfAT0h1-u6_GE/s320/2.JPG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;script&gt;
&lt;/span&gt;&lt;br style=&quot;color: rgb(68, 68, 68);&quot;&gt;&lt;span style=&quot;color: rgb(68, 68, 68);&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
var variableJS = &quot;&lt;%= str %&gt;&quot;;&lt;/span&gt;&lt;br style=&quot;color: rgb(68, 68, 68);&quot;&gt;&lt;span style=&quot;color: rgb(68, 68, 68);&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
alert(variableJS);&lt;/span&gt;&lt;br style=&quot;color: rgb(68, 68, 68);&quot;&gt;&lt;span style=&quot;color: rgb(68, 68, 68);&quot;&gt;
&lt;/script&gt; &lt;/span&gt;&lt;/i&gt;&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Y conseguimos asignar los datos de la variable Jsp a una de JS. Pero el problema reside en generar el objeto Java desde una variable en JS.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Después de investigar mucho llegué a a conclusión de que no hay una forma bonita de hacerlo.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
Mi idea era hacer una &lt;a href=&quot;http://chuwiki.chuidiang.org/index.php?title=Serializaci%C3%B3n_de_objetos_en_java&quot; target=&quot;_blank&quot;&gt;serialización java&lt;/a&gt; para que pudiera mandarlo por AJAX y crear una copia idéntica en la otra Jsp, pero resulta que JavaScript no soporta arrays de byte. De esta forma no podemos mandar los bytes que nos devuelven las funciones de las clases &lt;i&gt;ObjectOutputStream &lt;/i&gt;y&lt;b&gt; &lt;/b&gt;&lt;i&gt;DataInputStream &lt;/i&gt;y leerlas en el jsp de destino. Si conseguimos mandar los bytes, tenemos que interpretar estos bytes por nuestra cuenta y esta interpretación será distinta según el tipo de datos que son, como &lt;i&gt;floats&lt;/i&gt;, &lt;i&gt;integers &lt;/i&gt;o &lt;i&gt;strings&lt;/i&gt;.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
La forma alternativa a este escenario que se me ocurre es la de pasar la información de este objeto Java a variables de JavaScript y generar el contenido en la máquina cliente. La pega de esta forma es que puede ser muy pesada la carga en variables de todo el objeto Java. &lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;a href=&quot;http://meteatamel.wordpress.com/2011/08/02/is-javascript-ready-for-serious-development-part-ii/&quot; target=&quot;_blank&quot;&gt;Aquí&lt;/a&gt; podéis encontrar más necesidades de JavaScript. &lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://userexception.blogspot.com/feeds/7638099432606970258/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://userexception.blogspot.com/2011/11/pasar-una-variable-de-javascript-jsp.html#comment-form' title='5 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/7638099432606970258'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/7638099432606970258'/><link rel='alternate' type='text/html' href='http://userexception.blogspot.com/2011/11/pasar-una-variable-de-javascript-jsp.html' title='Pasar una variable de JavaScript a Jsp'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/01681511949016485084</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/AVvXsEj9kvZ4FY-NKuHtnc3bhFvrlSRvADxt-aLZEVdAI2mvG_7x2T8GHgndewEBMcHQH4WXRujXYnQmvIZrOyOVbgFXUGGgA6I9wP-429Ub3aypmidwzibmzLRw_fzfCcOUjgc5tOYSC4mTwc8/s72-c/1.JPG" height="72" width="72"/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-498680930346631562.post-7538343256908138025</id><published>2011-11-21T08:49:00.001-08:00</published><updated>2011-11-21T08:51:52.417-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Framework"/><category scheme="http://www.blogger.com/atom/ns#" term="Libro"/><category scheme="http://www.blogger.com/atom/ns#" term="Programación"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorial"/><title type='text'>Desarrollando aplicaciones con Python</title><content type='html'>Python es un lenguaje de programación de alto nivel. Es un lenguaje de scripting independiente de plataforma y multiparadigma puesto que soporta programación orientada a objetos, programación imperativa y programación funcional.&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&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/AVvXsEisATNyX0jAtFOl5VbCyRi3AI9zmQ1MzE66wCwQRgrXeXA_StJ0qpxdkAogv7TmRO67cUrXHki0z6sYbjAgTYp3SHA7g4uDy8FvpxLg5DBrBWvwJ062nrJSDHFauKXwUvCqR5PRqveXEao/s1600/python-logo-master-v3-trans.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Python&quot; border=&quot;0&quot; height=&quot;108&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisATNyX0jAtFOl5VbCyRi3AI9zmQ1MzE66wCwQRgrXeXA_StJ0qpxdkAogv7TmRO67cUrXHki0z6sYbjAgTYp3SHA7g4uDy8FvpxLg5DBrBWvwJ062nrJSDHFauKXwUvCqR5PRqveXEao/s320/python-logo-master-v3-trans.png&quot; title=&quot;Python&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Podemos programar cualquier tipo de programas como aplicaciones de escritorio, servidores de red o páginas web. Es un lenguaje interpretado, no se necesita &lt;br /&gt;
compilar el código fuente para poder ejecutarlo. Es más rápido a la hora de desarrollar pero tiene menor velocidad a la hora de ejecutar. Tiene una sintaxis muy limpia y se caracteriza por su código legible. &lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Os dejo un tutorial muy breve y conciso sobre la sintaxis de python: &lt;a href=&quot;http://mundogeek.net/tutorial-python/&quot; target=&quot;_blank&quot;&gt;Tutorial Python&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Si queréis información más detallada lo podéis encontrar en la página oficial de Python: &lt;a href=&quot;http://www.python.org/&quot; target=&quot;_blank&quot;&gt;Página oficial&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;
Para programar en Python existen varias IDE&#39;s gratuitas como &lt;a href=&quot;http://wiki.netbeans.org/Python&quot; target=&quot;_blank&quot;&gt;NetBeans con su plugin&lt;/a&gt;, &lt;a href=&quot;http://wiki.python.org/moin/PyDev&quot; target=&quot;_blank&quot;&gt;PyDev (Ecipse)&lt;/a&gt;, &lt;a href=&quot;http://ninja-ide.org/&quot; target=&quot;_blank&quot;&gt;Ninja IDE&lt;/a&gt;... aquí tenéis una lista completita:&amp;nbsp; &lt;a href=&quot;http://wiki.python.org/moin/IntegratedDevelopmentEnvironments&quot; target=&quot;_blank&quot;&gt;Lista de IDE&#39;s&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Para desarrollar aplicaciones web os recomiendo estos dos frameworks: &lt;a href=&quot;https://www.djangoproject.com/&quot; target=&quot;_blank&quot;&gt;Django&lt;/a&gt; y &lt;a href=&quot;http://jinja.pocoo.org/&quot; target=&quot;_blank&quot;&gt;Jinja&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Aquí os dejo un par de enlaces de interés. Este enlace va sobre pequeños trucos para python: &lt;a href=&quot;http://www.siafoo.net/article/52&quot; target=&quot;_blank&quot;&gt;Trucos Python&lt;/a&gt; y este otro sobre la convención a seguir en Python o guía para programar en Python: &lt;a href=&quot;http://www.python.org/dev/peps/pep-0008/&quot; target=&quot;_blank&quot;&gt;Convención Python&lt;/a&gt;.&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Para los que vivan en Madrid existe un grupo que realiza eventos y charlas sobre Python. La página web es: &lt;a href=&quot;https://www.python-madrid.es/&quot; target=&quot;_blank&quot;&gt;Python Madrid&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://userexception.blogspot.com/feeds/7538343256908138025/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://userexception.blogspot.com/2011/11/desarrollando-aplicaciones-con-python.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/7538343256908138025'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/7538343256908138025'/><link rel='alternate' type='text/html' href='http://userexception.blogspot.com/2011/11/desarrollando-aplicaciones-con-python.html' title='Desarrollando aplicaciones con Python'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/01681511949016485084</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/AVvXsEisATNyX0jAtFOl5VbCyRi3AI9zmQ1MzE66wCwQRgrXeXA_StJ0qpxdkAogv7TmRO67cUrXHki0z6sYbjAgTYp3SHA7g4uDy8FvpxLg5DBrBWvwJ062nrJSDHFauKXwUvCqR5PRqveXEao/s72-c/python-logo-master-v3-trans.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-498680930346631562.post-6738098167782866493</id><published>2011-11-17T13:02:00.000-08:00</published><updated>2011-11-29T01:02:06.765-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Framework"/><category scheme="http://www.blogger.com/atom/ns#" term="Hibernate"/><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><category scheme="http://www.blogger.com/atom/ns#" term="JSF"/><category scheme="http://www.blogger.com/atom/ns#" term="Libro"/><category scheme="http://www.blogger.com/atom/ns#" term="Programación"/><category scheme="http://www.blogger.com/atom/ns#" term="Spring"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorial"/><category scheme="http://www.blogger.com/atom/ns#" term="WEB"/><title type='text'>Libros y documentación sobre JSF, Spring e Hibernate</title><content type='html'>JSF, Spring e Hibernate son las tres tecnologías que voy a usar en mi siguiente proyecto web programado en Java. He estado documentándome y son 3 tecnologías que se integran muy bien.&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/AVvXsEjl5z2B68G7Kmdh9S3KC4Ex7wClOJx8d9yPLf-hx_5HlaTIAYhM5SzEh_mfF-hrdl7L2-HGPQIJ8JPmul6ABMWYrbamQwv_uHumYt9vsKcHcez0KVVbogy7N-8219MRnY2au0xEzmObs9E/s1600/integracion.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;125&quot; title=&quot;Spring Hibernate JSF&quot; alt=&quot;Spring Hibernate JSF&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjl5z2B68G7Kmdh9S3KC4Ex7wClOJx8d9yPLf-hx_5HlaTIAYhM5SzEh_mfF-hrdl7L2-HGPQIJ8JPmul6ABMWYrbamQwv_uHumYt9vsKcHcez0KVVbogy7N-8219MRnY2au0xEzmObs9E/s400/integracion.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.oracle.com/technetwork/java/javaee/javaserverfaces-139869.html&quot; target=&quot;_blank&quot;&gt;JSF&lt;/a&gt; o Java Server Faces es un framework escrito en java para la interfaz de usuario en páginas web. Para la parte gráfica se usan librerías como &lt;a href=&quot;http://www.icefaces.org/main/home/&quot; target=&quot;_blank&quot;&gt;IceFaces&lt;/a&gt;, &lt;a href=&quot;http://www.primefaces.org/&quot; target=&quot;_blank&quot;&gt;PrimeFaces&lt;/a&gt;, &lt;a href=&quot;http://www.jboss.org/richfaces&quot; target=&quot;_blank&quot;&gt;RichFaces&lt;/a&gt;...&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.springsource.org/&quot; target=&quot;_blank&quot;&gt;Spring&lt;/a&gt; es otro framework que da facilidad a la hora de programar aplicaciones en Java, y por consecuencia, aplicaciones web realizadas en java.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.hibernate.org/&quot; target=&quot;_blank&quot;&gt;Hibernate&lt;/a&gt; es otro framework que facilita la obtención de datos desde una base de datos, se ocupa de la persistencia de datos.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
Estos tres frameworks juntos hacen una pareja de baile formidable.&lt;br /&gt;
&lt;br /&gt;
En futuras entradas iré escribiendo mis vivencias con estas tecnologías. Por el momento os dejo libros y documentación en general.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Libros Hibernate:&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://java.ociweb.com/javasig/knowledgebase/2005-04/hibernate.pdf&quot; target=&quot;_blank&quot;&gt;http://java.ociweb.com/javasig/knowledgebase/2005-04/hibernate.pdf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://tech.sxinfo.net/UserFiles/mxk/File/eBook/java/hibernate/Manning%20-%20Hibernate%20in%20Action.pdf&quot; target=&quot;_blank&quot;&gt;http://tech.sxinfo.net/UserFiles/mxk/File/eBook/java/hibernate/Manning%20-%20Hibernate%20in%20Action.pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;b&gt;Libros Spring: &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://static.springsource.org/downloads/tutorial.pdf&quot; target=&quot;_blank&quot;&gt;http://static.springsource.org/downloads/tutorial.pdf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://static.springsource.org/spring/docs/2.5.x/spring-reference.pdf&quot; target=&quot;_blank&quot;&gt;http://static.springsource.org/spring/docs/2.5.x/spring-reference.pdf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.springbyexample.org/pdf/SpringByExample.pdf&quot; target=&quot;_blank&quot;&gt;http://www.springbyexample.org/pdf/SpringByExample.pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span data-mce-style=&quot;color: #ff0000;&quot; style=&quot;color: black;&quot;&gt;&lt;b&gt;Libros JSF: &lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span data-mce-style=&quot;color: #ff0000;&quot; style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.sicuma.uma.es/sicuma/Formacion/documentacion/JSF.pdf&quot; target=&quot;_blank&quot;&gt;http://www.sicuma.uma.es/sicuma/Formacion/documentacion/JSF.pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;color: black;&quot;&gt;Libros gratis:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.divxturka.net/e-books-amp-tutorials/1523107-all-oreilly-e-books-z.html&quot; target=&quot;_blank&quot;&gt;http://www.divxturka.net/e-books-amp-tutorials/1523107-all-oreilly-e-books-z.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style=&quot;color: black;&quot;&gt;y aquí os dejo unos tutoriales sobre la integración de estas tres tecnologías:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;b&gt;Spring + Hibernate + JSF&lt;/b&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.programacion.com/articulo/integracion_de_jsf_spring_e_hibernate_para_crear_una_aplicacion_web_del_mundo_real_307&quot; target=&quot;_blank&quot;&gt;http://www.programacion.com/articulo/integracion_de_jsf_spring_e_hibernate_para_crear_una_aplicacion_web_del_mundo_real_307&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.mkyong.com/jsf2/jsf-2-0-spring-hibernate-integration-example/&quot; target=&quot;_blank&quot;&gt;http://www.mkyong.com/jsf2/jsf-2-0-spring-hibernate-integration-example/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://santiagotapiay.blogspot.com/2011/03/integracion-de-jsf-spring-hibernatejpa.html&quot; target=&quot;_blank&quot;&gt;http://santiagotapiay.blogspot.com/2011/03/integracion-de-jsf-spring-hibernatejpa.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.roseindia.net/jsf/myfacesspring/&quot; target=&quot;_blank&quot;&gt;http://www.roseindia.net/jsf/myfacesspring/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://userexception.blogspot.com/feeds/6738098167782866493/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://userexception.blogspot.com/2011/11/libros-y-documentacion-sobre-jsf-spring.html#comment-form' title='2 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/6738098167782866493'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/6738098167782866493'/><link rel='alternate' type='text/html' href='http://userexception.blogspot.com/2011/11/libros-y-documentacion-sobre-jsf-spring.html' title='Libros y documentación sobre JSF, Spring e Hibernate'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/01681511949016485084</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/AVvXsEjl5z2B68G7Kmdh9S3KC4Ex7wClOJx8d9yPLf-hx_5HlaTIAYhM5SzEh_mfF-hrdl7L2-HGPQIJ8JPmul6ABMWYrbamQwv_uHumYt9vsKcHcez0KVVbogy7N-8219MRnY2au0xEzmObs9E/s72-c/integracion.png" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-498680930346631562.post-4201622725242578838</id><published>2011-11-16T08:23:00.001-08:00</published><updated>2011-11-29T01:02:44.617-08:00</updated><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="Subversion"/><title type='text'>GIT vs Subversion</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
A estas alturas todo el mundo sabrá lo que es un sistema de control de versiones, pero siempre queremos usar la mejor tecnología para nuestros proyectos. Por eso voy comparar GIT y Subversion.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&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/AVvXsEi70NHHu3sq0orHc5pTrU26xaMVCcJGEXoV6nlN19HKrYeuEIutkM0V7BDAS16eRsXRt40iac_K9BghmNIPdXrz5-g_qTRbb7mQEo-2-LfVSBNjkYU5ddUnOa1L1kCEcqxd8btxU7bnMLU/s1600/subversion_VS_git.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; title=&quot;GIT Subversion&quot; alt=&quot;GIT Subversion&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi70NHHu3sq0orHc5pTrU26xaMVCcJGEXoV6nlN19HKrYeuEIutkM0V7BDAS16eRsXRt40iac_K9BghmNIPdXrz5-g_qTRbb7mQEo-2-LfVSBNjkYU5ddUnOa1L1kCEcqxd8btxU7bnMLU/s1600/subversion_VS_git.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
GIT es un sistema de control de versiones diseñado por Linus Torvalds y que su principal ventaja es que trabaja de forma distribuida, es decir, cada usuario es su propio repositorio y no necesita una máquina centralizada, puede intercambiar versiones con otros usuarios y mezclar versiones. Mercurial es otro sistema que trabaja de forma distribuida.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Subversion es otro sistema de control de versiones que actualmente está muy extendido y trabaja de forma centralizada, con un repositorio central, donde necesitas su aprobación para cualquier transacción.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
En mi opinión el almacenamiento distribuido es una ventaja: no necesitas red para crearte tu propio repositorio.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Subversion tiene a su favor que está muy arraigado en la comunidad de programadores y por ese motivo su comunidad es mayor y mejor la documentación, pero GIT tiene a su favor que en estos momentos esta de moda y los programadores tienden a probar las tecnologías nuevas.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
GIT es muy potente y rápido, pero cuesta más aprender a usarlo que subversion. Aparte de eso el soporte de GIT para windows es muy escaso. &lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Como conclusión podemos decir que GIT es más apropiado para proyectos de gran envergadura y con mucha gente trabajando en éllos. Subversion en cambio para proyectos más pequeños y de corta duración.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Por experiencia yo recomiendo GIT. He trabajado con las dos tecnologías y GIT me parece más seguro, rápido y cómodo de usar (aunque Subversion también es fácil de usar), por eso os voy a dejar unos enlaces para que empecéis a probar un poco. &lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;a href=&quot;http://git.gnome.org/browse/gitg/&quot; target=&quot;_blank&quot;&gt;GITG&lt;/a&gt;: Aplicación muy recomendable para ver los commit, merge y demás acciones.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;a href=&quot;http://ietl.univ-lyon2.fr/sites/ietl/IMG/pdf/Git_merging_by_example.pdf&quot; target=&quot;_blank&quot;&gt;Ejemplito&lt;/a&gt; para empezar a trabajar.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Y si no os he convencido, este &lt;a href=&quot;http://es.whygitisbetterthanx.com/#distributed&quot; target=&quot;_blank&quot;&gt;comparativa &lt;/a&gt;lo hará ;)&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://userexception.blogspot.com/feeds/4201622725242578838/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://userexception.blogspot.com/2011/11/git-vs-subversion.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/4201622725242578838'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/4201622725242578838'/><link rel='alternate' type='text/html' href='http://userexception.blogspot.com/2011/11/git-vs-subversion.html' title='GIT vs Subversion'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/01681511949016485084</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/AVvXsEi70NHHu3sq0orHc5pTrU26xaMVCcJGEXoV6nlN19HKrYeuEIutkM0V7BDAS16eRsXRt40iac_K9BghmNIPdXrz5-g_qTRbb7mQEo-2-LfVSBNjkYU5ddUnOa1L1kCEcqxd8btxU7bnMLU/s72-c/subversion_VS_git.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-498680930346631562.post-5641330737469444827</id><published>2011-11-16T00:07:00.001-08:00</published><updated>2011-11-29T01:03:06.867-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript"/><category scheme="http://www.blogger.com/atom/ns#" term="Node.js"/><category scheme="http://www.blogger.com/atom/ns#" term="WEB"/><title type='text'>Node.js</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Node.js es un entorno JavaScript del lado del servidor que usa un modelo asíncrono dirigido por eventos. Esto posibilita a Node.js que obtenga un rendimiento excelente basándose en las arquitectura de diferentes aplicaciones de Internet. El entorno está basado en V8, el motor JavaScript de Google que usa Google Chrome: uno de los intérpretes más rápidos en la actualidad para lenguajes dinámicos.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&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/AVvXsEj33fHF-OVjLXRFqVz0Gi_WaZ3oudgci1axIci8lphspjGJXze44niJjy56583ar_inWl4Y1wlVFwAHc1ezIT-gbpSlSP6ISrh3RpM8yLNw8F53Le5o2xmHR2aoV7WSt9u65E7h-hpLX90/s1600/nodejs-light.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; title=&quot;Node.js&quot; title=&quot;Node.js&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj33fHF-OVjLXRFqVz0Gi_WaZ3oudgci1axIci8lphspjGJXze44niJjy56583ar_inWl4Y1wlVFwAHc1ezIT-gbpSlSP6ISrh3RpM8yLNw8F53Le5o2xmHR2aoV7WSt9u65E7h-hpLX90/s1600/nodejs-light.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
No es el único. Existen otros entornos escritos en otros lenguajes de programación como Twisted de Python, Perl Object Environment de Perl, Libevent de C y EventMachine de Ruby. A diferencia de la mayoría de JavaScript, no se ejecuta en el navegador web, es por el contrario un JavaScript del lado del servidor.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
La sintaxis es básicamente idéntica a JavaScript, por eso propongo a los programadores de JavaScript que le echen un vistazo y lo prueben. La versión estable salió el 11 de noviembre del 2011 pero la gente ya ha hecho sus &lt;a href=&quot;http://expressjs.com/applications.html&quot; target=&quot;_blank&quot;&gt;primeras páginas web&lt;/a&gt; y hasta se ha hecho una &lt;a href=&quot;http://nodeknockout.com/&quot; target=&quot;_blank&quot;&gt;competición. &lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
No deberíais de tener problema para empezar a picar código con esta &lt;a href=&quot;http://www.nodebeginner.org/index-es.html#head9&quot; target=&quot;_blank&quot;&gt;guía de Node.js&lt;/a&gt; y la página &lt;a href=&quot;http://nodejs.org/&quot; target=&quot;_blank&quot;&gt;oficial de Node.js&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;sup class=&quot;reference&quot; id=&quot;cite_ref-2&quot;&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/V8_%28JavaScript_engine%29#cite_note-2&quot;&gt;&lt;br /&gt;&lt;/a&gt;&lt;/sup&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://userexception.blogspot.com/feeds/5641330737469444827/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://userexception.blogspot.com/2011/11/nodejs.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/5641330737469444827'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/498680930346631562/posts/default/5641330737469444827'/><link rel='alternate' type='text/html' href='http://userexception.blogspot.com/2011/11/nodejs.html' title='Node.js'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/01681511949016485084</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/AVvXsEj33fHF-OVjLXRFqVz0Gi_WaZ3oudgci1axIci8lphspjGJXze44niJjy56583ar_inWl4Y1wlVFwAHc1ezIT-gbpSlSP6ISrh3RpM8yLNw8F53Le5o2xmHR2aoV7WSt9u65E7h-hpLX90/s72-c/nodejs-light.png" height="72" width="72"/><thr:total>0</thr:total></entry></feed>