Tuesday, June 25, 2013

Upcoming super star of film industry :- Tovino Thomas

Tovino Thomas called as "Tovi" is one of the most promising and talented super star in the Malayalam film industry.Tovino started his filmy career with the movie "Prabhuvinte Makkal ". He had played an villain role in the latest super hit Malayalam movie "ABCD".Tovino's upcoming movie includes "YOU TOO BRUTUS" directed by famous director "Roopesh Peethambaran".Tovino has worked as a model and even lend his face for few short films and advertisements. Maathra, Jaalakam and Snehapoorvam were the short films which proved him as an actor.

For all those who have missed this dude's pics here are few............

































Saturday, May 25, 2013

Naresh Iyer's new musical album :- Vennila

Naresh Iyer is back with a super hit musical album  Vennila .

Please click on the below image to listen/download vennila

Inline image 2



Vennila available @
1) vennilamusic.com/song/Vennila.mp3
2) http://www.4shared.com/zip/VazstO6o/Vennila.html
3) http://subinsuresh.blogspot.in/2013/05/naresh-iyers-new-musical-album-vennila.html
4) https://soundcloud.com/ajith1989/vennila 

Get day difference between two dates

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
   /**
         * @param date1
         * @param date2
         * @return
         */
        public static long getDayDifference(Date date1, Date date2) {

                long diffDays = 0;
                if(null != date1 && null != date2){
                        Calendar c1 = Calendar.getInstance();
                        c1.setTime(date1);

                        Calendar c2 = Calendar.getInstance();
                        c2.setTime(date2);
                        double milliseconds1 = c1.getTimeInMillis();
                        double milliseconds2 = c2.getTimeInMillis();
                        double diff = milliseconds2 - milliseconds1;
                        diffDays = (long) diff / (24 * 60 * 60 * 1000);
                      
                }
                return diffDays;
        }

Saturday, May 14, 2011

Subtract ndays from given Date

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
 
   /**
         * @param date
         * @param days
         * @param format
         * @return
         */
        public static String subtractDays(Date date, Integer days,String format) {

              
                String formattedDate = null;
                if(null != date && null != format){
                        Calendar calendar = Calendar.getInstance();
                        calendar.setTime(date);
                        calendar.add(Calendar.DATE, -days);
                        SimpleDateFormat dateFormat = new SimpleDateFormat(format);
                        formattedDate=dateFormat.format(calendar.getTime());
                }
                return formattedDate;
        }

Monday, May 9, 2011

Adding ndays to given Date

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

       /**
         * @param date
         * @param days
         * @param format
         * @return

         */
        public static String addDays(Date date, Integer days, String format) {

                String formattedDate = null;
                if(null != date && null != format){
                        Calendar calendar = Calendar.getInstance();
                        calendar.setTime(date);
                        calendar.add(Calendar.DATE, days);

                        SimpleDateFormat dateFormat = new SimpleDateFormat(format);
                        formattedDate = dateFormat.format(calendar.getTime());
                }
              
                return formattedDate;
        }
      


Saturday, February 26, 2011

What is a Framework?

Framework is special software that is capable of developing applications based on certain architecture having ability to generate certain logics of application development dynamically.

Sunday, December 5, 2010

Implementation of Connection Pooling for PostgreSQL in Tomcat6.0


  1. Copy the below Resource tag in between open tag <Context> and end tag          </Context> of context.xml available in META-INF directory of your Web Application
For Example
D:\SampleWeb\web\META-INF

<Context>
                                                                                                                         
<Resource name="jdbc/psql"
    auth="Container"
    type="javax.sql.DataSource"
    maxActive="100"
    maxIdle="30"
    maxWait="20000"
    removeAbandoned="true"
    removeAbandonedTimeout="120"
    username="postgres"
    password="postgres"
    driverClassName="org.postgresql.Driver"
    url="jdbc:postgresql://127.0.0.1:5432/testdb"/>

</Context>


2. Copy the same above Resource tag in between open tag <Context> and end tag        </Context> of context.xml available in Tomcat’s conf directory.

For example
           C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf\
<Context>

<Resource name=" jdbc/psql"
    auth="Container"
    type="javax.sql.DataSource"
    maxActive="100"
    maxIdle="30"
    maxWait="20000"
    removeAbandoned="true"
    removeAbandonedTimeout="120"
    username="postgres"
    password="postgres"
    driverClassName="org.postgresql.Driver"
    url="jdbc:postgresql://10.1.14.38:5432/testnpermit"/>

</Context>

3. You can have any number of Resource tags as you wish but names must be different.
    

4. Copy the postgresql-8.4-701.jdbc3.jar in Tomcat’s lib directory
  C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib
 
 
 
5. Create a Java Class ConnectionPooling
 

import java.sql.Connection;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
import nic.java.util.Debug;

public class ConnectionPooling {

    private static DataSource ds;

    public static Connection getDBConnection() throws NamingException, Exception {

        Connection con = null;
        try {
            if (ds != null) {
                con = ds.getConnection();
            } else {
                String dsString = "java:/comp/env/ jdbc/psql";
              ds = (DataSource) new InitialContext().lookup(dsString);
                con = ds.getConnection();
            }

        } catch (Exception e) {
            e.printStackTrace();
                  }
        return con;
    }
}