Skip to content

Tag: vídeo

jam over jobim

My friend Carlos Kaplan on keyboards and me on accustic guitar, jam session over “Samba de Uma Nota Só” by Tom Jobim.
At my room in Maryland.

Life = Risk

A simple and beautiful video about the early failures, things and people that tries to put you down and we have to face before achieve what we really want.

“If you never failed, you never lived”

Casa Brasil na TV

Esse é uma amostras dos bastidores do que rolou nas filmagens nessa terça-feira na Casa Brasil unidade Vila União. As filmagens são por mim e pela pequena Vitória de apenas 5 anos. =)

A reportagem vai ao ar no canal da Globo, esse sábado ao meio dia. Não percam!

Atualizado em 7 de Março:

Algumas fotos dos bastidores da gravação.

Reportagem Reportagem Reportagem Globo? Reportagem Reportagem

Pra quem não assistiu na TV, eu gravei com a câmera, aqui está.

Download: cbvilauniaonatv.ogg

Parabéns Alyne, Alexandra, Leonardo e todos, vocês foram ótimos!

Gravatar with JavaFX

Gravatar is easy way to put global recognized avatar images into any Internet application. Gravatar would stands for globally recognized avatar.

Below,  the Java class that I got from the Gravatar Java reference. Here is a static class called md5 that applies a MD5Sum algorithm over a string. Is a little complex code but all behavior keeps encapsulated and who uses it don’t need to know how it works. Just gives a string and receives a encrypted string. Those two codes are also a good example of how calling Java classes inside a JavaFX code.

package gravatarexample;


public class MD5 {
   public static String toHex(String message) {
      try {
         MessageDigest md = MessageDigest.getInstance("MD5");
         byte array[] = md.digest(message.getBytes("CP1252"));
         StringBuffer sb = new StringBuffer();
         for (int i = 0; i < array.length; ++i) {
            sb.append(Integer.toHexString((array[i]&0xFF)|0x100).substring(1, 3));
         return sb.toString();
      } catch (NoSuchAlgorithmException e) {
      } catch (UnsupportedEncodingException e) {
      return null;

As a Java class in the same package, any JavaFX (or Java) code can call it without any problem. Just to keep the code more clear I’m importing it explicitly. Is this example I also create some Swing interface to give user the option to put his mail, adjust the image size and get a output direct link or html image tag.

package gravatarexample;

import gravatarexample.MD5;
import javafx.ext.swing.SwingButton;
import javafx.ext.swing.SwingSlider;
import javafx.ext.swing.SwingTextField;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.VBox;
import javafx.scene.Scene;
import javafx.stage.Stage;

var mail = "Email";
var key = "";

function gravatalize(mail:String, size: Integer): String {
   return "{MD5.toHex(mail)}?s={size}"

var inputtxt = SwingTextField {
   columns: 20
   text: mail

var slider = SwingSlider {
   minimum: 10
   maximum: 128
   value: 100
   vertical: false

var button = SwingButton {
   text: "Get Gravatar"
   action: function() {
      key = gravatalize(inputtxt.text, slider.value);
      directoutput.text = key;
      htmloutput.text = "\"gravatar\"";
      photo.image = Image {
         backgroundLoading: true,
         url: key};

var photo:ImageView = ImageView {
   image: null

var directoutput = SwingTextField {
   columns: 20
   text: "direct link image"


var htmloutput = SwingTextField {
   columns: 20
   text: "html tag image"

Stage {
   title: "Gravatar"
   width: 300
   height: 340
   scene: Scene {
      content: [
         VBox {
            spacing: 10
            content: [inputtxt, slider, button, directoutput, htmloutput, photo]

The string itself is assembled in the gravatalize function. You give a mail and it’s returns a Gravatar direct link to the image. There’s many cool ways to use together Gravatar and a JavaFX Internet application.