package algo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Stack;
public class GraphTraversal {
public static void main(String[] args) {
Map<String, List<String>> graph = new HashMap<>();
List<String> aList = new ArrayList<String>();
aList.add("F");
aList.add("B");
aList.add("C");
graph.put("A", aList);
List<String> bList = new ArrayList<String>();
bList.add("E");
bList.add("A");
bList.add("D");
graph.put("B", bList);
List<String> dList = new ArrayList<String>();
dList.add("E");
dList.add("A");
dList.add("Z");
graph.put("D", dList);
buildPath(graph, "A", "Z");
}
public static void buildPath(Map<String, List<String>> graph, String start, String end){
Set<String> processedNode = new HashSet<>();
Stack<String> stack = new Stack<>();
processedNode.add(start);
stack.push(start);
processPath(graph, processedNode, stack, start, end);
}
public static void processPath(Map<String, List<String>> graph, Set<String> processedNode, Stack<String> stack, String start, String end){
if(start.equals(end)){
System.out.println(stack);
return;
}
List<String> children = graph.get(start);
if(children != null) {
for(String child : children){
if(!processedNode.contains(child)){
stack.push(child);
processPath(graph, processedNode, stack, child, end);
}
}
}
stack.pop();
}
}
Mar 15, 2019
Oct 16, 2017
ORA-01878: specified field not found in datetime or interval
https://stackoverflow.com/questions/22305466/oracle-date-compare-broken-because-of-dst
Aug 18, 2017
How to configure tomcat server with SSL configuration?
1. Create private key and CSR using OpenSSL
openssl genrsa -out www.mydomain.com.key 2048
openssl req -new -sha256 -key www.mydomain.com.key -out www.mydomain.com.csr
2. Submit CSR file to your Certificate Authority to generate & share valid CA certificates.
Valid CA certificates would have following files
a. www.mydomain.com.crt
b. xxxxCARoot.crt
c. xxxxTrustxxx.crt
d. xxxxxxxCA2.crt
3. Bundle CA, CA2 and Trust certificate into single file bundle.crt
4. Generate pkcs12 file using below command and provide keystorePass as 'changeit'
>openssl pkcs12 -export -in www.mydomain.com.crt -inkey www.mydomain.com.key -out www.mydomain.com.p12 -name tomcat -CAfile bundle.crt -caname root -chain
5. Configure tomcat server.xml with below <Connector>
<Connector SSLEnabled="true" keystoreFile="conf/ssl/www.mydomain.com.p12" keystorePass="changeit" keystoreType="PKCS12" port="443" protocol="HTTP/1.1" scheme="https" secure="true" sslProtocol="TLSv1.2"/>
Aug 5, 2017
How to change tomcat 8 port to 80
To run Tomcat on a port below 1024 in Ubuntu/Unix, the service needs root privileges.
And that you do not want. Use a port redirection via iptables
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
And that you do not want. Use a port redirection via iptables
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
Mar 16, 2017
MongoDB SSL connection command
$ mongo --host <hostname> --port <port> --username username --password --ssl --sslPEMKeyFile <filename> --sslPEMKeyPassword <value> --sslCAFile <filename>
Feb 20, 2017
Manage Tablespaces
Create:
CREATE TABLESPACE DATA05 DATAFILE 'D:\app_db12c\oracle\oradata\orcl\sample01.dbf' SIZE 1M AUTOEXTEND ON NEXT 1M;
Extend:
ALTER TABLESPACE DATA05 ADD
DATAFILE 'D:\app_db12c\oracle\oradata\orcl\sample02.dbf' SIZE 1M
AUTOEXTEND ON NEXT 1M;
Delete:
DROP TABLESPACE DATA05 INCLUDING CONTENTS AND DATAFILES;
CREATE TABLESPACE DATA05 DATAFILE 'D:\app_db12c\oracle\oradata\orcl\sample01.dbf' SIZE 1M AUTOEXTEND ON NEXT 1M;
Extend:
ALTER TABLESPACE DATA05 ADD
DATAFILE 'D:\app_db12c\oracle\oradata\orcl\sample02.dbf' SIZE 1M
AUTOEXTEND ON NEXT 1M;
Delete:
DROP TABLESPACE DATA05 INCLUDING CONTENTS AND DATAFILES;
Nov 4, 2016
SQLPLUS command to start oracle pdbs
sqlplus sys/xxxxx as sysdba@pdborcl.xxxx.com
SQL*Plus: Release 12.1.0.2.0 Production on Fri Nov 4 12:07:01 2016
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> SELECT name,open_mode from v$pdbs ORDER BY name;
NAME OPEN_MODE
------------------------------ ----------
PDB$SEED READ ONLY
PDBORCL MOUNTED
SQL> alter pluggable database pdborcl open read write;
Pluggable database altered.
SQL> SELECT name,open_mode from v$pdbs ORDER BY name;
NAME OPEN_MODE
------------------------------ ----------
PDB$SEED READ ONLY
PDBORCL READ WRITE
SQL>
SQL*Plus: Release 12.1.0.2.0 Production on Fri Nov 4 12:07:01 2016
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> SELECT name,open_mode from v$pdbs ORDER BY name;
NAME OPEN_MODE
------------------------------ ----------
PDB$SEED READ ONLY
PDBORCL MOUNTED
SQL> alter pluggable database pdborcl open read write;
Pluggable database altered.
SQL> SELECT name,open_mode from v$pdbs ORDER BY name;
NAME OPEN_MODE
------------------------------ ----------
PDB$SEED READ ONLY
PDBORCL READ WRITE
SQL>
Subscribe to:
Posts (Atom)