Articles on Trending Technologies

Technical articles with clear explanations and examples

How does Hibernate Second Level Cache Works?

Manu
Manu
Updated on 26-Aug-2022 2K+ Views

Caching helps to reduce database network call, for executing queries. First level cache is linked with a session. It is implemented implicitly. First level cache exist only till the session object is there. Once session object is terminated/closed, there will be no cache objects. Second level cache works across multiple sessions objects. It is linked with a session factory. Second level cache objects are available to all the session in a single session factory. These cache objects are terminated when that particular session factory is closed. Implementing second level caching We need to add the following dependencies in order to ...

Read More

Swift Program to find the area of the rectangle

Ankita Saini
Ankita Saini
Updated on 26-Aug-2022 885 Views

This tutorial will discuss how to write a Swift program to find the area of the rectangle. A rectangle is a quadrilateral or a closed two-dimensional shape with four sides. All the angles of a rectangle are equal (90 degrees) and the opposite sides are equal and parallel with each other.The area of the rectangle is known as the total space enclosed inside the boundaries of the rectangle. We can calculate the area of the rectangle by multiplying the length and width. Formula for Area of Rectangle Following is the formula for the area of the rectangle − Area = ...

Read More

How to Display all Prime Numbers from 1 to N in Golang?

Aman Sharma
Aman Sharma
Updated on 26-Aug-2022 2K+ Views

In this tutorial, we will learn how to print the prime numbers from 1 to N where N the value of N will be as an input from the user. Just a short brief about Prime numbers is that the Prime numbers are something which can be only divisible by 1 or itself. In this tutorial, we are going to discuss two approaches one which will take O(N^2) of time and the other will take O(N*log(logN)). Method 1 Time Complexity: O(N^2) Space Complexity: O(1) Algorithm STEP 1 − Declaring the number N of type int32 STEP 2 − Take ...

Read More

How to get Input from the User in Golang?

Aman Sharma
Aman Sharma
Updated on 26-Aug-2022 9K+ Views

In this tutorial, we will see how to get the input from the user in Golang. Golang has a library that consists of an input/output function which helps in printing and taking the output. The function to take the input is Scanln(). Algorithm For Taking Integer Input with User STEP 1 − We are importing the fmt package that has the input/output functions. STEP 2 − We are declaring a variable after that we are printing the lines to ask the user to give the input STEP 3 − Then using fmt.Scanln() we are taking the input and storing ...

Read More

How to Swap Two Numbers in Golang?

Aman Sharma
Aman Sharma
Updated on 26-Aug-2022 4K+ Views

In this tutorial, we will discuss swapping two numbers in Golang. We will cover two approaches: first swapping two numbers within the function and second creating a different function. Swapping two numbers within the function Algorithm STEP 1 − Defining the variables that we want to Swap. STEP 2 − Initializing the variables. STEP 3 − Swapping the two variables within the function. STEP 4 − Print the variables after swapping. Example package main // fmt package provides the function to print anything import "fmt" func main() { // define the variables we ...

Read More

How to Display Alphabets (A to Z) using a loop in Golang?

Aman Sharma
Aman Sharma
Updated on 26-Aug-2022 2K+ Views

In this tutorial, we are going to print the alphabet from A to Z. The logic we are going to use to print the alphabet is ASCII values. Every symbol, alphabet, or number has a unique ASCII value using which we can print the Alphabets using a loop. The ASCII value of A is 65 and the ASCII value of Z is 90. A = 65B =66C = 67.....Z = 90 Algorithm STEP 1 − First we are declaring an integer with the ASCII number of A i.e 65. STEP 2 − Then we are running a ...

Read More

How to add two Complex numbers in Golang?

Aman Sharma
Aman Sharma
Updated on 26-Aug-2022 946 Views

In this tutorial, we will learn how to declare and add complex numbers in Golang. Complex numbers are something that has an imaginary and real part which will make them different from other types of numbers. Golang supports declaring a variable of complex number type. Complex Number = Real Number + Imaginary Number Different ways to declare and initialize complex numbers and add them later in Golang. Initializing using complex number init syntax Syntax var variableName complex64 var variableName complex128 variableName = (realValue) ...

Read More

How to add Two Binary Strings in Golang?

Aman Sharma
Aman Sharma
Updated on 26-Aug-2022 2K+ Views

This tutorial will show how we can add two binary strings in Golang. Also, we will cover and understand all the cases while adding two strings using examples. Example Suppose we want to add these two binary strings “111” and “1011” whose numeric values are 7 and 11 whose addition is 18 with binary representation “10010”. Now we will do the addition of these strings step by step below.variables with the respective values you want to multiply. As you can see the length of string “111” is less than “1011” so we have to make them equal for which ...

Read More

How to Multiply Two Floating-Point Numbers in Golang?

Aman Sharma
Aman Sharma
Updated on 26-Aug-2022 1K+ Views

This tutorial will show how to multiply two float numbers within a function or by creating a separate function and calling it in the current function. Multiplying two float numbers within the function Algorithm STEP 1 − Defining the floating variables that we want to multiply and the floating variable in which we will add the result. STEP 2 − Initialize the variables with the respective values you want to multiply. STEP 3 − Multiply two numbers and store them in the third variable. STEP 4 − Print the result after multiplying two numbers. Example package main ...

Read More

How to Add Two Numbers in Golang?

Aman Sharma
Aman Sharma
Updated on 26-Aug-2022 6K+ Views

In this tutorial, we will discuss adding two numbers in Golang. We will cover two approaches first adding two numbers within the function and second creating a different function. Adding two numbers within the function Algorithm STEP 1 − Defining the variables that we want to add. STEP 2 − Initializing the variables. STEP 3 − Add two numbers and store them in the third variable. STEP 4 − Print the result after adding two numbers. Example 1 In this example, we will add two integers within the function. package main // fmt package provides the function ...

Read More
Showing 43181–43190 of 61,297 articles
Advertisements