GNU Health – The most solidary free and open source software

Sometimes I find technologies and free software that pleasantly surprise me. Not only because of its use, but because the impact it can cause. This is the case of GNU Solidario, or GNU Health, recently awarded by the FSF for their solidary contribution.

GNU Health Logo

This software is basically a free and open source platform for managing medical data such as patient records, test results, diagnoses,… Everything any hospital need and use to offer their services.

However, most surprising of all is that GNU Health was born inside a mind of a young computer scientist from Canarias, Luis Falcon. Often, you don’t have to look far away  to find talent that can change the world. We are so used to see foreign names that we don’t realize the talent is really close.

Anotaciones y Decoradores en Java

Las anotaciones o decoradores sobre el código se han vuelto muy comunes en los últimos tiempos. Permiten al programador añadir información útil extra ya sea para comentar mejor el código o para modificar la forma de compilar/ejecutar una clase concreta. Son una extensión a Java para permitir la programación orientada a aspectos.

We have three types of annotations based on the moment of usage:

Información para el Compilador

Estas anotaciones permiten al compilador indicar si debe o no omitir errores y warnings o qué hacer con ellos. A nada que se haya trabajado con un IDE Java (como eclipse) probably you would have used this type of annotations. For example, you can use usando @Override on a function to indicate that you are overwriting a method defined on a parent class. 

This annotation is completely optional, but allows both the compiler and the developer to check that they are indeed overwriting existing hierarchical functionality.

Por ejemplo:

public class Parent {     
    public void do(){
        System.out.println("Parent");
     }
}

public class Son extends Parent{     
    usando @Override
    public void do(){
        System.out.println("Son");
     }
}
Anotaciones en Tiempo de Compilación y Despliegue

These annotations allow the compiler to add extra information about how to generate the code. By adding or modifying functionality from that in the source code you can alter how a class behaves. Also to create new classes (based on a file descriptor), etc …

These annotations will only be visible at this point. They are not compiled to the .class files. Therefore they are not available at runtime.

Anotaciones en Tiempo de Ejecución

You can use this annotations on runtime and they work on a very similar way as an interface.

Veamos directamente un ejemplo de cómo crear una anotación Runtime y cómo se puede utilizar. La anotación MyAnnotation se podrá aplicar a elementos de tipo field, es decir, a atributos de una clase:

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
     public @interface MyAnnotation {
}

Ahora podemos crear una clase que esté anotada con esta anotación:

public class myObject
 {
 @MyAnnotation
 public String field;
 }

De esta forma, en cualquier otra parte del código, podemos comprobar mediante reflexión si un objeto tiene un campo marcado con la anotación:

Class<?> res = objeto.getClass();
for (Field f : res.getFields()) {
     if (f.isAnnotationPresent(MyAnnotation.class)) {
          System.out.println("OK");
      }
}

Más información:

Notes on the GeoServer Workshop

These are the notes I took on the GeoServer workshop at the last gvSIG Conference.

Data Directory

It is important to change the settings of the geoserver_data_dir in the web.xml file to keep the data each time you restart the application container (like Tomcat). It is also good to check out the other settings as it contains interesting facts such as the type of projections to be used or the size of the cache. There are configurable data on the fly and data not configurable on the fly.

Let’s try adding some data sources to generate the layers. To add a shapefile, you have to copy the file in the same physical server machine. To include the shapefile in GeoServer, look for the option of adding a new shapefile datastore type. If you use the location “file: data /…” you use a relative uri to geoserver. You can also search using the “Browse” and use absolute paths.

Warning: Do not you give permission to any user on the configuration interface because they can see all the physical hard disk in this type of dialog.

Memory Mapped Buffers

It is best to use memory mapped buffers (unless you use Windows) if you have enough RAM, then you will avoid continuous access to physical disk. Also, it is best to reproject from native to declared projection. If the shapefile is very big, calculate the bounding box take some time. This does not happen in real databases where spatial indexes.

GeoServer allows you to insert watermarks in your data (for example to use OpenStreetMap).

When you use database connections, you should check the validate connection option, because you never know when the connection is going to crash.

GeoWebCache

GeoWebCache allows, on the latest version of GeoServer, to set up easily which layers will be cached.

You can use data which varies through time, for example for storms and hurricanes. On the database table, you will have a column for time. You can also use elevation data, but then you have to use it with Google Earth. The interesting thing is that, once you have the data, some hipothetical free visor can be used to support it…

es_ESEspañol