My thoughts as an enterprise Java developer.

Friday, October 19, 2007

Autoboxing quiz

Does widening or autoboxing happen first? Which param method will be called from the autoboxing method? If one param method is commented out then it will have no problem calling the other.

private static void autoboxing() {
Integer integer = new Integer(2);

private static void param(int param) {
System.out.println("param(int " + param + ")");

private static void param(Object param) {
System.out.println("param(Object " + param + ")");

Thursday, October 18, 2007

Website idea

If you make your fortune with this idea, send me a few bucks.
Make a website where the user can keep a list of things that they need/want to buy.
Allow easy management of that list (through web, WAP, SMS, etc).

Work with stores so they the user can get a list of all of the items in the list that the given store has. The store could even allow printing the list from a kiosk in the store (registry computers) and would include the location, price, etc. The stores would benefit because people would probably buy more if they remembered what they wanted to buy and they would buy items that they didn't know the given store had. You could then charge the store a small fee so that you wouldn't need ads on the website or user fees.

For stores that don't support that use GPS to determine the store and try to send a list of items that the store has (scrape website?).

Does a website like this exist?

Wednesday, October 17, 2007


One connection good.
Then two connections better.
Or maybe not so.

Tuesday, October 09, 2007

Form post with URL paramters (after question mark)

I had a URL that I wanted to POST with JavaScript so a made a

<form name="doForm" action="" method="post">
and used JavaScript to set the action and call submit. But Tomcat showed the request as a GET. I found that adding a dummy form input fixed the problem:

<form name="doForm" action="" method="post">
<input type="hidden" name="blah" value="blah"/><!-- need at least 1 input or the form uses method="get" even when "post" is specified. -->

Exception plan

In projects on which I have worked I find that a few common Exceptions are used over and over again and tend to lose their meaning. Does anyone have good resources for exception patterns?

Thursday, October 04, 2007

Subversion notes

We recently converted from cvs to Subversion and overall I like it much better than cvs but:

  • I wish cvs2svn converted .cvsignore files to svn:ignore properties.
  • I wish it handled tags and branches natively instead of using the copy method. Tags and branches are core parts of version control and I think something is lost by implementing them non-natively.
  • I hope svn:externals will be able to point to a specific file soon.
  • I wish update and status didn't print so much extra info about the externals. For status I have to run svn status --ignore-externals --show-updates %* | grep -v "^[XI]" | grep -v "^Status against revision" just to get what I want.

Tuesday, October 02, 2007

Converting .cvsignore file to Subversion svn:ignore property

If you have converted a cvs repository to a Subversion repository and need to convert .cvsignore files to subversion svn:ignore properties then the following script should be useful to you. Note that it probably doesn't handle spaces in filenames.


find . -name ".cvsignore" -print | sed "s/\/.cvsignore//" | tee ignoredirs.txt

for i in `cat ignoredirs.txt`
echo Processing $i/.cvsignore
svn propset svn:ignore -F "$i/.cvsignore" "$i"
svn remove "$i/.cvsignore"