27 July 2011

String ... VS String []

Both are the same, but the later one calling the method you need to create String [] first and then call while the first one you can call it without creating String [].

More @ stackoverflow

11 July 2011

Google I/O 2011: How to Get Your Startup Idea Funded by Venture Capitalists





Some of the most interesting people in business, founder of Excite, have you ever used it ? Founder of FriendFeed and former employee of google and Seth, creator of scavenger. Watch it if you have time.

Google Hosting and its problems

It is easy to use Google Sites, Google apps and Google blogs (next generation name for blogger). But it is not that easy to remember if you have registered your blog with one of these services long time ago or is it someone else ? I am saying that for those who encountered this problem in hosting their sites/blogs with the custom domain name with google blogging.
It says
Another blog or Google Site is already using this address.
Good luck finding that blog or one page that you created long time ago and deactivate it. I couldn't find that, I wasn't even sure if it was me that created it, so I ended up deactivating my whole google apps for my domain, and I am still waiting for it to deactivate to see if it solves the problem. I know google for privacy issues won't let anyone know who is the one hosting your domain name on their sites. It is not fair to the real owner of the sites since even without confirmation that it is their own, you can ask google to host it on its google sites or blogger service. There should be some sort of approval for domains to add to your blog or sites. It might be as easy as first change the CNAME to ghs.google.com. and then use them with google sites, blogger service. That way one who has no control over a domain can't add that to his/her account and blocking you from using it in future.

There should be some simple way to resolve this issue, and should have been at least addressed in one of blogger's posts.

4 July 2011

Hibernate / Jasper Report Integration

I am looking into Hibernate / Jasper report integration. It seems that Jasper Report has not initially been compatible with Hibernate but only from it later versions. This make life harder when it comes to the nature of Jasper Report, whom as a novice I believe treats everything as a row and should be inputed with rows of data to be able to generate the report.

In different sources, I have come across solution on how to integrate Hibernate with Jasper reports. These are what I have found.

In 1 author has mentioned that:

However, when the Hibernate query returns tuples of objects (each tuple as an array, each array as an element in the returned List), things get a little tricky. Jasper needs a way to reference each object in the array by a field name. This class is a good solution, but at this time you are required to pass an array of field names matching the results of the query.
And he/she is suggesting that it is a helper class needed to interpret those results and transfer them into usable data for Jasper.
John is also suggesting the same solution for using Hibernate with Jasper; You can find more tips on optimization of Hibernate / Jasper integration in his post as well.
This is also a really good start for Jasper, a really nice Hello world tutorial for Jasper Reports.

Resources:

  1. http://community.jboss.org/wiki/UsingJasperReportsWithHibernate
  2. http://www.javalobby.org/articles/hibernatequery103/
  3. http://www.sanjbee.com/content/wp-content/uploads/2008/07/jasper.pdf

@EJB Annotation in EJB Client

Problem:

App server is JBoss, I created the Jar file for the bean class and interface in the right directory. Now I created a simple client using EJB annotations, but I am getting a NullPointerException.

Solution:

EJB annotation is an incejction, it is supposed to be deployed on the app server and then executed in an Application Client Container (ACC) so that injection can occur. Starting the ACC requires an application server specific command.


The following wiki explains the usage of the ACC in JBoss (how to package, deploy and launch an ACC): How to use an application client in JBoss-5.

If you don't want to use an Application Client Container and instead just run the application client class through a java command, injection won't be possible and you'll have to perform a JNDI lookup.

And in both cases, you'll have to provide and use a remote business interface for your bean.