<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1848824224762882917</id><updated>2024-08-28T11:36:37.227+05:30</updated><category term="Collection"/><category term="Collections"/><category term="Comparable"/><category term="Comparator"/><category term="Design"/><category term="Driver"/><category term="DriverManager"/><category term="Dynamic Class Loading"/><category term="FileFilter"/><category term="FilenameFilter"/><category term="JDBC"/><category term="Pattern"/><category term="Runnable"/><category term="Singleton"/><category term="factorial"/><category term="fibonacci series"/><category term="java threads"/><category term="methods"/><category term="multithreading"/><category term="non-static"/><category term="recursion"/><category term="sort"/><category term="static"/><category term="synchronized"/><category term="threading"/><title type='text'>Tech Guru</title><subtitle type='html'>This blog is created for the users who want to brush up their knowledge before Interviews. Also, you can ask related questions and give meaningful answers to the asked questions on &lt;i&gt;Discussion Forum&lt;/i&gt;.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://techi-guru.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1848824224762882917/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://techi-guru.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Vidosh Sahu</name><uri>http://www.blogger.com/profile/18017214379597919595</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='25' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDjlWSwkzjNlvyCM4Yh164clT2ly24pShIsWOwpRMc8vs53mrw0rbl9dQj5AWZiHY1MvKc-LorM5RpBbEQZ4qInkHL924wQnCwSORGt5o3jFYkhO4cPfSGsTSmKNA6nUE/s220/tech-guru.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>7</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1848824224762882917.post-5500050899026660699</id><published>2011-09-25T18:32:00.001+05:30</published><updated>2011-09-25T18:33:56.763+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="FileFilter"/><category scheme="http://www.blogger.com/atom/ns#" term="FilenameFilter"/><title type='text'>How to extract a list of filtered files in Java?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Sometimes, we need to get a list of files exist within a directory as per our criteria like filename, file extension, last modified date or other attributes. It reduces the overhead to filter them after getting the list using our code. To achieve this, Java provides an interface - &lt;i&gt;&lt;b&gt;FileFilter&lt;/b&gt;&lt;/i&gt; which has a single method prototype as &lt;b&gt;&lt;i&gt;boolean accept(File file)&lt;/i&gt;&lt;/b&gt;. To apply our filtering criteria, we have to override this method and if our logic returns true for a file then only the file will be included in the list otherwise not. Here is the sample code -&lt;br /&gt;
&lt;pre class=&quot;brush: csharp&quot;&gt;import java.io.*;
import java.util.*;

public class FilteredFileList {
&amp;nbsp;&amp;nbsp;&amp;nbsp; public static File[] getFilteredFileList(File folder, final String filenameFilter, Date lastModifiedDateFilter) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; File[] listOfFiles = folder.listFiles(new FileFilter(){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public boolean accept(File file) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //file is the object against which we are applying our logic.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //You can put your logic using filenameFilter and check whether
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //the file&#39;s name comes under your criteria or not.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //To check against the lastmodified date you can use lastModifiedDateFilter.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return true;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }});
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return listOfFiles;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}&lt;/pre&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techi-guru.blogspot.com/feeds/5500050899026660699/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techi-guru.blogspot.com/2011/09/how-to-extract-list-of-filtered-files.html#comment-form' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1848824224762882917/posts/default/5500050899026660699'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1848824224762882917/posts/default/5500050899026660699'/><link rel='alternate' type='text/html' href='http://techi-guru.blogspot.com/2011/09/how-to-extract-list-of-filtered-files.html' title='How to extract a list of filtered files in Java?'/><author><name>Vidosh Sahu</name><uri>http://www.blogger.com/profile/18017214379597919595</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='25' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDjlWSwkzjNlvyCM4Yh164clT2ly24pShIsWOwpRMc8vs53mrw0rbl9dQj5AWZiHY1MvKc-LorM5RpBbEQZ4qInkHL924wQnCwSORGt5o3jFYkhO4cPfSGsTSmKNA6nUE/s220/tech-guru.jpg'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1848824224762882917.post-4821823511783817157</id><published>2011-09-15T09:53:00.002+05:30</published><updated>2011-09-15T22:58:49.385+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Collection"/><category scheme="http://www.blogger.com/atom/ns#" term="Collections"/><category scheme="http://www.blogger.com/atom/ns#" term="Comparable"/><category scheme="http://www.blogger.com/atom/ns#" term="Comparator"/><category scheme="http://www.blogger.com/atom/ns#" term="sort"/><title type='text'>How to use Comparator and Comparable to sort the objects?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;
Today, we will see how can we sort the elements of an Array or Collections. There are two utilities to sort the collection of objects -&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;Comparable&lt;/i&gt;&lt;/b&gt; - This interface contains only one method prototype i.e. &lt;i&gt;compareTo (Object obj)&lt;/i&gt;. &lt;i&gt;This method returns a negative integer, zero, or a positive integer as this object (through which the method has been called) is less than, equal to, or greater than the specified object&lt;/i&gt;. To make our objects comparable we should implement our class to this interface.&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;br /&gt;
Here is the sample code -&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: csharp&quot;&gt;public class Employee implements Comparable {
    int id;
    String name;
    Date dob;

    Employee(int id, String name, Date date) {
        this.id = id;
        this.name  = name;
        this.dob  = dob;
    }
    
    //If you want to sort the Employee Collection based on empId;
    public int compareTo(Object object) {
        Employee emp = (Employee) object;
        // If you want the reversed order just reverse the subtraction as emp.id - this.id
        return this.id - emp.id;
    }

    //If you want to sort the Employee Collection based on name;
    public int compareTo(Object object) {
        Employee emp = (Employee) object;
        // If you want the reversed order call the below compare method using emp.name and pass this.name
        return this.name.compareTo(emp.name);
    }

    //If you want to sort the Employee Collection based on DOB;
    public int compareTo(Object object) {
        Employee emp = (Employee) object;
        // If you want the reversed order just reverse the subtraction
        return this.dob.equals(emp.dob);
    }
}

public class EmployeeSorter {
    public static void main(String[] args) throws Exception {
        DateFormat formatter = new SimpleDateFormat(&quot;dd-mm-yyyy&quot;);
        Employee emp1 = new Employee(1, &quot;Ram&quot;, formatter.parse(&quot;26-01-1988&quot;);
        Employee emp1 = new Employee(3, &quot;Shyam&quot;, formatter.parse(&quot;14-10-1984&quot;);
        Employee emp1 = new Employee(2, &quot;Ghanshyam&quot;, formatter.parse(&quot;25-01-1983&quot;);
        List listOfEmployee = new ArrayList();
        listOfEmployee.add(emp1);
        listOfEmployee.add(emp2);
        listOfEmployee.add(emp3);
        Collections.sort(listOfEmployee);
    }
}        
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;Comparator&lt;/i&gt;&lt;/b&gt; - This interface contains two methods prototype. One is &lt;i&gt;compare(Object obj1, Object obj2)&lt;/i&gt; and &lt;i&gt;equals(Object obj)&lt;/i&gt;. To sort the elements, we just have to override the compare method. &lt;i&gt;This method also returns a negative integer, zero, or a positive integer as this object (through which the method has been called) is less than, equal to, or greater than the specified object&lt;/i&gt;. To make the objects comparable we have to create a class implementing this interface and override the &lt;i&gt;compare&lt;/i&gt; method.&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;br /&gt;
Here is the code -&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: csharp&quot;&gt;public class Employee {
    int id;
    String name;
    Date dob;

    Employee(int id, String name, Date date) {
        this.id = id;
        this.name  = name;
        this.dob  = dob;
    }
    
    //If you want to sort the Employee Collection based on empId;
    public int compareTo(Object object) {
        Employee emp = (Employee) object;
        // If you want the reversed order just reverse the subtraction as emp.id - this.id
        return this.id - emp.id;
    }

    //If you want to sort the Employee Collection based on name;
    public int compareTo(Object object) {
        Employee emp = (Employee) object;
        // If you want the reversed order call the below compare method using emp.name and pass this.name
        return this.name.compareTo(emp.name);
    }

    //If you want to sort the Employee Collection based on DOB;
    public int compareTo(Object object) {
        Employee emp = (Employee) object;
        // If you want the reversed order just reverse the subtraction
        return this.dob.eqauls(emp.dob);
    }
}

public class EmployeeComparator implements Comparator {
    //If you want to sort the Employee Collection based on empId;
    public int compareTo(Object obj1, Object obj2) {
        Employee emp1 = (Employee) obj1;
        Employee emp2 = (Employee) obj2;
        // If you want the reversed order just reverse the subtraction as emp.id - this.id
        return emp1.id - emp2.id;
    }

    //If you want to sort the Employee Collection based on name;
    public int compareTo(Object obj1, Object obj2) {
        Employee emp1 = (Employee) obj1;
        Employee emp2 = (Employee) obj2;
        // If you want the reversed order call the below compare method using emp.name and pass this.name
        return emp1.name.compareTo(emp2.name);
    }

    //If you want to sort the Employee Collection based on DOB;
    public int compareTo(Object obj1, Object obj2) {
        Employee emp1 = (Employee) obj1;
        Employee emp2 = (Employee) obj2;
        // If you want the reversed order just reverse the subtraction
        return emp1.dob.equals(emp2.dob);
    }
}

public class EmployeeSorter {
    public static void main(String[] args) throws Exception {
        DateFormat formatter = new SimpleDateFormat(&quot;dd-mm-yyyy&quot;);
        Employee emp1 = new Employee(1, &quot;Ram&quot;, formatter.parse(&quot;26-01-1988&quot;);
        Employee emp1 = new Employee(3, &quot;Shyam&quot;, formatter.parse(&quot;14-10-1984&quot;);
        Employee emp1 = new Employee(2, &quot;Ghanshyam&quot;, formatter.parse(&quot;25-01-1983&quot;);
        List listOfEmployee = new ArrayList();
        listOfEmployee.add(emp1);
        listOfEmployee.add(emp2);
        listOfEmployee.add(emp3);
        Collections.sort(listOfEmployee, new EmployeeComparator());
    }
}
&lt;/pre&gt;&lt;br /&gt;
&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #073763;&quot;&gt;Note: The difference between two approach is in case of Comparable, we have to create our class whose objects need to be sorted and implement Comparable interface with overriding compare method which takes only one argument. While in case of Comparator, we have to create our own Comparator and implement Comparator interface with overriding compareTo mehod which takes two arguments.&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techi-guru.blogspot.com/feeds/4821823511783817157/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techi-guru.blogspot.com/2011/09/how-to-use-comparator-and-comparable-to.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1848824224762882917/posts/default/4821823511783817157'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1848824224762882917/posts/default/4821823511783817157'/><link rel='alternate' type='text/html' href='http://techi-guru.blogspot.com/2011/09/how-to-use-comparator-and-comparable-to.html' title='How to use Comparator and Comparable to sort the objects?'/><author><name>Vidosh Sahu</name><uri>http://www.blogger.com/profile/18017214379597919595</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='25' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDjlWSwkzjNlvyCM4Yh164clT2ly24pShIsWOwpRMc8vs53mrw0rbl9dQj5AWZiHY1MvKc-LorM5RpBbEQZ4qInkHL924wQnCwSORGt5o3jFYkhO4cPfSGsTSmKNA6nUE/s220/tech-guru.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1848824224762882917.post-3067193172599484585</id><published>2011-09-11T12:40:00.003+05:30</published><updated>2011-09-15T23:05:13.690+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Driver"/><category scheme="http://www.blogger.com/atom/ns#" term="DriverManager"/><category scheme="http://www.blogger.com/atom/ns#" term="Dynamic Class Loading"/><category scheme="http://www.blogger.com/atom/ns#" term="JDBC"/><title type='text'>How to create a JDBC Connection in Java?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;JDBC (Java DataBase Connectivity) is an API for the Java programming language through which the databse can be accessed using methods for querying and  updating data.&lt;br /&gt;
Here is the sample code -&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: csharp&quot;&gt;import java.sql.*;

public class ConnectionInfo {

    public Connection getConnection() {
        Connection conn = null;
        // the below properties should be read from a properties file based on the Database used
        String url = &quot;jdbc:mysql://localhost:3306/&quot;; // url = jdbc:[subprotocol]://[hostname]:[portnumber]/
        String dbName = &quot;jdbctutorial&quot;; // database name
        String driver = &quot;com.mysql.jdbc.Driver&quot;; //Driver class name
        String username = &quot;root&quot;; // username
        String password = &quot;root&quot;; // password
        try {
          Class.forName(driver); // Dynamic loading based on database used.
          conn = DriverManager.getConnection(url + dbName, username, password);
          System.out.println(&quot;Connection Established&quot;);
        } catch (SQLException e) {
          e.printStackTrace();
        } finally {
            return conn;
        }
    }

    public void closeConnection(Connection conn) {
        if (conn != null) {
            try {
                conn.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }
}
&lt;/pre&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techi-guru.blogspot.com/feeds/3067193172599484585/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techi-guru.blogspot.com/2011/09/how-to-create-jdbc-connection-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1848824224762882917/posts/default/3067193172599484585'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1848824224762882917/posts/default/3067193172599484585'/><link rel='alternate' type='text/html' href='http://techi-guru.blogspot.com/2011/09/how-to-create-jdbc-connection-in-java.html' title='How to create a JDBC Connection in Java?'/><author><name>Vidosh Sahu</name><uri>http://www.blogger.com/profile/18017214379597919595</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='25' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDjlWSwkzjNlvyCM4Yh164clT2ly24pShIsWOwpRMc8vs53mrw0rbl9dQj5AWZiHY1MvKc-LorM5RpBbEQZ4qInkHL924wQnCwSORGt5o3jFYkhO4cPfSGsTSmKNA6nUE/s220/tech-guru.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1848824224762882917.post-7267449451924884797</id><published>2011-09-09T23:48:00.003+05:30</published><updated>2011-09-15T23:08:05.183+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="java threads"/><category scheme="http://www.blogger.com/atom/ns#" term="multithreading"/><category scheme="http://www.blogger.com/atom/ns#" term="Runnable"/><category scheme="http://www.blogger.com/atom/ns#" term="threading"/><title type='text'>Java Multithreading</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div&gt;Process can be further divided into small tasks which refer as a &lt;b&gt;&lt;i&gt;Thread&lt;/i&gt;&lt;/b&gt;. If two or more tasks of a process executes concurrently, then this scenario refers as a &lt;b&gt;&lt;i&gt;Multithreading&lt;/i&gt;&lt;/b&gt; environment. Every thread has it&#39;s own independent path of execution. In java, there are two ways to implement multithreading -&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;u&gt;&lt;b&gt;&lt;i&gt;Through implementation of Runnable interface&lt;/i&gt;&lt;/b&gt;&lt;/u&gt; - To create a thread, we can implement Runnable interface. This interface has a single run() method declaration, so we have to override that method. Actually, in this approach, we write a wrapper over Thread class. The objects of the class which implements Runnable interface, work as a thread of the program and run on their own execution paths.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Here is the sample code -&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;pre class=&quot;brush: csharp&quot;&gt;//This class objects will work as Threads
public class RunnableExample implements Runnable {
    private Thread thread;
    public RunnableExample(String name) {
        //here we pass the reference whose run method should be called.
        thread = new Thread(this, name);
        //creating thread
        thread.start();
    }
    
    public void run() {
        //your logic will go here
        System.out.println(thread.getName());
    }
}

public class RunnableMain {
    public static void main(String[] args) {
        //Creating three objects
        Runnable run1 = new RunnableExample(&quot;Thread-1&quot;);
        Runnable run2 = new RunnableExample(&quot;Thread-2&quot;);
        Runnable run3 = new RunnableExample(&quot;Thread-3&quot;);
    }
}
&lt;/pre&gt;&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;u&gt;&lt;b&gt;&lt;i&gt;2. Using Thread class extension&lt;/i&gt;&lt;/b&gt;&lt;/u&gt; - This is another approach of thread creation. But, it restricts the class to extend other classes (if required). In this approach, we extend our class to Thread class so that it&#39;s objects work as threads and run on their own separate execution paths.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;i&gt;Here is the sample code -&lt;/i&gt;&lt;/div&gt;&lt;pre class=&quot;brush: csharp&quot;&gt;//This class objects will work as Threads
public class ThreadExample extends Thread {

    public ThreadExample(String name) {
        super(name);
    }
    
    public void run() {
        //your logic will go here
        System.out.println(thread.getName());
    }
}

public class ThreadMain {
    public static void main(String[] args) {
        //Creating three objects
        Thread t1 = new ThreadExample(&quot;Thread-1&quot;);
        Thread t2 = new ThreadExample(&quot;Thread-2&quot;);
        Thread t3 = new ThreadExample(&quot;Thread-3&quot;);
        creating threads
        t1.start();
        t2.start();
        t3.start();
    }
}
&lt;/pre&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techi-guru.blogspot.com/feeds/7267449451924884797/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techi-guru.blogspot.com/2011/09/java-multithreading.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1848824224762882917/posts/default/7267449451924884797'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1848824224762882917/posts/default/7267449451924884797'/><link rel='alternate' type='text/html' href='http://techi-guru.blogspot.com/2011/09/java-multithreading.html' title='Java Multithreading'/><author><name>Vidosh Sahu</name><uri>http://www.blogger.com/profile/18017214379597919595</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='25' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDjlWSwkzjNlvyCM4Yh164clT2ly24pShIsWOwpRMc8vs53mrw0rbl9dQj5AWZiHY1MvKc-LorM5RpBbEQZ4qInkHL924wQnCwSORGt5o3jFYkhO4cPfSGsTSmKNA6nUE/s220/tech-guru.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1848824224762882917.post-8341765615832640594</id><published>2011-09-04T23:42:00.008+05:30</published><updated>2011-09-15T23:08:36.319+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="factorial"/><category scheme="http://www.blogger.com/atom/ns#" term="fibonacci series"/><category scheme="http://www.blogger.com/atom/ns#" term="recursion"/><title type='text'>How to work with Recursion?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;i&gt;&lt;b&gt;Recursion&lt;/b&gt;&lt;/i&gt; is one of the interesting topic. The problems, which can be implemented using loops, can be implemented with &lt;b&gt;Recursion&lt;/b&gt; as well. But, most of us go with the looping solution. Today, I am going to set some light on how the same logic can be implemented using recursion. If we could derive a mathematical function for these type of problems, the implementation will be more easier. Lets understand it through some examples.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;Example 1 : Factorial&lt;/b&gt;&lt;/i&gt; &lt;br /&gt;
The factorial of a non-negative number is the multiplication of all the positive integers which are less than or equal to the number.&lt;br /&gt;
&lt;br /&gt;
Suppose fact(n) is a function of n, where x is non-negative integer value. Hence &lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;fact(0) = fact(1) = 1&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;fact(2) = 2 * fact(1) = 2&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;fact(3) = 3 * fact(2) = 6&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;...&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;...&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;... &lt;/i&gt;&lt;br /&gt;
&lt;i&gt;fact(n) = n * fact(n-1)&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: black;&quot;&gt;So, the logic would be - If the value of n is 0 or 1 return 1, else return multiplication of n and value of function for (n-1).&lt;/div&gt;&lt;div style=&quot;color: #073763;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;pre class=&quot;brush: csharp&quot;&gt;int fact(int num) {
    if(num == 0 || num == 1)
        return 1;
    else
        return num * fact (num - 1);
}
&lt;/pre&gt;&lt;br /&gt;
&lt;div style=&quot;color: black;&quot;&gt;&lt;i&gt;&lt;b&gt;Example 2 : Fibonacci&lt;/b&gt; &lt;/i&gt;&lt;b&gt;Series&lt;/b&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;The Fibonacci series is a sequence of integers whose first and second terms are 0 and 1 respectively and&amp;nbsp; each subsequent term is the sum of the previous two terms. Like - 0, 1, 1, 2, 3, 5, 8, 13, 21, .....&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;Suppose fibo(n) is a function of n which returns the term n of the fibonacci series and where n &amp;gt; 0 -&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;&lt;i&gt;fibo(1) = 0&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;&lt;i&gt;fibo(2) = 1&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;&lt;i&gt;fibo(3) = fibo(1) + fibo(2) = 1&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;&lt;i&gt;fibo(4) = fibo(2) + fibo(3) = 2&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;&lt;i&gt;fibo(5) = fibo(3) + fibo(4) = 3&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;&lt;i&gt;...&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;&lt;i&gt;...&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;&lt;i&gt;...&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;&lt;i&gt;fibo(n) = fibo(n-2) + fibo(n-1)&lt;/i&gt;&lt;/div&gt;&lt;span style=&quot;color: #073763;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;color: black;&quot;&gt;So, the logic would be - If the value of n is 1 or 2 return (n-1), else return the addition of value of function for (n-2) and function for (n-1) .&lt;/div&gt;&lt;div style=&quot;color: #073763;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;pre class=&quot;brush: csharp&quot;&gt;int fibo(int num) {
    if(num == 1 || num == 2)
        return (num - 1);
    else
        return fibo(num - 2) + fibo(num - 1);
}
&lt;/pre&gt;&lt;span style=&quot;color: black;&quot;&gt;I hope, this post will really helpful.&lt;/span&gt;&lt;i style=&quot;color: #073763;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techi-guru.blogspot.com/feeds/8341765615832640594/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techi-guru.blogspot.com/2011/09/how-to-work-with-recursion.html#comment-form' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1848824224762882917/posts/default/8341765615832640594'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1848824224762882917/posts/default/8341765615832640594'/><link rel='alternate' type='text/html' href='http://techi-guru.blogspot.com/2011/09/how-to-work-with-recursion.html' title='How to work with Recursion?'/><author><name>Vidosh Sahu</name><uri>http://www.blogger.com/profile/18017214379597919595</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='25' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDjlWSwkzjNlvyCM4Yh164clT2ly24pShIsWOwpRMc8vs53mrw0rbl9dQj5AWZiHY1MvKc-LorM5RpBbEQZ4qInkHL924wQnCwSORGt5o3jFYkhO4cPfSGsTSmKNA6nUE/s220/tech-guru.jpg'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1848824224762882917.post-9043991822317350881</id><published>2011-09-03T00:29:00.015+05:30</published><updated>2011-09-15T23:08:46.610+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Design"/><category scheme="http://www.blogger.com/atom/ns#" term="Pattern"/><category scheme="http://www.blogger.com/atom/ns#" term="Singleton"/><title type='text'>How to make a class Singleton?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;The &lt;i&gt;&lt;b&gt;Singleton&lt;/b&gt;&lt;/i&gt; class means whose only one instance can be created. To make the class &lt;i&gt;&lt;b&gt;Singleton&lt;/b&gt;&lt;/i&gt;, we should restrict the ways through which the objects can be created. The object can be created in the following ways -&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;i&gt;Using &lt;b&gt;new&lt;/b&gt; operator&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Using &lt;b&gt;newInstance()&lt;/b&gt; method&amp;nbsp; (by Dynamic loading of class).&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Through &lt;b&gt;Serialization/Deserialization&lt;/b&gt;&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Through &lt;b&gt;Cloning&lt;/b&gt;&lt;/i&gt;&lt;/li&gt;
&lt;/ol&gt;To restrict the ways of object&amp;nbsp; creation, we should take care of the following points -&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;i&gt;The &lt;b&gt;Constructer&lt;/b&gt; must be &lt;b&gt;private&lt;/b&gt; so that static (using new operator) and dynamic (using newInstance() method) creation of object does not get supported.&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Static field as object of the Singleton class should be declared within that class. In &lt;b&gt;getInstance()&lt;/b&gt; method, it&lt;/i&gt;&lt;i&gt; should be checked whether the static object has been instantiated or not. If not, then instantiate and return it.&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;The method &lt;b&gt;getInstance()&lt;/b&gt; must be &lt;b&gt;Static&lt;/b&gt; and &lt;b&gt;Synchronized&lt;/b&gt;. Static, so it can be accessed through the class name. Synchronized, because it should be thread-safe.&lt;/i&gt;&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;The class must implement the &lt;b&gt;Externalizable&lt;/b&gt; interface and override the &lt;b&gt;writeExternal()&lt;/b&gt; and &lt;b&gt;readExternal()&lt;/b&gt; methods such that serialization/deserialization should not be supported.&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;The class must override &lt;b&gt;clone()&lt;/b&gt; method so that another object could not get created.&lt;/i&gt;&lt;/li&gt;
&lt;/ol&gt;Here is an example -&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: csharp&quot;&gt;import java.io.*;

//Implement Externalizable interface to avoid object creation through Deserialization.
public class SingletonExample implements Externalizable {
    //make a static object
    private static SingletonExample g_instance;

    //make the construct as provate to hide it from outer world.
    private SingletonExample() {
        //do nothing
    }

    //make this static method as synchronized for thread-safe model.
    public synchronized static SingletonExample getInstance() {
        if (g_instance == null)             
            g_instance = new SingletonExample();
        return g_instance;
    }
    
    //override method and throw exception to avoid serialization     
    public void writeExternal(ObjectOutput out) throws SerializationNotAllowedException {
        throw new SerializationNotAllowedException(&quot;Serialization is not supported.&quot;);
    }     

    //override method and throw exception to avoid deserialization
    public void readExternal(ObjectInput in) throws SerializationNotAllowedException {
        throw new SerializationNotAllowedException(&quot;Deserialization is not supported.&quot;);
    }         

    //override method to avoid object cloning
    protected Object clone() throws CloneNotSupportedException {
        throw new CloneNotSupportedException(&quot;Cloning not allowed&quot;);
    } 
}

//As the methods writeExternal and readExternal throws IOException, hence we have to extend to create our own Exception.
class SerializationNotAllowedException extends IOException {
    public SerializationNotAllowedException(String message) {
        super(message);
    }
}
&lt;/pre&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techi-guru.blogspot.com/feeds/9043991822317350881/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techi-guru.blogspot.com/2011/09/how-to-make-class-singleton.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1848824224762882917/posts/default/9043991822317350881'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1848824224762882917/posts/default/9043991822317350881'/><link rel='alternate' type='text/html' href='http://techi-guru.blogspot.com/2011/09/how-to-make-class-singleton.html' title='How to make a class Singleton?'/><author><name>Vidosh Sahu</name><uri>http://www.blogger.com/profile/18017214379597919595</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='25' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDjlWSwkzjNlvyCM4Yh164clT2ly24pShIsWOwpRMc8vs53mrw0rbl9dQj5AWZiHY1MvKc-LorM5RpBbEQZ4qInkHL924wQnCwSORGt5o3jFYkhO4cPfSGsTSmKNA6nUE/s220/tech-guru.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1848824224762882917.post-4317763115566355984</id><published>2011-09-01T02:38:00.001+05:30</published><updated>2011-09-15T23:09:01.738+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="methods"/><category scheme="http://www.blogger.com/atom/ns#" term="non-static"/><category scheme="http://www.blogger.com/atom/ns#" term="static"/><category scheme="http://www.blogger.com/atom/ns#" term="synchronized"/><title type='text'>Static and Non Static Synchronized Methods</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Hi Friends,&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;This is my first post. I hope you will like this one.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Have you ever thought about the behavior of a static synchronized method call and a non-static synchronized method call in Java? Before that, first of all we should have a look on how the static and non static calls work -&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;i&gt;&lt;b&gt;Static Method Call&lt;/b&gt;&lt;/i&gt; - When we make a call to a static method (either directly from class or any object of that class), the Class object of that Class involves in that call. Every Class has only one Class object.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;i&gt;&lt;b&gt;Non-static Call&lt;/b&gt; -&amp;nbsp;&lt;/i&gt;&amp;nbsp;When we call a non-static method (always from an object of that class), it works for that object only (which is of that class only). A class can have as many objects (if not restricted though some design patterns or lack of memory).&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Now, lets come to Static and Non-static Synchronized method calls -&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;b style=&quot;font-style: italic;&quot;&gt;Static Synchronized Method Call - &lt;/b&gt;Whenever a thread accesses any synchronized static method, it acquires the lock on Class object of that class and hence no other static method can be accessed of that class.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;b style=&quot;font-style: italic;&quot;&gt;Non-static Synchronized Method Call - &lt;/b&gt;As the non-static methods can be accessed through only objects of that class. So whenever, a thread enters any non-static synchronized method, it acquires the lock on the object through which the call has been made. Hence the other threads can still access the same or other non-static methods using other unlocked objects (free resources) of that class.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Thanks&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techi-guru.blogspot.com/feeds/4317763115566355984/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techi-guru.blogspot.com/2011/09/static-and-non-static-synchronized.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1848824224762882917/posts/default/4317763115566355984'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1848824224762882917/posts/default/4317763115566355984'/><link rel='alternate' type='text/html' href='http://techi-guru.blogspot.com/2011/09/static-and-non-static-synchronized.html' title='Static and Non Static Synchronized Methods'/><author><name>Vidosh Sahu</name><uri>http://www.blogger.com/profile/18017214379597919595</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='25' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDjlWSwkzjNlvyCM4Yh164clT2ly24pShIsWOwpRMc8vs53mrw0rbl9dQj5AWZiHY1MvKc-LorM5RpBbEQZ4qInkHL924wQnCwSORGt5o3jFYkhO4cPfSGsTSmKNA6nUE/s220/tech-guru.jpg'/></author><thr:total>6</thr:total></entry></feed>