Wednesday, December 24, 2008
Monday, November 03, 2008
Throwing this java.lang.Error can get you fired
Imagine your boss going through your server log file and he see's the Error being thrown as CoderMalfunctionError. The discussion might not start in a pleasant way but you both might end up laughing since it really has nothing to do with Coder Malfunctioning.
java.nio.charset.CoderMalfunctionError is thrown when either encoder or decoder is malfunctioning. Sun decided to call combination of encoder and decoder as Coder and hence the confusion.
Irrespective of this Error always remember that if a project fails its the Architect or Coder's fault :-).
Posted by Kumar at 6:26 PM 1 comments
Friday, October 17, 2008
Debugging JWS with Eclipse
After nearly 10 years, I spent considerable amount of time working on java desktop application recently. Looking at Java Web Start forums and FAQ it appears still users have issues with setting up Eclipse Remote Debugging with Java Web Start. This can be easily achieved by following three simple steps:
1. Debug Java Web Start applications locally before deploying them on your web server. i.e use javaws <<fileName>> and not javaws <<url>> and set your codebase in jnlp file to local libraries (like codebase="file:///c:/jwstest").
2. set JAVAWS_VM_ARGS environment variable to right value.
Example set JAVAWS_VM_ARGS=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8199
Make sure you don't use "-classic".
3. Start Eclipse remote debugging targeting localhost and port set in JAVAWS_VM_ARGS (8199 in this example).
One thing that comes handy is collecting your logs from application in a log file while using Java Web Start.Tracing features for Java Web Start comes handy in this case.
Posted by Kumar at 9:56 PM 1 comments
Tuesday, September 23, 2008
Android Price
I saw the live webcast and tried to preorder Andriod which was supposed to be 179$ with 2 year contract. But here is what I see when I go to TMobile web site and try to buy G1:
Posted by Kumar at 3:07 PM 1 comments
Friday, September 19, 2008
Best PC vs Mac Parody
With all the hype around Microsoft and Apple Ads, I think this the best parody:
Posted by Kumar at 11:59 AM 1 comments
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.
}
}
Posted by Kumar at 10:16 PM 1 comments
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):
Posted by Kumar at 11:02 PM 0 comments
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.
Posted by Kumar at 2:21 PM 0 comments
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.
Posted by Kumar at 12:36 PM 0 comments
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.
Posted by Kumar at 10:47 PM 2 comments
Wednesday, June 11, 2008
Firefox Mobile Concept Video
Forefox Mobile concept video by Aza Raskin:
Firefox Mobile Concept Video from Aza Raskin on Vimeo.
Posted by Kumar at 9:38 PM 0 comments
Wednesday, May 28, 2008
A Clever Hack
Once in a while you see things and think "Seems so simple, Why didn't I think of that?". This Hack by Aza Raskin belongs to that Category. He created a simple and smart way to read user browser history. In the example here, Aza is maintaining an array all the social networking sites he is aware of and checking which of those site the user has visited. How can he do that? By checking the color of link referring the Site. In his own words:
By using a cute information leak introduced by CSS. The browser colors visited links differently than non-visited links. All you have to do is load up a whole bunch of URLs for the most popular social bookmarking sites in an iframe and see which of those links are purple and which are blue. It’s not perfect (which, from a privacy perspective, is at least a little comforting) but it does get you 80% of the way there. The best/worst part is that this information leak probably won’t be plugged because it’s a fundamental feature of the browser.
Posted by Kumar at 10:59 PM 0 comments
Tuesday, May 13, 2008
Sunday, March 02, 2008
iPhone like Android Demo
Darren Waters of BBC interviewed Andy Rubin Google's director of mobile platforms who provided a demo of Android Phone. The phone is based on touch screen and shows features similar to Apple iPhone running on 300MHz (Compared to iPhone which is a 600MHz phone) and also running on 3G Network (3G iPhone is still in the works). Looks like iPhone killer phones may be based on Android.
I have been playing with Android API for a while now and I have to say though there are improvements to be made, Android API is superior Java API compared to any phone in market today based on JavaME.
Posted by Kumar at 12:12 AM 0 comments
Saturday, March 01, 2008
Go Daddy: Configure Apache HTTPd as a reverse proxy for Tomcat
Configuring Apache HTTPd as reverse proxy is one way to re-route requests to Tomcat from Apache. This post addresses how to do that for Dedicated Virtual Hosting at GoDaddy.com. Doing this requires simple configuration changes as described below:
1. Find httpd.conf file (usually located at /etc/httpd/conf).
2. Make sure the following lines are not commented in the file (by default they are not commented).
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
3. Add the following lines to enable the proxy to http.conf assuming you want to enable the servlet-examples webapps that comes with Tomcat installation (better to add at the end of the file):
ProxyPass /servlets-examples http://localhost:9080/servlets-examples
ProxyPassreverse / http://localhost:9080/
4. Restart Apache (using /usr/sbin/apachectl).
Now type http://www.yoururl.com/servlets-examples/ in your browser and you will be able to execute the Servlet samples.
Posted by Kumar at 10:18 AM 1 comments
Thursday, January 17, 2008
Java is everywhere
Not sure how this is missed but SUN seem to have started posting to YouTube on how Java is Everywhere. Good PR to the minimum:
Posted by Kumar at 4:23 PM 1 comments
Sunday, January 06, 2008
RIP Netscape Navigator
AOL has announced that its discontinuing support for Netscape Web Browser. Though it was just matter of when, somehow I still have nostalgic feelings and fond memories of Netscape. Without Netscape, Internet would not have been what it is today. Some of the contributions from Netscape are good and some are bad but when Internet history is being written Netscape would have a chapter of its own. Remember Netscape used to have "About the Internet" menu item instead of About Netscape?
Its sad that winners are out of business and losers are making Billions. When Microsoft started giving away IE free and embedded in windows it has 2 goals:
1. Destroy Netscape
2. Avoid paying to Spyglass (Spyglass's contract with Microsoft required Microsoft pay to Spyglass for using its code in IE only if Microsoft makes money on IE).
Microsoft accomplished both the goals and got sued by both Netscape and Spyglass. Both Netscape and Spyglass won in the court but are out of business today while Microsoft still makes Billions. The world is a strange place :-)
Posted by Kumar at 12:01 AM 0 comments
Saturday, January 05, 2008
Amazon Kindle has JVM
Amazon Kindle seems to be heavy on Java. All the applications running seems to be developed in Java. From the look of the files existing on Kindle, it appears Kindle is using CDC and CVM. If Amazon opens up Kindle, it would become a great programming device for Java Developers soon and most widely available CDC device. According to Tritschler opening up kindle API's is a future direction.
Looking at contents of Kindle has the following files indicating its CDC based implementation:
/usr/java/bin/cvm
/usr/java/lib/jsse-cdc.jar
All the applications (Some of which are not made public exist as java applications based on existence of following jar files:
/opt/amazon/ebook/booklet:
AudiblePlayer.jar
AudioPlayer.jar
Browser.jar
ContentManager.jar
Demo.jar
Experimental.jar
Home.jar
MobiReader.jar
PictureViewer.jar
PrefBooklet.jar
Search.jar
XymlBooklet.jar
msp.jar
/opt/amazon/ebook/lib:
MobiCore-impl.jar
MobipocketCoreReader.jar
ReaderSDK.jar
SearchSDK.jar
framework-api.jar
framework-impl.jar
jdbm.jar
json.jar
kxml2.jar
xyml.jar
Posted by Kumar at 1:51 AM 1 comments