Awesome trick using reflection and java.lang.String’s literal store.
http://www.theserverside.com/news/thread.tss?thread_id=53818
Awesome trick using reflection and java.lang.String’s literal store.
http://www.theserverside.com/news/thread.tss?thread_id=53818
Tried out iText sometime back for creating PDFs in a J2EE app (ADF 10.1.3 to be specific). It’s a fabulous tool. From my initial read up, pdf layouts will be a bit pain to create as the component tree has to be programatically created. I didn’t need to do layouts so I may have missed out easier ways of doing that. For my use-case, I had pre-built PDFs with AcroForms. With iText, it’s quite easy to fill in the fields in the AcroForm and save a copy. All in a few lines of code. If you have to create/edit PDFs in your Java application, iText is the best thing out there.
Everyone knows the ubiquitous instanceof operator especially when we drill into our minds that instanceof is not a method, it is an operator. :-) You would’ve found it useful in many situations especially when you need to do a bit of refactoring or reflection. This is one operator any programmer ought to be careful about. Unfortunately, you find it strewn around the place all the time. When used in the wrong place it easily becomes a bug.
Did you know that the Java VM ships with two different binaries? Yes, there’s a client VM and a server VM. They differ in various compilation policies and (in particular) heap defaults. While the client VM can be used for applications that require quick start-up and low memory footprint, the sever VM is – well – for “server” like applications. The server VM is started up by default on “server-class” machines. See Ergonomics in the 5.0 Java[tm] Virtual Machine for definitions.
Sadly, my dev box – a 32-bit intel running MS Windows – does not qualify as “server-class”. I would have to start up java with the “-server” switch all the time. This can be impractical when I am using someone else’s ant scripts, etc. So what can I do?? Well, there is another unsupported (and mortal) way. Edit the file “jvm.cfg” found in $JAVA_HOME\jre\lib\i386. Move the server entry to the top of the list and you are set to go.
How often have you implemented a cache in your application? Quite a lot? And how often has the cache lead to an OutOfMemoryError? Did you know that you could use something called SoftReference to prevent that? I didn’t too. It’s surprising how such a great feature in Java hasn’t been as popular as it should be. Interested? Read Ethan Nicholas’ post.
Recent Comments