SDN Featured Content

Do you Think Hibernate is better technology that EJB

Java/J2EE blogs

Welcome to my java /J2EE blogs.


Friday, July 9, 2010

Example extending an existing java.util.Date class to add custom function

I have created a simple example where one can get the last month first day of month by creating a class by extending a simple java class and then creating own function.

 

package com.date.extension;
/**
*
* @author Ajay
* This example shows how we can create the extension of the existing java API classes to
* create our own custom class.
* These days all the new tools those are build using the java API are using these concepts
*
*/
public class DateExtension extends java.util.Date{

    /**
     *
     */
    private static final long serialVersionUID = -6611137942020737569L;
    public DateExtension(){
    }
    @Deprecated
    public java.util.Date getPriorMonth() {
            this.setDate(1);
            this.setMonth(this.getMonth()-1);
            return this;
         }
}

Thursday, June 10, 2010

Eclipse support to debug the application for Oracle WebLogic server

Want to debug the Weblogic server using plugin.. here you go.

This certified set of Eclipse plug-ins is designed to help develop, deploy and debug applications for Oracle WebLogic Server. It installs as a plug-in to your existing Eclipse, or will install Eclipse for you, and enhances Eclipse's capabilities for Java, Java EE, Spring, ORM and Web Services.

11gr1 release is available at the below given link

 

http://www.oracle.com/technology/software/products/oepe/index.html

Exception Transparency

Below is very good link from oracle project lamda on the exception transparency.

 

http://blogs.sun.com/briangoetz/entry/exception_transparency_in_java

 

E njoy reading…

Thursday, June 3, 2010

Good example of System.out.format method

You can use this new feature to quickly format strings into table :

public class Table{
public static void main(String args[]){
String format = "|%1$-10s|%2$-10s|%3$-20s|\n";
System.out.format(format, "FirstName", "Init.", "LastName");
System.out.format(format, "Ajay", "", "Kumar");
System.out.format(format, "Sunil", "Dr", "Bainsla");

System.out.format(String.format(format, (Object[])ex));
}
}


Output:



|FirstName |Init.     |LastName           |
|Ajay | |Kumar |
|Sunil |Dr |Bainsla |

Friday, May 28, 2010

Paypal payment using java

Hi All,

I have been thinking of writing on paypal to my blog from so long. As we all know the online payment,Paypal is one of the secure payment gateway.I worked on different requirement at different point of time in paypal and got a chance to explore it's flexibility.Paypal provide the developer the ease to implement the payment applcation in your current system via support to different API available in different languages. So you don't worry if you are a java developer or a .net developer, you would be getting the full API support. Paypal has different releases on API serving different needs of the customer. i.e if I am a small customer then I can implement the sandbox setting or the signature method of the paypal or we have the option of going for the merchant accounts. There are los of JSP code available and the core java example that perform the following action for the developer to get it integrated in their exisitng system.


So you have the option as:

1) Sandbox setting for paypal
2) Using Signature method created using the paypal account
3) Using the merchant account for the transacton.

You can have a test environment before you go live so even if you have the paypal account that is genuine but not the test one ,you can have the test and live environment with that account. So you can switch or have two environment like QA vs Production.


Paypal has the release Payflow_SDK_for_Java_v4.31 for the merchant account and you have then numerous settings to be made to manage your account and the reportings.

Sometime if your reporting is like you feed data to the different environment then you can get the report and write the parser as per you need for the specific report.

There are different sort of transactions that paypal supports like:

1)Credit
2)Debit
3)Sale
4)Reference
5)Swipe
6)Voice authorization
7)Void
8)EC
9)Fraud Filtering

And there are more than these.

Watch this link to download the free developer Kit for the Paypflow:

https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/library_download_sdks#PayflowPro

There are number of tutorial avalable through the paypal to learn the basics and then follo up with the provided code and modify it as per our need.There are tutorial for the Reportings also.

It's very user friendly to interact with the paypal manager as well to manage the reports and to see the exisiting transactions.

Hope you would be enjoying reading the stuff over there and see how easy it is to implement the paypal in your existing application.


Without your involvement you can't succeed. With your involvement you can't fail.

Posted by Ajay Kumar java j2ee blogs (Spring,Hibernate,JSF,Ice Faces,Rich Faces)

Friday, February 5, 2010

Groovy on Grails is awesome....

This was another busy week at office. Thank god it's Friday.

when I came back home I thought of doing something new. Guess what i found,It's on the title of this blog.

Groovy on Grails... One of the hotshot technology in the marketplace and will get sky high in the near future.

A very good visual presentation by the Project manager of the groovy on grails.
Just watch out at the below given link.


http://www.youtube.com/watch?v=NEnniZTdOYk


Really a worthy language.

Saturday, January 23, 2010

Compiling Java class from command Line setting classpath in core java

Hi All,

This is simple problem we guys face while compiling the java class when we need to specify the jar files into the path and compiler become awsome and throws the hell lots of errors. Don't worry .. java is not so bad. The only thing is that here we have to compile and run without an IDE(IDE came after the compilers).

Follow the below line to compile the java classes.

javac -classpath "path of the jar files like(lib\jar1.jar;lib\jar2.jar)" JavaClass.java


Here path of the jar files is relative to the folder where the java class resides.

But here I have missed one thing and due to that I'll get the errors when the same compiled file will get run from the command line as



java -classpath "path of the jar files like(lib\jar1.jar;lib\jar2.jar)" JavaClass


Friends make sure that your classpath is like ".;lib\jar1.jar;lib\jar2.jar"

Atleast when you are running java command.

You will now be able to compile and run your code successfully.