BibLaTeX, BibTeX backend, multiple cite keys

This drove me literally crazy: I couldn’t fit a multiple citation in the same square brackets.

I was going like blabla\cite{key1,key2} and it came out like blabla[1], [2] instead of blabla[1,2]

After some time of googling (and admitting my own ignorance in this field) I came up with:


Blablah \parencites{key1,key2}


This renders the citation as I wanted. Hope you find this useful.

How do you crop PDF files?

Sometimes you need to crop a PDF, maybe just to cut out a single image, or a single paragraph you want to embed in another document. You may want to keep it vectorial.

That’s what BRISS does, and it does it good and fast, so I suggest you to give it a try. Also, it’s Java so it’s cross platform (I tried it on Linux and Mac OS X).

You could also use it to crop “wide” margins in some documents so your PDF gets better surface coverage on your eBook reader.


BRISS in action to crop marging for better surface coverage on eBook Reader

BRISS in action to crop marging for better surface coverage on eBook Reader

Camel and JSON

Well, I’m using Apache Camel for a project and sometimes I need to observe messages flowing on the routes, obviously I use the wiretap, but where do you send those messages?

I send them to a direct endpoint that renders them in JSON so I can inspect those messages (remember: no circular references allowed). This is the route I use.


So now I only need to wiretap("direct:json") whatever I want.

Camel Exponential Backoff Delay Route

I needed to retry a message over a JMS topic until I got an answer, I wanted to use and exponential delay for sending messages. After little thinking I came up with this route:

public class BackOffDelayRoute extends RouteBuilder {

	public class BackOffDelayCompute {

		public void compute(Exchange e) {

			Integer backoffDelay = 
							new Integer(500), Integer.class);

			backoffDelay = backoffDelay * 15 / 10;

			e.getIn().setHeader("backoff", backoffDelay);



	public void configure() {

			.bean(new BackOffDelayCompute())




I think it’s the dirtiest way I could came up, but after all I’m a beginner.

PromImport, Syslog, CSV, and so on.

Recently I had to import in ProM6 a log I was generating with Log4J on a Java project.

This involved several machines gathering their logs on a syslog server, log lines where CSV formatted, so to be easy to import but the PromImport tools had quite some problems converting the dates in my file. If you had similar problem I’ll show you a cheap and dirty solution that may work for you too.

Import in your IDE the PromImport Sources, navigate in the package org.processmining.prim.filters package and open class, find the parseDate method and modify to your needs. In my case I had a HH:mm:ss.SSS timestamp, so it became like this:


	protected Date parseDate(String timestamp) {

			SimpleDateFormat formatter = 
					new SimpleDateFormat("HH:mm:ss.SSS");
			Date date;
			try {
				date = formatter.parse(timestamp);
				return date;
			} catch (ParseException e) {
			return null;

Hope you’ll find it useful.

Package Apache Camel, ActiveMQ and Spring into a runnable JAR

I wanted to create a fat JAR (executable JAR with all dependencies) for a project involving Camel and ActiveMQ, using Spring.

This project had some Camel routes and I wanted to bundle the ActiveMQ broker (for distributed federation of brokers, via multicast/peer) to make it easier to deploy and run my distributed application.

I found out that generating the package with maven assembly plugin lead to this error:

Exception in thread "main" org.springframework.beans.factory
.parsing.BeanDefinitionParsingException: Configuration
 problem: Unable to locate Spring NamespaceHandler for XML
 schema namespace []

Offending resource: class path resource

This happens because the packaging phase overwrites META-INF/spring.handlers and META-INF/spring.schemas files, whenever they are found in dependencies.
I solved this through googling and then using maven shade plugin

					<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
					<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">

EDIT: i forgot to mention, you need to launch maven with

mvn package

to build the (fat) jar, you’ll find it in target/ folder.

I hope you’ll find this useful.

Populate directory with random, nested, files.

Sometimes for testing you might need to populate some sort of random filesystem structure, like random files in random folders. This is what I used today, it’s simple and dirty but did the job.



for i in rand_{A..E}{0..9}
	 	if ! ((RANDOM % 5)); then
  		  mkdir $i
  		  cd $i

		if ! ((RANDOM % 15)); then
  		  cd $DIR

	 	dd if=/dev/urandom of=./$i bs=4k count=$((RANDOM/100))

Hope you find it useful.