Friday, September 19, 2008

Best PC vs Mac Parody

With all the hype around Microsoft and Apple Ads, I think this the best parody:

Monday, September 15, 2008

JPA: java.lang.IllegalArgumentException: Removing a detached

One of the common issues that I end up debugging is the following exception:

java.lang.IllegalArgumentException: Removing a detached instance

When does this occur?: While removing a record.
Why does this occur?: You are trying to delete a record which is retrieved in another transaction (probably even trying to delete a record that is stored in user HTTP session).
How to fix it?: Make sure you retrieve the record in the same transaction. Sample code for the same:


public void removeOrganization(Organization org) {
if (org.getId() != null) {
org=em.find(Organization.class, org.getId());
em.remove(org);
} else {
// your error logic.
}
}

Sunday, August 31, 2008

Low cost Multi-Touch project

Since there is too much hype of Multi-Touch products from different companies, its worth checking out Johnny Lee's cheaper version of Multi-Touch screen. I bought a LED flashlight for 18$ and ever since having fun with my WII.

Here is a introduction video from Johnny Lee:


Johnny Lee’s page has more info and is worth checking out.

Also Wiimote Whiteboard has a good Java API that worked fairly well for me (Tried only on my Mac):

Thursday, August 28, 2008

Yahoo: Nicely Done

Google and Yahoo both offer Ability to add RSS feeds to users personalized home page. While checking my personal server's access log, I noticed a nice little information that Yahoo sends with each request. It sends you data on how many users added your feed and how many times a feed has been loaded on users homepages. Here is a snippet from from yahoo and google requests from Apache access logs:

216.39.58.78 - - [28/Aug/2008:13:19:43 -0700] "GET /personalfeed.rss HTTP/1.0" 304 - "-" "YahooFeedSeeker/2.0 (compatible; Mozilla 4.0; MSIE 5.5; http://publisher.yahoo.com/rssguide; users 1; views 247)"
209.85.238.24 - - [28/Aug/2008:13:27:11 -0700] "GET /personalfeed.rss HTTP/1.1" 200 2173 "-" "Feedfetcher-Google; (+http://www.google.com/feedfetcher.html)"

Nicely done Yahoo.

Tuesday, August 26, 2008

Making Div Clickable

Here is a simple trick to make entire div clickable which is needed when you want to make a banner clickable for a site:


<div id="banner" style="cursor: pointer;" onclick="location.href='http://javaswamy.blogspot.com/';">
</div>

The best part is inside the Div you can have other links redirecting user to a different page.

Monday, August 25, 2008

Google: Are you kidding me?


That's the related search that World No 1 Search engine could come up for Java?

Yahoo seems to be better in this case:


I guess there is still need for multiple search engines.

Wednesday, June 11, 2008

Firefox Mobile Concept Video

Forefox Mobile concept video by Aza Raskin:


Firefox Mobile Concept Video from Aza Raskin on Vimeo.