JAVA 8 / NOTES</>↗Java 828 Dec 2023
You can sort strings based on their length using the sort method combined with a custom comparator. In the code snippet below we are going to use the Arrays.sort() method. We pass an array of string to the sort() method and also a lambda expression as the custom comparator. Here is how you’d do it […]
JAVA 8 / NOTES</>↗Java 823 Dec 2023
In the previous example, How do I convert an image file to a Base64 string?, you’ve seen how to convert image file to base64 string. In this example, you will see how you can convert a base64 string back into an image file. Below are examples of how to do this in Java, using the […]
JAVA 8 / NOTES</>↗Java 822 Dec 2023
A Base64 string is a way of encoding binary data using 64 printable characters, which are the 26 uppercase letters of the English alphabet, the 26 lowercase letters of the English alphabet, the 10 numerical digits, and the “+” and “/” symbols. This makes a total of 64 distinct characters, hence the name “Base64”. Base64 […]
APACHE POI / NOTES</>↗Apache POI09 Dec 2023
Apache POI is a robust open-source library that provides APIs for manipulating various file formats based upon the Office Open XML standards (OOXML) and Microsoft’s OLE2 compound document format (OLE2). Being Java-based, it’s readily used by Java developers for creating, reading, and modifying Excel files. To create a new Excel file using Apache POI, you […]
UBUNTU / NOTES</>↗Ubuntu08 Dec 2023
To scp between two remote hosts, you typically need to be logged into one of the hosts and execute the scp command there. The general format is like this: scp <user>@<source_host>:<source_file_path> <user>@<destination_host>:<destination_file_path> Suppose, you are logged into host1, and you want to copy a file from host2 to host3. First, make sure that the key-based […]
APACHE POI / NOTES</>↗Apache POI08 Dec 2023
First of all, make sure that you have the Apache POI library included in your project. If you are using Maven, you can add the following to your pom.xml: Maven Dependencies <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>5.2.5</version> </dependency> Then, you can use the following code to create an Excel .xlsx file: package org.kodejava.poi; import org.apache.poi.ss.usermodel.*; import org.apache.poi.xssf.usermodel.XSSFWorkbook; […]