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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * | |
| */ | |
| package com.selenium.demo; | |
| import static org.junit.jupiter.api.Assertions.*; | |
| import java.util.Iterator; | |
| import java.util.Set; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //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){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package jarcopier; | |
| import java.io.*; | |
| import java.util.Enumeration; | |
| import java.util.jar.*; | |
| /* | |
| * @author Shubham Shah | |
| */ |
NewerOlder