View RSS Feed

Most Popular Blogs

  1. JMeter Listeners

    by , 04-27-2012 at 07:26 PM
    Listeners provide access to the information JMeter gathers about the test cases while JMeter runs. The Graph Results listener plots the response times on a graph. The "View Results Tree" Listener shows details of sampler requests and responses, and can display basic HTML and XML representations of the response. Other listeners provide summary or aggregation information.

    Additionally, listeners can direct the data to a file for later use. Every listener in JMeter provides ...
    Categories
    Tutorial
  2. The Five Tiers in Java EE

    by , 11-19-2011 at 05:57 PM (My Java Tips)
    This post briefly explains the 5 tiers in Java Enterprise Edition.



    Client

    A web browser, a hand held device or an application which remotely accesses the services of an enterprise application are examples of a Client tier. In other words a Client tier can consists of all the types of components that are clients of an enterprise application.

    Presentation

    Filters, Java Servlets, JavaServer Pages, JavaBeans and other utility classes ...
  3. Building your first Spring 3 MVC application using Eclipse

    by , 12-10-2011 at 06:51 AM
    Spring is one of the most popular application frameworks for Java development. The framework comes with various projects like Spring Core, Spring Data, Spring Web Services, Spring MVC…Each project suits for a particular area, and for the area of web development, Spring MVC is very well-known.
    Spring MVC makes web development easier by separating the three components: Model, View, and Controller.

    • The model represents the principal data that is managed by the application.
    ...
    Tags: eclipse, mvc, spring 3 Add / Edit Tags
    Categories
    MVC , Spring 3 , Eclipse
  4. Advantages/Disadvantages of EJB

    by
    EJB
    , 01-02-2012 at 05:43 PM
    EJB Advantages
    • To access EJB free security is provided.
    • Declarative transactions are provided.
    • EJBs are cached & pooled. Containers manage the EJB life cycles.
    • Remote access capabilities are present & are clustered for sake of scalability.
    • OO concepts are supported for example inheritance.
    • Usage of attributes or annotation based programming is possible.
    • Free usage & access of complex resources


    EJB Disadvantages
    • Complicated and large specification
    • Increased
    ...
  5. Minimize memory leaks in Java

    by , 01-08-2012 at 12:46 PM
    The main causes for memory leaks in java are poor design with invalid references. Garbage collector is not able to claim those objects.

    Following steps help you to detect memory leaks in your application.

    • Use tools like JProbe, OptimizeIt.
    • Use operating system process monitors.
    • Override totalMemory() and freeMemory() methods in the Java Runtime class.

    Following steps help you to minimize memory leaks in your application.
    ...
    Categories
    Memory
  6. How to get e-mail with Java

    by , 02-29-2012 at 03:39 PM
    In the article “How to send e-mail with Java”, you are familiar with the JavaMail API on sending e-mail messages from a SMTP server. What about receiving e-mail messages? Well, that is the topic of this article. We will study how the JavaMail API exposes classes and interfaces for retrieving e-mail messages from a server, to write a utility class that checks for new messages in inbox of an e-mail account from Gmail server.

    Protocols for receiving e-mail

    There are two ...
    Categories
    Mail API
  7. A recursive method for searching an array of integers...

    by , 03-08-2012 at 08:49 PM
    Java Code:
    public class ArrayLister {
    	
    	private static int arraySearcher(int[] arrayToSort,int numberToFind,int left,int right){
    		
    		int middle = (left + right) / 2 ;
    		System.out.println(middle);
    
    		if(middle==arrayToSort.length-1)
    		{
    			if(arrayToSort[middle] == numberToFind) {
    				return middle;
    			}
    			else
    				return -1;
    		}
    		
    		if(arrayToSort[middle] == numberToFind) {
    			return
    ...
    Categories
    Uncategorized
  8. SOAP Introduction

    by , 07-07-2012 at 07:39 PM
    To exchange messages and information between multiple computers, XML based protocol is used which is called SOAP. SOAP is XML based protocol so you can say that it is the XML specification application.

    Following rules or statements are considered as true for the SOAP.

    • It is a protocol for communication.
    • SOAP stands for Simple Object Access Protocol.
    • It is designed to use internet for all its communication.
    • It has the facility to use HTTP ...
    Categories
    Tutorial , SOAP
  9. Using Spring Web Flow Part 2

    by , 11-30-2011 at 05:00 AM
    In the previous article, we looked at the components of Spring Web Flow. In this article, I will tie all the pieces together for the application.

    As you know, Spring Web Flow provides a powerful controller to control the user navigation in case your application requires it. Below is the definition of a simple flow to carry out a booking process is shown graphically below:

    Why Spring Web Flow
    We know that defining and understanding page flow of a complex web application ...

    Updated 12-05-2011 at 01:45 PM by Spring Framework

    Categories
    MVC , Spring 3 , Web Flow , Spring Flow , Webflow
  10. Building your first Struts 2 application using Eclipse

    by , 12-09-2011 at 04:30 PM
    Struts is one of the most popular web framework for Java. It comes with 2 major branches, Struts 1 and Struts 2. Both implement MVC architecture but Struts 2 is much simpler, easier to build, deploy and maintain than Struts 1.
    This article will guide you through the steps to build a simple Struts 2 application using Eclipse IDE.

    Download Struts 2 and required libraries

    Download latest version of Struts 2 from Download a Release
    Select the full distribution, ...
    Categories
    Eclipse , Struts
  11. The Singleton pattern

    by , 08-12-2011 at 04:29 AM
    In mathematics a singleton (not to be confused with a simpleton) is a set with exactly one element.
    In computer science Singleton is a pattern which enforces the existence of only up to one instance of a class.

    Singleton is sometimes considered an anti-pattern, and it's famous for being considered unnecessary in the world of Python (where you duck type).
    Singleton is however useful, it is a nice and clean why to restrict the number of instances, to only one.
    In ...

    Updated 08-12-2011 at 06:13 PM by Hibernate (typo)

    Categories
    Patterns
  12. What is a remote object? Why UnicastRemoteObject should be extended?

    by
    RMI
    , 01-02-2012 at 06:34 PM
    Remote object is considered to be the one in which other JVM are used to invoke the methods. Remote interface gets implemented by the remote object class. RMI is that application that produces various remote objects.
    Responsibility of a RMI Server is:
    • To create the remote object’s instance e.g CarImpl instance = new CarImpl()).
    • Export the remote object.
    • Bind the remote object instance to the RMI registry.

    Client’s incoming calls are being accepted ...
    Categories
    Tutorial
  13. Passing parameters in RMI

    by
    RMI
    , 01-02-2012 at 06:36 PM
    • By value, primitive types get passed. For example, Boolean, char, int etc.
    • Being remote references, remote object references get passed which permits the client process to make the methods invoked.
    • By object serialization, non remote objects get passed by value. Implementation of the java.io.Serializable interface shall take place which shall allow objects to get serialized.

    Remote method’s invocation gets initiated by the client process, using calling method present ...
    Categories
    Tutorial
  14. Decorator Pattern Example

    by , 03-03-2012 at 09:27 PM
    Java Code:
    package decoratorPattern;
    
    public abstract class Beverage {
    	
    	String description;
    	int size;
    	
    	public Beverage(int size) {
    		this.size = size;
    	}
    		
    	public String getDescription() {
    		
    		String mySize = null;
    		
    		if(size == 1)
    			mySize = "Small";
    		else if(size==2)
    			mySize="Medium";
    		else if(size==3)
    			mySize="Large";
    ...
    Categories
    Uncategorized
  15. Using the Observable - Observer class , interface in JAVA. Observer Pattern example.

    by , 03-03-2012 at 10:00 PM
    Java Code:
    package observerPatternBuiltIn;
    
    import java.util.Observable;
    
    public class MyObservable extends Observable {
    	
    	int integerToBeObserved;
    	
    	public void setInt(int i) {
    		integerToBeObserved = i;
    		setChanged();
    		notifyObservers();
    	}
    	
    	public int getInt() {
    		return integerToBeObserved;
    	}
    
    }
    
    
    package observerPatternBuiltIn;
    
    import
    ...
    Categories
    Uncategorized
  16. java (7) equivalent of .Net timespan

    by , 07-28-2012 at 07:03 AM
    Quote Originally Posted by .paul. View Post
    i used Dates in this particular case, as they were better suited to the application.

    but i also created a java TimeSpan class, similar to the .Net Framework TimeSpan class:

    Java Code:
    package javaTimeSpans;
    
    /**
     *
     * @author Paul
     */
    public class TimeSpan {
        
        private int _days;
        private int _hours;
        private int _minutes;
        private int _seconds;
        
        public int Days(){
    ...
    Categories
    Uncategorized
  17. Create SQL File in Eclipse

    by , 05-21-2011 at 10:03 PM (My Java Tips)
    SQL files can be created manually in any existing eclipse project. It's simple and useful. I'll list the required steps.

    • Open Database Development perspective
    • Select File > New > Other, expand SQL Development, select SQL File, and click Next
    • This will open the New SQL File wizard.
    • To create a new project, click "Create Project" and follow the wizard instructions. Now provide the SQL file name.
    • Select a connection profile type from the Connection profile
    ...
    Tags: eclipse, sql Add / Edit Tags
    Categories
    Eclipse
  18. XML Prolog

    by , 11-01-2011 at 05:15 PM (My Java Tips)
    Developer who are working with XML, should know about XML prolog. This post will brief you about the said topic.


    Its an optional component of the XML document. If you wish to include it, then it must appear before the root element. A prolog consists of two parts:

    Part 1 comprises of XML declaration
    Part 2 comprises of Document Type Declaration (DTD)

    You can include both depending on your needs.

    Example:

    <!--?xml ...
    Categories
    XML
  19. Unary operators

    by , 11-02-2011 at 06:09 PM (My Java Tips)
    I will present an an example that will show the use of following uniary operators: Unary minus operator, Increment operator, Decrement operator, Logical compliment operator


    Unary plus operator (+) indicates positive value. This (+) operator is used to perform a type conversion operation on an operand. The type of the operand must be an arithmetic data type i.e. if a value of the integer operand is negative then that value can be produced as a positively applying unary plus (+) operator. ...
    Categories
    Java SE
  20. Example - HashMap

    by , 11-02-2011 at 06:11 PM (My Java Tips)
    Map is an object that stores key/volume pairs. Given a key, you can find its value. Keys must be unique, but values may be duplicated. The HashMap class provides the primary implementation of the map interface. The HashMap class uses a hash table to implementation of the map interface. This allows the execution time of basic operations, such as get() and put() to be constant.


    This code shows the use of HaspMap. In this program HashMap maps the names to account balances.
    ...
    Categories
    Java SE
  21. LinkedList (Generics)

    by , 11-03-2011 at 12:07 PM (My Java Tips)
    Like Vectors and ArrayLists, LinkedList can also be made to deal with only one type of objects. Lets see how to do that.



    Java Code:
    LinkedList ll = new LinkedList();
    ll.add("Str1");
    ll.add("Str2");
    ll.addFirst("Str3");
    The LinkedList named ll can only store String objects. This is very useful and provides more control over collection. You are always sure that you will get objects of a specific type from the list. ...
    Categories
    Java SE
  22. Object Pointer In Java

    by , 11-08-2011 at 05:43 PM (My Java Tips)
    Pointer in C/C++ denotes to the variables saving the reference, In Java there is only call by reference. But here the pointer refers to an object which itself has another reference within it.

    Java classes can have instance variables. If an instance variable is of class type, then it can hold instance of the class in it. This is called pointer to the object.

    In some cases, we need an object that contains an instance variable that can refer to another object of the same ...
    Categories
    Java SE
  23. Tracking Class Loading and Garbage Collection

    by , 11-08-2011 at 06:41 PM (My Java Tips)
    When any Java program runs, In background some libraries are loaded by JVM (Java Virtual Machine) in order to execute the Java program. Java command line tool(”java”) has various options that might be helpful for a Java programmer to know more about the class loading mechanisms.

    For example “ –cp “ option that instructs JVM to find necessary classes other than system classes. An usage is shown below


    java -cp ExampleDir.ExampleTipIf ExampleTip.class is not found in ExampleDir ...
    Tags: command line, jvm Add / Edit Tags
    Categories
    Java SE
  24. Plugin project - Overview page

    by , 11-17-2011 at 06:30 PM (My Java Tips)
    This post is about the overview page for plugin project.



    The Overview page is designed to be a quick reference on how to develop, test and deploy a plug-in. It is also a navigational center where you can follow the hyperlinks to navigate a particular page or execute a particular command.

    Plugin overview

    The Plug-in Content section explains the structure and content ...
  25. GPS location / Cell id / Placing a call

    by , 11-22-2011 at 05:16 PM (My Java Tips)
    This post presents miscellaneous tasks that you can do in your J2ME application.


    Firstly, how to get GPS location. javax.microedition.location.Location provides support for this. Review the snippet below:

    Java Code:
    LocationProvider loc = LocationProvider.getInstance(null);
    loc.setLocationListener(ll,0,-1,-1);
    Location location = loc.getLocation(60*3);
    String lat = location.getQualifiedCoordinates().getLatitude();
    String lon = location.getQualifiedCoordinates().getLongitude();
    ...
  26. Login Forms with Spring Security

    by , 11-27-2011 at 10:51 PM
    In my previous tips I showed how to add in the necessary servlet filters in your Spring application file and then to configure minimal security in your Spring application. In this tip, we will look at setting up a form for logging into an application.

    As I mention in the last tip, by setting auto-config to true, the autoconfiguration give our a free login page, support for HTTP Basic authentication and logging out, and Spring Security will automatically generate a login page page. ...
    Categories
    Security , Web , Spring 3
  27. Logging Out with Spring Security

    by , 11-27-2011 at 10:52 PM
    In my previous tips, I showed you how to configure and setup Spring Security as well as the login form autogenerated when auto-config is set to true. In this tip, I will show you how to setup the logout for your application. Basically the <logout> element will setup a Spring Security filter that will invalidate a user session. If it is used as is, the filter set up by <logout> is mapped to /j_spring_security_ logout. In order to ensure that there is no collision with the DispatcherServlet, ...
    Categories
    Spring 3 , Security , Web
  28. Use an Interface to Compare Objects in Generics

    by , 11-29-2011 at 11:25 PM
    A key aspect of using generics is being able to compare different objects. Consider an example where you are comparing different species of felines.
    Java Code:
    public class ComparableFeline implements Comparable<ComparableFeline> {
    
    	@Override
    	public int compareTo(ComparableFeline arg0) {
    		return 0;
    	}
    }
    So if you wanted to narrow ComparableFeline for use only among different types of domesticated cats instead of other felines such as ...

    Updated 11-30-2011 at 08:37 AM by Advanced Java

    Categories
    Generics
  29. How to send HTTP request to a URL

    by , 12-09-2011 at 07:28 AM
    Sometimes an application needs to communicate to a web server to send/receive data through HTTP. For example, connecting to a financial service to get stock price, posting user data to server to save in database, or checking for a new version of an application if available.

    This article will guide you to write a generic utility method that can connect to a specified URL with either HTTP’s GET/POST method, and attaching parameters to the request. The method will return server’s response ...
    Tags: http, java, post, request, url Add / Edit Tags
    Categories
    HTTP , URL
  30. How to validate form in Struts 2's action

    by , 12-10-2011 at 05:41 AM
    This article will guide you how to validate a form from Strut’s action classes. We are going to develop a simple web application that allows user to enter email address and password to login. The email and password will be validated on the server side, in the action class.
    You are assumed to be familiar with Java web development using Eclipse IDE and understand how a Struts application works at the fundamental level. You also know how to deploy a Java web application on Tomcat server. ...
Page 2 of 4 FirstFirst 1234 LastLast