DumpJNDI.java

import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

/**
*
*/

public class DumpJNDI {

 /**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
Properties props = new Properties();
props.put(“java.naming.factory.initial”, “com.ibm.websphere.naming.WsnInitialContextFactory”);
props.put(“java.naming.provider.url”, “iiop://hostname:2809/”);
Context context = new InitialContext(props);
//Context context = new InitialContext();
Object obj = context.lookup(“java:comp/env/service/MDMQSWSService”);

  } catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

 }

}

CreateForIn.java

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class CreateForIn {

 private static FileWriter fw = null;

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub

String inputFile = “C:\\InSQLInput.txt”;
String input=””;
try {
readALineAtATime(inputFile);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

    private static void readALineAtATime(String inputFile) throws FileNotFoundException, IOException {

BufferedReader br = new BufferedReader(new FileReader(inputFile));
String line;
System.out.println(“Begin:::”);
while ((line = br.readLine()) != null) {
genSQL(line);

}
br.close();
fw.close();
System.out.println(“End:::”);

}

 private static void genSQL(String line) {

try{
// TODO Auto-generated method stub
String newValue = “‘”+line.trim()+”‘,”;
writeToFile(newValue);
}catch(Exception e){
e.printStackTrace();
}

}

private static void writeToFile(String line) {
// TODO Auto-generated method stub
//BufferedWriter br = new BufferedReader(new FileReader(inputFile));
try {
if (fw == null)
fw = new FileWriter(“C:\\InSQLOutput.txt”);
fw.append(line);
fw.append(“\n”);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

}

CRDupeRemovalSQL.java

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Vector;

public class CRDupeRemovalSQL {

 private static FileWriter fw = null;
private static Map<String, List<String>> map = new HashMap<String, List<String>>();
private static Map<String, Integer> countMap = new HashMap<String, Integer>();

/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
String inputFile = “C:\\crdupesplusrl_sorted.del”;
//String inputFile = “C:\\test.del”;
System.out.println(“Reading input file ” + inputFile + ” … “);
String input=””;
try {
readALineAtATime(inputFile);
removeOldest();
getFileWriter(null);
genSQL();
closeFileWriter();
getFileWriter(“verification”);
genVerificationSQL();
closeFileWriter();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}

private static void readALineAtATime(String inputFile) throws FileNotFoundException, IOException {

BufferedReader br = new BufferedReader(new FileReader(inputFile));
String line;
System.out.println(“Begin read:::”);
while ((line = br.readLine()) != null) {
// Business key is cont_id + contract component id + contract role
if (!hasRoleLocation(line)){
System.out.println(“No role location”);
System.out.println(getBusinessKey(line));
if(map.get(getBusinessKey(line))!=null){
System.out.println(“Not first set”);
List<String> list = map.get(getBusinessKey(line));
list.add(getPrimaryKey(line));
map.put(getBusinessKey(line), list);
}else{
System.out.println(“First set”);
List<String> list = new ArrayList<String>();
list.add(getPrimaryKey(line));
map.put(getBusinessKey(line), list);
}
}
if (countMap.get(getBusinessKey(line)) == null){
System.out.println(“Count First set”);
countMap.put(getBusinessKey(line), 1);
System.out.println(countMap.get(getBusinessKey(line)));
}
else{
System.out.println(“Count Not First set”);
countMap.put(getBusinessKey(line), countMap.get(getBusinessKey(line))+1);
System.out.println(countMap.get(getBusinessKey(line)));
}

}
br.close();
System.out.println(“End read:::”);

    }

 private static boolean hasRoleLocation(String line) {

String [] tokens = line.split(“,”);
for (int i = 0; i < tokens.length; i++){
if (i == 20){
return true;
}
}
return false;
}

private static String getLUD(String line) {

String [] tokens = line.split(“,”);
return tokens[11];
}

 private static String getBusinessKey(String line) {

String [] tokens = line.split(“,”);
Vector vec = new Vector();
StringBuffer businessKey = new StringBuffer();
for (int i = 0; i < tokens.length; i++){
if (i == 1 || i == 2 || i == 3){
businessKey.append(tokens[i]);
}
}
return businessKey.toString();

}

private static String getPrimaryKey(String line) {
String [] tokens = line.split(“,”);
return tokens[0];
}

private static void removeOldest() throws Exception {
System.out.println(“Begin removeOldest:::”);
Set<String> keySet = map.keySet();
Iterator it = keySet.iterator();
while(it.hasNext()){
String key = (String)it.next();
List<String> list = map.get(key);
Integer cardinailty = countMap.get(key);
if (list.size() == cardinailty)
list.remove(0);
if (list.size() > cardinailty){
System.out.println(“list size::”+list.size());
System.out.println(“cardinailty::”+cardinailty);
System.out.println();
System.out.println(key);
printList(list);
throw new Exception(“List is bigger than cardinality”);
}

}
System.out.println(“End removeOldest:::”);
}

 private static void printList(List<String> list) {
Iterator<String> it = list.iterator();
while(it.hasNext()){
System.out.println(it.next());
}

}

 private static void writeToFile(String updateStr) {
try {
fw.append(updateStr);
fw.append(“\n”);
fw.flush();
} catch (IOException e) {
e.printStackTrace();
}
}

private static void writeToLine(String updateStr) {
try {
fw.append(updateStr);
fw.flush();
} catch (IOException e) {
e.printStackTrace();
}
}

private static void getFileWriter(String type) {
try {
if (fw == null){
if (type == null)
fw = new FileWriter(“C:\\DuplicateCRsEndDate.sql”);
else
fw = new FileWriter(“C:\\PreRunVerification.sql”);
}

} catch (IOException e) {
e.printStackTrace();
}
}

private static void closeFileWriter() {
try {
if (fw != null){
fw.close();
fw = null;
}

} catch (IOException e) {
e.printStackTrace();
}
}

 private static void genSQL() {
System.out.println(“Begin genSQL:::”);
try{
Set<String> keySet = map.keySet();
Iterator it = keySet.iterator();
while(it.hasNext()){
List<String> list = map.get(it.next());
if (!list.isEmpty()){
Iterator listIt = list.iterator();
while (listIt.hasNext()){
System.out.println(“SQL created”);
//StringBuffer sb = new StringBuffer(“UPDATE CONTRACTROLE SET END_DT = CURRENT TIMESTAMP, LAST_UPDATE_DT = CURRENT TIMESTAMP, LAST_UPDATE_USER = ‘SQLPatch-06Apr2016’ WHERE CONTRACT_ROLE_ID = “+listIt.next());
writeToFile(“UPDATE CONTRACTROLE SET END_DT = CURRENT TIMESTAMP, LAST_UPDATE_DT = CURRENT TIMESTAMP, LAST_UPDATE_USER = ‘SQLPatch-06Apr2016’ WHERE CONTRACT_ROLE_ID = “+listIt.next()+”;”);
}
}
}
writeToFile(“COMMIT;”);
}catch(Exception e){
e.printStackTrace();
}
System.out.println(“End genSQL:::”);
}

private static void genVerificationSQL() {
System.out.println(“Begin genVerificationSQL:::”);
try{
writeToLine(“SELECT COUNT(*) FROM ROLELOCATION WHERE CONTRACT_ROLE_ID IN (“);
Set<String> keySet = map.keySet();
Iterator it = keySet.iterator();
while(it.hasNext()){
List<String> list = map.get(it.next());
if (!list.isEmpty()){
Iterator listIt = list.iterator();
while (listIt.hasNext()){
writeToLine(listIt.next()+”,”);
}
}
}
writeToFile(“0);”);
}catch(Exception e){
e.printStackTrace();
}
System.out.println(“End genVerificationSQL:::”);
}

}

CovertToSingleLine.java

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class CovertToSingleLine {

 /**
* @param args
*/
public static void main(String[] args) {
String inputFile = “C:\\filename.xml”;
System.out.println(“Reading input file ” + inputFile + ” … “);
try {
System.out.println(readAllLinesIntoOne(inputFile));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}

 private static String readAllLinesIntoOne(String inputFile)
throws FileNotFoundException, IOException {
System.out.println(“Inside readAllLinesIntoOne”);
BufferedReader br = new BufferedReader(new FileReader(inputFile));
String line;
StringBuffer sb = new StringBuffer();
while ((line = br.readLine()) != null) {
sb.append(line.trim());
}
br.close();
return sb.toString();
}
}

ReadFirstNLines

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public class ReadFirstNLines {

/**
* @param args
*/
public static void main(String[] args) {
String inputFile = “C:\\inputfile.txt”;
System.out.println(“Reading input file ” + inputFile + ” … “);
Map errorMap = new HashMap<String, String>();
try {
readALineAtATime(inputFile, “100”);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}

private static void readALineAtATime(String inputFile, String numberOfLines) throws FileNotFoundException, IOException {
System.out.println(“Inside readALineAtATime”);
int lineLimit = Integer.valueOf(numberOfLines);
int lineCount = 0;
BufferedReader br = new BufferedReader(new FileReader(inputFile));
String line;
while ((line = br.readLine()) != null && lineCount < lineLimit) {
System.out.println(line);
lineCount++;
}
br.close();

}
}

My Cheatsheet

Oracle

DROP TABLE SHER_TEMP;
CREATE TABLE SHER_TEMP
(
COL1 VARCHAR2(9) NOT NULL
)
;

INSERT INTO SHER_TEMP VALUES (‘78444177’);

DB2

Instance Name Service Name Port Number
DB2 db2j_DB2 55000

Creates a creates a HTTP service on above port

db2iupgrade /j:”text_search”

DB2 Export

export to filename.del of del select select col1, col2 from .

DB2 Import

db2 ‘import from filename.del of del method p (1, 2) insert into . (col1, col2)’

DB2 Event Monitor

create event monitor db2activities for activities write to file maxfiles 1 maxfilesize 200 replace

DB2 Lookup

db2look -d -i username -e -w password -z -tw  -o ddl.sql

DB2 Create Index

create index . on . (col1, col2) allow reverse scans page split symmetric collect sampled detailed statistics;

DB2 Runstats

db2 -v runstats on table . with distribution and detailed indexes all

DB2 Check last run stats info

select TABNAME,STATS_TIME from syscat.tables where tabname in (‘CONTACT’);

DB2 Advise

login to db server
db2advis -d -q -i sqlfile.in -t 5 -m I > sqlfile.out

–#SET FREQUENCY 100 (this line to be inserted into the sqlfile.in to give an indication of load among multiple sql statements)

DB2 Cleanup SUSPECT Table
db2 “alter table .suspectaugment drop foreign key F1_SUSPA”
db2 “truncate .suspect immediate”
db2 “alter table  .suspectaugment add constraint F1_SUSPA foreign key (suspect_id) references suspect(suspect_id)”

DB2 load data
db2 “import from filename.del of del method p (1, 2) messages output.log insert into . (col1, col2)”
db2 “load client from filename.del of del insert into . copy yes to /dev/null” — worked. set proper access to del file, say 770, 755. Follow this by set integrity below.

db2 “set integrity for . immediate checked”

load from /dev/null of del replace into .;
db2 “set integrity for . immediate checked”

DB2 Set path

export PATH=$PATH:/opt/ibm/db2/V9.7/bin:

DB2 Alter table (Drop not null)

alter table  alter column  drop not null;
reorg table ;

DB2 describe index

db2 describe indexes for table . show detail

DB2 backup restore

db2 attach to db2 user using db2 backup database user using to c:/db2backups
db2 restore database user using from c:/db2backups taken at 20160408153909 into
db2 restart database
db2 list tablespaces show detail

DB2 Catalog

catalog tcpip node node2 remote server catalog database as at node node2

DB2 User Defined Function

CREATE FUNCTION DB2ADMIN.GETXSDDATETIME(mdmtimestamp VARCHAR(100))
RETURNS VARCHAR(100)
EXTERNAL NAME ‘ASIDATEUTIL!GETXSD’
LANGUAGE java
PARAMETER STYLE JAVA
DETERMINISTIC
FENCED
NOT NULL CALL
NO SQL
NO EXTERNAL ACTION
NO SCRATCHPAD
ALLOW PARALLEL;

db2 “CALL sqlj.install_jar (‘file:C:/jarfile.jar’,”)”

DB2 Trigger backup and drop

db2look -d -z -t  -e -i -w > file.out
DROP TRIGGER .

DB2 Drivers

IBM DB2 Universal Driver Type 4

——————————————————————————–

DRIVER CLASS: com.ibm.db2.jcc.DB2Driver

DRIVER LOCATION: db2jcc.jar and db2jcc_license_cu.jar
(Both of these jars must be included)

JDBC URL FORMAT: jdbc:db2://[:]/

JDBC URL Examples:

 jdbc:db2://127.0.0.1:50000/SAMPLE

IBM DB2 Universal Driver Type 2

——————————————————————————–

DRIVER CLASS: com.ibm.db2.jcc.DB2Driver

DRIVER LOCATION: db2jcc.jar and db2jcc_license_cu.jar
(Both of these jars must be included)

JDBC URL FORMAT: jdbc:db2:

JDBC URL Examples:

 jdbc:db2:sample

DB2 Execute SQL files

db2 -tvf upd_inqlvlquery.sql | tee upd_inqlvlquery.log

db2 -td; -vf triggers.sql

DB2 Query CLOB

SELECT CAST(CAST( AS CLOB(1073741824)) as varchar(32000))  FROM .;
SELECT XMLSERIALIZE( AS VARCHAR(10000)) FROM .;

DB2 current timestamp

select current timestamp as runtime from sysibm.sysdummy1;

Linux

cd /opt/IBM/MDM/HTTP*/logs
x=$(grep ‘ 200 ‘ access_log | grep -c ’20/Nov/2017’)
y=$(grep ‘ 500 ‘ access_log | grep -c ’20/Nov/2017’)
z=$((x+y))
s=$((x*100/z))
echo Found : $x
echo Not Found: $y
echo Found %: $s

// Delete lines from a file that match a pattern

sed –in-place ‘/matchpattern/d’ filename

TAR
tar czvf sher.tgz /apps/temp/mainDir –exclude=/apps/temp/mainDir/subDir2

Run jar

java -cp jarname.jar  arguments

Change mod to be writable by group (eg: chmod -R g+w folder_name) after creation or replacement. Otherwise you might lose the privilege as the sudo restart will change the owner back to admin.
Please don’t use 777, use 775. The developers are all part of group and you wouldn’t want other people delete the whole folder.

// remove duplicates
sort garbage.txt | uniq -u

word count
wc -l < file.txt

Linux Version Info

$ cat /etc/*-release
$ uname -a

linux bit info
$ uname -m

update jar
jar uf name.jar com jar uf AdaptiveServiceInterface.jar com

// Linux Change Logon

su –

sudo su –

NOHUP

nohup some_command > /dev/null 2>&1& # doesn’t create nohup.out

MDM

Enable SAM (Service Activity Monitoring)
SELECT * FROM CONFIGELEMENT WHERE NAME LIKE ‘%Report%’;
UPDATE CONFIGELEMENT SET VALUE = ‘true’, LAST_UPDATE_DT = CURRENT TIMESTAMP WHERE NAME LIKE ‘%Report%’;

Enable performance monitoring log
UPDATE .CONFIGELEMENT SET VALUE = ‘true’, LAST_UPDATE_DT = CURRENT TIMESTAMP WHERE NAME LIKE ‘%Performance%enabled’;
UPDATE .CONFIGELEMENT SET VALUE = 6, LAST_UPDATE_DT = CURRENT TIMESTAMP WHERE NAME = ‘/IBM/DWLCommonServices/PerformanceTracking/level’;
Enable PME Timer log
========================================================================================
To change the logging levels, In WebSphere Application Server admin console, add / set the following in logging of the InfoSphere MDM application server.

Login WebSphere console, navigate to

Troubleshooting – > Logs and trace – > Your MDM Server – > Diagnostic trace service

–  You can define your own trace file name and maximum file size, or use the default  (trace.log)
–  Select “Change Log Detail Levels”, append current log level with the following to enable  timer log.

*=info: com.ibm.mdm.eme.core.Timer=fine

With persistent changes (configured on Configuration Tab), MDM restart is required. With temporary changes (configured on Runtime Tab), changes will be taken affect without MDM restart.

Sample for the trace.log:

[9/1/11 19:57:45:188 EDT] 00000032 Timer         1 com.ibm.mdm.eme.core.util.Timer log |search|5 ms|2 ms|1 ms|7 bkts|1,2,3,5 bktroles|3 cands|1 matches|
[9/1/11 19:57:45:190 EDT] 00000033 Timer         1 com.ibm.mdm.eme.core.util.Timer log |update|11 ms|
[9/1/11 19:57:45:205 EDT] 0000002d Timer         1 com.ibm.mdm.eme.core.util.Timer log |search|27 ms|26 ms|0 ms|13 bkts|1,2,3,5 bktroles|2 cands|0 matches|
[9/1/11 19:57:45:209 EDT] 00000031 MatchingServi I com.ibm.mdm.eme.core.MatchingServiceImpl searchWithProband No candidates found.

============================================================================================

Enable XSLT Logs (ASI)
========================================================================================

*=info: com.ibm.xltxe.*=fine
com.ibm.xltxe.rnm1.xtq.xslt.drivers.XSLTExecutable=fine:com.ibm.xltxe.rnm1.xtq.xslt.drivers.XSLTPreparer=fine:com.ibm.xltxe.rnm1.xtq.xpath.drivers.XPathExecutable=fine:com.ibm.xltxe.rnm1.xtq.xpath.drivers.XPathPreparer=fine

Configelement comparison
——————————
SELECT SRC1.NAME, SRC1.VALUE, SRC1.VALUE_DEFAULT, SRC2.VALUE, SRC2.VALUE_DEFAULT FROM
(SELECT NAME, VALUE, VALUE_DEFAULT FROM CONFIGELEMENT
EXCEPT
SELECT NAME, VALUE, VALUE_DEFAULT FROM .CONFIGELEMENT) SRC1 LEFT OUTER JOIN
(SELECT NAME, VALUE, VALUE_DEFAULT FROM .CONFIGELEMENT
EXCEPT
SELECT NAME, VALUE, VALUE_DEFAULT FROM CONFIGELEMENT) SRC2  ON SRC1.NAME = SRC2.NAME
UNION
SELECT SRC1.NAME, SRC1.VALUE, SRC1.VALUE_DEFAULT, SRC2.VALUE, SRC2.VALUE_DEFAULT FROM
(SELECT NAME, VALUE, VALUE_DEFAULT FROM .CONFIGELEMENT
EXCEPT
SELECT NAME, VALUE, VALUE_DEFAULT FROM CONFIGELEMENT) SRC1 LEFT OUTER JOIN
(SELECT NAME, VALUE, VALUE_DEFAULT FROM CONFIGELEMENT
EXCEPT
SELECT NAME, VALUE, VALUE_DEFAULT FROM .CONFIGELEMENT) SRC2  ON SRC1.NAME = SRC2.NAME;

IBM Log Analyzer for MDM
SAM Analysis (Run from IBM HRE 1.7 – C:\IBM\SDP\runtimes\base_v7_stub\java\jre)
set JRE_HOME=C:\IBM\SDP\runtimes\base_v7_stub\java\jre
set JRE_HOME=C:\IBM\SDP\runtimes\base_v8_stub\java\jre
java -jar C:\Progra~2\IBM\LogAnalyzer-11.5.0\LogAnalyzer\LogAnalyzer-11.5.0.jar -l MDMSamLog -f C:\Progra~2\IBM\LogAnalyzer-11.5.0\LogAnalyzer\logs\transactiondata.log -ts “2016-05-06 06:00:00” -te “2016-05-06 11:00:00” -c n -y n -p “May06Forenoon” -d C:\Progra~2\IBM\LogAnalyzer-11.5.0\LogAnalyzer\results

Scripts

// Self attempt – Working
// works for ASI
tail -n 0 -F /apps/IBM/WebSphere/AppServer/profiles//logs/RequestResponseMessage.log | \
while read LINE; do
if [[ $LINE == *Service*Operation* ]]; then
echo “$LINE” | sed -e ‘s/2.*//’ -e ‘s/<\/ServiceTime>.*/,/’ -e ‘s/<\/Operation>/,/’ -e ‘s/<\/Name>//’ -e ‘s/<\/Version>.*//’
elif [[ $LINE == *ServiceTime\>\<DWLControl* ]]; then
value=”$(echo “$LINE” | sed -e ‘s/2.*<port://’ -e ‘s/Response .*/,/’ -e ‘s/<\/ServiceTime>.*//’)”
echo ${value##*,},${value%,*}
elif [[ $LINE == *ResultCode*FATAL* ]]; then
echo “$LINE” | sed -e ‘s/2.*//’ -e ‘s/<\/mdm:ServiceTime>.*/,/’ -e ‘s/<\/mdm:RequestType>.*//’
fi
done
MYVAR=”/var/cpanel/users/joebloggs:DNS9=domain.com”

NAME=${MYVAR%:*}  # get the part before the colon
NAME=${NAME##*/}  # get the part after the last slash
echo $NAME

declare -A animals=( [“key1″]=”val1” [“key2″]=”val2”)

// Self attempt – Working
// works for ASI
tail -n 0 -F RequestResponseMessage.log | \
while read LINE; do
if [[ $LINE == *Service*Operation* ]]; then
echo “$LINE” | sed -e ‘s/2.*//’ -e ‘s/<\/ServiceTime>.*/,/’ -e ‘s/<\/Operation>/,/’ -e ‘s/<\/Name>//’ -e ‘s/<\/Version>.*//’
elif [[ $LINE == *ServiceTime\>\<DWLControl* ]]; then
echo “$LINE” | sed -e ‘s/2.*<port://’ -e ‘s/Response .*/,/’ -e ‘s/<\/ServiceTime>.*//’
elif [[ $LINE == *ResultCode*FATAL* ]]; then
echo “$LINE” | sed -e ‘s/2.*//’ -e ‘s/<\/mdm:ServiceTime>.*/,/’ -e ‘s/<\/mdm:RequestType>.*//’
fi
done

// Missing admin client ids loop
while read -r var;
do
db2 -x “select count(*) from contequiv where admin_client_id = ‘$var’ and admin_sys_tp_cd = 100007 and x_end_date is not null” |
while read -r dbvar;
do
if [ “$dbvar” -eq 0 ]; then
echo $var >> missingAdminIds.out
fi
done
done < adminIds.txt
extract failed requests
grep -rh ‘,’ * | sed ‘s/<\/TCRMService>\,//g’ > personRetry.txt

JMeter

———–Ant Trigger with HTML Report——————
C:\Users\sheriff\JMeter\ProjectFolder>ant -Dshow-data=y -Dtest=jmeterprojectfile -Djmeter.home=C:\apache-jmeter-3.2
ant -Dshow-data=y -Dtest=jmeterprojectfile -Djmeter.home=C:\apache-jmeter-3.2
Buildfile: C:\Users\Sheriff\JMeter\ProjectFolder\build.xml

———–JMeter Non GUI Trigger with APDEX Report——————
cd C:\Users\sheriff\JMeter\ProjectFolder
jmeter -n -t file.jmx -l out.csv -e -o “C:\Users\sheriff\JMeter\ProjectFolder\out”

JMeter Scripts
BirthDateIncrement
${__javaScript(var d = new Date();d.setFullYear(0001\,0\,1);d.setDate(d.getDate() + ${__counter(FALSE)});new Date(d.getTime()).toISOString().substring(0\,10);)}

BirthDateRandom
${__javaScript(var d = new Date();d.setDate(d.getDate() – ${__Random(0,100000)});new Date(d.getTime()).toISOString().substring(0\,10);)}

Current time including ms
${__javaScript(var d = new Date();new Date(d.getTime()).toISOString();)}
${__javaScript(var d = new Date();new Date(d.getTime());)}
${__javaScript(var d = new Date();new Date(d.getTime(yyyy-mm-dd hh:mm:ss));)}
BirthDate
${__time(yyyy-MM-dd)}

${__javaScript(var d = new Date();d.setDate(d.getDate() – ${__Random(0,100000)});new Date(d.getTime()).toISOString().substring(0\,10);)}

Time in milliseconds + Random 4 Digit

${__V(${__time()}${__Random(1000,9999)})}

ClearCase

cleartool mkview -tag -str Domain_Release_shdev@/vobs/ -stgloc ccviewstg
cleartool setview

clearfsimport -preview -recurse -nset C:\ccviews\Domain_Release_shdev\MDM\JavaModule\* C:\ccviews\Domain_Release_shdev\MDM\JavaModule
// UCM Activity details
cleartool descr -l activity:@/vobs/
cleartool lsactivity -contrib activity:@/vobs/

// Baseline details
cleartool describe baseline:@/vobs/
cleartool describe stream:Domain_Release_int@/vobs/
cleartool describe stream:Domain_Release_shdev@/vobs/
cleartool diffbl -activities  baseline:@/vobs/
cleartool lsbl -component your_copmponent@\yourPVob  -stream your_integration_stream@\yourPVob  -level PRODUCTION-short’

// Find CRs between two baselines
cleartool diffbl -activities  baseline:@/vobs/ | grep -v “deliver”
cleartool diffbl -activities  baseline:@\/vobs\/IBM_Proj “/ – /g’ | sed ‘s/”//g’ | sed ‘s/>>//g’ | sed ‘s/->//g’

// Baseline diff – activity details
cleartool setview sheriff_Domain_Release_int_view
cleartool diffbl -activities  baseline:@\/vobs\/IBM_Proj “/ – /g’ | sed ‘s/”//g’ | sed ‘s/>>//g’ | sed ‘s/->//g’ > bsldiff.log
@/vobs/
while read -r var;
do
cr=$(echo $var | cut -c1-10)
echo $cr
cleartool descr -l activity:$cr@/vobs/
done < bsldiff.log > sher.log

// Baseline comparison
–working–
cd ~
cd shershell
rm -f bsldiffdetails.txt
cleartool setview sheriff_Domain_Release_int_view
cleartool diffbl -activities  baseline:@\/vobs\/IBM_Proj “/ – /g’ | sed ‘s/”//g’ | sed ‘s/>>//g’ | sed ‘s/->//g’ | grep “CR00*” | grep “deliver” > bsldiffdetails.log
while read -r var;
do
cr=$(echo $var | cut -c1-10)
echo $cr
cleartool descr -l activity:$cr@/vobs/ > acttemp.log
cat acttemp.log >> bsldiffdetails.txt
done < bsldiffdetails.log
exit 0
// Stream activity details
–working–
cd ~
cd shershell
rm -f strdayact.txt
cleartool setview sheriff_Domain_Release_view
cleartool describe stream:Domain_Release_int@/vobs/ | grep “CR00*” > temp.log
tac temp.log >> strallact.log
while read -r var;
do
cr=$(echo $var | cut -c1-10)
echo $cr
today=$($echo date +”%Y-%m-%d”)
echo $today
cleartool descr -l activity:$cr@/vobs/ > acttemp.log
if grep -q “$today” acttemp.log; then
cat acttemp.log >> strdayact.txt
else
break
fi
done < strallact.log
rm *.log
exit 0

DOS

findstr /S “string1” “string2” c:\users\sheriff\*.txt > sher.txt
DOS port usage
Display all ports – netstat -n
Display a specific port – netstat -n | find “2810”
DOS Runas
C:\Users\Sheriff>runas /noprofile /user:db2admin “C:\Program Files (x86)\IBM\SQLLIB\BIN\db2cw.bat”
Enter the password for db2admin:
Attempting to start C:\Program Files (x86)\IBM\SQLLIB\BIN\db2cw.bat as user “db2admin” …

WAS

The below setting was used to terminate long running queries that was triggered from the transaction after 120 seconds.

webSphereDefaultQueryTimeout = 120 (In seconds)
syncQueryTimeoutWithTransactionTimeout = false

(Or)

webSphereDefaultQueryTimeout = 0(In seconds)
syncQueryTimeoutWithTransactionTimeout = true

Run as admin from cmd window

cd c:\IBM\WebSphere\AppServer\bin
manageprofiles -delete -profileName AppSrv01
manageprofiles -validateAndUpdateRegistry

manageprofiles -create -profileName AppSrv01 -profilePath “C:\IBM\WebSphere\AppServer\profiles\AppSrv01”

MISC

sonar-runner -Dsonar.sources=”C:\MDM\Workspaces\Release10\CustomExtensionModule”

Excel
COUNTIF(B:B,B2)

Add comma to end of column text

=”‘”&A1&”‘,”
— Excel Macro to save multiple tabs in a sheet to multiple csv files
Public Sub SaveWorksheetsAsCsv()
Dim WS As Excel.Worksheet
Dim SaveToDirectory As String

SaveToDirectory = “C:\”

For Each WS In ThisWorkbook.Worksheets
WS.SaveAs SaveToDirectory & WS.Name, xlCSV
Next

End Sub

Castor XML Code Gen
Usage: -i schema filename -is input source for XML schema [-package package name] [-dest destination directory] [-resourcesDestination resources destination directory] [-line-separator (unix | mac | win)] [-f ] [-h ] [-verbose ] [-fail ] [-nodesc ] [-gen-mapping mapping filename] [-types types] [-type-factory collections class name] [-nomarshall ] [-testable ] [-sax1 ] [-binding-file filename] [-generateImportedSchemas ] -case-insensitive  -nameConflictStrategy  [-classPrinter ] [-useOldFieldNaming ]
-i C:\Users\sheriff\Schema.xsd -dest C:\Users\sheriff\SherCastor\src -package com.sher.xml.model -binding-file C:\Users\sheriff\SherCastor\xml\binding.xml
java -cp %classpath% org.exolab.castor.builder.SourceGeneratorMain -i Schema.xsd -package test
java -cp %classpath%;.; org.exolab.castor.builder.SourceGeneratorMain -i Schema.xsd -package com.sher.cem.xml.model

set classpath = c:/progra~2/castor-1.3.3/castor-1.3.3-codegen.jar;c:/progra~2/castor-1.3.3/castor-1.3.3.jar;c:/progra~2/castor-1.3.3/castor-1.3.3-core.jar;c:/progra~2/castor-1.3.3/castor-1.3.3-ddlgen.jar;c:/progra~2/castor-1.3.3/castor-1.3.3-jdo.jar;c:/progra~2/castor-1.3.3/castor-1.3.3-xml.jar;c:/progra~2/castor-1.3.3/castor-1.3.3-xml-schema.jar;
java -cp %classpath%;.; org.exolab.castor.builder.SourceGeneratorMain -i C:\Users\sheriff\schema.xsd -dest C:\Users\sheriff\Yard\src -package test -binding-file C:\Users\sheriff\Yard\subbinding.xml

XML Schema Validation

WebSphere Version Check

/apps/IBM/WebSphere/AppServer/java/jre/bin/java com.ibm.xml.xlxp.scan.Version
/apps/IBM/WebSphere/AppServer/java/jre/bin/java org.apache.xalan.Version
/apps/IBM/WebSphere/AppServer/java/jre/bin/java org.apache.xml.serializer.Version
/apps/IBM/WebSphere/AppServer/java/jre/bin/java org.apache.xerces.impl.Version
/apps/IBM/WebSphere/AppServer/java/jre/bin/java -version
/apps/IBM/WebSphere/AppServer/bin/versionInfo.sh

Manual Heap Dump Windows
wsadmin>set objectName [$AdminControl queryNames WebSphere:type=JVM,process=server1,node=Node01,*]
WebSphere:name=JVM,process=server1,platform=proxy,node=Node01,j2eeType=JVM,J2EEServer=server1,version=7.0.0.27,type=JVM,mbeanIdentifier=JVM,cell=Node01Cell,spec=1.0
wsadmin>$AdminControl invoke $objectName generateHeapDump
C:\Program Files (x86)\IBM\SDP\runtimes\base_v7\profiles\AppSrv01\bin\.\heapdump.20140318.192444.10100.0001.phd
wsadmin>

jconsole dumpJavaNameSpace DWLCommonServicesEJB.jar DWLServiceController -report long

WebServices Security

http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken

com.ibm.websphere.security.registry.propagateExceptionsToClient

com.ibm.websphere.ejbcontainer.poolSize
Specifies the size of the pool for the specified bean type. This property applies to stateless, message-driven, and entity beans. If you do not specify a default value, the container default value, 50 and 500, are used.
Set the pool size for a given entity bean as: beantype=[H]min,[H]max [:beantype=[H]min,[H]max…]
The beantype element is the Java EE name of the bean, formed by concatenating the application name, the # character, the module name, the # character, and the name of the bean, that is, the string assigned to the field in the deployment descriptor of the bean. The min and max elements are the minimum and maximum pool sizes for that bean type. Do not specify the square brackets shown in the previous prototype; they denote optional additional bean types that you can specify after the first bean type. Each bean type specification is delimited by a colon (:).
Use an asterisk (*) as the value of beantype to indicate that all bean types are to use those values unless overridden by an exact bean-type specification somewhere else in the string; for example: *=30,100
To specify a default value, omit either the min or max value but retain the comma (,) between the two values; for example:
Dcom.ibm.websphere.ejbcontainer.poolSize=ivtApp#ivtEJB.jar#ivtEJBObject=125,1327

Seer Data Cruncher – Windows Installation

Data Cruncher

Home Page – http://see-r.github.io/SeerDataCruncher/

Download zip file from https://github.com/see-r/SeerDataCruncher/zipball/master

The file contains source code and necessary files for build.

 

MySQL

Version 5.7.22 from https://downloads.mysql.com/archives/get/file/mysql-5.7.22-win32.zip

Extract to a desired location

Shell1 – Run Windows cmd shell as Adminstrator
cd C:\mysql-5.7.22-winx64

mkdir data

bin\mysqld –initialize –console
alter user ‘root’@’localhost’ identified by ‘root’; — Write this line to init.txt
bin\mysqld –init-file=C:\mysql-5.7.22-winx64\init.txt
delete init.txt

Shell2 – Run a new Windows cmd shell as Adminstrator
mysql -u root -p <new password set in init.txt>
create database datacruncher;

 

Maven

http://www-us.apache.org/dist/maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin.zip

Extract to a preferred directory and add to path environment variable

For example, add C:\apache-maven-3.5.4\bin to Path

 

DataCruncher Build

Edit C:\datacruncher\src\main\resources\META-INF\persistence.xml to change the password of MySQL to the one set earlier

cd C:\datacruncher

mvn install -DskipTests

War file should be created in C:\datacruncher\target\SeerDataCruncher-1.1.war

 

Apache Tomcat

Download from http://www-us.apache.org/dist/tomcat/tomcat-8/v8.5.34/bin/apache-tomcat-8.5.34-windows-x64.zip

Extract to a desired location

Edit C:\apache-tomcat-8.5.34\conf\tomcat-users.xml to include the below content

<role rolename=”manager-gui”/>

<role rolename=”manager-script”/>
<user username=”tomcat” password=”s3cret” roles=”manager-script”/>

Shell1 – Run Windows cmd shell as Adminstrator

cd C:\apache-tomcat-8.5.34\bin

startup

Access http://localhost:8080/ in browser

 

Install WAR

Stop tomcat (CTRL + C on Shell)

Copy war file to C:\apache-tomcat-8.5.33\webapps

Start tomcat

Access DataCruncher from http://localhost:8080/SeerDataCruncher-1.1/