Android First Program eclipse- getting started

Android apps are written in Java, and use XML extensively. I shall assume that you have basic knowledge of Java programming and XML.
Step 0: Read - Read "Hello, world" tutorial at http://developer.android.com/resources/tutorials/hello-world.html.
Step 1: Create a Android Virtual Device (AVD) - AVDs are emulators that allow you to test your application without the physical device. You can create AVDs for different android platforms (e.g., Android 2.3 for phone, Android 3.2 for tablet) and configurations (e.g., screen sizes and orientations, having SD card and its capacity).

java zip- create text file from list of string and zip them

java - create text files from list of string and zip them ( without creating temporary file)

 private static void list_of_string_into_text_file_and_zip_them_all(List dataList) throws Exception {

  File zipFile = new File("OutputZipFile.zip");
  ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFile));
  int count = 0;

  for (String string : dataList) {

   // repeat for each string
   String fileNameInsideZip = ++count + "-inside_text_file.txt";
   ZipEntry e = new ZipEntry(fileNameInsideZip);
   out.putNextEntry(e);

   // write data into zip entry
   byte[] data = string.getBytes();
   out.write(data, 0, data.length);
   out.closeEntry();
  }
  out.flush();
  out.close();

 }

Testing the code :

 public static void main(String[] args) throws Exception {
  // store string into text file - and zip them . doesnot create a
  // temporary text file.
  List test = new ArrayList();
  test.add("This is amazing");
  test.add("What a wonderful world");
  test.add("This is a beautiful day ");
  list_of_string_into_text_file_and_zip_them_all(test);
 }

For creating a single text file from string and zip it - see  this post.

Final Report : Text Prompted Remote Speaker Authentication : Joint Speech and Speaker Recognition/Verification System

Here is complete report of our project :Text Prompted Remote Speaker Authentication : Joint Speech and Speaker Recognition/Verification System


Next time ... Runnable Project or may be snapshots..... just wait

Presentation Slide for this report and project work is here.

Some Intelligent Humorous Quotes about Computer/Science

Here is some my favorite quotes that i collected from different pages


  • "In order to understand recursion, one must first understand recursion."
  • Any fool can write code that a computer can understand. Good programmers write code that humans can understand.-Martin Fowler
  • Theory is when one knows everything, but nothing works. Practice is when everything works, but nobody knows why.
  • Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why. Programmers combine theory and practice: Nothing works and they don't know why.
  • If Java had true garbage collection, most programs would delete themselves upon execution.
  • Beware of bugs in the above code; I have only proved it correct, not tried it. Donald Knuth
  • "There are 10 types of people in the world, those who can read binary, and those who can't."
  • We better hurry up and start coding, there are going to be a lot of bugs to fix.
  • UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity- Dennis Ritchie
  • If I had more time, I would have written a shorter letter-Cicero
  • "When all you have is a hammer, everything starts to look like a nail." 

java zip - create text file of String and zip it

Create a text file with some string (without temporary file) and zip it : working source code java

 private static void zip_single() throws Exception {
  final StringBuilder sb = new StringBuilder();
  sb.append("Test String that goes into text file inside zip");

  final File f = new File("single_text_file_inside.zip");
  final ZipOutputStream out = new ZipOutputStream(new FileOutputStream(f));
  ZipEntry e = new ZipEntry("inside_text_file.txt");
  out.putNextEntry(e);

  byte[] data = sb.toString().getBytes();
  out.write(data, 0, data.length);
  out.closeEntry();

  out.close();
 }

Call as :
 public static void main(String[] args) throws Exception {
  zip_single();
 }

For creating text files from List of string and zip them - see my earlier post 

Final Presentation Slide :Text Prompted Remote Speaker Authentication : Joint Speech and Speaker Recognition/Verification System

Here is the download link for our final years project's presentation slide. The title of project is Text Prompted Remote Speaker Authentication which is a Joint Speech and Speaker Recognition/Verification System and uses Gaussian Mixture Model and Hidden Markov Model/Vector Quantization for classification and MFCC as feature Vector.

Refer to http://ganeshtiwaridotcomdotnp.blogspot.com/2010/12/text-prompted-remote-speaker.html for detail of our project.

This project was done at Tribhuvan University, Institute of Engineering-Department of Electronics and Computer Engineering, Kathmandu, Nepal during November 2010 to January 2011.
The project members were:
Ganesh Tiwari
Madhav Pandey
Manoj Shrestha

Speaker Verification for Remote Authentication

Java open url in default system browser

open a url in system default browser - work for all  : windows, mac, linux operating systems

Full working JAVA source code example
import java.io.IOException;
public class StartBrowserUtil {
    private StartBrowserUtil() {
    }
    public static void openURL(String s) {
        String s1 = System.getProperty("os.name").toLowerCase();
        Runtime runtime = Runtime.getRuntime();
        try {

Java Image Processing : Negative of Input Image - source code

The code below is for getting negative of an input image in JAVA:


public class TestImagesss {
    public static void main(String[] args) {
        BufferedImage org = getImage("test.jpg");
        BufferedImage negative = getNegativeImage(org);
        new ImageFrame(org, "Original");
        new ImageFrame(negative, "After Negative");

java hex -int-string-byte conversion source code

Hexadecimal conversion - string, byte, integer - working java source code example :

public final class HexConvertUtils {

    private HexConvertUtils() {
    }

    public static byte[] toBytesFromHex(String hex) {

Java delete a folder and subfolders recursively

Java source code for deleting a folder and subfolders recursively.
Code for copying and moving files is here.
Working source code example:
public final class FileIOUtility {
    private FileIOUtility() {}
    public static boolean deleteFile(File fileToDelete) {
        if (fileToDelete == null || !fileToDelete.exists()) {
            return true;
        } else {