UBUNTU / CATATAN</>↗Ubuntu08 Des 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 / CATATAN</>↗Apache POI08 Des 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; […]
MAVEN / CATATAN</>↗Maven07 Des 2023
To compile and execute a JDK preview features with Maven, you need to add in the following configurations in your pom.xml file: Compiler Plugin: The configuration should specify the JDK version and enable the preview features. It should look similar to this: <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.1</version> <configuration> <release>21</release> <compilerArgs>–enable-preview</compilerA...
JAVA 8 / CATATAN</>↗Java 807 Des 2023
If you have a collection of objects and want to sum one of their properties using the Java Stream API, you need to use the map() function to convert each object into the value of its property and then use the reduce() function to sum all the values. Here is an example where we have […]
GENERAL / CATATAN</>↗General18 Nov 2023
In this Tutorial, we will learn about how to read a file in Java. File manipulation is a fundamental aspect of programming, especially when dealing with data processing and storage. Java provides robust libraries and classes to handle file operations efficiently. In this in-depth tutorial, we will explore the various techniques and best practices for […]
JAVA DATE TIME API / CATATAN</>↗Java Date Time API04 Okt 2023
The following code snippet shows you how to iterate through a range of dates in Java. We use the Java Date Time API. We do increment and decrement iteration using a simple for loop. Here are the steps: We declare the start and end date of the loop, the dates are instance of java.time.LocalDate. Create […]