What is Android One and important for buying purpose ?

We all know a new specification of google android its a Android one.Google has launched the first family of Android One phones in India, saying the move is part of a "larger initiative to bring high-quality smartphones to as many people as possible."
But what is it ? Why is it so? What is so important about Android One? And more importantly, what is there in it for you, the consumer? Some of that questions arise in your mind .Then read on, we have the answers.
Before giving your answer just brief feature of it.

  • Always the latest version of Android

Runs the latest version of Android (4.4 KitKat) and automatically gets the new operating system soon after it's released.*

  • Simple yet powerful features 

Helpful innovations like voice commands and clever engineering help your phone run faster, last longer, and take more stunning photos.

  • Make it your own

Start with a fresh home screen and customize it with your favorite Android Apps and wallpaper to make it exactly the way you want it.

  • Security in-built
Unlock your phone with a password, pattern, or even using the image of your face. If you lose your phone, you can find it, lock it, or delete your content remotely using Android Device Manager.

android one, what is android one, google android one, android kitkat, spice dream uno, karbonn sparkle v, micromax canvas a1, sundar pichai, google india, cheap amartphone, affordable smartphone, android phone,android, android one, google, google android one, india, karbonn, karbonn sparkle v, karbonn sparkle v india price, karbonn sparkle v price in india, karbonn sparkle v specifications, micromax, micromax canvas a1, micromax canvas a1 india price, micromax canvas a1 price in india, micromax canvas a1 specifications, mobiles, spice, spice dream uno, spice dream uno india price, spice dream uno price in india, spice dream uno specifications


What is Android One?
Android One is a Google programme where it is partnering with phone companies to create "high-quality" but low-cost Android smartphone. The programme was announced in June by Pichai and India is the first country where the company is launching Android One phones.

According to Google, Android One programme is its attempt to create affordable smartphones so that billions of people who still use a feature phone can buy a smartphone. Of course, this is the stated aim. We suspect that Google has one more motive. With Android One it also wants to wrest back the control of the Android ecosystem from companies like Samsung, Sony and LG.

But how it is different from any other Android phone which already use Google's Android ?
Android One is different. First of all, it has- despite its similarities with the regular version of Android - some extra customization that makes it more suitable to low-end hardware. At least that is what Google says. Second, it doesn't have any third-party user interface or unnecessary features. It is the version of Android created by Google. This means when you buy an Android One phone, you get the Android experience that Google has designed for you and not Micromax or Spice.

With normal Android phones, the company selling the phone is responsible for choosing right hardware and software for the devices. For Android One phone, Google is in the driver's seat. It finalises the hardware and software.

Important thing :
Google is also responsible for delivering software updates to Android One phones. This means you can expect Android One phones to get latest version of Android - next is Android L -- without much delay unlike normal low-end Android phones, which are rarely updated. Google is promising that every Android One phone will get updates for at least two years.
What kind of Android One phones I can buy and at what price?
Only three Android One phones are available as of now. And currently, you can get them only in India and at specific e-commerce sites. The Spice Dream UNO is available at Flipkart at a price of Rs 6,299. The Karbonn Sparkle V is available at Snapdeal at a price of Rs 6,399. And Micromax Canvas A1 is available at Amazon India at a price of Rs 6,499.

All three are entry-level Android phones and hence pack in rather modest hardware. In terms of hardware, all three use same hardware.

  • Each one has a 4.5-inch screen with 854 X 480 pixels resolution.
  • MediaTek quad-core processor running at 1.3GHz.
  • 1GB RAM
  • 4GB internal storage
  • support for microSD card
  • 5MP rear camera and 2MP front camera. 
  • The only major difference is the brand name and design. 




How to sort jTable in Swing

Hello friends today i am telling you how to sort your jtable in swing. Recently i worked on sport academy billing project and need to sort the list of student. Then i searched and found this tutorial and hope it would be helpful for you.
The basis for sorting and filtering rows in Mustang is the abstract RowSorter class. RowSorter maintains two mappings, one of rows in a JTable to the elements of the underlying model, and back again. This allows for one to do sorting and filtering. The class is generic enough to work with both TableModel and ListModel. However only a TableRowSorter is provided with the Mustang libraries to work with JTable.

In the simplest case, you pass the TableModel to the TableRowSorter constructor, and then pass the created RowSorter into the setRowSorter() method of JTable. Here's an example program, SortTable, that demonstrates the approach:
import javax.swing.*;
   import javax.swing.table.*;
   import java.awt.*;

   public class SortTable {
     public static void main(String args[]) {
       Runnable runner = new Runnable() {
        public void run() {
           JFrame frame = new JFrame("Sorting JTable");
           frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
           Object rows[][] = {
               {"AMZN", "Amazon", 41.28},
               {"EBAY", "eBay", 41.57},
               {"GOOG", "Google", 388.33},
               {"MSFT", "Microsoft", 26.56},
               {"NOK", "Nokia Corp", 17.13},
               {"ORCL", "Oracle Corp.", 12.52},
               {"SUNW", "Sun Microsystems", 3.86},
               {"TWX",  "Time Warner", 17.66},
               {"VOD",  "Vodafone Group", 26.02},
               {"YHOO", "Yahoo!", 37.69}
             };
           String columns[] = {"Symbol", "Name", "Price"};
           TableModel model =
               new DefaultTableModel(rows, columns) {
             public Class getColumnClass(int column) {
               Class returnValue;
               if ((column >= 0) && (column < getColumnCount())) {
                 returnValue = getValueAt(0, column).getClass();
               } else {
                 returnValue = Object.class;
               }
               return returnValue;
             }
           };

           JTable table = new JTable(model);
           RowSorter<TableModel> sorter =
             new TableRowSorter<TableModel>(model);
           table.setRowSorter(sorter);
           JScrollPane pane = new JScrollPane(table);
           frame.add(pane, BorderLayout.CENTER);
           frame.setSize(300, 150);
           frame.setVisible(true);
         }
       };
       EventQueue.invokeLater(runner);
     }
   } 
How to sort jTable in Swing,sort jTable in Swing,jTable in Swing,jtable sort,sorting in swing,swing table sort,
Click on one of the columns of the displayed table, and notice that the contents of the column are reordered.
How to sort jTable in Swing,sort jTable in Swing,jTable in Swing,jtable sort,sorting in swing,swing table sort,
After that you arise a question is that
why not simply use the DefaultTableModel, as opposed to creating a custom subclass of it? 
A. TableRowSorter has a set of rules to follow for sorting columns. By default, all columns of a table are thought to be of type Object. So, sorting is done by calling toString(). By overriding the default getColumnClass() behavior of DefaultTableModel, RowSorter sorts according to the rules of that class, assuming it implements Comparable. You can also install a custom Comparator for a column by calling setComparator(int column, Comparator comparator).

Explanation :
The key three lines in the SortTable program that are pertinent to sorting are shown here:
 JTable table = new JTable(model);
           RowSorter<TableModel> sorter =
             new TableRowSorter<TableModel>(model);
           table.setRowSorter(sorter);
The first line associates the model with the table. The second line creates a RowSorter specific to the model. The third line associates the RowSorter with the JTable. This enables a user to click on the column header to sort that column. Clicking a second time on the same column reverses the sort order.

If you want to add your own action when the sort order changes, you can attach a RowSorterListener to the RowSorter. The interface has one method:
void sorterChanged(RowSorterEvent e)

The method allows you to update the text on the status bar, or perform some additional task. The RowSorterEvent for the action allows you to discover how many rows were present before the sort, in the event that the RowSorter filtered rows in or out of the view.

How to combine two or more column in mysql database

Hello friends today i am telling you how to concat or combine two or more column in mysql database. My friend Eric Leschinski told me a problem and i share solution of this :

I have the following structure with a MySQL table:
+----------------+----------------+----------+
|    zipcode     |      city      |   state         |
+----------------+----------------+----------+
|     10954      |     Nanuet     |    NY    |
+----------------+----------------+----------+
I want to combine the above 3 columns into one column like this:
+---------------------+
|      combined       |
+---------------------+
| 10954 - Nanuet, NY  |
+---------------------+
And I want to add this "combined" column to the end of the table without destroying the original 3 fields.
How to combine two or more column in mysql database,combine two or more column in mysql database,two or more column in mysql database,more column in mysql database,column in mysql database,


Create the column:
alter table add column combined varchar(50);

Update the current values:
update table set combined = concat(zipcode, ' - ', city, ', ', state);

Update all future values automatically:
create trigger insert_trigger

before insert on table

for each row

set new.combined = concat(new.zipcode, ' - ', new.city, ', ', new.state);



create trigger update_trigger

before update on table

for each row

set new.combined = concat(new.zipcode, ' - ', new.city, ', ', new.state);
Select value from column
SELECT CONCAT(zipcode, ' - ', city, ', ', state) FROM Table;

Add new column to your table and perfrom the query:
UPDATE tbl SET combined = CONCAT(zipcode, ' - ', city, ', ', state)

How to use CRUD with Mysql in Java

In my previous post i am telling you crud on Hibernate and if we're beginner then we need to start our program with starting .That's why you read here how to use crud function with mysql for your java projects.
You should see : Disadvantage of Hibernate
This tutorial gives you overview of Hibernate and ease to understand them in future.
I will demostrate how to create table named “Person”, how to select all records, how to select specific record (by id), how to insert a new record, how to update existing record and how to delete record.
CONNECT JAVA APPLICATION TO MYSQL DATABASE AND PERFORM CRUD OPERATIONS,JAVA APPLICATION TO MYSQL DATABASE AND PERFORM CRUD OPERATIONS,APPLICATION TO MYSQL DATABASE AND PERFORM CRUD OPERATIONS,MYSQL DATABASE AND PERFORM CRUD OPERATIONS,DATABASE AND PERFORM CRUD OPERATIONS,PERFORM CRUD OPERATIONS,CRUD OPERATIONS,How to use CRUD with Mysql in Java,use CRUD with Mysql in Java,CRUD with Mysql in Java,Mysql in Java,

First of all you need to create java bean class named “Person.java”:
public class Person {
 
    private int id;
    private String firstName;
    private String lastName;
 
    public Person() {
 
    }
 
    public Person(String firstName,String lastName) {
        this.firstName = firstName;
        this.lastName = lastName;
    }
 
    public int getId() {
        return id;
    }
 
    public void setId(int id) {
        this.id = id;
    }
 
    public String getFirstName() {
        return firstName;
    }
 
    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }
 
    public String getLastName() {
        return lastName;
    }
 
    public void setLastName(String lastName) {
        this.lastName = lastName;
    }
}
Next thing you are going to do is to create a small utility class named “ConnectionConfiguration” with a single method which will return a connection to database named “test”:

public class ConnectionConfiguration {
    public static final String URL = "jdbc:mysql://localhost:3306/test";
    /**
     * In my case username is "root" *
     */
    public static final String USERNAME = "root";
    /**
     * In my case password is "1234" *
     */
    public static final String PASSWORD = "geekonjava";
 
    public static Connection getConnection() {
        Connection connection = null;
 
        try {
            Class.forName("com.mysql.jdbc.Driver");
            connection = DriverManager.getConnection(URL, USERNAME, PASSWORD);
        } catch (Exception e) {
            e.printStackTrace();
        }
 
        return connection;
    }
 
}

And finally, last class you will create is a class named “PersonDaoImpl” where all magic happens.

public class PersonDaoImpl {
 
    /**Creates table named Person with three columns (id, first_name, last_name)**/
   
    public void createPersonTable() {
        Connection connection = null;
        Statement statement = null;
 
        try {
            connection = ConnectionConfiguration.getConnection();
            statement = connection.createStatement();
            statement.execute("CREATE TABLE IF NOT EXISTS person (id int primary key unique auto_increment," +
                    "first_name varchar(55), last_name varchar(55))");
 
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (statement != null) {
                try {
                    statement.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
 
            if (connection != null) {
                try {
                    connection.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
        }
    }
 
    /**Inserts new record in Person table as you pass new Person instance**/
   
    public void insert(Person person) {
        Connection connection = null;
        PreparedStatement preparedStatement = null;
 
        try {
            connection = ConnectionConfiguration.getConnection();
            preparedStatement = connection.prepareStatement("INSERT INTO person (first_name,last_name)" +
                    "VALUES (?, ?)");
            preparedStatement.setString(1, person.getFirstName());
            preparedStatement.setString(2, person.getLastName());
            preparedStatement.executeUpdate();
            System.out.println("INSERT INTO person (first_name,last_name)" +
                    "VALUES (?, ?)");
 
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (preparedStatement != null) {
                try {
                    preparedStatement.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
 
            if (connection != null) {
                try {
                    connection.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
        }
    }
 
    /**Returns specific record (single person object) from table depending on "id" you provide**/
   
    public Person selectById(int id) {
        Person person = new Person();
        Connection connection = null;
        PreparedStatement preparedStatement = null;
        ResultSet resultSet = null;
 
        try {
            connection = ConnectionConfiguration.getConnection();
            preparedStatement = connection.prepareStatement("SELECT * FROM person WHERE id = ?");
            preparedStatement.setInt(1, id);
            resultSet = preparedStatement.executeQuery();
 
            while (resultSet.next()) {
                person.setId(resultSet.getInt("id"));
                person.setFirstName(resultSet.getString("first_name"));
                person.setLastName(resultSet.getString("last_name"));
            }
 
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (resultSet != null) {
                try {
                    resultSet.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
            if (preparedStatement != null) {
                try {
                    preparedStatement.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
            if (connection != null) {
                try {
                    connection.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
        }
 
        return person;
    }
 
    /**Returns all records from table as a List of person objects**/
   
    public List<Person> selectAll() {
        List<Person> persons = new ArrayList<Person>();
        Connection connection = null;
        Statement statement = null;
        ResultSet resultSet = null;
 
        try {
            connection = ConnectionConfiguration.getConnection();
            statement = connection.createStatement();
            resultSet = statement.executeQuery("SELECT * FROM person");
 
            while (resultSet.next()) {
                Person person = new Person();
                person.setId(resultSet.getInt("id"));
                person.setFirstName(resultSet.getString("first_name"));
                person.setLastName(resultSet.getString("last_name"));
 
                persons.add(person);
            }
 
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (resultSet != null) {
                try {
                    resultSet.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
            if (statement != null) {
                try {
                    statement.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
            if (connection != null) {
                try {
                    connection.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
        }
 
        return persons;
    }
 
    /**Deletes single record depending on "id" you provide**/
   
    public void delete(int id) {
        Connection connection = null;
        PreparedStatement preparedStatement = null;
 
        try {
            connection = ConnectionConfiguration.getConnection();
            preparedStatement = connection.prepareStatement("DELETE FROM person WHERE id = ?");
            preparedStatement.setInt(1, id);
            preparedStatement.executeUpdate();
 
            System.out.println("DELETE FROM person WHERE id = ?");
 
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (preparedStatement != null) {
                try {
                    preparedStatement.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
            if (connection != null) {
                try {
                    connection.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
        }
    }
 
    /**Updates a specific record depending on "id"
     * after you pass new Person object with new values**/
    
    public void update(Person person, int id) {
        Connection connection = null;
        PreparedStatement preparedStatement = null;
 
        try {
            connection = ConnectionConfiguration.getConnection();
            preparedStatement = connection.prepareStatement("UPDATE person SET " +
                    "first_name = ?, last_name = ? WHERE id = ?");
 
            preparedStatement.setString(1, person.getFirstName());
            preparedStatement.setString(2, person.getLastName());
            preparedStatement.setInt(3, id);
            preparedStatement.executeUpdate();
 
            System.out.println("UPDATE person SET " +
                    "first_name = ?, last_name = ? WHERE id = ?");
 
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (preparedStatement != null) {
                try {
                    preparedStatement.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
            if (connection != null) {
                try {
                    connection.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

Note that I intensively used PreparedStatement which protects us from SQL injection attacks.


Also, you can create a single class where you can test your data access model:

public class App {
 
    public static void main(String [] args) {
        PersonDaoImpl pdi = new PersonDaoImpl();
 
        /**Create table. Note that you can always run this
         * method. Table will be created only once (if it doesn't exist)**/
        pdi.createPersonTable();
 
        /**Insert a new record. Create a new Person instance and just
         * pass it as an argument in "insert" method**/
        Person person = new Person("John","Johnson");
        pdi.insert(person);
 
        /**Select by id**/
        Person personSelect = pdi.selectById(2);
        System.out.println(personSelect.getId()+", "+personSelect.getFirstName()+", "+personSelect.getLastName());
 
        /**Delete person by id**/
        pdi.delete(3);
 
        /**Update person**/
        Person personUpdate = new Person("Tom","Johnson");
        pdi.update(personUpdate,1);
 
        /**Select all persons**/
        List<Person> persons = pdi.selectAll();
        /**To retrieve values, you will have to use "for each" loop
         * to iterate through list**/
        for(Person p : persons) {
            System.out.println(p.getId()+", "+p.getFirstName()+", "+p.getLastName());
        }
 
    }
}

Hope it useful for you.

Hibernate CRUD example using HQL query language

Hello all beginners today i am telling you a CRUD example in hibernate by which you can be make a small example until you make a expert.
By this example you got some knowledge of HQL (Hibernate Query Language).
If you're novice in Hibernate then this example obviously help you to understand them.

In this demo first of all you need to make a java project and add the project capabilities of Hibernate.
Here i use a simple example on Student( Insert,Update,Read and Write ).
Hibernate CRUD example using HQL query language,CRUD example using HQL query language,example using HQL query language, HQL query language,hql example,hibernate tutorial,hibernate crud

In this example two package :
  • com.demo.gsfile
all the getter setter and methods exist in this package
Sudent.java is variable and getter setter file.
  • com.demo.dbfile
all the database functions are exist in this package.
StudentDB.java  is database function file
StudentWork.java  is main file which would be run.

Hibernate function using HQL
package com.demo.dbfile;

import java.util.List;

import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2ddl.SchemaExport;

import com.demo.gsfile.Student;

public class StudentDb 
{
 
 private static SessionFactory factory; 
    
    
    
    public static SessionFactory SessionData()
    {
     try{
           factory = new Configuration().configure().buildSessionFactory();
        }catch (Throwable ex) { 
           System.err.println("Failed to create sessionFactory object." + ex);
           throw new ExceptionInInitializerError(ex); 
        }
     return factory;
    }
 //-----------------------------------------------------------------------------//   

/* Method to INSERT student in the database */
    public static Integer addStudent(String stuname,String sturoll,String stuage,String stuschool)
    {
     factory=StudentDb.SessionData();
       Session session = factory.openSession();
       Transaction tx = null;
       Integer employeeID = null;
       try{
          tx = session.beginTransaction();
          Student stu = new Student(stuname,sturoll,stuage,stuschool);
          employeeID = (Integer) session.save(stu); 
          tx.commit();
       }catch (HibernateException e) {
          if (tx!=null) tx.rollback();
          e.printStackTrace(); 
       }finally {
          session.close(); 
          factory.close();
       }
       return employeeID;
    }
   
//-------------------------------------------------------------------------------//
//  Method to  READ all the students 
    public static List listStudents(String query1){
     factory=StudentDb.SessionData();
       Session session = factory.openSession();
       List list=null;
       Transaction tx = null;
       try{
          tx = session.beginTransaction();

          Query query=session.createQuery("from Student "+query1);//here persistent class name is Emp  
           list=query.list(); 
          tx.commit();
         
       }catch (HibernateException e) {
          if (tx!=null) tx.rollback();
          e.printStackTrace(); 
       }finally {
          session.close(); 
          factory.close();
       }
  return list;
    }
   
//------------------------------------------------------------------------------//

 // Method to UPDATE salary for an employee 
   public static int updateStudent(String query ){
     factory=StudentDb.SessionData();
       Session session = factory.openSession();
       int status=0;
       Transaction tx = null;
       try{
          tx = session.beginTransaction();
          Query q=session.createQuery("update Student "+query);  
          
            
           status=q.executeUpdate();  
          System.out.println(status);  
          tx.commit();
       }catch (HibernateException e) {
          if (tx!=null) tx.rollback();
          e.printStackTrace(); 
       }finally {
          session.close(); 
       }
       return status;
    }
     
//-------------------------------------------------------------------------------//
//Method to DELETE an employee from the records 
    public static void deleteStudent(String query){
     factory=StudentDb.SessionData();
       Session session = factory.openSession();
       int i=0; 
       Transaction tx = null;
       try{
          tx = session.beginTransaction();

          Query query1=session.createQuery("delete from Student "+query);  
        
        i=query1.executeUpdate();  
          tx.commit();
       }catch (HibernateException e) {
          if (tx!=null) tx.rollback();
          e.printStackTrace(); 
       }finally {
          session.close(); 
       }
    }
 
  
}

Download all program here.





EContact Android Project

Today i am giving you a project on Android which named is Econtact.
What is EContact ?
It  is designed to help users in emergency situation. Using E contact mobile app user can contact hospital, fire station, police, bock bank, emergency contact and ambulance. 
Project Introduction:

The bottom line is that the main idea behind this project was to create an android application that could be of great use in times of emergency. Our goal is to help set an official guideline to assist Emergency Response Teams in their efforts to save time and lives in the event of an emergency and help people in times of emergency.

EContact Android Project,Android Project,Emergency Response Teams,EContact ,LIFE SAVER android apps,econtact apps,google map project,contact project,college project


There would also be functionalities that would allow quick access to all relevant information that would be required at the times of an emergency. Thus, with only one click on your screen, we can send SMS alerts to all your saved contacts,call rescue workers.Thus, this application could be a LIFE SAVER in times of a calamity.

Download                       Documentation

E Contact APP Design:

Here are few high-level details of application:


EContact Android Project,Android Project,Emergency Response Teams,EContact ,LIFE SAVER android apps,econtact apps,google map project,contact project,college project


  1. Whenever you install the application for the first time, it is mandatory to enter your details and register yourself by providing your name,contact number, blood group, emergency contact name and emergency contact number.
  2. An option to update your and your emergency contact details is provided in the application under the “Settings” option. Incase you want to give your phone to someone, they can update their corresponding details instead of uninstalling and installing the app again.
  3. Feature to contact the emergency contact number is provided under “Help” option.
  4. Feature to contact rescue hotlines is provided under “SOS” session.
  5. Option to send a request for blood group by sending an SMS to all the contacts, which includes the current location of the user, blood group required is possible with the “Blood Bank” feature.
  6. Nearest hospitals, Ambulance Service, Fire Station, Police Stations available can be searched using the corresponding options provided in our application. 

How to Expanding your dictionary of acoustic model in Sphinx project

Hello Everyone,

Today I’m going to tell you how to expand dictionary of acoustic model for Sphinx4. In simple words, This tutorial will tell you how you can add more words in Sphinx’s words database (Dictionary) and let it recognize those words, which are not available in default acoustic models provided by CMU Sphinx. This tutorial is based on “HelloWorld” example provided by CMU Sphinx.



Important Files in this example :

  1. HelloWorld.java
  2. hello.gram
  3. helloworld.config.xml

Acoustic Model used in this example : 
WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar

Now, I will tell you, How to add name of cities and states in dictionary.

PART ONE

  1. Create a txt file “words.txt”, Write all the names of cities and states in it and save.
  2. Open this link : http://www.speech.cs.cmu.edu/tools/lmtool.html
  3. On that page, go to “Sentence corpus file:” section, Browse to “words.txt” file and click “Compile Knowledge Base”.
  4. On next page, Click on “Dictionary” link and save that .DIC file.

PART TWO

  1. Extract WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar file.
  2. Go to edu\cmu\sphinx\model\acoustic\WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz\dict folder.
  3. Open “cmudict.0.6d” file in that folder.
  4. Copy data from .DIC file, you have downloaded in PART ONE, paste it in “cmudict.0.6d” file and save.
  5. Zip the extracted hierarchy back as it was and Zip file named should be same as JAR file.

Note:
Now, remove “WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar” file from Project’s CLASSPATH and add “WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.zip” instead of it.

That’s it ! We are done.  Now Sphinx will also recognize all name of cities and states that we wrote in “words.txt” file.

If you have any quires, Please feel free to ask.

How to Split only after comma 3 times appear in Java

Question asked by my friend :
I have a string that looks like this:
0,0,1,2,4,5,3,4,6
What I want returned is a string[] that was split after every 3rd comma, so it would look like this:
[ "0,0,1", "2,4,5", "3,4,6" ]
I have found similiar functions but they all don't split with the nth amount of commas.
You can try to use split method with (?<=\\G\\d+,\\d+,\\d+), regex
String data = "0,0,1,2,4,5,3,4,6";
String[] array = data.split("(?<=\\G\\d+,\\d+,\\d+),"); //Magic :) 
// to reveal magic see explanation below answer
for(String s : array){
    System.out.println(s);
}
How to Split only after comma 3 times appear in Java,Split only after comma 3 times appear in Java,only after comma 3 times appear in Java,comma 3 times appear in Java,3 times appear in Java,times appear in Java,appear in Java,

Output:

0,0,1
2,4,5
3,4,6
Explanation

  • \\d means one digit, same as [0-9], like 0 or 3
  • \\d+ means one or more digits like 1 or 23
  • \\d+, means one or more digits with comma after it, like 1, or 234,
  • \\d+,\\d+,\\d+ will accept three numbers with commas between them like 12,3,456
  • \\G means last match, or if there is none (in case of first usage) start of the string
  • (?<=...), is positive look-behind which will match comma , that has also some string described in (?<=...) before it
  • (?<=\\G\\d+,\\d+,\\d+), so will try to find comma that has three numbers before it, and these numbers have aether start of the string before it (like ^0,0,1 in your example) or previously matched comma, like 2,4,5 and 3,4,6.

Also in case you want to use other characters then digits you can also use other set of characters like

  • \\w which will match alphabetic characters, digits and _
  • \\S everything that is not white space
  • [^,] everything that is not comma
  • ... and so on. More info in Pattern documentation

By the way, this form will work with split on every 3rd, 5th, 7th, (and other odd numbers) comma, like split("(?<=\\G\\w+,\\w+,\\w+,\\w+,\\w+),") will split on every 5th comma.

To split on every 2nd, 4th, 6th, 8th (and rest of even numbers) comma you will need to replace + with {1,maxLengthOfNumber} like split("(?<=\\G\\w{1,3},\\w{1,3},\\w{1,3},\\w{1,3}),") to split on every 4th comma when numbers can have max 3 digits (0, 00, 12, 000, 123, 412, 999).

Hope if you face same problem and then you got answer.

How to Upload file with Text Easily in Java Using GOJFileUpload

Hello friends in my previous post i am telling you how to upload your file in java using GOJFileUpload.jar.
But when we need a form where file upload button and some textfields are also exist then you need to do nothing more.
How to Upload file with Text Easily in Java Using GOJFileUpload,Upload file with Text Easily in Java Using GOJFileUpload,file with Text Easily in Java Using GOJFileUpload,Text Easily in Java Using GOJFileUpload,Easily in Java Using GOJFileUpload,Java Using GOJFileUpload,GOJFileUpload,

What would you do ?
see below friends...
uploadfilewithtext.jsp
 <form action="FetchDataAndFile.jsp" enctype="multipart/form-data" name="form1" id="form1" method="post">
  
  First Text:<input type="text" name="firsttext"><br>
  Second Text:<input type="text" name="secondtext"><br>
   First Image:<input type="file" name="img1"><br>
   Second Image:<input type="file" name="img2"><br>
  Third Text:<input type="text" name="thirdtext"><br>
   <input type="submit" name="submit" value="Submit Product">
   </form>
FetchDataAndFile.jsp
<%@page import="com.geekonjava.fileupload.FileUploading"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.HashMap"%>
<%
String imagepath=config.getServletContext().getRealPath("/")+"files\\";


ArrayList<String> imagename = new ArrayList<String>();
      imagename.add("img1");
      imagename.add("img2");
      
ArrayList<String> dataname = new ArrayList<String>();
      dataname.add("firsttext");
     dataname.add("secondtext");
      dataname.add("thirdtext");
 
HashMap map = FileUploading.UploadFile(imagepath,dataname,imagename,request);
out.println(map.get("error")+"<br>");
out.println(map.get("img1")+"<br>");
out.println(map.get("firsttext")+"<br>");
out.println(map.get("img2")+"<br>");
out.println(map.get("secondtext")+"<br>");
out.println(map.get("thirdtext")+"<br>");

%>
After that we need to upload package named : com.geekonjava.fileupload.FileUploading

GOJLibrary give you UploadFile method which has four parameter :

imagepath- this is a field for set the uploading path.
dataname-this is a field for all text data name by using ArrayList.
imagename-this is a field for all images name by using ArrayList.
request-its not for programmer and not be changed.
They'll return you the all file name which you uploaded after uploading at your given destination folder.

How to Upload file in Java Using GOJFileUpload library

Hello friends i face the problem on uploading files and many of types for them in java. If you want to upload single file or file with text data at that time you really face problem in your web project.
Obviously you use servlet for  them but today i am telling you a proper solution for them and the solution is
GOJFileUpload-1.0.1.jar
This jar file gives you a easy way to upload your files easily and how can you achieve them.
You need five libraries for it
  1. commons-fileupload-1.2.1.jar
  2. commons-io-1.4.jar
  3. GOJFileUpload-1.0.1.jar
  4. javax.servlet.jar
  5. org-apache-commons-codec.jar

How to Upload file in Java Using GOJFileUpload library,Upload file in Java Using GOJFileUpload library,file in Java Using GOJFileUpload library,Java Using GOJFileUpload library,Using GOJFileUpload library,GOJFileUpload library,Easy way to upload file in java,way to upload file in java,upload file in java,file in java,

index.jsp
<form action="FetchData.jsp" enctype="multipart/form-data" name="form1" id="form1" method="post">
  
 
   First Image:<input type="file" name="img1"><br>
   Second Image:<input type="file" name="img2"><br>
  
   <input type="submit" name="submit" value="Submit Product">
   </form>
Above coding is a frond end where have file upload button and action goes to FetchData.jsp where our upload coding exist.


FetchData.jsp
<%@page import="com.geekonjava.fileupload.FileUploading"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.HashMap"%>
<%
String imagepath=config.getServletContext().getRealPath("/")+"files\\";


ArrayList<String> imagename = new ArrayList<String>();
      imagename.add("img1");// name from index page of first image
      imagename.add("img2");// name from index page of second image

HashMap map = FileUploading.UploadFile(imagepath,imagename,request);
out.println(map.get("error")+"<br>");
out.println(map.get("img1")+"<br>");
out.println(map.get("img2")+"<br>");

%>

After that we need to upload package named : com.geekonjava.fileupload.FileUploading
GOJLibrary give you UploadFile method which has three parameter :

  • imagepath- this is a field for set the uploading path.
  • imagename-this is a field for all images name by using ArrayList.
  • request-its not for programmer and not be changed.
They'll return you the all file name which you uploaded after uploading at your given destination folder.

If you want to upload file with textfield data then check this

Speed up a Slow Android AVD or Emulator

One thing you must have noticed that emulators are dead slow by default. I mean they are so much slow that you can take your lunch in the mean time and they will be loading all the time.

Can we improve this slow emulators? Ye, we can. Let’s see how.

Step 1) Download HAXM Driver using SDK Manager
To improve the performance of an emulator first thing you will need is installing the “Intel Hardware Accelerated Execution Manager Driver” from SDK Manager you get with Android ADT. Look at the screen shot below.

Step 2) Execute IntelHaxm.exe to install the HAXM driver
This will create the IntelHaxm.exe inside “extra” folder in your android ADT package. Execute this file to install the HAXM Driver which is responsible for virtualization in your system.

Step 3) Update BIOS if driver installation failed
There are chances that above installation process failed and you are advised to update the BIOS configuration related to “Intel Virtualization Technology“. Go ahead and do it. For related information to this step, read the manual received with motherboard when you purchased it.

Generally, when you go to BIOS options by pressing “DEL” key during boot process, you can easily find the menu option “Intel Virtualization Technology” in third tab. Enable this option and restart the machine.
Step 4) Use Host GPU Option
Once Virtualization Technology is enabled, you can use this feature while creating the Emulator by checking the checkbox “Use Host GPU“. This will enable the system’s native support for virtualization for emulator.

Step 5) Test the configuration changes
Now start the emulator and see the major performance gain you obtained using above steps.