View RSS Feed

All Blog Entries

  1. Declaring a Variable to Refer to an Array

    by , 03-04-2012 at 10:02 AM
    Array is declared in the above program along with this line of code.
    Java Code:
    // declares an array of integers
    int[] anArray;
    Array declaration also consists of 2 components, just like other declarations for other types of variables. They are
    • Array’s name
    • Array’s type


    Array’s type is written as type[].

    An array’s name could be anything that you may want provided it follows the conventions. Just like other type variables, array ...
    Tags: refer array Add / Edit Tags
    Categories
    Add
  2. Java Array

    by , 03-04-2012 at 10:00 AM
    Array is that container object which consists of fixed value numbers of one single type. When array is created, establishment of the length of an array takes place. Length is fixed after creation of an array. In Hello world application’s main method, example of array has already been given. Here detailed array section will be given.

    Name:  1.JPG
Views: 155
Size:  10.5 KB
    An array of ten elements


    Every item present in array is known as an element. Numerical index is used ...
    Tags: java array Add / Edit Tags
    Categories
    Add
  3. Drools Components

    by , 03-04-2012 at 09:57 AM
    1. Rules – Where conditions are specified (If a then b)
    2. Facts – Simple objects (POJOs). E.g, a Bank Account fact consists of an account number, someone’s id and balance.
    3. Knowledge Base –is where rules are built and loaded into a structure that gets implemented by the Rete algorithm.
    4. Session – Here facts are placed. Facts are inserted into a session. A session can be State less or State full. Facts in the statefull shall be present in a constant rule alignment once ...
    Categories
    Drools Rules
  4. How is JBoss Drools is made up

    by , 03-04-2012 at 09:54 AM
    There are 2 main parts of Drools:

    Authoring & Runtime

    Creation Rules files (.DRL) are involved in authoring process. They consists of rules that are being fed to a parser. Correct syntax of rules is checked by parser which creates intermediate structure so that to describe certain rules. Then it is passed on to Package Builder that creates the packages. After this, any code generation as well as compilation is undertaken that is essential to create package.
    ...
    Tags: jboss drools Add / Edit Tags
    Categories
    Drools Rules
  5. Why using a Rule Engine ?

    by , 03-04-2012 at 09:53 AM
    Rule systems are able to solve hard problems by providing the detail of the arrival of the solution and also why every decision was been taken along the way.

    Major benefits of Rule Engine are:

    Logic & Data Separation
    To break down the domain objects from business rules could make it possible to easily maintain the application. This is possible because it may shield from the future alterations.

    Speed & Scalability
    Several times, “if” ...
    Tags: rule engine Add / Edit Tags
    Categories
    Rule Engine
  6. Drools Components and Terminology

    by , 03-04-2012 at 09:51 AM
    Objects used by the Drools are market out by the rules and patterns which are responsible for invoking the certain actions:

    • Drool objects are considered as the Java objects. They are usually presented by the XML schemas or instances of the Java classes.
    • A patter being a coded expression is involved in the manipulation of 1 or more than 1 objects so that to create a pattern for making, adapting behavior, according to the designed logic.
    • Working Memory drools stores its objects
    ...
    Categories
    Drools Rules
  7. Advantages of the Drools rule engine

    by , 03-04-2012 at 09:48 AM
    Drools rule engine offers these advantages.
    • It separates conditions and applications

    • They are present in separated files
    • Different people groups can modify them
    • After changing a rule, recompilation is not needed. Redeployment is also not needed in the whole application.
    • To control an application’s flow, put rules at one place
    • All the complexed statements can be replaced by rules in an easier or understandable way

    • Rule language is not tough to be learnt.
    • An
    ...
  8. Drools Overview

    by , 03-04-2012 at 09:46 AM
    Drools, BRMS i.e. business rule management system consists of a forward chaining inference based rule engine. Correctly, it is called production rule system which uses enhanced Rete algorithm implementation.
    For its business rule engine as well as its enterprise framework, Drools provides support to JSR-94 standard. This is done for maintenance, construction & enforcement of organization’s business policies, services or applications.

    Pluggable language implementations are ...
    Tags: drools Add / Edit Tags
    Categories
    Tutorial
  9. Self Made Observable Pattern

    by , 03-03-2012 at 10:50 PM
    Java Code:
    package observerPatternSelfMade;
    
    public class MyObservableClass implements MyObservableInterface {
    
    	
    	
    	@Override
    	public void registerObserver(MyObserverInterface o) {
    		observers.add(o);
    	}
    
    	@Override
    	public void removeObserver(MyObserverInterface o) {
    		observers.remove(o);
    	}
    
    	@Override
    	public void notifyObservers() {
    		
    		for(int i = 0; i<observers.size();i++)
    ...
    Categories
    Uncategorized
  10. Strategy Pattern Example

    by , 03-03-2012 at 10:20 PM
    Java Code:
    package strategyPattern;
    
    public class Warrior {
    	
    	private AttackBehaviour attackBehaviour;
    	public String name;
    
    	void setAttackBehaviour(AttackBehaviour aB) {
    		this.attackBehaviour = aB;
    	}
    	
    	void attack() {
    		attackBehaviour.attack();
    	}
    }
    
    package strategyPattern;
    
    public interface AttackBehaviour {
    	
    	void attack();
    
    }
    
    package
    ...
    Categories
    Uncategorized
  11. 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
  12. 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
  13. How to set value to entity?

    by , 03-03-2012 at 07:42 AM
    Quote Originally Posted by heart_throbber View Post
    Hi all,
    I have 2 DTOs & 2 Entities, 1 controller & 1 service implementation over here.

    Now, my problem is at the service implementation setStates. I dont know how to set states to address entity from addressDTO's getStatesList. because address entity includes state entity while addressDTO using stateDTO .

    My Address Entity:
    Java Code:
    public class Address
    {
        private List<State> states;
    
        public List<State>
    ...
    Categories
    Uncategorized
  14. Types of Garbage Collector in Java

    by , 03-02-2012 at 04:31 PM
    Java Runtime provides various Garbage collection types in Java. One may choose them according to the requirements of performance of your application. In Java 5, three garbage collectors are added except “serial” garbage collector. Each garbage collector is implemented to raise the throughput of application or to reduce the garbage collection’s pause time.

    1) Throughput Garbage Collector:
    Garbage collector used parallel version of the Young generation collector. JVM, -XX:+UseParallelGC ...
  15. Garbage Collection Disadvantages

    by , 03-02-2012 at 04:30 PM
    Garbage collection has certain disadvantages which are as following:

    • Garbage collection uses computing resources so that to take a decision that which memory shall be reconstruct or free the fact to which programmer is well-aware of. When object lifetime is not manually annotated in source code, penalty is overhead. It will reduce the performance. Overheads are not bearable or tolerable, when interaction is present to memory hierarchy effects. It is not easy to predict them during
    ...
  16. Garbage Collection Overview

    by , 03-02-2012 at 04:28 PM
    Garbage collection is automatic memory management in computer sciences. Garbage collector attempts to reclaim garbage or occupied memory of the object that is not in use of program. In 1959, Garbage collection was invented by John McCarthy to solve the Lisp problems.

    Usually garbage collection and manual memory management are considered opposite of each other. Objects are required by programmers which are returned or deallocated to the memory. Various approaches are taken into consideration ...
  17. Object Reference Type Casting

    by , 03-02-2012 at 04:27 PM
    In Java object typecasting, type cast of 1 object reference is possible to another object reference. Suck type of casting is done with superclass, subclass or class types. Compile time rules or runtime rules are present in Java for casting.

    Class relationship is the basic thing at which Object reference is dependent. Any object reference could be assigned to reference variable of type object because the object class is usually the superclass, for each Java class.

    Two ...
    Tags: type casting Add / Edit Tags
    Categories
    Casting
  18. Final Fields and Methods

    by , 03-02-2012 at 04:20 PM
    Fields and methods might be declared final. For final method possibilities are not there to be overridden, in subclasses. Final field is considered to be constant: Possibility of assigning once again is not present when a value is been provided already. For example, Constructor function of the List class does the item field initialization to size ten array. For array’s initial size, usage of constant is recommendable. For whole class only 1 constant copy is needed. Hence field static as well as ...
    Tags: final fields Add / Edit Tags
    Categories
    Classes
  19. Static Fields and Methods

    by , 03-02-2012 at 04:16 PM
    Methods and fields might be declared static. This is also possible for C++. Only one copy is present for the complete class when field is static, rather than one copy for all class instances. If class instance is not present even then field’s copy is available. For example, given field addition in List class:

    static int numLists = 0;

    And, the given statement addition in the List constructor:

    numLists++;

    When new List object creation takes ...
    Categories
    Uncategorized
  20. Fields, Methods, and Access Levels

    by , 03-02-2012 at 04:13 PM
    • Java classes consist of methods and fields. A field is same as a C++ data member & a method is similar to a C++ member function.
    • Each method & field possess an access level:

    o private: access is possible in this class only
    o (package): access is possible in this package only
    o protected: access is possible in this package only & also in all subclasses.
    o public: access is possible anywhere this class is present.
    • Every class consist of these
    ...
    Categories
    Classes
  21. Java Classes

    by , 03-02-2012 at 04:10 PM
    Various individual objects might be found of same kind, in real work. Thousands of similar bicycles might be present in world that have similar model or make. Same components or same blueprints set are used to build bicycles.

    Bicycle may be considered as class bicycle instance, in case of the object oriented programming. Class is basically the blue print which is involved in creation of the individual objects.

    This given Bicycle class is the possible bicycle implementation: ...
    Tags: java classes Add / Edit Tags
    Categories
    Classes
  22. Plain Text Emails

    by , 03-01-2012 at 06:22 PM
    I am trying to send a plain text email via XSL. The problem I am facing is including an ampersand ("&") in an Url link.

    So i am trying in the following manner :

    <a href>https://www.abc.com?a="ankit"&amp;b="agarwal"</a>

    So when I this link in a plain text email its shows like this:

    https://www.abc.com?a="ankit"&amp;b="agarwal"

    instead of :
    ...
    Categories
    Uncategorized
  23. 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
  24. How to send e-mail with Java

    by , 02-29-2012 at 03:05 PM
    Sending an e-mail is a trivial task in the information world today. Billions of e-mails are sent everyday on the earth. For those who are Java developers, the ability to send e-mail from within a Java program is trivial also. However the standard Java platform does not include any e-mail functionality by default. Instead, developers have to use a separate library for the e-mail things, it is the JavaMail API. This article will guide you on how to write an email utility to send an e-mail out with ...
    Tags: java, javamail, mail, send Add / Edit Tags
    Categories
    Mail API
  25. Working with SVN in Eclipse

    by , 02-29-2012 at 11:26 AM
    In a team work environment, using a version control system has been becoming standard approach to foster collaboration among team members, increase productivity, centralize resources management, reduce risks and development time…Subversion (SVN) is a version control system which is very popular and widely used in software development, and Subclipse is an Eclipse plug-in that supports Subversion within the Eclipses IDE. Subclipse has been widely used to develop Java projects in Eclipse IDE for team-oriented ...
  26. How to use properties file in Java

    by , 02-29-2012 at 09:57 AM
    Software programs may need to store its settings or configuration in a file on disk, such as database connection settings or user preferences. In Java, it is possible to use some classes in the java.io package such as FileReader and FileWriter to read/write the configuration file. However, that approach is tedious and error-prone, because it requires writing a lot of code from scratch. Fortunately, the Java platform provides an out-of-the-box utility class which is designed specifically for that ...
    Categories
    Properties
  27. How to work zip files in Java

    by , 02-29-2012 at 08:59 AM
    he Java platform provides powerful API to work with the most popular compressed file format – zip format. This article will show you how to write code to compress and decompress zip files using Java. And beyond the basics, the code that works with multiple files in a directory recursively is also provided.

    The Zip API

    The package java.util.zip provides classes for working with zip file format. Although the documentation states that the package also provides classes ...
    Tags: file, java, zip Add / Edit Tags
    Categories
    Zip
  28. How to use JTree in Java

    by , 02-29-2012 at 06:14 AM
    JTree is a Swing component that displays hierarchical data in a tree structure. The screen-shot below depicts a tree component:

    Name:  sample tree.png
Views: 3251
Size:  12.3 KB
    Figure: A tree component in Java

    This article will focus on how to implement such a tree component in Java, by walking through basic concepts to develop an interesting sample application.

    Fundamental concepts about Tree component

    • Node: A tree displays data vertically in rows,
    ...
    Tags: java, jtree, swing Add / Edit Tags
    Categories
    Tree
  29. Writing String array into text files

    by , 02-28-2012 at 02:52 PM
    Hai,
    I want the java code to write a string array into a text file...
    Categories
    Uncategorized
  30. Using Random class to generate two numbers

    by , 02-27-2012 at 10:42 PM
    Guys can you please help me out here, I'm using JOptionPane to receive two values from the user I then use these values as a range for my random generator. I then ask the user what's the answer based on a question randomly generated, but since I'm asking a division question how can I make sure that the first value is always bigger than the second?

    Random rand = new Random();
    it val1 = 0;
    it val2 = 0;
    it start = Integer.parseInt(JOptionPane.showInputDialog("enter ...
    Tags: java Add / Edit Tags
    Categories
    Uncategorized
Page 19 of 48 FirstFirst ... 9171819202129 ... LastLast