Tag Archives: Java

Build Your Vagrant Box From Scratch

Introduction: Vagrant Box Did you ever experience the pain after your DEV PC crashed? Or the tedious steps to help a new hire to set up his DEV environment? If so, you may be interested in reading the post. The … Continue reading

Posted in Tool and Debug, Uncategorized | Tagged , , , , , , , , | Leave a comment

JConsole Connection Failed

It is very annoying when you see JConsole failed to attach to a runtime with simply tells you “The connection to pid did not succeed. Would you like to try again?”. This is a completely useless message. How to troubleshooting … Continue reading

Posted in Tool and Debug | Tagged , , | Leave a comment

Yukes! The Space in @WebParam

Today I really got a bite after so many years in web application coding. It is the extra space character in the @WebParam. Problem I had a working soap based webservice API then decided to add a new parameter to … Continue reading

Posted in Java | Tagged , , , , | Leave a comment

Tomcat Server Slow Due To Blocked SeedGenerator Thread on Insufficient Random Number On Linux

Problem: An application deployed on Tomcat server (via Coldfusion11) suffers slowness problem. Sometimes opening up a https page could take 20 seconds or so. The problem was not experienced on CF9 (which doesn’t use Tomcat). And the same application runs … Continue reading

Posted in Coldfusion, Java, Linux, Tool and Debug | Tagged , , , , , , , | 2 Comments

Java Read Excel Files Using Apache POI

Apache POI is a Java library for processing Microsoft Office files. Here below are a few limited examples of its operation on Excel files(both in xls and xlsx format). Maven POM Add the following dependency into your project pom.xml file … Continue reading

Posted in Excel, Java | Tagged , , | Leave a comment

Java 8 Stream and Collector

Recently I need to generate a report based on a database query result, I ended up using Java 8 stream and collector and was surprised how easy it was. Problem: To generate a report on each person’s home country based … Continue reading

Posted in Java, Programming | Tagged , , , | Leave a comment

Eclipse Workspace Mechanic for Java Code Format in Team Environment

Problem How do you ensure each developer in your team can deliver Java code in the same format (indentation, line length, code blocks….)? Well, you of course know Eclipse preference is the place to go. You can easily import a … Continue reading

Posted in Tool and Debug | Tagged , , , , , | Leave a comment

Spring 4 Without XML

Spring web framework 4 was release last December and I have been very excited about its ability to build completely XML free applications. I always like most part of the Spring framework, especially its powerful and flexible ability to glue … Continue reading

Posted in Java, Programming | Tagged , , , , , | Leave a comment

Oracle JDK Built-in Profiler

Oracle has included its Java Mission Control and Flight Recorder (the original JRockit Mission Control) into the SE JDK package since 7u40. Both seem free for develop environment but may have additional cost for production deployment. See its pros/cons with … Continue reading

Posted in Java, Tool and Debug | Tagged , , , | Leave a comment

Thread Safety – Race Condition

When only considering operation atomicity and memory visibility, the following code is thread safe. ┬áBut a potential race condition can lead to bugs that are hard to debug. The race condition may seem obvious here, but this faulty code is … Continue reading

Posted in Java, Programming | Tagged , , , | Leave a comment