Tuesday, 31 July 2018

Data Anonymisation

Data anonymization:
It  is a type of information sanitization whose intent is privacy protection. It is the process of either encrypting or removing personally identifiable information from data sets, so that the people whom the data describe remain anonymous.

Friday, 27 July 2018

Monthly data Extraction Logic using Oracle SQL

The following logic is used to get data from Database for monthly data extraction

For example if you want employee attendance data from DB for monthly then logic will be like shown in below

Select  Emp_attendance from Employee where Emp_attendance between add_months(trunc(sysdate,'mm'),-1) and last_day(add_months(trunc(sysdate,'mm'),-1)) ;

You can cross check whether the logic is getting correct dates or not by firing the below queries in sql developer or any tool you used to execute the queris

The below query will give you the first day date of  last month:
select add_months(trunc(sysdate,'mm'),-1) from dual;

The below query will give you the last day date of  last month:
select last_day(add_months(trunc(sysdate,'mm'),-1)) from DUAL;

Thursday, 5 July 2018

Java program to check the given two strings in an Array are anagrams or not

package learning;

import java.util.Arrays;

public class Anagram {

    public static void main(String[] args) {

        String[] s = new String[]{"raw", "aar"};
   
         char[] s0 = s[0].toLowerCase().toCharArray();
       
         char[] s1 = s[1].toLowerCase().toCharArray();

         Arrays.sort(s0);

         Arrays.sort(s1);
        
         if(Arrays.equals(s0, s1)) {
             System.out.println("The given two words in the array are anagrams");
       
        }
         else {
             System.out.println("The given two words are not anagrams");
         }

    }

}

Wednesday, 4 July 2018

Finding the possibility of Adding two numbers in an given array and finding the number which we give at runtime in java

package learning;

import java.util.Scanner;

public class FindingNoOfPossibilitiesOfAddingTwoNumbersInAnArray {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int s[] = { 1, 2, 3, 4, 5 };
        int a = s.length;
        System.out.println("Enter your number");

        int b = sc.nextInt();

        for (int i = 0; i < a; i++) {

            if (s[i] < a) {

                for (int x = a; x > i; x--) {
                    if (s[i] + s[x - 1] == b) {
                        System.out.println("s[i] is :"+s[i]);
                        System.out.println("s[x-1] is :"+s[x-1]);
                        System.out.println("The possible sum of two numbers is "+(s[i] + s[x - 1]));
                    }
                }
            }

        }

    }

}