View RSS Feed

My Java Tips

  1. Handling ASCII character set in Java

    by , 11-19-2011 at 06:11 PM (My Java Tips)
    In this post, I will talk about ASCII character set and how to deal with ASCII codes in Java.


    ASCII character uses 7 bits for character representation. This means that there are total of 128 characters supported by ASCII set. Point to note is that there are only 93 printable characters in ASCII whose ASCII codes are from 33 till 126.

    Java supports all popular character including UTF. But sometimes you only want the input to comprise of ASCII printable characters. This ...
  2. IDL Plugin for Eclipse

    by , 11-19-2011 at 06:06 PM (My Java Tips)
    Developers working on CORBA often complains that writing IDL takes time. If you are new to it, you are bound to make a lot of mistakes. You need something to assist you in writing IDL. Fortunately, Eclipse has a plugin for this.



    Eclipse CORBA plugin can be downloaded from:
    http://sourceforge.net/project/showf...roup_id=111345

    You need Eclipse 3.2 or higher to use this plugin.

    ...
  3. Design Patterns - Basics

    by , 11-19-2011 at 06:01 PM (My Java Tips)
    A design pattern is an abstraction at a very high level. It is to create common and reusable solutions to the recurring problems. Design Patterns provide solutions to design problems which arise again and again in a certain design situations. As a result design patterns have become immensely popular and are very useful to known design issues and problems.


    There are several ways to use and implement these design patterns. These implementation details are called strategies.
    ...
  4. 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 ...
  5. Creating and visualizing graphs - JGraphT

    by , 11-19-2011 at 05:54 PM (My Java Tips)
    Graphs are used to represent knowledge in a visual form. There are many types and forms of graphs. Java provides support for graphical structures. In this post, I will talk about JGraphT which is a free Java graph library.


    You may download the library from:
    http://prdownloads.sourceforge.net/j...3.zip?download

    Creating and visualizing the graph is very easy:
    Java Code:
    // create a JGraphT graph
    ListenableGraph g = new ListenableDirectedGraph(
    ...
    Categories
    Graphs
  6. The Intercepting Filter

    by , 11-19-2011 at 05:50 PM (My Java Tips)
    In a client-server environment, a system must be able to handle client requests with different processing needs before sending them to server.


    - The system receives requests from a client with different protocols such as HTTP, FTP, SMTP etc.
    - The system must authorize and authenticate some requests, where as for some requests it is not necessary to authorize and authenticate requests and system can handle such requests directly.
    - From certain requests and responses ...
  7. Applets with parameters

    by , 11-19-2011 at 05:37 PM (My Java Tips)
    Applets may accept parameters. This post briefly shows how to do that.


    Applet in included in HTML using APPLET tag. You have to specify the parameters in APPLET tag in the following form:
    Java Code:
    <applet code="AppletSubclass.class" width="anInt" height="anInt">
    <param name="parameter1Name" value="aValue"></param>
    <param name="parameter2Name" value="anotherValue"></param>
    ...
    Categories
    Java SE
  8. MVC Model

    by , 11-19-2011 at 05:18 PM (My Java Tips)
    The Model is the one which is responsible for managing data storage as well as retrieval of the data from the data source. When data changes it notifies all its Views about change in data. A model holds part of the current state of the application. The model represents enterprise data and the business rules that govern access to and updates of this data. The Model knows everything about the data that need to be displayed. However, it does not know anything about the View, that is the manner in ...
  9. MVC Controller

    by , 11-19-2011 at 05:07 PM (My Java Tips)
    In this post, I will briefly talk about MVC controller.


    Controller manages users interaction with the system. The component Controller is perhaps the most important component in the MVC architecture. It invokes the component Model and the component View and also couples these two that is View with the Model. If the application requires, it may invoke multiple Views and may couple them with the same Model. It listens to the user actions and according to business rules manipulates the ...
  10. MVC - View

    by , 11-19-2011 at 05:02 PM (My Java Tips)
    This post will briefly explain MVC view. I assume that you have some basic knowledge about MVC.


    There are many ways in which data can be accepted from the user and presented to the user in an application where data has to be accepted from the user, has to be updated/modified and has to presented back in a proper way to the user again.

    The component View consists of a presentation logic. It presents the data contained in the Model to the user. Further, it also allows ...
    Categories
    MVC
  11. MVC - View

    by , 11-19-2011 at 05:00 PM (My Java Tips)
    This post will briefly explain MVC view. I assume that you have some basic knowledge about MVC.


    There are many ways in which data can be accepted from the user and presented to the user in an application where data has to be accepted from the user, has to be updated/modified and has to presented back in a proper way to the user again.

    The component View consists of a presentation logic. It presents the data contained in the Model to the user. Further, it also allows ...
    Categories
    MVC
  12. Ant (an introduction)

    by , 11-19-2011 at 04:54 PM (My Java Tips)
    Ant is an open source software written in Java language. This is an Apache product. Ant is cross platform and portable. Ant is similar to make utility. It is used to automate software build processes to essentially build Java projects. However, at the same time it should be remembered that Ant is not a programming language. Ant uses XML to describe build processes. This XML file is called as build.xml.


    Ant can compile source code as well as Ant can package compiled source code and ...
  13. Simple Ant script

    by , 11-19-2011 at 04:49 PM (My Java Tips)
    Let us see how to write a simple ant script for a Java application. Write a simple HelloWorld Java class


    HelloWorld.Java
    Java Code:
    public class HelloWorld
    {
     	public static void main(String args[])
      	{
       		System.out.println("HelloWorld!");
      	}
    }
    By default Ant uses build.xml as the name for a buildfile. This is the build.xml.
    Java Code:
    <project default="compile">
    
      	<target name="compile">
    ...
    Categories
    Ant
  14. Ant Project

    by , 11-19-2011 at 04:43 PM (My Java Tips)
    In this post, I will present a sample build.xml file for a simple Java "Hello, world" application and will explain the ANT project.


    Java Code:
    <project name="HelloWorld" default="compile">
    
      	<target name="compile">
        		<javac srcdir=".">
      	</javac></target>
    
        	<target name="run" depends="jar">
        		<java classname="HelloWorld">
    ...
    Categories
    Ant
  15. ANT Targets and Tasks

    by , 11-19-2011 at 04:39 PM (My Java Tips)
    In this post, I will talk about ANT targets and tasks.


    <strong>Targets</strong>
    Each buildfile contains at least one target within the project. One target can be dependent upon the another target.
    Java Code:
    <target name="A">
    <target name="B" depends="A">
    <target name="C" depends="B">
    <target name="D" depends="C">
    <target name="E"
    ...
    Categories
    Ant
  16. ANT properties

    by , 11-18-2011 at 06:23 PM (My Java Tips)
    A project in a build.xml can have a set of properties. This property has a name and a value. In which the name of the property is case-sensitive. Properties can be used in the value of task attributes. It is done by putting the property name between "${" and "}" in the attribute value. For example, if there is a "builddir" property with the value "build", then this could be used in an attribute like this: ${builddir}/classes. At run-time this is resolved as ...

    Updated 11-18-2011 at 06:26 PM by Java Tip

    Categories
    Ant
  17. Struts 1 vs Struts 2

    by , 11-18-2011 at 06:20 PM (My Java Tips)
    In the following article, we are going to compare the various features between the two frameworks. Struts 2 is very simple as compared to struts 1, few of its important features are:


    1. Servlet Dependency

    Actions in Struts1 have dependencies on the servlet API since the HttpServletRequest and HttpServletResponse objects are passed to the execute method when an Action is invoked while in case of Struts 2, Actions are not container dependent because they are made of simple ...
    Categories
    Subversion
  18. Struts 1 vs Struts 2

    by , 11-18-2011 at 06:17 PM (My Java Tips)
    In the following article, we are going to compare the various features between the two frameworks. Struts 2 is very simple as compared to struts 1, few of its important features are:


    1. Servlet Dependency

    Actions in Struts1 have dependencies on the servlet API since the HttpServletRequest and HttpServletResponse objects are passed to the execute method when an Action is invoked while in case of Struts 2, Actions are not container dependent because they are made of simple ...
  19. Struts Controller

    by , 11-18-2011 at 06:13 PM (My Java Tips)
    Let us see how to configure the struts-config.xml file to map the request to some destination servlet or jsp file.


    The class org.apache.struts.action.ActionServlet is at the heart of the Struts Framework. It is the Controller part of the Struts Framework. ActionServlet is configured as Servlet in the web.xml file as shown in the following code.

    <!-- Standard Action Servlet Configuration (with debugging) -->
    Java Code:
    <servlet>
         <servlet-name>action</servlet-name>
    ...
  20. Using Struts2 Tags

    by , 11-18-2011 at 04:59 PM (My Java Tips)
    Struts provides HTML tag library for easy creation of user interfaces. In this lesson I will show you what all Struts HTML Tags are available to the JSP for the development of user interfaces.



    To use the Struts HTML Tags we have to include the following line in our JSP file:
    Java Code:
    &lt;%@ taglib uri="/tags/struts-html" prefix="html" %&gt;
    above code makes available the tag to the jsp.

    Java Code:
    <html:message key="thekey"/>
    ...
    Categories
    Struts
  21. Validating ASCII character set

    by , 11-17-2011 at 07:04 PM (My Java Tips)
    In this post, I will write about how to validate characters of ASCII characterset.

    ASCII is a well know character set. It is a 7 bit character set and represents 128 characters. The printable character codes range from 33 to 126 inclusive. Sometimes you want to make sure that your strings do not contains non ASCII printable character. This is easy and can be done by writing a method for this.

    Review the static method below. It takes an ArrayList of String type and after ...
  22. Creating a Simple Plug-in using PDE

    by , 11-17-2011 at 07:01 PM (My Java Tips)
    To get a better idea of how to develop plug-ins using PDE, you will create a simple workbench view. In this post, Ill give you some basic understanding.


    To get started, launch your Eclipse SDK and choose an empty workspace. When you close the Welcome page, you should find yourself in the Java perspective, by default (however, it is not required that you are in the Java perspective in order to proceed). First, you will use the New Plug-in wizard to create the plug-in. Then, you will ...
    Categories
    Eclipse
  23. Eclipse Plug-in Development Environment

    by , 11-17-2011 at 06:58 PM (My Java Tips)
    The Eclipse Plug-in Development Environment (PDE) provides a set of tools that assist the developer in every stage of plug-in development from genesis to deployment. The Plug-in Development Environment (PDE) is freely distributed as part of the Eclipse SDK, and serves as a good example of an Eclipse-based IDE tool.




    In PDE, each plug-in under development is represented by a single Java project. Plug-in projects have certain unique characteristics that make them what ...
    Categories
    Eclipse
  24. PDE - Preparing the workbench

    by , 11-17-2011 at 06:54 PM (My Java Tips)
    This post will help you in preparing the PDE workbench.




    From the default Resource perspective, open the PDE perspective via Window > Open Perspective > Other and choose Plug-in Development from the offered list.


    In addition to the main views and toolbar actions that are useful for Java development, the PDE perspective adds shortcuts to very frequently used wizards ...
    Categories
    Eclipse
  25. PDE Concepts

    by , 11-17-2011 at 06:50 PM (My Java Tips)
    In this post, I will introduce some PDE concepts to the audience.



    Host vs. runtime

    When you start up the workbench, you will use it to work on your projects that define the plug-ins you are building. The workbench instance that you are running as you develop your plug-in using the PDE and other tools is the host instance. The features available in this instance will come exclusively from the plug-ins that are installed with your application.

    Once ...
  26. Creating a plug-in project

    by , 11-17-2011 at 06:38 PM (My Java Tips)
    In this post, I will show you step by step how to create a plugin project.


    To create a plug-in project, bring up the New Plug-in Project creation wizard via File > New > Plug-in Project.


    It is a convention that plug-in project names are the same as plug-in IDs, but they can be different.

    The plug-in project can be created in one of two flavors: a Java project or ...

    Updated 11-17-2011 at 06:45 PM by Java Tip

    Categories
    Eclipse
  27. Plug-in manifest editor

    by , 11-17-2011 at 06:34 PM (My Java Tips)
    Lets talk about plugin manifest editor. When the plug-in project is created, the manifest file is open in the plug-in manifest editor.


    This multi-page editor is the central place to manage your plug-in and can be used to edit all the plug-in's file (manifest.mf , plugin.xml and build.properties).

    When you use the editor's forms, PDE transparently handles the task of writing the ...
  28. 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 ...
  29. Plugin project - Dependencies page (II)

    by , 11-17-2011 at 06:26 PM (My Java Tips)
    In this post, I will talk about the Eclipse project's dependencies page.



    The Dependencies page shows the dependencies that your plug-in has on other plug-ins. You must list on this page all the plug-ins that contribute code required on your plug-in project's classpath to compile. When you modify the list of dependencies and save the file, PDE will automatically update your classpath.
    ...
  30. Plugin Runtime Page

    by , 11-17-2011 at 06:20 PM (My Java Tips)
    The Runtime page shows all the packages that your plug-in makes visible to other plug-ins.


    Press the Add button in the Exported Packages section to add the com.example.xyz and com.example.xyz.actions packages to the list.


    The Package Visibility section allows you to control on a per-package basis the visibility of your plug-in code to downstream plug-ins.

    The ...
    Categories
    Eclipse
Page 3 of 15 FirstFirst 1234513 ... LastLast