Install Packages in R

You can install packages in R using :

install.packages(“rpart.plot”)

Advertisements
Posted in Uncategorized | Leave a comment

Store Encrypted and Decrypted Password Java

https://stackoverflow.com/questions/1132567/encrypt-password-in-configuration-files

Posted in Uncategorized | Leave a comment

Define Implementation at Runtime using Lambda Expression

import org.testng.annotations.Test;

interface MathOperation
{
int operation(int a,int b);
}

 

public class Lambda2 {

@Test
public void testLambda2()
{

MathOperation add=(int a,int b)->a+b;
MathOperation mul=(int a,int b)->a*b;
System.out.println(“Value after addition seen is “+add.operation(10, 20));
System.out.println(“Value after multiplication seen is “+mul.operation(10, 20));
}
}

Posted in Java, Uncategorized | Leave a comment

Using Lambda Expression Java

import org.testng.annotations.Test;

interface MultiplyByTwo
{
int Multiply(int num);
}

interface MathOperation
{
int operation(int a,int b);
}

interface Number
{
double getValue();
}

interface Message
{
String getMessage(String msg);
}
public class Lambda2 {

@Test
public void testLambda2()
{
MathOperation add=(int a,int b) ->a+b;
MultiplyByTwo two=(int a) ->a*2;
Number num=()->100.80;
Message mess=(String msg)->msg.toLowerCase();
System.out.println(“Message seen is “+mess.getMessage(“HELLO WORLD”));
System.out.println(“Value seen is “+num.getValue());
System.out.println(“Multiplication seen is “+two.Multiply(10));
}
}

Posted in Java, Uncategorized | Leave a comment

Using Index DataFrame Python

#Using Dataframes

import numpy as np
import pandas as pd

data=[1,2,3,4,5]
data=pd.DataFrame(data,index=[‘range’,’range1′,’range2′,’range3′,’range4′])
print(data)

Posted in Python, Uncategorized | Leave a comment

Using Series Pandas

import numpy as np
import pandas as pda
data=np.array([1,2,3,4])
p=pda.Series(data)
print(p)

Posted in Python, Uncategorized | Leave a comment

Transpose of Matrix in Python

import numpy as np
num1 = np.array([[1,2], [3,4]])
print(num1)
print(“Transpose of matrix seen now is”,num1.T)

Posted in Uncategorized | Leave a comment