etc/profile

JAVA_HOME=/usr/local/thesis/jvm/jdk_1_8_66/jdk1.8.0_66
PATH=$PATH:$JAVA_HOME/bin
HADOOP_INSTALL=/usr/local/thesis/hadoop/hadoop-2.7.0

# — HADOOP ENVIRONMENT VARIABLES START — #

export HADOOP_HOME=/usr/local/thesis/hadoop/hadoop-2.7.0
export PATH=$PATH:$HADOOP_HOME/bin
export PATH=$PATH:$HADOOP_HOME/sbin
export HADOOP_MAPRED_HOME=$HADOOP_HOME
export HADOOP_COMMON_HOME=$HADOOP_HOME
export HADOOP_HDFS_HOME=$HADOOP_HOME
export YARN_HOME=$HADOOP_HOME
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native

# — HADOOP ENVIRONMENT VARIABLES END — #

PATH=$PATH:$HADOOP_INSTALL/bin

export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
export HADOOP_OPTS=”-Djava.library.path=$HADOOP_HOME/lib”

export SCALA_HOME=/usr/local/thesis/scala/scala-2.11.7
export PATH=$SCALA_HOME/bin:$PATH

export SPARK_HOME=/usr/local/thesis/spark/spark-1.5.2-bin-hadoop2.6
export PATH=$SPARK_HOME/bin:$PATH

export JAVA_HOME
export JRE_HOME
export PATH
export HADOOP_INSTALL

Advertisements

Clone , Shallow and Deep Copy

 

 

The default Object.clone() is indeed a shallow copy. However, it’s designed to throw a CloneNotSupportedException unless your object implements Cloneable.

And when you implement Cloneable, you should override clone() to make it do a deep copy, by calling clone() on all fields that are themselves cloneable.

Hadoop System Environment Variables

JAVA_HOME=/usr/local/java/jdk1.8.0_66
PATH=$PATH:$JAVA_HOME/bin
JRE_HOME=/usr/local/java/jre1.8.0_66
PATH=$PATH:$JRE_HOME/bin
HADOOP_INSTALL=/usr/local/hadoop

# — HADOOP ENVIRONMENT VARIABLES START — #

export HADOOP_HOME=/usr/local/hadoop
export PATH=$PATH:$HADOOP_HOME/bin
export PATH=$PATH:$HADOOP_HOME/sbin
export HADOOP_MAPRED_HOME=$HADOOP_HOME
export HADOOP_COMMON_HOME=$HADOOP_HOME
export HADOOP_HDFS_HOME=$HADOOP_HOME
export YARN_HOME=$HADOOP_HOME
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
export HADOOP_OPTS=”-Djava.library.path=$HADOOP_HOME/lib”
export HADOOP_OPTS=$HADOOP_OPTS -Djava.library.path=/usr/local/hadoop/lib/native
# — HADOOP ENVIRONMENT VARIABLES END — #

PATH=$PATH:$HADOOP_INSTALL/bin
export JAVA_HOME
export JRE_HOME
export PATH
export HADOOP_INSTALL

export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
export HADOOP_OPTS=”-Djava.library.path=$HADOOP_HOME/lib”
export HADOOP_OPTS=”$HADOOP_OPTS -Djava.library.path=/usr/local/hadoop/lib/native”
export JAVA_HOME

# Add following hostname and their ip in host table
10.12.32.110    HadoopMaster
10.12.32.109    HadoopSlave1

Boxing , Unboxing

Converting from a primitive type to its corresponding reference type is boxing conversion and vice versa is unboxing conversion.

Examples are,

  • From primitive boolean to type Boolean
  • From primitive int to type Integer
	int i = 10;
	Integer iObj = new Integer(100);

	iObj = i;//boxing conversion
	i = iObj;//unboxing conversion

Check Whether Number is Palindrom

For Number:

private static boolean isPalindrome(int number){

int orignalNo = number;
int reverse = 0;
while(number != 0){
reverse = reverse*10 + number%10;
number = number/10;
}
return (orignalNo == reverse);
}

For String:

private static boolean isPalindrome(String pText){

for ( int i = pText.length() – 1; i >= 0; i– )
reverse = reverse + original.charAt(i);
if (original.equals(reverse))
System.out.println(“Entered string is a palindrome.”);
else
System.out.println(“Entered string is not a palindrome.”);

References

http://javarevisited.blogspot.com/2012/12/how-to-check-if-number-is-palindrome-or-not-example.html

http://www.programmingsimplified.com/java/source-code/java-program-check-palindrome

Through Put vs Response Time

Response Time – Amount of time system takes to process a request after it has received one.

Latency – In simplest terms this is Remote Response time. For instance, you want to invoke a web service or access a web page. Apart from the processing time that is needed on the server to process your request, there is a delay involved for your request to reach to server. While referring to Latency, it’s that delay we are talking about. This becomes a big issue for a remote data center which is hosting your service/page. Imagine your data center in US, and accessing it from India. If ignored, latency can trigger your SLA’s. Though it’s quite difficult to improve latency it’s important to measure it. How we measure Latency? There are some network simulation tools out there that can help you – one such tool can be found here.

Throughput – Transactions per second your application can handle (motivation / result of load testing). A typical enterprise application will have lots of users performing lots of different transactions. You should ensure that your application meets the required capacity of enterprise before it hits production. Load testing is the solution for that.

 

 

Think about a garden hose. The wider the hose the more water can come out. You would probably measure that _throughput_ in gallons per minute. A fire hose has more throughput than a garden hose.

Now think about the amount of time it takes from the time you turn on the spigot until the water comes out the end of the hose. You could call that _response time_. You would probably measure that in seconds.

The length of the hose will affect the response time. If it’s clogged or kinked somewhere the throughput would be decreased.

 

 

References :

 

Nodejs Module (How to create nodejs module)

We will learn about Node.js Modules.