if you think this library has been useful, feel free to give any help. Don't be shy.

Click here to lend your support to: Java2word, coding for fun! and make a donation at !

Tuesday, November 30, 2010

best vi vim macvim command reference

I have recently started using MacVim for my Ruby stuff I write for fun. It is amazing things you can do using this text editor combined with all those plugins.

I installed Janus version ( of MacVim and turned it to a proper IDE for ruby code.

I found this website that has absolutely everything about vi - best VI reference:

I use Janus on Linux as well and works perfectly as well.



Monday, November 22, 2010

Java Sun JDK 1.5 or 1.6 no Ubuntu 10.10 or 11.04 (updated: 01 Jun 2011)

As we know, Java 1.5 has not been maintained anymore and Java 6, has been hanging around for a while and Java 7 is coming soon. But it doesn't mean everybody has to move on to Java 1.6. The problem in Ubuntu is they force you to use OpenJDK. Worse yet, they don't let you downgrade to 1.5.

There are lots of legacy systems running on Java 5 and we can't forget that. It is also about freedom of choice. If you want to install Sun JDK 5 or 6 Ubuntu should not make your life difficult.

Ubuntu 10 and 11 don't allow us to natively (or easily) install Sun JDK's via apt-get.

It is so frustrate when we try to install it on Ubuntu 10.10 and have no luck:

sudo apt-get install sun-java5-jdk (or sudo apt-get install sun-java6-jdk)

After installed, the JDK will go to this directory: /usr/lib/jvm/java-6-sun

You can see all JDK's installed running the following command:

sudo update-java-alternatives -l

After a while, finally got the solution for this:

sudo add-apt-repository "deb jaunty multiverse"

sudo add-apt-repository "deb jaunty-updates multiverse"

sudo apt-get update

sudo apt-get install sun-java5-jdk

Check it out just to confirm:

sudo update-java-alternatives -l

The commands above worked for me in Ubuntu 10 and 11, installing Sun JDK 1.5 and 1.6.
If it doesn't work, try to add the following repositories and repeat the process: (anonymous suggestion - thanks a lot):

sudo add-apt-repository "deb hardy multiverse"
sudo add-apt-repository "deb hardy-updates multiverse"



Thursday, July 22, 2010

Java2Word Microsoft Word Document Generator from Java code without any "special" components or libraries

I had a problem in my work a few weeks ago which was how to generate one Microsoft Word Document from Java code. Reports were composite by 40 pages around and over 30 database queries to bring data. It also had cover page, table of contents, header, footer and many tables.

We tried a lot of things but they were all crap solution. We had to delivery those "word" reports so the solution was pretty bad: Generate Jasper RTF and open as an Word Document.

When you open this rtf, the result is just horrible. You can't properly edit those dodge tables generated by jasper. Other problem is when you save this document as .doc, file size increased from 5 MB to 40 MB.

So... there were I again... playing around with the problem...

I decide to create an API in Java to generate Word documents from Java code. The Document generated HAS to be compatible with Microsoft Word and can't have any manipulation - so has to be ready for the end user!

I wrote two implementations: one for Word 97 - 2003 and another for Word 2004 +.

To be honest I spent more time in W2004 because this is the current standard.

I have created the java project and hosted in Google code:

The philosophy is have something in Java and really easy like:

   IDocument myDoc = new Document2004();
myDoc.getBody().addEle(new Heading1("Heading01"));
myDoc.getBody().addEle(new Paragraph("This is a paragraph..."));

You are Java dev and deal with this API. You Don't need to worry about the implementation!

*Project has 97% of code test coverage.

** When I say no "special" components I mean not using any MS library.
In order to use the Java2Word you will need in your classpath xstream (if you use images) and log4j (for other than JBoss server).
Please refer to dependencies section in the project page.

Sunday, May 30, 2010

SQL Server performs very well on data warehouse

I personally don't like .net, ms office, windows and all this shit. Maybe because I love open source, Linux, Java, Mac.

In a data warehouse project, we utilized MySql as first option but the database was considerably slow with 90 Gigabytes database (We are using "star schema" for the data warehouse).

In order to solve this problem, the database was switched to SQL Server . After the initial historical loading, the SQL Server database has got 460 Gigabytes of data and I am very impressed with the response time.

Considering the amount of data processed, I have to admit that SQL Server is a great database for huge data warehouse projects.

It is difficult to sit on your hands when the SQL Server performs comfortably well in a 460 GB database.