Archivo

Archivo para septiembre, 2010

JavaFX Script ha muerto, Swing aún sigue en pie

Martes, 21 de septiembre de 2010

Bueno, es un cambio de tono que no esperaba. En JavaOne de este año anunciaron que JavaFX Script está muerto y en va a tener integración desde Swing y otros lenguajes dinámicos.

Las mentadas de madre no se hicieron esperar en Twitter y otros lados el día de hoy. Después de todo son 3 años en los cuales un producto se vuelve a reiniciar (yo me cuento entre quienes perdieron el tiempo leyendo sobre JavaFX). Por otro lado, Java Swing necesita mejoras pronto y quizas esta es la mejor decisión.

Como que alguien en Oracle se dio cuenta que la inversión en Swing de tantos años no se puede botar a la basura, sin embargo queda por verse si vale la pena invertir el tiempo en JavaFX antes de la versión 2.0 (apenas estamos en 1.3, la cual tiene todavía muchos huecos).

¿Quiere más detalles (código)? Aquí tienen una muestra de lo que viene…

java , , , ,

And the winner of the JavaFXpert RIA Exemplar Challenge

Lunes, 20 de septiembre de 2010

La aplicación es una belleza, además de que el código y el problema que resuelve son interesantes. Si agregar más nada
And the winner [of the JavaFXpert RIA Exemplar Challenge]

¡Ah, y tiene código abierto!

java, kodegeek, opensource, oracle, programación ,

Opciones útiles de la máquina virtual de Java

Miércoles, 15 de septiembre de 2010

Bueno, está página es super conocida para quienes usan la máquina virtual de Java por parte de Oracle.

Yo en particular corro procesos los cuales pasan largo tiempo haciendo cosas durante el día. Una de las cosas que quiero que hagan es que si se mueren me digan porqué. En especial uno de los errores más difíciles de capturar son los de “OutOfMemory” (quedarse sin memoria) ya que en muchos casos la aplicación queda en un estado inconsistente; La recomendación dice que si se queda sin memoria es mejor matar a la aplicación, aunque muchas veces es imposible cambiar el código para hacerlo de manera limpia, por lo que este truco seguro le vendrá a la mano.

Pero primero, nuestro programa el cual se va a quedar sin memoria:

1
2
3
4
5
6
7
package com.kodegeek.blog;
public class RunOutOfMemory {
        public static void main(String [] args) {
                long [] array = new long[Integer.MAX_VALUE];
                System.out.println("Mi arreglo tiene un tamaño de: " + array.length);
        }
}

El programa es un poco artificial, en especial si podemos pedir suficiente memoria con parámetros como ‘-XmsXXXXm -XmxXXXXm’, pero ilustra un caso en que no podemos reservar suficiente memoria:

1
2
3
4
5
6
7
8
9
auyan:~ josevnz$ java -classpath . com.kodegeek.blog.RunOutOfMemory
Exception in thread "main" java.lang.OutOfMemoryError: Requested array size exceeds VM limit
	at com.kodegeek.blog.RunOutOfMemory.main(RunOutOfMemory.java:7)
auyan:~ josevnz$ echo $?
1
if [ $? != 0 ]; then
    echo "Mi programa se quedó sin memoria en $HOSTNAME"|mail kodegeek@kodegeek.com
fi
auyan:~ josevnz$

Un poco complicado, además de que si el programa se queda guindado (es decir la máquina virtual nunca termina) entonces nunca sabremos que fué lo que paso :(

¿Y como nos enteramos de que murió, por ejemplo recibiendo un correo electrónico? Bueno, es sólo cuestión de agregar unos cuantos parámetros:

1
2
3
4
5
6
7
8
9
auyan:~ josevnz$ java -classpath . -XX:OnOutOfMemoryError="echo 'Me quede sin memoria en $HOSTNAME'|mail jose.nunez@gmail.com; kill -9 %p" com.kodegeek.blog.RunOutOfMemory
#
# java.lang.OutOfMemoryError: Requested array size exceeds VM limit
# -XX:OnOutOfMemoryError="echo 'Me quede sin memoria en auyan.local'|mail kodegeek@kodegeek.com; kill -9 %p"
#   Executing "echo 'Me quede sin memoria en auyan.local'|mail jose.nunez@gmail.com"...
#   Executing "kill -9 254"...
Killed
auyan:~ josevnz$ echo $?
137

Hay muchos recipes en Internet, pero este es uno de mis favoritos :)

java, kodegeek, oracle, programación , ,

¡No votes el 26 de Septiembre!

Lunes, 6 de septiembre de 2010

Recuerdo como una persona me dijo hace ya varios años atrás que no iba a votar porque no vivía en Venezuela y no se sentía con derecho de hacerlo; Es uno de los argumentos más hipócritas e irresponsables que alguien me haya dado para mostrar su indiferencia por el desnalgue que ocurre en el país.

Una de las razones por las cuales Venezuela está sumida en la situación actual es la apatía de la gente a involucrarse; Si bien es poco lo que un individuo puede hacer el aporte de un voto sumado a la opinión de otros puede cambiar muchas cosas. Es hora de ir a votar el 26 de Septiembre de este año.

¡Es hora de que a los Venezolanos les importe!. Y si no vas a opinar, entonces quédate callado la jeta :)

venezuela

Secuestro express: 4 años después

Domingo, 5 de septiembre de 2010

Leyendo las estadísticas del blog me conseguí con que el articulo que escribí hace 4 años atrás sobre la película “Secuestro express” ha tenido mucho tráfico estos últimos días.

La pregunta obligatoria vino a mi mente: ¿que ha cambiado en Venezuela, en los últimos 4 años, desde que escribí el artículo? No continúe leyendo sin ver lo que escribí ya hace tiempo atrás.

¿Ya terminó?, mi respuesta en una sola línea: Caracas es oficialmente la ciudad más violenta del mundo

Una verdadera verguenza para los Venezolanos. Me pregunto que escribiré cuando el articulo original tenga 10 años.

Espero que sean cosas mejores.

venezuela

Book review: HTML5 up and running, by Mark Pilgrim

Jueves, 2 de septiembre de 2010

HTML5 up and running

Thanks to O’Reilly I got the chance to review the book ‘HTML5 up and running‘, by Mark Pilgrim. Please read below to get an idea on what to expect about this new title from O’Reilly ($34.99).

Synopsis:

HTML5 is a set of technologies that came together as HTML, JavaScript and the Internet in general evolved. The author tries to explain how all the pieces fit together along with some important history lessons.

This is a practical and fun book, so keep your computer on all the times while you read it.

How is it organized:

  1. How did we get there?: History of some web standards, where they succeeded and where they failed because of being impractical. If you want to learn more about the history of software usability and common pitfalls then this is a must.
  2. Detecting HTML5 features: How to deal with different HTML5 compatibility levels (oh yeah, you thought the nightmares are over, think again!). Lots of boilerplate code, but still a foundation of things to come.
  3. What does it all mean?: Explains the structure of an HTML document, along changes that are mean to make it easier to maintain and create.
  4. Let’s call it a draw(ing surface): In my opinion the best chapter of the book. This is where HTML5 (with JavaScript) overlaps and competes with other technologies like JavaFx and Flash. There are examples, but I was left wanting more code to show how some features work. Also, I got the impression than mouse events are a pain in the neck to handle in HTML5, something than is easily accomplished in JavaFX or Flash.
  5. Video on the web: Very detailed explanation of most popular formats, how they ‘embedded’ video magic works, how royalties licenses can break your pocket. Pay attention to the upcoming WebM format
  6. You are here (and so everybody else): Describes the Geolocation API. This is a tricky subject and the author shows how the different browser API complexity can be handled with third party libraries and also how to deal with important issues like permissions (the user doesn’t want to tell where it is), precision, timeouts and others. Code is simple enough to understand the basics and move forward.
  7. The past, present, and future of local storage for web applications: The author tries to explain the new local storage API, which is a great improvement over cookies. Quickly explains several important limitations (storage size, everything is saved as strings) and suggest how to use Google Gears instead, which is not a bad thing.
  8. Let’s take this offline: Caching website contents for offline use. Can improve the user experience a lot, but as the author says the developer work here is a tough one as debugging is very primitive. Offline mode requires careful thinking of what server side and client side settings to change, plus not all the browsers support this feature (like IE8). Google Gears comes to the rescue
  9. A form of madness: New form elements and how to use them so even users of old browsers can have a ‘degraded’ experience. You will be probably changing ALL your form pages after reading this chapter, very useful :)
  10. “Distributed”, “Extensibility”, and other fancy words: This is all about how to use ‘microdata’ to decorate existing HTML and embed extra information without breaking your documents. Very interesting indeed as this information can easily end up displayed on the search engine or consumed by other applications that interact with your web application.
  11. Missing things:

    Sometimes I felt than there were too many mentions of Open Source frameworks to do repetitive tasks, one has to wonder if HTML5 is mature enough or if you just rather use tools like Modernize and Google Gears and forget about the browser madness (there is still plenty). Also more complex programming examples feel missing, specially for the canvas chapter (still the code shown is simple and good to the point so you can say this is a minor fault).

    Conclusion:

    The book is easy to read, well written and does a very good job explaining what is the set of technologies that made HTML5. It is not a book for beginners as it assumes you know how to code a little in JavaScript and at least you wrote an page in HTML4 before. It is not an advanced book either on the topics covered but will definitely will give you a good head start if you want to go deep on this new set of technologies.

    Kodegeek stars: 4 of 5.

internet, kodegeek, programación