View RSS Feed

All Blog Entries

  1. Cassandra Column

    by , 02-23-2012 at 06:54 PM
    Column is also known as triplet or tuple which has value, name & timestamp. This is considered to be a smallest data container.

    Name:  1.JPG
Views: 781
Size:  3.8 KB

    Cassandra Column

    Column’s Java representation is given as following. Complex structures are more conveniently been explained by this:
    Java Code: This is the code to explain Cassandra Column
    public class Column {
      Byte[] name;
      Byte[] value;
      Long timestamp;
  2. AppDos Vulnerability in java using BufferedReader.readLine()

    by , 02-22-2012 at 11:08 AM
    Hi When my application is going through an Scanner I am getting AppDos Vulnerability with BufferedReader.readLine() can anyone help me out on this.My Sample code is as follows:

    while((line = reader.readLine())!= null)

    // Remove JavaScript
    if (isPartOfString(SCRIPT_OPEN_TAG, line))
    while ((!isPartOfString("somestring", line)) && ((line = reader.readLine())!= ...
  3. Cassandra alternatives

    by , 02-21-2012 at 09:12 PM
    Before taking any start along with Cassandra, it is important to be well aware of the fact that many alternatives exists for complimenting the relational database. E.g., memcached has been made to be used for, and is free of cost. If you apply such solution to some larger Mysql database alone, you may expect a great performance boost of 100 times.

    Other than this, another famous Nosql solution that has been well renowned is MongoDB, which has been written in language ...
    Tags: cassandra Add / Edit Tags
  4. Why Use Cassandra?

    by , 02-21-2012 at 09:09 PM
    Why Cassandra shall be chosen against any other NoSQL solution?

    • Main selling point of Cassandra is that it is being written in Java.
    • Cassandra has been present on the largest website of the world i.e. Face book.
    • Cassandra has met all the requirements to be decentralized and it doesn’t have one single failure point.
    • Read as well write throughput have been seen to increase in linear fashion, when newer machines get added without any sort of downtime or interruption.
    • It gets
    Tags: cassandra Add / Edit Tags
  5. What is Cassandra?

    by , 02-21-2012 at 09:06 PM
    The Apache Cassandra Project is involved in creating the highly scalable database that is second generation distributed. It brings the Bigtable’s ColumnFamily (based data model) & fully distributed design of Dynamo, together.

    Apache Cassandra is basically an open source that is a highly available database and distributed. Architecture of Apache Cassandra incorporates the design, from Dynamo project. It makes use of data model that is Google’s Bigtable data model based.
    Tags: cassandra Add / Edit Tags
  6. Apache Portability

    by , 02-19-2012 at 09:29 AM
    Portability problems are solved by the Apache Ant. All the required actions for creation of a target are being specified as the shell commands, in Make file. All commands are platform specified. For running the Make at varying platforms, platform specific commands shall be written.

    Built in functionality is being provided largely by the Apache Ant which would be behaving similary at all platforms.

    For cleaning targets or to delete files present in class directory, this ...
  7. Sample build.xml file

    by , 02-19-2012 at 09:27 AM
    A sample of“build.xml” file is given as following, for a java program. These four targets are defined by it.
    • Clean
    • Compile
    • Clobber
    • Jar

    All these targets have an associated description.
    XML Code:
    <?xml version="1.0"?>
    <project name="Hello" default="compile">
        <target name="clean" description="remove intermediate files">
            <delete dir="classes"/>
    Tags: build file Add / Edit Tags
  8. Overview of Apache Ant Tasks

    by , 02-19-2012 at 08:54 AM
    Number of tasks is provided by Apache Ant. What could be done by each task is not predictable easily. All tasks present in Apache Ant are:

    1. Archive Tasks
    2. Compile Tasks
    3. Audit/Coverage Tasks
    4. Deployment Tasks
    5. EJB Tasks
    6. Documentation Tasks
    7. Execution Tasks
    8. SCM Tasks
    9. File Tasks
    10. Logging Tasks
    11. Java2 Extensions Tasks
    12. Miscellaneous Tasks
    13. Mail Tasks
    14. Pre-process ...
  9. Troubleshooting ANT

    by , 02-19-2012 at 08:53 AM
    Ant consists of built in and supportive diagnostic features. Internal state could be seen and printed out by usage of this ant –diagnostic. Code will be checking and printing these points.

    • Ant run directory.
    • All the available optional tasks.
    • JVM system’s properties.
    • The ant-*.jar versions & ant.jar version, which consist of an optional tasks.
    • All jar file present in ANT_HOME/lib
    • XML parser’s information
    • Temp directory status.
    • Current time zone.

  10. Building Ant

    by , 02-19-2012 at 08:52 AM
    Options present to build source, from Apache Ant are:

    • Installation of the Ant source distribution
    • Checking out of the Ant module, from SVN

    Your installation directory shall be changed after the installation is done.

    JAVA_HOME environment variable shall be set, to the JDK installation directory.

    These commands are used to build by the help of Ant:

    build -Ddist.dir=<directory_to_contain_Ant_distribution> dist ...
    Tags: building ant Add / Edit Tags
  11. Why use Apache Ant

    by , 02-19-2012 at 08:50 AM
    Build tools given below are used widely and are present already in the market.
    1. Make
    2. Nmake
    3. Gnumake
    4. Jam
    Why Apache Ant is needed in presence of various build tools? All the given tools hold certain bounds and original author of Ant doesn’t survive without it.

    Ant has always been considered to be a different kind of build tool. Java classes are used for extension of Ant rather than shell based command extension. Configuration files are based ...
    Tags: apache ant Add / Edit Tags
  12. Apache Ant

    by , 02-19-2012 at 08:48 AM
    Apache Ant is a java library and is considered as command line tool. Major tasks performed by Apache Ant is building processes drive which have been explained in the files of builds as extension points and targets, dependent at each other. Java based applications are built by the Ant which is the key usage of it. Various built in tasks are provided by the Ant so that following could be performed at Java applications:

    1. Compile
    2. Test
    3. Assemble
    4. Run
    Tags: apache ant Add / Edit Tags
  13. Java's SortedMap Interface

    by , 02-19-2012 at 08:38 AM
    The java.util.Map interface’s subtype is the java.util.SortedMap. Functionality of java.util.Map is extended by this interface and elements are sorted which have been stored in the Map, internally.

    Element’s sorting orders are as following:

    • If java.lang.Comparable is implemented then it means that there exist element’s natural sorting order.
    • Comparator determines the order which you will be providing to the SortedSet.

    Default sorting orders are ascending ...
  14. Removing Elements from Map

    by , 02-19-2012 at 08:36 AM
    From Map, the removal of elements is done by using remove (Object key) method. This would be removing pair (Key, Value) from Map.

    Any type of elements could be put into Map. Type of objects can be limited to be used for values or keys in a Map. How to limit values or keys is well explained in the given code.
    Java Code: This is the code to limit values or keys
    Map<String, MyObject> map = new HashSet<String, MyObject>();
    Map just accepts the value son MyObject type or keys of string type, ...
  15. Adding and Accessing Map Elements

    by , 02-19-2012 at 08:24 AM
    For addition of elements to Map, use put() method. This process is explained by the given code.
    Java Code: This is the code to explain map add operation
    Map mapA = new HashMap();
    mapA.put("key1", "element 1");
    mapA.put("key2", "element 2");
    mapA.put("key3", "element 3");
    Key values are mapped by calling 3 put() methods, in the code given above. Both values & keys are String, in above code. To get value, use this code.
    Java Code: This is the code to explain map access operation
  16. Java Map Implementations

    by , 02-19-2012 at 08:21 AM
    Map can’t be instantiated as it is an interface. For creation of the Map interface instance, concrete implementation is required. Map interface has these concrete implementations which are present in Collection API.

    • java.util.HashMap
    • java.util.Hashtable
    • java.util.EnumMap
    • java.util.IdentityHashMap
    • java.util.LinkedHashMap
    • java.util.Properties
    • java.util.TreeMap
    • java.util.WeakHashMap

    Map implementations which ...
  17. Java Hash Map

    by , 02-19-2012 at 08:19 AM
    Key value paired data structure is provided by the Map interface so that for mapping the keys to values. Keys are unique which are used for retrieval of the values, from Map.

    Key features are as following:

    • Key value repair is used for storage of all values. Key is used for the retrieval.
    • When Map doesn’t contain any element, various methods throw the “NoSuchElementException”.
    • When compatibility of element is not present with map elements, ClassCastException gets
    Tags: hash map Add / Edit Tags
  18. Java's Stack Class

    by , 02-19-2012 at 08:16 AM
    Stack is considered to be a data structure which used last in first out policy. New elements could be added or removed to/from the top of Stack. Queue uses First in First out mechanism as compared to Stack.

    Java Code: Stack usage is explained by this code
    Stack myStack = new Stack();
    //look at top object ("3"), without taking it off the stack.    
    Object topObj = stack.peek();
    Tags: stack class Add / Edit Tags
  19. Implementing a Stack in Java

    by , 02-19-2012 at 08:13 AM
    This post will be explaining the Java’s Stack implementation. Last in first order policy is used in Stack in which one by one elements get inserted in a sequence which could be retrieved later on in reverse order. Use these 2 methods to insert or read the elements to/from the Stack.

    • Pop()
    • Push()

    Code is given below to show the implementation of LIFP stack. Total elements that are needed to be inserted to Stack will be taken and after which it will be asked ...
    Tags: java stack Add / Edit Tags
  20. Java Stack Introduction

    by , 02-19-2012 at 08:11 AM
    A stack is basically a data structure which uses the following:

    • Methods for inserting the data by the help of push operation
    • Methods for removal of data by the help of pop operation.

    Peak method is supported by Stack implementations. It will make the head to be read without removal from Stack. Last in First out policy is used in Stack. This means that data which has been inserted in data structure at last will be made to get removed first.

    Data ...
    Tags: stack Add / Edit Tags
    Queue , Stack
  21. Java Deque Implementations

    by , 02-19-2012 at 08:07 AM
    Collection interface subtype is DeQue interface. In DeQue interface, all of the Collection interface methods are present.

    DeQue interface instance can be created. This interface’s concrete implementation is required to do so. In Collections API, these DeQue implementations are present. Among them, you may select to use.

    • java.util.LinkedList
    • java.util.ArrayDeque

    LinkedList is considered to be a pretty queue implementation.

    In an array, ...
    Tags: java deque Add / Edit Tags
  22. Adding and Accessing Queue Elements

    by , 02-19-2012 at 08:05 AM
    Call add() method for addition of the elements to Queue. This is an inherited type of method of Collection interface.

    Different elements are added to a Queue which is explained by this given code.

    Java Code: This is the code to explain add operation in Java Queue
    Queue myQueue = new LinkedList();
    myQueue.add("element 1");
    myQueue.add("element 2");
    myQueue.add("element 3");
    In a Queue, added elements get stored in internal order and they are dependent upon implementation. ...
  23. Java Queue Implementations

    by , 02-19-2012 at 08:02 AM
    Collection Interface’s subtype is Queue. In the Queue interface, collection interface methods are present automatically.

    Queue interface instance can’t be created. Queue interface concrete implementations are required. In Collections API, the available Queue implementations are as following. Among them, one can make a choice:
    • java.util.PriorityQueue
    • java.util.LinkedList

    LinkedList is a considered to be a standard queue implementation.

  24. Java – Queue Example

    by , 02-19-2012 at 08:00 AM
    Queue base is at first in first out policy. The Queue interface is present in java.util package. Queue size is not required to be specified just like it is done in arrays.

    Functionality of Queue is explained in the given code.

    Example of Queue
    Java Code: This is the code to explain Java Queue
    import java.util.Iterator;
    import java.util.LinkedList;
    import java.util.Queue;
    public class QueueTesting {
        public static void main(String[] args) {
    Tags: java queue Add / Edit Tags
  25. Java Queue

    by , 02-19-2012 at 07:58 AM
    Java Queue is also collection interface for holding the objects. Collections store or hold elements, before processing. Following operations are provided by Queues:

    1. Insertion
    2. Inspections
    3. Extraction
    4. (All) Other Collection operations

    Queues are basically first in first order implements. They don’t depend on use order. Poll() and remove() methods are used to remove the elements present at head.

    From queue’s tail, all elements ...
    Tags: java queue Add / Edit Tags
  26. Java Linked List Implementations

    by , 02-19-2012 at 07:57 AM
    Collection interface is subtype of a List. Collection interface methods are also present in list interface.
    List can’t be instantiated as it is an interface. For creation of instance of the List, create concrete implementation instance of the interface. In Java Collection APIs, these options are present:

    • java.util.ArrayList
    • java.util.LinkedList
    • java.util.Vector
    • java.util.Stack

    In java.util.concurrent package, List implementations ...
  27. What is the advantage of using an Iterator compared to the get(index) method?

    by , 02-19-2012 at 07:55 AM
    One of the following methods should be used to iterate the List.

    1. Iterator
    2. get(index)

    get(index) method is quite slower in comparison with Iterator.

    Consider this example:

    Java Code: This is the code to explain Iterator
    public class TestClass {
      public static void main(String[] args) {
        int  len = 100000;
        LinkedList linkedLst = new LinkedList(); 
        ArrayList  arrayLst = new ArrayList();
        for (int m =0; m!= len; m++)
    Linked List
  28. Removing an Item from the List

    by , 02-19-2012 at 07:52 AM
    For removal of an item out of List, different methods would be discussed here. Use these methods.

    • remove()
    • removeFirst()
    • removeLast()

    Java Code: This is the code to explain removal of an element from the List
    import java.util.*;
    public class TestLinkedList
    public static void main(String[] args)
    int pause;
    String temp;
    LinkedList theList = new LinkedList();
    Tags: remove item Add / Edit Tags
    Linked List
  29. Accessing Items from a List

    by , 02-19-2012 at 07:50 AM
    Get List Size:

    To get the List size, method “size()”is used. Size of MyList will be printed by this code.
    Java Code:
    Get Item:

    For getting a specific spot value, use get() method. In this method index of the List is provided. In case when index is not present, IndexOutOfBoundsException gets thrown.

    Element is not removed from the list by this method. Just this object is returned. This given code will ...
  30. Adding Elements to a List

    by , 02-19-2012 at 07:47 AM
    Elements are added to list by using these 4 different methods given below:
    Java Code:
    An item is added by it to end of list.
    At a particular location, elements could be added as given below.
    Java Code:
    MyList.add(0, "2");
    MyList.add(0, varName);
    Zero tells the element location, as given in above code. This is basically added as 1st element.
    Other two ...
    Linked List
Page 22 of 48 FirstFirst ... 12202122232432 ... LastLast