Search This Blog

Thursday, February 25, 2016

Java File content detector - Apache Tika

1. renamed sample.txt to sample.pdf

2. Add tika-core-1.11.jar in your lib

3. java class
    Output : text/plain File is of type - .txt


import org.apache.tika.config.TikaConfig;
import org.apache.tika.metadata.Metadata;
import org.apache.tika.mime.MediaType;
import org.apache.tika.mime.MimeType;
import org.apache.tika.mime.MimeTypeException;

public class TikaExample

    public static void main ( String [] args ) throws IOException, MimeTypeException

      TikaConfig config = TikaConfig.getDefaultConfig ();

        // renamed sample.txt to sample.pdf
        File file = new File ( "D:/drvijay/Reliance/testing/sample.exe" );
        InputStream stream = new FileInputStream ( file );
        // whatever the source you get inputstream, please add buffer for mark/reset support,
        // else u may get exception
        InputStream bufferedIn = new BufferedInputStream ( stream );

        final Metadata metadata = new Metadata ();
        metadata.set ( Metadata.RESOURCE_NAME_KEY, file.getName () );
        MediaType mediaType = config.getMimeRepository ().detect ( bufferedIn, metadata );
        // MediaType mediaType = config.getMimeRepository ().detect ( bufferedIn, new Metadata() );
        MimeType mimeType = config.getMimeRepository ().forName ( mediaType.toString () );
        String extension = mimeType.getExtension ();

        System.out.println ( mimeType + " File is of type - " + extension );

Monday, February 22, 2016

Chrome Hangs or Freezed

Follow these simple steps.

 1. Goto->start->run and type 


go back to appdata folder from roming folder. or simply open C:/Users/youruser/AppData

C:\Users\youruser\AppData\Local\Google\Chrome\User Data
1.1 delete default (folder) and  localstate (file)

 2. download google cleanup tool and run it

2. open chrome as administrator
    Place mouse on chrome icon -> right click -> run as adminstrator

3.  disable shock/flash plugin 
type in chrome browser :


4. in chrome settings -> advance settings 

    4.1 change your download path,
     4.2 uncheck the [ use hardware acceralation when available ]
     4.3 uncheck the continue running background apps

ENJOY madi

Wednesday, February 10, 2016

Git or bitbucket checkout public key - Self signed certificate issue


1. generate your self signed private key from "putty-gen.exe" or "open ssl" etc..
    > generate new key
    > save private key ex: D:/drvijay/self-private.ppk

2. type  the below command in cmd 1. to ignore ssl verify, 2. add your self certificate , 

3. check out 

    > git config --global http.sslverify false
    > git config --system http.sslCAPath D:/drvijay/self-private.ppk

    > git clone https://@url/repo.git
    > pwd: test123

-- Enjoy

Thursday, February 4, 2016

linux Ubuntu Postgresql Setup Installation

Type the below commands.


    sudo apt-get install postgresql postgresql-contrib
    apt-cache search postgres
    sudo apt-get install pgadmin3

create default user/role postgres
    sudo -u postgres psql postgres
    \password postgres

linux Ubuntu SVN Setup Installation

Type the below commands.

    sudo apt-get install subversion apache2 libapache2-svn

    svn co --username vijay svn://
    enter pwd

Wednesday, February 3, 2016

linux Ubuntu Maven Setup Installation


Type the below commands.

    sudo apt-get install maven
    sudo update-alternatives --config mvn

linux Ubuntu JDK Java Setup Installation

java 1.8

Type the below commands.

    Installing Java 8
        $ sudo add-apt-repository ppa:webupd8team/java
        $ sudo apt-get update
        $ sudo apt-get install oracle-java8-installer
    Verify java
        $ java -version
    Configuring Java Environment
        $ sudo apt-get install oracle-java8-set-default

linux Ubuntu Git Setup Installation

Type the below commands.

    sudo apt-get install git-core
    git clone

Linux - Ubuntu - Mongodb Installation Setup


1.    Install MongoDB
    Import the public key used by the package management system.

    sudo apt-key adv --keyserver hkp:// --recv 7F0CEB10

2Create a list file for MongoDB.

    echo "deb trusty/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list

3 Reload local package database.

    sudo apt-get update

4 Install the MongoDB packages.

    sudo apt-get install -y mongodb-org

4.1 Install a specific release of MongoDB.

    sudo apt-get install -y mongodb-org=3.0.7 mongodb-org-server=3.0.7 mongodb-org-shell=3.0.7 mongodb-org-mongos=3.0.7 mongodb-org-tools=3.0.7

5. Start MongoDB.

    sudo service mongod start

5.1 Verify that MongoDB has started successfully
    Verify that the mongod process has started successfully by checking the contents of the log file at /var/log/mongodb/mongod.log for a line reading

6 Stop MongoDB.

    sudo service mongod stop

7 Restart MongoDB.
    sudo service mongod restart

8. mongodb - uninstall

    sudo service mongod stop
    sudo apt-get purge mongodb-org*
    sudo rm -r /var/log/mongodb
    sudo rm -r /var/lib/mongodb

Hit Counter

View My Stats