Posts

Go Language Program to Display Fibonacci Series

Image
In the Fibonacci series, the next number is the sum of the previous two numbers for example 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 etc.  Example 1. Go Program to Display Fibonacci Series, //Go Program to Display Fibonacci Series package main import "fmt" // Main function func main() { number := 12 PrintFibonacci(number) } func PrintFibonacci(number int ) { fmt.Println( "Fibonacci Series till " , number, " terms:\n" ) firstTerm := 0 secondTerm := 1 for i := 1 ; i <= number; i++ { fmt.Print(firstTerm, ", " ) // compute the next term nextTerm := firstTerm + secondTerm firstTerm = secondTerm secondTerm = nextTerm } fmt.Println( "\n " ) } Output: Example 2. Input number from standard input, //Go Program to Display Fibonacci Series package main import "fmt" // Main function func main() { var number int fmt.Println( "Enter an integer val

Kotlin + Spring Boot + Apache Commons Export Data to CSV Example

Image
 Hello everyone, today we will learn how to export and download the data as a CSV file in a Kotlin + Spring Boot project. CSV stands for Comma-Separated-Values and it's a common format for doing a bulk data transfer between systems. For creating and parsing CSV files, we will use Apache Commons' 3rd-party library.  Project Directory: Technologies used: Kotlin Spring Boot Apache Commons Spring Data JPA H2DB Maven Maven[pom.xml] <? xml version ="1.0" encoding ="UTF-8" ?> < project xmlns ="http://maven.apache.org/POM/4.0.0" xmlns: xsi ="http://www.w3.org/2001/XMLSchema-instance" xsi :schemaLocation ="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" > < modelVersion > 4.0.0 </ modelVersion > < parent > < groupId > org.springframework.boot </ groupId > < artifactId > spring-boot-starter-parent </ artifactId >

Kotlin + Spring Boot + OpenCSV Export Data to CSV Example

Image
Hello everyone, today we will learn how to export and download the data as a CSV file in a Kotlin + Spring Boot project. CSV stands for Comma-Separated-Values and it's a common format for doing a bulk data transfer between systems. For creating and parsing CSV files, we will use OpenCSV 3rd-party library. Project Directory Technologies used: Kotlin Spring Boot OpenCSV Spring Data JPA H2DB Maven Maven[pom.xml] <? xml version ="1.0" encoding ="UTF-8" ?> < project xmlns ="http://maven.apache.org/POM/4.0.0" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi :schemaLocation ="http://maven.apache.org/POM/4.0.0  https://maven.apache.org/xsd/maven-4.0.0.xsd" > < modelVersion > 4.0.0 </ modelVersion > < parent > < groupId > org.springframework.boot </ groupId > < artifactId > spring-boot-starter-parent </