Saturday, March 31, 2012

Hello World Program In Hibernate Using Annotaion

Required Software :



  1. Java JDK 5 or above
  2. Eclipse IDE 3.2 or above
  3. Maven 3.0 or above
  4. Hibernate 3.0 or above
  5. MySQL 5.0 or above
Starting The First Programme:


we will create a simple table “employee” in MySQL. Use following script to create the table:


CREATE TABLE `employee` (
    `id` BIGINT(10) NOT NULL AUTO_INCREMENT,
    `firstname` VARCHAR(50) NULL DEFAULT NULL,
    `lastname` VARCHAR(50) NULL DEFAULT NULL,
    `birth_date` DATE NOT NULL,
    `cell_phone` VARCHAR(15) NOT NULL,
    PRIMARY KEY (`id`)
)




Hadoop Hive Hbase Profiler

If you have some question lie this

How do I get the following meta information about a table

1. recent users of table,

2. top users of table,

3. recent queries/jobs/reports,

4. number of rows in a table

Look :->

The tool available here
Store information from the job tracker including counters, progress, jobxml info. Put it all in cassandra so you can profile runs of a job, day over day etc.

Some Code Samples from This project :


Friday, March 30, 2012

Java memory tuning

You may have come in scenario sometime when you program our cede result in error java memory related error, like could not allocate memory on heap for java, These error may result in OutOfMemoryError exceptions or to a reduction in the performance of the Java application, here is the typical setting for java memory so that you can escape these errors.

There is and command line option for java, that defines the maximum size of memory to be allocated to JVM

-Xmx    :  this allows application to run with 70% of max memory uses

Lets see the list of Maximum possible heap size and what is recommended for the heap size specification, as this is just a recommendation not a rule you can decide accordingly.

Installing .run file in ubuntu or linux

1. Right-click the file and select Properties
2. Under the Permissions tab, make sure that Allow executing file as program is ticked and press Close


                                              or


1. Inside terminal execute  "chmod +x filename.run"


                        and proceed with next steps


3. Double-click the .run file to open it. A dialog box should appear
4. Press Run in Terminal to run the installer


The installer will start






If this does not work or the program that you want to run needs root permission you can go to terminal and issue following commannd....


sudo ./filename.run


then this will start the program and the gui screen will come.

Get list of all files in a directory : java Recursively


 public static ArrayList<String> files=new  ArrayList<String>();
    public static ArrayList<String> ReturnAllFileFromAFolder(String FolderPath)
    {
       
        File folder = new File(FolderPath);
    File[] listOfFiles = folder.listFiles();

    for (int i = 0; i < listOfFiles.length; i++) {
      if (listOfFiles[i].isFile()) {
       // System.out.println("File " + listOfFiles[i].getName());
        files.add(FolderPath+"/"+listOfFiles[i].getName());
      } else if (listOfFiles[i].isDirectory()) {
       // System.out.println("Directory " + listOfFiles[i].getName());
        //files.add(FolderPath+"/"+listOfFiles[i].getName());
        ReturnAllFileFromAFolder( FolderPath+"/"+listOfFiles[i].getName());
      }
    }
    return files;
    }


Featured Posts

#Linux Commands Unveiled: #date, #uname, #hostname, #hostid, #arch, #nproc

 #Linux Commands Unveiled: #date, #uname, #hostname, #hostid, #arch, #nproc Linux is an open-source operating system that is loved by millio...