HSSF (Horrible SpreadSheet Format) is a great library for creating Excel spread-sheets using Java. It is part of the larger Apache POI project. Yesterday I hit an interesting issue while creating an Excel file with a modestly large collection of elements.
The Excel file was generated fine by HSSF but when opening it, Excel greeted me with the following message:
"some text formatting may have changed in this file because the maximum number of fonts was exceeded"
As it turns out, Excel only allows for a limited amount of styles/fonts to be used. Thus, the good advice when dealing with Excel files is to reuse styles and fonts wherever possible. It also results in substantially smaller Excel files. I was able, in my little example, to reduce the file-size from 54kb to 17kb, just by refactoring my usage of styles.
On last interesting observation: Once you hit that popup error in Excel, it does not simply suffice to close the Excel file, but you must restart Excel in order for the message not to popup again.
Friday, September 26, 2008
Friday, September 12, 2008
Flex and Maven First Steps
I finally decided to take the plunge and started learning Flex last night. First I wanted to setup my environment. As I don't have a Flex Builder License (My Evaluation License Expired before I had a chance to actually use it...arrgh...) I started creating a simple build environment that works with a plain Eclipse setup.
As far as I see there are 2 options out there:
http://www.israfil.net/projects/mojo/maven-flex2-plugin/
http://code.google.com/p/flex-mojos/
After some Googling the there seemed to be a preference for flex-mojos. So I decided to go with it.
Getting my first hello-world compile using flex-mojos was a bit tricky. The issue is that flex-mojos is under heavy development and seems to change a bit. E.g. the location of their Subversion repository and Maven repository changed which however is not necessarily reflected in their examples. Nevertheless there is a very helpful blog and a useful wiki available.
In order to keep up with the project, I decided to also check-out the latest flex-mojo trunk from Subversion and build it locally. Well, it turns out that my local Maven version on my MacBook Pro was not up-to-date but finally I got everything running.
Thus, after some fiddling around I got my first Maven-based Flex-Hello-World running.
In my next post I blog about some further progress and also some of the configuration that was necessary.
As it got really late last night I came across good read about building Flex applications using Maven and Flex-mojos:
http://www.adobe.com/devnet/flex/articles/fullstack_pt1.html
http://www.adobe.com/devnet/flex/articles/fullstack_pt2.html
http://www.adobe.com/devnet/flex/articles/fullstack_pt3.html
As far as I see there are 2 options out there:
http://www.israfil.net/projects/mojo/maven-flex2-plugin/
http://code.google.com/p/flex-mojos/
After some Googling the there seemed to be a preference for flex-mojos. So I decided to go with it.
Getting my first hello-world compile using flex-mojos was a bit tricky. The issue is that flex-mojos is under heavy development and seems to change a bit. E.g. the location of their Subversion repository and Maven repository changed which however is not necessarily reflected in their examples. Nevertheless there is a very helpful blog and a useful wiki available.
In order to keep up with the project, I decided to also check-out the latest flex-mojo trunk from Subversion and build it locally. Well, it turns out that my local Maven version on my MacBook Pro was not up-to-date but finally I got everything running.
Thus, after some fiddling around I got my first Maven-based Flex-Hello-World running.
In my next post I blog about some further progress and also some of the configuration that was necessary.
As it got really late last night I came across good read about building Flex applications using Maven and Flex-mojos:
http://www.adobe.com/devnet/flex/articles/fullstack_pt1.html
http://www.adobe.com/devnet/flex/articles/fullstack_pt2.html
http://www.adobe.com/devnet/flex/articles/fullstack_pt3.html
Upgrading Maven on Apple's Leopard
Today on my MacBook Pro I needed to upgrade the pre-installed Maven version 2.0.6 to the latest Maven version 2.0.9.
This gave me a good reason to install MacPorts. The took a little bit of time, especially since as a pre-requisite I also needed to install Apple's Xcode which comes along as a hefty 1GB download.
Once it was downloaded and installed, I installed MacPorts. For some reason after the MacPorts installation successfully finished, executing sudo port -v selfupdate did not work. The port command was not found... Well, it turns out that I needed to add the path to my .profile which is located in the home directory:
Lastly, all I needed to do in order to install the latest Maven version was to execute:
sudo port install maven2
Maven 2.0.9 was immediately available thereafter:
mvn -v
This gave me a good reason to install MacPorts. The took a little bit of time, especially since as a pre-requisite I also needed to install Apple's Xcode which comes along as a hefty 1GB download.
Once it was downloaded and installed, I installed MacPorts. For some reason after the MacPorts installation successfully finished, executing sudo port -v selfupdate did not work. The port command was not found... Well, it turns out that I needed to add the path to my .profile which is located in the home directory:
- export PATH=/opt/local/bin:/opt/local/sbin:$PATH
- export MANPATH=/opt/local/share/man:$MANPATH
Lastly, all I needed to do in order to install the latest Maven version was to execute:
sudo port install maven2
Maven 2.0.9 was immediately available thereafter:
mvn -v
Wednesday, September 10, 2008
Effective Java @ Parleys - Presentation
I loved reading Effective Java Second Edition by Joshua Bloch - At Parleys they have a presentation by Joshua Bloch on some of the issues discussed in the book. It is really a great presentation and I can only highly recommended it (e.g. for understanding PECS when dealing with generics (producer extends, consumer super)).
Tuesday, September 9, 2008
jpwgen - Password Generator for Java
If you ever have the requirement to auto-generate passwords that must meet certain security guidelines such as having at least one number, a special character etc. then take a look at jpwgen. It is written in Java and is based on pwgen (unix).
What is nice about it is that you can use it both as a command line program and/or as a library within your applications.
By the way, if you need a GUI tool for Windows to generate passwords, check out pwgen-win
What is nice about it is that you can use it both as a command line program and/or as a library within your applications.
By the way, if you need a GUI tool for Windows to generate passwords, check out pwgen-win
Monday, September 8, 2008
A Life-Changing Event...
Subscribe to:
Posts (Atom)