Need to encode and decode base64 in Java? If so, you’ll see the complete steps to do it.

How to use Base64 encoding and decoding in Java
How to use Base64 encoding and decoding in Java

In principle, an encoder is a way to encode anything as it is, without any line separation. Where output generated is the character set A-Za-z0–9+/, and the decoder rejects any characters outside of that set.

How to encode?

Let’s try it out by encoding a simple String,

String input = "encode test";
String encodedInput = Base64.getEncoder().encodeToString(input.getBytes());
System.out.println("Encode : " + encodedInput);

then the result is,

Encode : ZW5jb2RlIHRlc3Q=

How to decode?

As for returning the encode result to its actual value, you can use getDecoder() by storing it…


Need to save a CSV file using Python? If so, you’ll see the complete steps to save a CSV file using Pandas.

Pandas Save to CSV File
Pandas Save to CSV File

First, please open the editor that will be used, here I use Google Colab.

Then.,

  • import pandas
  • Let’s create a simple data frame that we will export as CSV later.
# Import pandas libraryimport pandas as pd
# initialize list of listsdata = [['Asep', 10], ['Jack', 15], ['Natsu', 14]]
# Create the pandas DataFramedf = pd.DataFrame(data, columns = ['Name', 'Age'])

the result is like this,


Need to read a CSV file using Python? If so, you’ll see the complete steps to import a CSV file into Python using Pandas.

pandas read csv
pandas read csv

First, please open the editor that will be used, here I use Google Colab. As well as the CSV file used. You can find it by looking at the folder icon in the left corner, there is a directory ‘sample_data’.

Then.,

How to read it?

  • import pandas
  • Specify the path of the CSV file to be read.
import pandas as pddf = pd.read_csv (r'Path where the CSV file is stored\FileName.csv')

According to what we have, then we will call…


What Is Spring Boot?
What Is Spring Boot?

Spring Boot is an open-source micro-framework maintained by a company called Pivotal. It provides Java developers with a platform to get started with an auto configurable production-grade Spring application. With it, developers can get started quickly without losing time on preparing and configuring their Spring application.

Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can “just run”.

What’s the Difference Between Spring and Spring Boot?

  • Spring is a Java framework that makes it easier for programmers to create a Java application by implementing one of them is the design pattern: dependency-injection. …

Reserved Word
Reserved Word

Here is a list of keywords in the Java programming language. You cannot use any of the following as identifiers in your programs. The keywords const and goto are reserved, even though they are not currently used. true, false, and null might seem like keywords, but they are literals; you cannot use them as identifiers in your programs.

  • abstract
  • assert
  • boolean
  • break
  • byte
  • case
  • catch
  • char
  • class
  • const
  • default
  • do
  • double
  • else
  • enum
  • extends
  • false
  • final
  • finally
  • float
  • for
  • goto
  • if
  • implements
  • import
  • instanceof
  • int
  • interface
  • long
  • native
  • new
  • null
  • package
  • private
  • protected
  • public
  • return
  • short
  • static
  • strictfp
  • super
  • switch

In this post I will create an example of how to replace null with a String using the NVL Function in Oracle.

What is NVL Function?

The NVL function lets you substitute a value when a null value is encountered.

NVL replaces a null with a String. NVL returns the replacement String when the base expression is null, and the value of the base expression when it is not null.

To replace an expression with one value if it is null and a different value if it is not, use NVL2.

Syntax

NVL( params1, replace_with )

with details :

  • params1
    The string to test for…


In this post, I will show you how to upload files to the local directory in Spring Boot.

How to Upload Files to Local Directory in Spring Boot
How to Upload Files to Local Directory in Spring Boot

Preliminary

This post is a continuation of the previous article…

Steps

  • MultipartFile

By using this you can upload files

public ResponseEntity<Object> uploadFile(@RequestParam("file") MultipartFile file) {
// Some Code
}
  • Java File

File handling is an important part of any application, Java has several methods for creating, reading, updating, and deleting files.

The File class from the java.io package, allows us to work with files. To use the File class, create an object of the class, and specify the filename or directory name. …


In this post, I will show you how to add Swagger OpenAPI support to the Spring Boot project so that you can start documenting your REST API.

How to Add Swagger to Spring Boot
How to Add Swagger to Spring Boot

Preliminary

This post is a continuation of the previous article…

Steps

  • Add this to your pom.xml
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.5.2</version>
</dependency>

Next, build and run. You can access this to look the OpenAPI descriptions…

http://localhost:8080/v3/api-docs/

it will appear like this.


In this post, I will show you how to modify the JSON response with ResponseEntity in Spring Boot to handling response.

Custom JSON response with ResponseEntity in Spring Boot
Custom JSON response with ResponseEntity in Spring Boot

Preliminary

This post is a continuation of the previous article so that you don’t get confused, you should see it first.

Steps

Please create a new package with the name ‘response’ in which we will create a class with the name “ResponseHandler”.

This class will later be used to generate responses, where the response will be received in the form of an object with 3 parameters/values ​​in it.

Next, let’s test the results by editing your controller like this.

Asep Saputra

Java Developer at PT Metrodata Electronics Tbk

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store