22 December 2014

Free postcard in India. Receive by poostcardin Facebook App

POSTCARD-IN Project! Free Postcard

This Project Will let you send Postcard to Your Loved ones for their Birthdays, Anniversary etc.
Postcard Project:
We will send free Greeting Postcard to your Address just Register with Service. This Project is carried out to go OFF the web and greet them through pen.
You Don't Have Much to Do. The Cost of Service is beared by us. You can also Donate to this project. Donate to porject
Login to the Project. you will Receive Postcard to your doorstep on the Month or Before the week of Your Special Day.




  • 1.Signup To Project
  •  
  • 2.Login to Project
  •  
  • 3.Add your Details
  •  
  • 4.Save it. Done.
  • 5.Postcard Sent on week Before Sheduled Date

18 December 2014

Fast Track Your Startup Google Lunch

Fast Track Your Startup

Startup Launch provides startups in all stages with the platform, resources, online content, mentorship and training they need to succeed. From first idea to successful implementation and growth, our mission is to help startups worldwide become successful on the Google Developers platform and open-source technologies.

1) Start 2)Build 3)Go

https://developers.google.com/startups/

17 December 2014

java test a condition stored into string variable


package com.nhc.personal;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
public class TestCondition {
   public static void main(String[] bag) throws Exception {
                  ScriptEngineManager factory = new ScriptEngineManager();
                  ScriptEngine engine = factory.getEngineByName(“JavaScript”);
                  String condition = “10==10 && 20==20?;
                  System.out.println(engine.eval(condition));
     }

java write logs to file


package com.nhc.personal;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
/*
 * Author : Niraj chauhan
 * */
class Base{
 
 private String path = null;
 
 Base(String path){
  this.path = path;
 }
 
 public boolean setStandardLogOutput() {
  
  if(path == null) {
   System.out.println("Sorry !! Path is null");
   return false;
  }
  
  File stdLogDirPath = new File(path);
  
  if(stdLogDirPath.exists()==false) {   
   System.out.println("Directory path "+path+ " does not exist. Creating the directory path.");
   if(stdLogDirPath.mkdirs() == false) {
    System.out.println("Could not create directory path : "+path); 
    return false;
   }else {
    System.out.println("Directory path created successfully : "+path);
   }   
  }
  
  if(stdLogDirPath.isDirectory()==false) {
   System.out.println(path +" is not a directory");
   return false;
  }
  
  File logFile = new File(path, "EngineLogs.log");
  if(logFile.exists()==false) {
   System.out.println("Log file "+logFile.getName()+ " does not exist");
   boolean isFileCreated = false;
   try {
    isFileCreated = logFile.createNewFile();
    if(isFileCreated == true) {
     System.out.println("Log file "+logFile.getName()+ " created at path : "+path);
     FileOutputStream fs = new FileOutputStream(logFile,true);
     PrintStream ps = new PrintStream(fs);
     System.setOut(ps);
     System.setErr(ps);
    }else {
     System.out.println("Error while creating file  ");
    }
   } catch (IOException e) {
    System.out.println("Exception while creating the logfile. Reason: "+e.getMessage());
    e.printStackTrace();
    return false;
   }
  }
  return true;
 }
}

public class Engine extends Base {
 
 Engine(String path){
  super(path);
 }
 
 public static void main(String[] args) {
  String ENGINE_HOME = System.getenv("ENGINE_HOME");
  System.out.println(ENGINE_HOME);
  Engine engine = new Engine(ENGINE_HOME);
  boolean flag = engine.setStandardLogOutput();
  if(flag == false) {
   System.out.println("Error while setting the Eninge stardard logs output in a EngineLogs.log file");
  }
  System.out.println("--Begin--");
  System.out.println("--Finish--");
 }
 
}

java BlockingQueue


package com.nhc.personal;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
class Consumer implements Runnable{

    protected BlockingQueue queue = null;

    public Consumer(BlockingQueue queue) {
        this.queue = queue;
    }

    public void run() {
        try {
            System.out.println("Taken:"+queue.take());
            System.out.println("Taken:"+queue.take());
            System.out.println("Taken:"+queue.take());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}

class Producer implements Runnable{

    protected BlockingQueue queue = null;

    public Producer(BlockingQueue queue) {
        this.queue = queue;
    }

    public void run() {
        try {
            queue.put("1");
            System.out.println("Put:1");
            Thread.sleep(1000);
           
            System.out.println("Put:220");
            queue.put("220");
            Thread.sleep(1000);
           
            System.out.println("Put:38");
            queue.put("38");
            Thread.sleep(1000);           
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}

class BlockingQueueFlight {

    public static void main(String[] args) throws Exception {

        BlockingQueue queue = new ArrayBlockingQueue(1024);

        Producer producer = new Producer(queue);
        Consumer consumer = new Consumer(queue);

        new Thread(producer).start();
        new Thread(consumer).start();

        Thread.sleep(4000);
    }
}

Heap Memory

1) Heap is a run time data area from which memory for all class Instances and arrays is allocated

2) Heap is created at Virtual Machine Startup

3) Heap storage is reclaimed by the Garbage Collector

4) Heap may be of fixed size or may be expanded as required

5) Heap memory does not need to be Contiguous

6) If a program need More heap memory than the automatic memory management system provides then Java Virtual Machine throws OutOfMemoryError

java code of batch operation


package com.nhc.personal;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.Statement;
 /**  
  *  
  * @author Niraj Chauhan  
  */
public class CommitWriteBatchTestFlight {
 
 public static void main(String[] dataTrays){
  System.out.println("--BEGIN--");
  String commitCommand = "COMMIT WORK WRITE BATCH";
  
  final String TBL_NAME = "PLAYERS";
  final String COL_ID = "ID";
  final String COL_NAME = "NAME";
  final String COL_TEAM = "TEAM";
  final String COL_TOTAL_RUNS = "TOTAL_RUNS";
  
  String createTableQuery =  "CREATE TABLE PLAYERS ( " +
          "ID INT, " +
          "NAME VARCHAR(255), " +
          "TEAM VARCHAR(255), " +
          "TOTAL_RUNS VARCHAR(255)" +
         ")";
  
  try {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection connection = DriverManager.getConnection("jdbc:oracle:thin:@192.168.8.87:1521:aaadb","netvertextrunk","netvertextrunk");
    
    Statement stmt = connection.createStatement();
    stmt.execute(createTableQuery);
    System.out.println("Table create Successfully");
    stmt.close();
    
    PreparedStatement commitPrepStmt = connection.prepareStatement(commitCommand);
    PreparedStatement prepStmt = connection.prepareStatement("INSERT INTO PLAYERS (ID, NAME, TEAM, TOTAL_RUNS) VALUES (?, ?, ?, ?)");
    
    long startTime = System.currentTimeMillis();
    
    for(int i=1; i<=11; i++){
     prepStmt.setInt(1, i);
     prepStmt.setString(2, "Player"+i);
     prepStmt.setString(3, "Team"+i);
     prepStmt.setString(4, "100"+i);
     prepStmt.executeUpdate();
    }
    prepStmt.close();
    
    //connection.commit();
    //System.out.println("Execution Time: "+(System.currentTimeMillis()-startTime)+" ms");
        
    commitPrepStmt.executeUpdate();
    System.out.println("Execution Time: "+(System.currentTimeMillis()-startTime)+" ms");
    
    connection.close();
    
  } catch (Exception e) {
   System.out.println("Error while executing preparedstatement, Reason: "+e.getMessage());
  }
  
  System.out.println("--END--");
 }
}

Project Jigsaw, Changes for use java development kit (JDK)

In Moving toward a modular java, It have impacts on both developers and users. The changes made for modular run-time images to java and now in JDK 9.Moving toward a modular Java, Oracle is ushering in changes that have "significant impact" on both developers and users, including breaking IDEs, a high-ranking Oracle Java official said.

Project Jigsaw modularity improvements had been intended for inclusion in Java 8, which was released in March. But Jigsaw has been deferred until the release of Java 9. With modularization, applications can use just the modules they need, offering performance improvements as well secure boundaries between components. The effort also is intended to make Java more scalable to smaller devices

Other changes in modularization include JRE (Java SE Runtime Environment) and JDK images having identical structures. Previously, a JDK image embedded the JRE in a jre subdirectory; now a JDK image is simply a runtime image that set of development tools and other items found in the JDK.User-editable configuration files that were located in the lib directory now are in the new conf directory. Also, internal file rt.jar, tools.jar and dt.jar have been removed, with the content stored in a more efficient format in implementation-private files in the lib directory.


A new built-in NIO file system provider can be used to access class and resource files stored in a run-time image. Tools previously reading rt.jar and other files directly need to be updated to this file system. 

9 December 2014

Google is building new Android compilers Jack and Jill

new compilers jack and jill could be due to the ongoing dispute with Oracle over the use of Java.

new compilers jack and Jill could be due to the ongoing dispute with Oracle over the use of Java.
What changes for developers yet defined, but part of an ongoing process to cut-down on compile times and optimize Android development process.


The internal process would be Jill adds a new pre-processing and caching step which "shields" Jack from standard .class Java bytecode, where needed, and convert it into .jayce intermediate bytecode instead. Jack then takes the Java source code, and the .jayce bytecode, and converts it into Dalvik bytecode. Removing Java bytecode means would have less of an argument. 

Ubuntu 15.04 Release Dates

Mark Shuttleworth posted a blog in which he announced the codename for the next version of Ubuntu, which will follow ubuntu 14.10 (Utopic).

Original Blog Post

"In my favourite places, the smartest thing around is a particular kind of monkey. Vexatious at times, volant and vogie at others, a vervet gets in anywhere and delights in teasing cats and dogs alike. As the upstart monkey in this business. I can think of no better mascot. And so let’s launch our vicenary cycle, our verist varlet, the Vivid Vervet!"

23-apr-2015 is the tentative release date being given for Ubuntu 15.04 ‘Vivid Vervet’. Ubuntu’s 14.04 LTS went live on 17-apr-2014. The starting alpha release will shortly available from 18th December.

How to install PHP in Ubuntu 14.10?

Step 1 : Install Apache

sudo apt-get update
sudo apt-get install apache2

Step 2: install MYSQL

sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql

Step 3: install php


sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt

Step 4: Restart Apache

sudo service apache2 restart

you can find your web-server files in /var/www/html Directory

to check installation add index.php file with code

phpinfo();
?>

Check with Firefox http://localhost or http://127.0.01.