Difference Between Parallel Stream and CompletableFuture in Java

I am going to discuss here CompletableFuture vs Parallel Stream in Java programming language. CompletableFuture extends Future with added advantage to allow the tasks finish in an ad hoc manner. In Parallel Stream task is divided into sub-tasks and run on separate threads to be completed faster. Both CompletableFuture and Parallel Stream were added in Java 8. I am not going to explain in details about CompletableFuture and Parallel Stream but you can always check the corresponding link to read details. But I am going to tell you in which…

Continue

How to convert Video (MP4/AVI) Clips to GIF in Python

I am going to show you how to convert video (MP4/AVI) clips to gif in Python programming language. Recently I was trying online to convert an avi format video file to gif and I found that there are some limitations: you cannot upload more than 50 or 100 MB file; you need to register or login to the web site to convert your video file. And my requirement was not fulfilled. So I wrote this example. The source code which I am going to show you can be found in…

Continue

AJAX Example with CodeIgniter 4 and MySQL – Check Username Availability

Here I am going to explain how to use AJAX with CodeIgniter 4 and MySQL to check the availability of username on key event. So instead of user waiting at the end of the input form and submitting the form, I am going to let user know immediately whether the username he/she is choosing is available or someone else has already taken. This way user does not have to come to the username input field after submitting the form. So if you give instant result to the user for username…

Continue

Java and XML based JPA Persistence Unit Configurations

Here in this tutorial I am going to tell you how to configure Persistence Unit for JPA (Java Persistence API). Here I am going to show you both XML and Java based configurations for persistence unit in JPA. This is a pure Java application and I am not using Spring framework for this example. A persistence unit defines the details that are required when you acquire an entity manager. To package your EclipseLink JPA application, you must configure the persistence unit during the creation of the persistence.xml file. Define each…

Continue

How to display Date Time in Different Formats in Python

Here I am going to discuss how to display date time in different formats using Python programming language. Python datetime module supplies classes for manipulating dates and times. Date and time objects may be categorized as “aware” or “naive” depending on whether or not they include timezone information. An aware object, such as time zone and daylight saving time information, can locate itself relative to other aware objects. An aware object represents a specific moment in time that is not open to interpretation.

Continue

Spring Boot OAuth2 SSO Example with AWS Cognito

Here in this example I am going to show you how to allow users for OAuth2 SSO (Single Sign On) using AWS (Amazon Web Services) Cognito. I had explained how to do OAuth2 Single Sign On using Spring Boot and GitHub account. Here I am going to use AWS Cognito. You can use any other providers, such as, Google, Facebook, etc. SSO is where a user logs in with single set of credentials (username/password) to gain access to multiple software systems. OAuth is a protocol with which a 3rd-party app…

Continue

CodeIgniter 4 Single and Multiple Files Upload Examples

In this tutorial I will show you how to upload single and multiple files using PHP based CodeIgniter framework 4. In many enterprise applications files upload is an important task for various purposes. CodeIgniter makes working with files uploaded through a form much simpler and more secure than using PHP’s $_FILES array directly. This extends the File class and thus gains all of the features of that class. Using PHP’s $_FILES array super global variable has some major shortcomings when working with multiple files uploaded at once, and has potential…

Continue

Check a Given Date is Past, Today or Future’s Date in Java 8

In this example I am going to show you how to check if an input date is past date or today’s date or future date. I am using Java version 12 and for this example you should use at least Java version 8. Java 8 or higher version provides thread safe version of date time API that can be used safely in multi-threaded environment. If you want to calculate the future or past date by adding or removing days to the input or given date then you can read the…

Continue

How to delete Duplicate Records from MySQL Table

This example will show you how to delete or eliminate duplicate records from a table in database. Keeping duplicate records in a table is unnecessary and it also grows the size of database unnecessary. Removing duplicate records from the table will free the occupied space and enhance also the performance of the query execution. Let’s say you have the following data in your database table. The table name is teacher. The following table has some duplicate records. Now I will show you how to remove duplicates from the below table.

Continue

CodeIgniter 4 Form Validation Example

In this tutorial I am going to show you how to validate form in CodeIgniter 4 framework. CodeIgniter 4 is a PHP based web framework makes your life easier to build the web application quickly right from the scratch. CodeIgniter 4 is still under development and it is supposed to be supported with PHP version 7.2+. I will also tell you how to retain the input values on form so that next time end users do not need to input the same values. Validation is important thing in the world…

Continue