Following command can be used to retrieve directory sizes in Linux. Below command returns 5 largest files in any sub directory in /apps/ directory.
find /apps/ -type f -ls | sort -k 7 -r -n | head -5
Sunday, March 24, 2019
Thursday, September 6, 2018
Informix 12.10 docker image (Rest Services)
You can find the docker image for "informix 12.10" database at following location. Informix 12.10 is rest enabled. That means CRUD opreations can be done using rest services without JDBC connectivity.
For demonstration purposes, you can use above docker image as a informix database.
You can use standard http requests to CRUD operations.
insert = POST
get = GET
update = PUT
delete = DELETE etc
Sample requests
Sample Testing
database = test_db
table = test_tbl
table schema = id int(11), name varchar(20)
Insert request
http://192.168.111.132:27018/test_db/test_tbl
{
"id":0,
"name":"sujith"
}
Get request
http://192.168.111.132:27018/test_db/test_tbl
{
{
"id":0,
"name":"sujith"
},
{
"id":1,
"name":"delachithra"
}
}
Update request
http://192.168.111.132:27018/test_db/test_tbl/id/2
{
"id":2,
"name":"test update"
}
Delete request
http://192.168.111.132:27018/test_db/test_tbl/id/2
Monday, August 13, 2018
Retrieve application running on ports in windows
Use netstat command to get application list running on specific ports.
netstat -anob
Run the above command as administrator in command prompt.
netstat -anob
Run the above command as administrator in command prompt.
Thursday, June 21, 2018
Protect PDF using password in iText
When you need to protect PDF files using password, you can use following iText codes to encrypt PDF using passwords.
String ownerPasswd="owner";
String userPasswd="user";
PdfReader reader = new PdfReader("/apps/abc.pdf");
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream("/apps/abc_pw.pdf"));
stamper.setEncryption(userPasswd.getBytes(), ownerPasswd.getBytes(),
PdfWriter.ALLOW_PRINTING, PdfWriter.ENCRYPTION_AES_128 | PdfWriter.DO_NOT_ENCRYPT_METADATA);
stamper.close();
reader.close();
Library versions used,
itextpdf-5.5.10.jar
bcprov-ext-jdk14-1.47.jar
You can use preferred encryption algorithms. Refer documentations.
String ownerPasswd="owner";
String userPasswd="user";
PdfReader reader = new PdfReader("/apps/abc.pdf");
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream("/apps/abc_pw.pdf"));
stamper.setEncryption(userPasswd.getBytes(), ownerPasswd.getBytes(),
PdfWriter.ALLOW_PRINTING, PdfWriter.ENCRYPTION_AES_128 | PdfWriter.DO_NOT_ENCRYPT_METADATA);
stamper.close();
reader.close();
Library versions used,
itextpdf-5.5.10.jar
bcprov-ext-jdk14-1.47.jar
You can use preferred encryption algorithms. Refer documentations.
Wednesday, March 21, 2018
Weblogic certificate issues
"The loading of the trusted certificate list
raised a certificate parsing exception PKIX: Unsupported OID in the
AlgorithmIdentifier object:"
"javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE - A corrupt or unuseable certificate was received"
Above error was raised while accessing https URL in application server. To avoid this error, we have following options.
curl - k https://www.google.com
wget https://www.google.com
Since, this is a valid http request server will install certificate in Linux server and validate requests against it.
"javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE - A corrupt or unuseable certificate was received"
Above error was raised while accessing https URL in application server. To avoid this error, we have following options.
- Install certificate in cacert to trust the certificate (JAVA_HOME/jre/lib/security)
- Install certificate in a key store and refer it
- Install certificate in Linux server
curl - k https://www.google.com
wget https://www.google.com
Since, this is a valid http request server will install certificate in Linux server and validate requests against it.
Sunday, February 18, 2018
java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method
Above error was occurred in Maven project while running application in weblogic server. It can be ignored by modifying pom.xml file as below.
<dependency>
<groupId>axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
<exclusions>
<exclusion> <!-- declare the exclusion here -->
<groupId>org.apache.axis</groupId>
<artifactId>axis-jaxrpc</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
<exclusions>
<exclusion> <!-- declare the exclusion here -->
<groupId>org.apache.axis</groupId>
<artifactId>axis-jaxrpc</artifactId>
</exclusion>
</exclusions>
</dependency>
Monday, October 2, 2017
JAVA application Monitoring using JMX
Your application can be started with following JMX parameter.
-Dcom.sun.management.jmxremote.port=12345
Or
You can set System property as JMX port as follows to enable JMX monitoring.
System.setProperty("com.sun.management.jmxremote.port", 12345);
Then, use VisualVM to monitor your application. You can monitor CPU, Memory, Threads etc using this VisualVM tool.
https://visualvm.github.io/
For more information visit :-
https://dzone.com/articles/java-memory-and-cpu-monitoring-tools-and-technique
-Dcom.sun.management.jmxremote.port=12345
Or
You can set System property as JMX port as follows to enable JMX monitoring.
System.setProperty("com.sun.management.jmxremote.port", 12345);
Then, use VisualVM to monitor your application. You can monitor CPU, Memory, Threads etc using this VisualVM tool.
https://visualvm.github.io/
For more information visit :-
https://dzone.com/articles/java-memory-and-cpu-monitoring-tools-and-technique
Subscribe to:
Posts (Atom)