Archive for the 'Java' Category

Changing User Agent in Rome

Wednesday, October 19th, 2005

If you are trying to use Rome and Rome Feed Fetcher, the following will not change the default user agent:

FeedFetcher feedFetcher = new HttpURLFeedFetcher();
feedFetcher.setUserAgent(\”User Agent 007\”);
SyndFeed feed = null;
feedURL = new URL(rssUrl);
feed = feedFetcher.retrieveFeed(feedURL);
List entries = feed.getEntries();

To change the user agent you must use the InfoCache as shown:

FeedFetcherCache feedInfoCache = HashMapFeedInfoCache.getInstance();
FeedFetcher feedFetcher = new HttpURLFeedFetcher(feedInfoCache);
feedFetcher.setUserAgent(\”User […]

Cobertura

Sunday, July 10th, 2005

Cobertura is a fork of jCoverage. It runs reports to let you see how much of your code is being tested by unit tests. This is incredibly useful to find areas of your code where a bug would go undetected.
It looks like there is a plugin for Maven already, so I’m […]

Maven Runs out of Memory

Saturday, July 2nd, 2005

Maven 1.0 has some problems with memory leaks. Most of the time these aren’t issues, but if you are trying to compile a multiproject you might run into problems. By default Maven tells java to let it have up to 256MB of ram. If you need to increase this you’ll need to […]

Why Java Won’t Get It Right

Sunday, April 3rd, 2005

Why Java Won’t Get It Right is an interesting entry about some of the problems with Java technology. The best part is that it is written by someone who actually knows Java. A part that I particularly liked was:

They over-architect everything. I’ve actually used a Java framework (I’m not gonna say which) […]

Thread.sleep() problem

Saturday, April 2nd, 2005

The following is a JUnit test that looks like it should always run without a problem. Mark the current time in a variable called start call Thread.sleep and tell it to sleep for x number of seconds, note the current time again in a variable called end and then assert that end - start […]

Entry Level Java Certification (SCJA)

Tuesday, March 29th, 2005

According to some posts on Java Ranch, Sun is looking to create a Sun Certified Java Associates exam. The idea is to have an exam that companies can use to certify entry level programmers. I’m not sure why this is better than the current Sun Certified Java Programmer certification. It sounds like […]

Comparable vs. Equals

Sunday, March 27th, 2005

Agylen: Comparable vs equals has a nice discussion of how compareTo is used in Sets.
If you don’t understand how Java is going to use your compareTo and your equals methods you can run into a problem with Sets. Basically you shouldn’t have a compareTo() method that returns 0 unless equals() returns true.
Since […]

ONJava.com: Using JUnit With Eclipse IDE

Wednesday, February 23rd, 2005

Using JUnit With Eclipse IDE is a great simple tutorial on how to use JUnit in Eclipse. It doesn’t assume any knowledge of JUnit, but is useful as a quick tutorial for people wanting to make a switch to the Eclipse development environment.

Simple Introduction to Reflection

Tuesday, February 22nd, 2005

Reflection is a mechanism in java that allows to to get information about a class without needing to know the type of the class. The program below takes a java class name as a command line argument and shows you all of the methods and field names that are in the class.
You […]

Dealing with Slow XSLT Transformations

Sunday, January 30th, 2005

I have some XSLT stylesheets that I use to integrate information from Amazon with my reading list on my website. This weekend I decided to create another list using Amazon’s “People Who Bought this Book also Bought” feature. After a couple generations of downloading books that were related to books I read, I […]

Running out of Memory with Java

Sunday, January 30th, 2005

The other day when doing some particularly large xslt conversions I kept running out of memory in the JVM. After doing a bit of research I found two command line arguments that help solve the problem. -mx allows you to set the maximum size of the memory allocation pool while -ms allows you to […]

New Sun Java Programmer Test for 1.5

Sunday, January 2nd, 2005

The new certification test for Java 1.5 (or Java 5 or Tiger) is going to be coming out as a beta soon. According to Kathy Sierra’s weblog the new test is going to avoid the complicated “puzzle” type problems and concentrate more on your ability to accomplish specific objectives with Java code. It […]

Comments in Java

Sunday, January 2nd, 2005

One of the questions I ran into when preparing for the Java Certification exam dealt with how Java handles nested comments. Since this isn’t something I usually do in my code I wasn’t sure how it worked. It turns out the results were different than I expected.
First lets look at the double slash […]

Passing the Java Programmer Certification Exam

Sunday, January 2nd, 2005

After using Java for about four years, I started wondering how well I really understood the language, so I started looking into Sun’s certification. Sun offers the following certifications:

Sun Certified Programmer
Sun Certified Developer
Sun Certified Web Component Developer
Sun Certified Business Component Developer
Sun Certified Developer for Java Web Services
Sun Certified Enterprise Architech
Sun Certified Mobile Application Developer

The […]