Archive for java

Setting up Mirth as Eclipse project

Posted in Computación with tags , , , , on 31/August/2015 by Alex Pérez


This is a mini-guide to setup Mirth as an eclipse project, in order to adapt some classes, build it from sources or explore the sources to learn how mirth is built. In fact, this is an enhanced version of my previous guide found in the wiki section of Mirth site. This new version has many screenshots of the configuration to provide an easier guide, and is adapted where needed to Mirth v1.8.1


Required software
To start the setup of eclipse project I’ll assume you have installed and configured:

You can install the appropiate version of subclipse from eclipse. You should go to Help item in eclipse menu, “Software Updates”, “Find and Install”:

“Search for new features to install”, and define a new repository location. Provide the appropiate URL to you eclipse version:


Continue reading

Using JMeter to test JDBC databases

Posted in Computación with tags , , , , , , , on 17/April/2010 by Alex Pérez

Despite JMeter is a well-known load testing tool when testing web projects, it seems to be unused when testing SQL performance. So I decided to share how to configure a fairly simple SQL test plan involving only one SQL statement.

Download Apache JMeter and Java, if you don’t have them already.

Get a copy of the oracle driver (ojdbc14.jar) or a JDBC driver of your preferred DB, and throw it into the JMETER_HOME/lib directory

  • Open JMeter and create a test plan as shown in fig1. Based on this plan you can complicate it as you want to load your DB and fit it to your needs. There are two JMeter Listeners (red) called “Aggregate Report” and “Summary Report” that will report us some statistical results like mean, median, throughput among others. I recommend you to use the Statistical Aggregate Report listener. Inside the thread group (blue) are two items of type “JDBC Connection Configuration” and “JDBC Request”. As we will see, is where we define the DB connection properties (user, password, driver, IP, SID), and the statement we want to test. Continue reading

XSL basics

Posted in Computación with tags , , , on 12/March/2009 by Alex Pérez

I’ve been playing arround with XML and XSL transformations recently. XSL transformations may be very useful for:

  • transforming XML to XML with different structure.
  • converting XML to another well-known formats, as CSV or SQL. Then, you can pipe the output to another tools like awk/sqlplus or perform some complex querys in a RDBM.
  • simple ordering / extracting node-values from the XML. Do you want to extract only a numeric value from a SOAP-response, if there is no a “soap fault” element?

All the above possible usages make XSL a powerful tool to deal with XML specially when integrating applications.

So, lets see a sample XML file, storing some info about music CDs:

<?xml version="1.0" encoding="ISO-8859-1"?>
<catalog>
    <cd>
        <title>Empire Burlesque</title>
        <artist>Bob Dylan</artist>
        <country>USA</country>
        <company>Columbia</company>
<price>10.90</price>
        <year>1985</year>
    </cd>
    <cd>
        <title>Hide your heart</title>
        <artist>Bonnie Tyler</artist>
        <country>UK</country>
        <company>CBS Records</company>
<price>9.90</price>
        <year>1988</year>
    </cd>
....
</catalog>

And a Java class to perform XSL transformation:

public static void main(String[] args)
    throws FileNotFoundException,
    TransformerException {
    File inXMLFile = new File("input.xml");
    File inXSLFile = new File("transformation.xsl");
    File outXMLFile = new File("output.xml");

    javax.xml.transform.TransformerFactory tFactory =
    javax.xml.transform.TransformerFactory.newInstance();

    // Get the XML input document and the stylesheet
    javax.xml.transform.Source xmlSource =
    new javax.xml.transform.stream.StreamSource(inXMLFile);

    javax.xml.transform.Source xslSource =
    new javax.xml.transform.stream.StreamSource(inXSLFile);

    // Generate the transformer.
    javax.xml.transform.Transformer transformer =
    tFactory.newTransformer(xslSource);
    // Perform the transformation, sending the output to the response.
    transformer.transform(xmlSource,
    new javax.xml.transform.stream.StreamResult(outXMLFile));
}

In the code above, there are three files:

  • input.xml: XML input file. We are using the CD catalog as input for our tests.
  • transformation.xsl: XSL sheet. The cornerstone of this test.
  • output.xml: The resulting XML from the XSL processing will be stored here. The output may no be an XML file (csv,txt,…) Continue reading

incidencias HOYGAN

Posted in Computación with tags , , , , , on 30/October/2008 by Alex Pérez

Esto es una parida se mire por donde se mire, pero me ha parecido gracioso. Últimamente estoy muy viciado a Ogame, y rebuscando por los foros para ver consejos de estrategia .. etc me encontré con este pedazo de post. Me partía, asi que me puse a indagar sobre los HOYGAN, vida y milagros de una tribu del internet:

beran les cunto tango un ipone qeu lo conpre en una tin da y resufrta que llo lo en siendo y entonses esta en sendido y sale la man sana la man sana que da bueltas y abla y despues sale como si tubiese un briquiage es desir esta como briquiado yo el ipone lo avia jaquiado y funsiono funsiona va asta que de go de funsionar porfabor que peudo aser estoi des esperado por que es tube haorriando durante muncho timpo y aora no funsiona nesesito alluda ur gente grasisrasias [1]

preg qlia,bueno la wa es qu no puedo estar mas aburrio y pense ya voy apreg una wea qu siempre quise saver(aparte de kerer saver para

qu xuxa toi vivo) y me asalto esa pregunta… si el ocio me hace pensar en puras weas.

en fin la wa es qu todo el mundo anda hablando de facebook y la wa qu es bkn y esa onda
y onda me da risa x qu todos los dias llega un wn y me dice :””oye wn hacete un facebook, el otro dia pille a un ex-compañero de pre-kinder y ahora somos super amiguis y carreteamos”
ademas que me tiene hinchado el sistemilla este, no por si mismo, sino por lo mucho que explotó acá. Me hablan de él , en el diario, en el instituto, en la micro, en la TV.

y weno eso a ti, usuario de Facebook, te pregunto, qué gracia le encuentras a esa wea?
eso po [2] Continue reading

LDAP/Jira user importing: jira-ldap-userimporter

Posted in Computación with tags , , , , on 28/September/2008 by Alex Pérez
JIRA - Bug tracking, issue tracking and project management software

I’ve slightly modified the jira-ldap-userimporter script to fit my needs. This script manages the Jira-LDAP integration, by doing a LDAP query to a server and generating a Jelly Script that can run througt the Jira’s Jelly Runner. The goal of this modification is accepting some parameters in the ldap.properties to optionally wrap the <jira:createUser> tags with a <jira:Login> tag, this way the resulting Jelly script can be run as a service.

In my scenario there are continuously adding/removing users, so I should run the jira-ldap-userimporter with crontab and executing the output as Jelly service. I found this modification may be useful for other people.

Executable XML

Jelly - Jelly : Executable XML

You can download the jar file from the project’s page, and set the jelly.service=1, jelly.username and jelly.password in ldap.properties.

apache – tomcat/jboss (mod_jk)

Posted in Computación with tags , , , on 7/July/2008 by Alex Pérez

Esta es la receta que uso para conectar un servidor Apache HTTPd con Tomcat, JBoss… cualquier servidor de aplicaciones que entienda el protocolo AJP.

¿En qué consiste esto?

Con esta configuración tendremos que las peticiones HTTP que haga un cliente, se procesarán primero en el servidor HTTP (apache) y dependiendo de la configuración de éste se reenviarán a Tomcat (o JBoss, Resin … o lo que sea, en esta entrada me referiré a todos ellos como Tomcat para abreviar).

¿Qué ventajas tiene?

En mi opinión hay configuraciones que son mucho más simples de aplicar sobre un Apache que sobre un Tomcat. p.ej:

  • Configurar el servicio para que obligue al usuario a usar https para navegar por http://lalala/secured/*
  • Exigir que el usuario se valide contra un directorio LDAP para acceder a la web
  • Permitir el acceso a determinadas zonas de la web en función de la ip/subred de origen

Pero además de facilitar estas tareas de configuración, nos puede aportar algunos beneficios como:

  • Distribuir el trabajo entre dos servicios que no tienen por qué estar en el mismo servidor: Apache maneja el cifrado SSL y Tomcat la aplicación y/o Apache sirve el contenido estático (imágenes, css, javascript) y sólo envía las peticiones de contenido dinámico (jsp’s) a Tomcat, de esta manera no le llegan peticiones de contenido estático a Tomcat y apache actúa de “proxy” de estáticos.
  • Se pueden agrupar distintas aplicaciones que corren en uno o más tomcats, para que se acceda siempre desde la misma URL: p. ej. http://www.domain.com (apache), http://www.domain.com/app1 (tomcat1), http://www.domain.com/app2 (cluster de tomcats2), … con lo que se usa siempre el mismo dominio para todas.
  • Escalado: se pueden añadir más o menos servidores Tomcat, Apache, sin tener que aumentar las prestaciones de un equipo concreto, sino añadiendo equipos o aumentando los recursos allí donde realmente hace falta. Continue reading

unas citas …

Posted in Computación with tags , on 27/June/2008 by Alex Pérez

Una selección de citas sobre Java/C++ … :

If Java had true garbage collection, most programs would delete themselves upon execution.

Robert Sewell

There are only two things wrong with C++: The initial concept and the implementation.

Bertrand Meyer

Java is, in many ways, C++–.

Michael Feldman

Java: the elegant simplicity of C++ and the blazing speed of Smalltalk.

Jan Steinman

Javascript is the duct tape of the Internet.

Charlie Campbell (y que diria de AJAX? xD)

sacadas de aqui:
http://sysprog.net/quotjava.html

empaquetar Java al estilo Debian

Posted in Computación with tags , on 13/October/2007 by Alex Pérez

Vamos a ver como generar un archivo .deb a partir de las JRE o JDK que podemos bajar de Sun. Lo habitual es hacer la instalación bajo /opt, ejecutar el archivo .bin, definir JAVA_HOME y añadir la ruta al PATH.

Tambien es posible hacer la instalación como paquete deb a partir del archivo .bin. Para eso, necesitamos bajar las utilidades fakeroot y java-package.

apt-get install fakeroot java-package
Continue reading