Minimum moves to segregate even followed by odd elements in Array

Introduction This tutorial will find out minimum moves to segregate even followed by odd elements in an Array using Java programming language. The function will put all even numbers first, and then odd numbers and finally count the number of moves required to arrange all elements in the desired order. This example also works on duplicate elements but does not…

Return array of products of all other numbers from a given array

Introduction This tutorial will show you how to return array of products of all other numbers from a given array. Let’s say you are given an array of non-zero integers. So you have to return an output array of products of all other numbers except the number itself.

Finding Start and End Index of an element in a sorted Array using Kotlin

Finding start and end index of an element in a sorted array using Kotlin programming language will be shown here. The array may contain duplicate elements and we will see how to find a start and end index for an element in this array elements. We may design the algorithm for finding start and end index of an element in…

How to setup Liquibase in Spring for Multiple DataSources

Introduction In this tutorial I will show you how to setup Liquibase in Spring for multiple datasources. In my previous tutorial I had shown how to setup multiple datadources in Spring Boot application. Here also I am going to create a Spring Boot application to define multiple datasources and will use these datasources into Liquibase. I had created examples using XML…

SOLID Design Principle Explained with Java

Introduction SOLID design principle is one of the most popular set of design principles in object-oriented software development. It’s a mnemonic acronym for the following five design principles: S – Single Responsiblity Principle O – Open Closed Principle L – Liskov Substitution Principle I – Interface Segregation Principle D – Dependency Inversion Principle

Real Time Face Detection in Webcam using Python 3

Introduction Real time face detection in webcam using Python 3 will show you how your working webcam detects your face and draws a rectangle around your face. In my previous tutorial we have seen how you see yourself in webcam using Python. The similar tutorial we will use here to detect your face and draw a rectangle around it to…

Define Multiple DataSources in Spring Boot

Introduction This tutorial will show you how you can define multiple datasources in Spring Boot application. I had shown how to define multiple datasources in Spring application, but here I will define multiple datasources in Spring Boot application. There may be situations where you need to define multiple datasources in Spring Boot application. For instance, you may need to define…

Mock ObjectMapper.readValue() using Junit Mockito

Introduction This example will show you how to mock ObjectMapper.readValue() using Junit Mockito. When we write Junit test cases or classes, we generally do not test on real object that are injected into the class that has to be tested using Junit to avoid any test case failure at some point, instead we want to test the business logic out…

See Yourself in Webcam using Python 3

Introduction The tutorial, see yourself in webcam using Python 3, will show yourself in front of the webcam as a video motion. In this example we will capture the video in front camera in the same way you see yourself in front of the mirror. Make sure you do have the camera installed in your system in order to see…

Mock an Autowired @Value field in Spring with Junit Mockito

Mock @Value Field The below example will show you how to mock an Autowired @Value field in Spring with Junit Mockito. Generally you read some configuration values from properties file into Spring bean or component class using @Value annotated attributes but when you want to test such service or component class using Junit test class then it is required to…