Monthly Archives: August 2012

android install in eclipse

android install in eclipse

Android Install in Eclipse

Step1: download the eclipse from the following link
                                eclipse download
Step2: unZip the elipse and install the following plugin in the eclipse



Step3:  download the android sdk from following link
             android sdk download
Step4: unzip the sdk folder and configure that in the eclipse
           4.1: In eclipse open window—>preferences—>android—>SDKLocation  to configure the                 unziped folder. and —>ok.
Step5: update the sdk tools. 
            5.1:In eclipse open window—>Android SDK Manager–>
            5.2: check the tools and click the install.
Step6: Install the which version you want select that version Sdk platform  and install.

Step7: Configure the emulator.
           7.1:n eclipse open window—>AVD Manager –>

           7.2:  Select new button to open new window
           7.3: give name,select the Target version.
           7.4:  click Create AVD button.
            then select the created AVD and click Start button.
            7.5: click Launch button.

How do I delete from multiple tables using INNER JOIN IN SQL

How do I delete from multiple tables using INNER JOIN IN SQL

DELETE t1,t2,t3 
FROM Filedata AS t1
INNER JOIN Filepath as t2
INNER JOIN Fileversions as t3 where t3.file_id='0.9067535276368446'

Changing the engine in the all tables of the database progrmetically for mysql

database and java

Changing the engine in the all tables of the database progrmetically for mysql

                     Connection connection = null;
                     //for getting the connecion
     connection =                                                       DriverManager.getConnection(“jdbc:mysql://localhost:3306/hydhouse”,”root”,”password”);
            // Create statement object 
            Statement stmt = connection.createStatement();

                            //for getting the tables from that database
            DatabaseMetaData dbm = connection.getMetaData();
  String[] types = {“TABLE”};
  ResultSet rs = dbm.getTables(null,null,”%”,types);
  while ({
  String table = rs.getString(“TABLE_NAME”);

//for change the engine in mysql
  String sql=”ALTER TABLE “+table+” ENGINE = innodb “;
  int i=stmt.executeUpdate(sql);
        catch (SQLException s){
          System.out.println(“SQL Exception ” + s);

permissions and process killing in Ubuntu


for giving permisions

>chmod -R 777 filename/foldername

for know the processes of any application

>ps aux|grep eclipse             for eclipse

for kill the processes

>kill -9 processnumber

For see the tomcat log changes in console

>tail -f catalina.out

Running multiple tomcat servers

Running multiple tomcat servers

Running multiple tomcat servers

Download tomcat, and unpack it twice, into two separate directories. Edit the conf/server.xml file in one of the copies in the following way: Change the port on the root Server element to a different number (e.g. 8006) Change the port attributes on the Connector elements to a different number (e.g. 8010 instead of 8009, 8081 instead of 8080 and 8444 instead of 8443) You should now be able to run the bin/ scripts in both installations to get two running tomcats. Connect using port 8080 and install the basic application services, and then connect using port 8081 to install the service provider management services. Source link. Some other useful links are given linkslinks.

Configuring Tomcat 6 with eclipse in ubuntu

Configuring Tomcat 6 with eclipse in ubuntu

Configuring Tomcat 6 with eclipse in ubuntu

open terminal and type this
sudo apt-get install tomcat6(not required if already installed)
cd /usr/share/tomcat6
sudo ln -s /var/lib/tomcat6/conf conf
sudo ln -s /etc/tomcat6/policy.d/03catalina.policy conf/catalina.policy
sudo ln -s /var/log/tomcat6 log
sudo chmod -R 777 /usr/share/tomcat6/conf
restart server
then configure the server

Sorting an ArrayList that contains pojo class

sorting the arraylist contains pojo classes

Sorting an ArrayList that contains pojo class

Sorting of ArrayList containing our own Class/Objects in java, Sorting ArrayList that contains customizes java class/objects in java . How to sort Arraylist that contains our own class in java?
Here is the example of sorting  a list that contains java pojo class.
In below example, we have Employee class with attribute id, first name & last name.
We have another class that actually use the sort() method of Collections which has to implement Comparator() to sort pojo with its field.

Here is the Employee Class

  1. public class Employee   
  2. {  
  3.     int id;  
  4.     String firstName;  
  5.     String lastName;  
  7.     public Employee(int id,String firstName,String lastName)  
  8.     {  
  10.         this.firstName=firstName;  
  11.         this.lastName=lastName;  
  12.     }  
  13.     public int getId() {  
  14.         return id;  
  15.     }  
  16.     public void setId(int id) {  
  17. = id;  
  18.     }  
  19.     public String getFirstName() {  
  20.         return firstName;  
  21.     }  
  22.     public void setFirstName(String firstName) {  
  23.         this.firstName = firstName;  
  24.     }  
  25.     public String getLastName() {  
  26.         return lastName;  
  27.     }  
  28.     public void setLastName(String lastName) {  
  29.         this.lastName = lastName;  
  30.     }  
  31. }  

Here is actual class that sort the list which contains Employee objects

  1. import java.util.ArrayList;  
  2. import java.util.Collections;  
  3. import java.util.Comparator;  
  4. import java.util.List;  
  7. public class SortEmployeeList  
  8. {  
  9.     public static void main(String[] args)   
  10.     {  
  11.         Employee emp1 = new Employee(1,“Dipen”,“Khadka”);  
  12.         Employee emp2 = new Employee(2,“John”,“Rotela”);  
  13.         Employee emp3 = new Employee(3,“Shark”,“Anderson”);  
  14.         Employee emp4 = new Employee(4,“Suman”,“Bhatt”);  
  16.         List<Employee> employeeList = new ArrayList<Employee>();  
  17.         employeeList.add(emp1);  
  18.         employeeList.add(emp2);  
  19.         employeeList.add(emp3);  
  20.         employeeList.add(emp4);  
  22.         //sort by First name  
  23.         Collections.sort(employeeList, new Comparator() {  
  24.             @Override  
  25.             public int compare(Object obj1, Object obj2) {  
  26.                 Employee emp1 = (Employee)obj1;  
  27.                 Employee emp2 = (Employee)obj2;  
  28.                 return emp1.getFirstName().compareToIgnoreCase(emp2.getFirstName());  
  29.             }  
  30.         });  
  31.         //Now the employeeList is sorted based on first name  
  34.         //sort by Last name  
  35.         Collections.sort(employeeList, new Comparator() {  
  36.             @Override  
  37.             public int compare(Object obj1, Object obj2) {  
  38.                 Employee emp1 = (Employee)obj1;  
  39.                 Employee emp2 = (Employee)obj2;  
  40.                 return emp1.getLastName().compareToIgnoreCase(emp2.getLastName());  
  41.             }  
  42.         });  
  43.         //Now the employeeList is sorted based on last name  
  44.     }  
  45. }  
%d bloggers like this: