Skip to content

Instantly share code, notes, and snippets.

View ShubhamS32's full-sized avatar
💭
To be happy

ShubhamS32

💭
To be happy
View GitHub Profile
@ShubhamS32
ShubhamS32 / Selenim_Demo.java
Created April 22, 2019 05:59
A small demo of Selenium using java 8 to show the use case of multi-windows pop ups and accessing the data within them.
/**
*
*/
package com.selenium.demo;
import static org.junit.jupiter.api.Assertions.*;
import java.util.Iterator;
import java.util.Set;
@ShubhamS32
ShubhamS32 / Solution.java
Created March 23, 2019 19:25
Find pair of Socks pair
import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;
import java.lang.*;
import java.util.List;
import java.util.HashMap;
@ShubhamS32
ShubhamS32 / session tracking.md
Created March 14, 2019 12:08 — forked from jackblack369/session tracking.md
[learn session tracking] #java #web

session

Session simply means a particular interval of time. Session Tracking is a way to maintain state (data) of an user. It is also known as session management in servlet.

  • HTTP is stateless that means each request is considered as the new request. It is shown in the figure given below:

  • There are four techniques used in Session tracking:

    • Cookies
@ShubhamS32
ShubhamS32 / LinkedList vs ArrayList
Last active May 19, 2021 04:24
LinkedList vs ArrayList
LinkedList vs ArrayList in Java
Difference between LinkedList and ArrayList in JavaAll the differences between LinkedList and ArrayList has there root on difference between Array and LinkedList data-structure. If you are familiar with Array and LinkedList data structure you will most likely derive following differences between them:
1) Since Array is an index based data-structure searching or getting element from Array with index is pretty fast. Array provides O(1) performance for get(index) method but remove is costly in ArrayList as you need to rearrange all elements. On the Other hand LinkedList doesn't provide Random or index based access and you need to iterate over linked list to retrieve any element which is of order O(n).
2) Insertions are easy and fast in LinkedList as compared to ArrayList because there is no risk of resizing array
and copying content to new array if array gets full which makes adding into ArrayList of O(n) in worst case, while adding is O(1) operation in LinkedList in Java. Array
@ShubhamS32
ShubhamS32 / ReverseString.java
Created March 14, 2019 11:03
To Reverse String without using String Buffer
package org.pre;
public class ReverseString {
public static void main(String[] args) {
// TODO Auto-generated method stub
String word="shubham";
char[] warray=word.toCharArray();
char[] farray= new char[warray.length];
System.out.println("Length :"+warray.length);
@ShubhamS32
ShubhamS32 / SumOfElem.java
Created March 13, 2019 12:31
SumOfElem.java
public class SumOfElem {
static int sum=0;
public static void main(String[] args) {
// TODO Auto-generated method stub
int no=3850;
int val=getValue(no);
System.out.println("The Total is:"+val);
}
public static int getValue(int a)
{
@ShubhamS32
ShubhamS32 / For Logging
Created March 6, 2019 09:59
For Logging Purpose
//log.append(reqTime +" |Exception appErrorCode"+appErrorCode + "| httpErrorCode |"+httpErrorCode);
// logit("PayTM_Exp_Log",true,reqTime,log.toString());
public static void logit(String filename,boolean newline,String ...X){
try{
//String path="C:\\logs\\atom\\";
String path ="C:\\logs\\paytm";
StringBuffer sb = new StringBuffer();
String today = new SimpleDateFormat("MMM-dd-yyyy").format(new java.util.Date());
BufferedWriter outlog = new BufferedWriter(new FileWriter(path+"\\"+filename+"-"+today+".log", true));
for(String str:X){
@ShubhamS32
ShubhamS32 / PayTMJAVA.java
Created February 19, 2019 10:31
For JSON Lopping and Paytm Check
String statusCheckOP=gratification.gratificationStatusCheckk(gratification.paytmtxtTestUrl, wp.getJSONDOC_ID());
JSONObject jsonstatusObj = new JSONObject(statusCheckOP);
JSONArray statusCode=jsonstatusObj.getJSONObject("response").getJSONArray("txnList");
for (int j = 0; j < statusCode.length(); ++j) {
JSONObject rec = statusCode.getJSONObject(j);
String loc = rec.getString("status");
wp.setPAYTMSTATUS_CODE(loc);
System.out.println("statusCode "+statusCode +": loc"+loc);
}
@ShubhamS32
ShubhamS32 / SQLKeys.sql
Last active February 3, 2019 09:45
Some of the shortcuts,techniques learned in Abbott
1)To Use Replace
select replace(coName,'Char to Repalce','Char to Replace with')
2)Relace the leading zeros of text
SELECT REPLACE(LTRIM(REPLACE('094434580980','0',' ')),' ','0') FROM table1
3)Replace Trailing zeros of the text
SELECT REPLACE(RTRIM(REPLACE('094434580980','0',' ')),' ','0') FROM table1
@ShubhamS32
ShubhamS32 / copy.java
Created April 6, 2018 18:05
This program copies jar from the source folder to the destination folder.
package jarcopier;
import java.io.*;
import java.util.Enumeration;
import java.util.jar.*;
/*
* @author Shubham Shah
*/