Simple Project on Spring Boot, Ngnix, Certbot, Docker, MySQL

In this article, we explain how to start a simple project with Spring Boot, Ngnix, Certbot, and MySQL. Working with Ngnix Ngnix installation can be done with the following command. There is a simple configuration for the website. As you can see the Ngnix server works as a load balancer between 8080 and 8090 ports of backend services. Restart Ngnix. In this case you can be sure that all configuration is ok. Working with Certbot These software we need to provide SSL connection between the client’s browser and our server.…

Read More

WireGuard VPN Installation by Wizard

wireguard vpn

WireGuard is a fast, modern, secure VPN tunnel. You can set up your server in several clicks with a help of specific wizards. See the instructions below. How to get Started? Download the installation script https://github.com/Nyr/wireguard-install. Launch the script. Then follow the interactive instructions of the wizard. How to Setup Client on Mac OS? Install the WireGuard client for your OS. In my case, it’s Mac OS. The installation is here. Additional Restriction with Torrents Please, remember if you download by torrent some materials covered by copyright some consequences may…

Read More

Java String substring() Method

substring in Java

Often programmers need to extract substrings from String objects in Java. It’s possible by the String class substring() method. As we had written before the substring() methods are the part or String class where objects are immutable. Further in this article, we will dig into the internal structure of the substring() method with all related aspects. How to Extract a Substring of String in Java The main functionality is represented by two methods, see them below. What is About Immutability of Substrings? As we can see from the internal code…

Read More

Comparing Strings in Java

There are three approaches to how to compare strings in Java. Java String CompareTo(), Equals() methods and comparing by reference by == operator. The first two methods compare the string on the basis of content but the last one is by reference. Compare String in Java by Equals() Method The String class provides two methods for comparing. See please below. The strings compare are different depending on what method we use, see the example below. Compare String with CompareTo() Method When we use the method CompareTo() Java analyzes the strings…

Read More

JDBC Transaction Management in Java

Java has a lot of units dedicated to interacting with databases. One of them is the JDBC unit, which means an abbreviation of Java Database Connection. The main purpose of JDBC is to provide a connection to the database via a specific driver with a special set of SQL statements and commands. By default, each operation with a database has a unique JDBC transaction. It means that each SQL operation will be called with the command Commit. JDBC Auto-Commit. How to Disable? As we discussed before that JDBC auto-commit mode…

Read More

Shorten URL with CatCut API

Today’s web provides many opportunities to shorten links. Short links can be useful for a variety of purposes, such as sending them to messengers or posting them on social networks. Therefore, we suggest shortening links in a few clicks with CatCut.net. In parallel, you can make money as well. Links often contain a lot of extra information or special characters. Specifically, this information is not useful and as a result, these links have a lot of space in the messages or on Web pages. How to Shorten a Link in…

Read More

Polymorphism in Java

What is Polymorphism Polymorphism – this term comes from ancient Greek and means “poly” – many, “morphos” – forms. In this case, polymorphism means many forms. Polymorphism is one of the basic foundations of object-oriented programming. You can read about object-oriented programming here. Polymorphism in Java Polymorphism in Java is represented comprehensively. There are two forms of polymorphism: compile time and runtime. The language syntax also supports overloading and the ability to rewrite methods. Java polymorphism involves multiple implementations of one of the interfaces. The code may work very differently,…

Read More

Advanced Immutable Objects in Java

What are Immutable Objects in Java? These objects are multifunctional and immutable that can be used in different parts of the program. For example, they can be used in a multithreaded environment to work with data. They can also be complex constants that help to avoid unnecessary memory usage and garbage collector overloading. Separately we should mention immutability when working with collections. The Main Parameters of Immutable Classes The class is immutable if it follows the following criteria: Practical Use of Immutable Objects In practice, immutability allows to build of…

Read More

JVM Structure Overview. Memory Distribution

The JVM greatly simplifies and automates memory handling in Java programs. The programmer simply declares variables without even worrying about how the occupied memory will be freed. Although in some cases a random memory leak can occur, where the program will just start devouring memory in large amounts, in most cases everything happens automatically and without problems. Memory Types Allocation Generally speaking, the JVM allocates memory into a stack and a heap. Every Java program has at least one parent process and every process has one main thread. In turn,…

Read More

Optional in Java Overview

Java Optional – represents a container object that may or may not contain a non-null value. If the value is present isPresent returns true otherwise false will be returned and the object will be considered empty. Previously, we wrote about immutable objects, which are also used under the hood of optionals. Initialize Java 8 Optional The optional can be initialized using the static constructor as follows: If you put a null value to such a constructor, a java.lang.NullPointerException will occur. You can use the ofNullable method to safely pass an…

Read More