September 2015

Scenario 3

If you want to develop the code for below json format.

    "Products": [
            "ProductNo": "11111",
            "Descr": "Myproduct-1",
            "Price": "225.36"
            "ProductNo": "11112",
            "Descr": "Myproduct-2",
            "Price": "235.46"
            "ProductNo": "11113",
            "Descr": "Myproduct-3",
            "Price": "245.56"
            "ProductNo": "11114",
            "Descr": "Myproduct-4",
            "Price": "255.56"
    "DateUpdated" : "20091209",
    "UpdatUser" : "Bob" 

$array = array (
	'Products' => array (),
	'DateUpdated' => '20091209',
	'UpdateUser' => 'Bob',

while ($row = mysql_fetch_assoc($result))
	$array['Products'][] = $row;

$json = json_encode($array);


Installation of Hadoop in VMplayer in windows 8.1

Refer this for more info

Install ubuntu in vmware player

install JDK/JRE using command line

JDK is installed in /usr/lib/jvm
for check wheather JDK is installed or not write java -version

Download hadoop from this link

Create hadoop folder in home directory and extract hadoop.tar in this folder

write sudo gedit /etc/profile
add this line in last of this file

export JAVA_HOME
export JRE_HOME
export PATH

sudo update-alternatives –install “/usr/local/java” “java” “/usr/local/java/default-java/bin/java” 1

bin/hadoop jar hadoop-examples-*.jar grep input output ‘dfs[a-z.]+’

For remove JDK
sudo apt-get install ssh

open conf/core-site.xml



change JAVA_HOME /usr/local/java/jdk1.8.0_60
make sure # must be removed

install ssh and rsync

setup password key and run two command from first link of thisa artical

goto hadoop folder and write
bin/hadoop namenode format

for start all node and process regarding hadoop

jps is used for show the running process
jps is a command

bin/hadoop fs -put conf input

for install cludera installtion

for kill the process on port
sudo kill `sudo lsof -t -i:9000`

netstat -nlp
for show the process

Find first( ) from CFG using JAVA

Under Testing….

UBUNTU update software command

Update software using command line

sudo apt-get update
sudo apt-get dist-upgrade

How to install ns in ubuntu
sudo apt-get install ns2

Easy way to learn Hadoop on windows


Hortonworks is a business computer software company based in Santa Clara, California. The company focuses on the development and support of Apache Hadoop, a framework that allows for the distributed processing of large data sets across clusters of computers.


Cloudera Inc. is an American-based software company that provides Apache Hadoop-based software, support and services, and training to business customers.

Cloudera’s open-source Apache Hadoop distribution, CDH (Cloudera Distribution Including Apache Hadoop), targets enterprise-class deployments of that technology. Cloudera says that more than 50% of its engineering output is donated upstream to the various Apache-licensed open source projects (Apache Hive, Apache Avro, Apache HBase, and so on) that combine to form the Hadoop platform. Cloudera is also a sponsor of the Apache Software Foundation.

How to remove Unit production from CFG using JAVA

package cd;

import java.util.ArrayList;
import java.util.Arrays;
* @author Soham Navadiya
public class Unit_Production {
static int caseCheck(String c){
return 1;
else if(c.matches(“[a-z]”)){
return 2;
return 0;
public static void main(String []args) throws FileNotFoundException, IOException{

int check;
ArrayList<String> terminal=new ArrayList<String>();
ArrayList<String> nonterminal=new ArrayList<String>();

DataInputStream dis = new DataInputStream (new FileInputStream (“file/production.txt”));
byte[] datainBytes = new byte[dis.available()];
String content = new String(datainBytes, 0, datainBytes.length);
String input = content;

String lines[] = input.split(“\\r?\\n”);

Character [][]production=new Character[10][10];
int k=0;
ArrayList<Integer> len=new ArrayList<Integer>();
for(String i:lines){
//System.out.println(“Production:”+i+”—Length: “+i.length());
for(int j=0;j<i.length();j++){
char[] chara=i.toCharArray();
//  System.out.println();

System.out.println(“Non terminal: “+i);
else if(check==2){
System.out.println(“Terminal: “+i);

for(int i=0;i<len.size();i++){
//System.out.print(“Length is: “+l+”\n”);
for(int j=0;j<len.get(i);j++){
// System.out.print(production[i][j]+”|”);
//System.out.println(“Non terminal is:” +production[i][j]);
String firstSubString = null;
String secondSubString;
for(int i=0;i<len.size();i++){

String ln2=lines[i].substring(0, lines[i].indexOf(“@”));
String ln=lines[i].substring(lines[i].lastIndexOf(“@”) + 1);

//System.out.println(“Left Part part is “+ln2);
//System.out.println(“Right part is”+ln);

int h=check(ln,nonterminal);

System.out.println(ln2+” @ “+ln);


System.out.print(“Replace with “+ln2+” @ “);
//System.out.println(“Unit Production is “+ln);
//System.out.println(“Left Part part is “+ln2);

for(int p=0;p<len.size();p++){

String[] split = lines[p].split(“@”);

firstSubString = split[0];
secondSubString = split[1];

//char c=production[p][0];


//System.out.println(“You have to Replace with “+secondSubString);

//System.out.println(“Left part is “+firstSubString);
//System.out.println(“Right part is “+secondSubString);


System.out.println(ln2+” @ “+ln);

//  System.out.println();
// System.out.println(“After @ Length of String “+ln.length());
// System.out.println();
// System.out.println(“———–“);
String example = “A@bCd”;
System.out.println(example.substring(example.lastIndexOf(“@”) + 1));
static int check(String c,ArrayList<String> arr){


return 1;
return 2;

return 0;

public static boolean testAllUpperCase(String str){
for(int i=0; i<str.length(); i++){
char c = str.charAt(i);
if(c >= 97 && c <= 122) {
return false;
return true;

How to install Genymotion in Eclipse

Open Eclipse -> Help -> Install new Software –> write this url and install it then add path of installation in genymotion tab in preferances.

What is Robotium?? How to learn it??

Robotium is a test framework created to make it easy to write powerful and robust automatic UI test cases for Android applications. With the support of Robotium, test case developers can write function, system and acceptance test scenarios, spanning multiple Android activities.

For beginner,

Protected: How to generate UML ( Class , Sequence ) Diagram from JAVA file or Project

This content is password protected. To view it please enter your password below:

Protected: Super not regarding JDBC

This content is password protected. To view it please enter your password below:

Unit Testing Principle and Feature

Unit testing work on only one object at a time.

Protected: Object oriented design interms of Programming ( Very usefull for develop the Efficient Software)

This content is password protected. To view it please enter your password below:

Use full Information regarding Regular Expression

In most regex dialects there are a set of convenient character summaries you can use for this kind of thing – these are good ones to remember:

\w – Matches any word character.

\W – Matches any nonword character.

\s – Matches any white-space character.

\S – Matches anything but white-space characters.

\d – Matches any digit.

\D – Matches anything except digits.

A search for “Regex Cheatsheets” should reward you with a whole lot of useful summaries.

What is Transaction in SQL???

A transaction is a single unit of work. If a transaction is successful, all of the data modifications made during the transaction are committed and become a permanent part of the database. If a transaction encounters errors and must be canceled or rolled back, then all of the data modifications are erased.

What is Context in android

In general term,

Context is the information surrounding the information. Without context, information can be misinterpreted; with context, information can be understood.

Context is a much-needed assistant, helping readers define unknown words and make sense of outside information.

IN android world,

Context represents environment data.

It provides access to things such as databases.

typically you call it to get information regarding another part of your program.

The Context class is an “Interface to global information about an application environment”.

Different invoking methods by which you can get context

  1. getApplicationContext()
  2. getContext()
  3. getBaseContext()
  4. this (when in the activity class) (“this” is the keyword of java and it refers to the context of the current activity)
     TextView TV=new TextView(this);



What is Data buffer?

In computer science, a data buffer (or just buffer) is a region of a physical memory storage used to temporarily store data while it is being moved from one place to another.

Buffers are often used in conjunction with I/O to hardware, such as disk drives, sending or receiving data to or from a network, or playing sound on a speaker.

What is Serialization?

Serialization is the process of translating data structures or object state into a format that can be stored (for example, in a file or memory buffer, or transmitted across a network connection link) and reconstructed later in the same or another computer environment.

What is GSON????

Gson (Google Gson) is an open source Java library to serialize and deserialize Java objects to (and from) JSON.

GSON is developed for internal purpose of Google ,After it is under the terms of Apache License 2.0.

For more tutorial:


How to create short link of any URL.



Paste your URL here in this Page

Software Development Tips Web Application

  1. When you develop any database connectivity make sure connectivity should be in single place ,because it is easy to change when modification of connectivity is require.
  2. Add comment ,when important source code block is in web page.
  3. Maintain standard for variable name , static variable name.
  4. When you upload your site on server for testing male sure to create sub domain in your hosting site and create one ftp account and integrate with your dreamweaver
  5. For connect account to Dreamweaver ,refer this
  7. If you have problem to create new user in local server then open xampp shell and write
  8. Then create the new user , Select database –>privileges–>Add your server detail

Virtual School App Password Generator

This code is for Generate the system generated Password.


$password=”your password”;

echo “Password is :”.$password.”<br>”;
//echo $ran;
$salt = sha1($ran);

//echo “<br>”.$salt;
$salt = substr($salt, 0, 10);

//echo “<br>”.$salt.”<br>”;

$encrypted = base64_encode(sha1($password . $salt, true) . $salt);

//echo “Encrypted Password is :”.$encrypted;

$hash = array(“salt” => $salt, “encrypted” => $encrypted);

//Store in Database
echo $saltt;
echo “<br>”.$passwordt;

$hash = base64_encode(sha1($password . $saltt, true) . $saltt);
echo “<br>Yes match found”;
echo “<br>Not found”;

// $uuid = uniqid(”, true);
//echo “<br>”.$uuid;


Introduction Data Structure and Algorithm

What is Data Structure and Algorithm?????

In simple word,

Algorithm + Data Structure = Program

Algorithm: Method for solving problem.

Data Structure: Method for store Information.

Topics                                  data structure and algorithms

data types                            stack ,queue ,bag ,union-find ,priority queue

sorting                                  quicksort ,mergesort ,heapsort ,radix sort

searching                              BST ,red-black BST ,hash table

graphs                                   BFS ,DFS ,Prim ,Kruskal ,Dijkstra

strings                                  KMP ,regular expressiona ,TST ,Huffman ,LZW

advanced                             B-tree ,suffix ,array ,maxflowUntitled


JSON Practical scenario : 2

Target Format From Database:





$output = array();

while ($row = mysql_fetch_assoc($result)) {
    $key = intval($row['hours']);
        $output[$key] = array('hours' => $key);
    $output[$key][$row['subtype']] = intval($row['y']);

echo json_encode($output);

JSON Practical scenario : 1

  1. You have one table and two column.
  2. One column contain repeated data and second column contain different different  repeated data.
  3. Task is to write second column data as JSON array and First column data as JSON object.

Database Table:


Output Like.



$con = mysql_connect(“localhost”,”root”,””);
die(“Could Not connect”.mysql_error());


$result=mysql_query(“SELECT DISTINCT `standard`,`division` FROM `timetable_teacher_detail` WHERE `Monday`=$tea_id”);
while ($row = mysql_fetch_assoc($result)) {
$key = $row[‘standard’];
$output[$key][] = $row[‘division’];
echo json_encode($output);



How work one dimensional array in JSON?

One dimensional scenario in JSON

How work two dimensional array in json?

Two dimensional scenario in JSON

JSON Introduction

Two main Parameter

  1. JSON Object  ,denoted as {  }
  2. JSON Array, denoted as [  ]

Blog at

Up ↑