Useful commands for SSL certificates

Reading Time: 2 minutesGenerate self signed certificate and export to truststore 1. Generate a certificate using keygen command in windows keytool -genkey -alias myAlias -keyalg RSA -sigalg SHA256withRSA -keystore keystore.jks -validity 10950 2. Self certify the csertificate keytool -selfcert -alias mycert-20161109 -keystore keystore.jks -validity 3950 3. Export certificate to folder keytool -export -alias myAlias -keystore keystore.jks -rfc -file

Read More

Linux commands

Reading Time: 1 minuteLinux commands that I frequently use Open a file sudo vim server.log Open a log file and display the last 10 lines tail -f /opt/keycloak/standalone/log/server.log Exit vim without saving Press Esc Press “:” Press “q!” Save and exit vim Press Esc Press “:w” Press “:x” Copy a file from source to destination directory sudo cp

Read More

Dockerizing Spring Boot Application

Reading Time: 3 minutesIn my previous post, I mentioned about How to run docker container on your local machine. This post is about the dockerizing backend part of the Nutrition Tracking Application. We will follow these steps: Building Spring Boot project Writing a Dockerfile Building and running docker image Step 1: Building Spring Boot project mvn clean packagewill produce a

Read More

Java 8 Optionals for Null Objects

Reading Time: 2 minutesIn my previous post, I mentioned about refactoring techniques including testing interface for null checks. I have recognized that there is an alternative for it while reading Java 8 in Action: Lambdas, streams, and functional-style programming. Optional Class If there is an object that might contain a null value, we can use Optional to wrap the

Read More

Inner Classes

Reading Time: 1 minuteHi, This post is about Inner Classes, which could be useful when you are learning Lambda Expressions and Functional Programming in Java 8. Member Inner Class They can access private variables of outer class. public class MemberInnerClass { private int outer = 5; class Inner { private int inner = 10; public void print() {

Read More

Class Initialization

Reading Time: 2 minutesToday, I will briefly mention about the class initialization. When we execute any java program (e.g.: java InitTest), Java Virtual Machine loads and link the class, execute initializers, and invokes the main class. Initialization process has some rules. Before we go into the details, spend a few minutes to figure out the output. class SuperClass { static { System.out.print(“0

Read More

Core Java APIs

Reading Time: 5 minutesHi, In this post, I will cover a some of the Core Java APIs (String, StringBuilder, Wrapper classes, and Date Time API) that we are responsible for Java 8 Programmer I exam. Immutability I think the first thing that we need to know is immutability. String class is immutable, meaning that the state of the

Read More

Java Exceptions

Reading Time: 2 minutesHi, This section is about exception handling in Java. I will try to cover as much use cases as I can. The best way to learn exceptions is to play with different exception types, especially handling multiple exceptions, by yourself. We are responsible for following specific classes for Java 8 Programmer I exam: Error, Unchecked

Read More

Numeric Promotion

Reading Time: 2 minutesHi all, In this post, we will cover numeric promotion in Java. Make sure that you know the bit-length of each primitive types before you proceed. 8-bit 16-bit 32-bit 64-bit byte short, char int, float long, double Assume that you add, subtract, multiple, or divide two primitive types. Should you care about the resulting data

Read More