Parallelism Example in Java Stream API

I am going to show you how to work with parallel stream in Java 8 or higher version of Java. In parallel computing a task is divided into sub-tasks and these sub-tasks are computed parallelly in each separate threads and finally the result of the solution for each sub-tasks is combined. One of the features for computing parallelism is to use Java’s join/fork framework, where you need to mention how the particular task will be sub-divided or partitioned into sub-tasks. The main difficulty for parallel computing in applications is the…

Continue

Spring Data JPA @NamedQuery and @NamedQueries Example

Spring Data JPA provides multiple ways of selecting or fetching data from database server and one of the ways is using @NamedQuery or @NamedQueries. @NamedQuery and @NamedQueries can be created using XML configuration, external properties file or using Java based annotation config. Spring Data JPA supports both JPQL and SQL native named queries. Here I am going to show you examples on @NamedQuery and @NamedQueries. I am also going to use named parameter and positional parameter in the named queries. In XML configuration you need to use <named-query/> and for…

Continue

How to use AJAX in React HTTP GET Request without using Third Party Library

Here I am going to show you how to use AJAX in React HTTP GET request without using Third Party library. To do this I am going to use XMLHttpRequest for fetching data instead of Fetch API (fetch()). AJAX is an acronym that stands for Asynchronous JavaScript and XML. The Fetch API provides an interface to fetch resources from the server. This Fetch API is similar to the XMLHttpRequest but the new Fetch API provides more powerful and flexible feature set.

Continue

How to setup CodeIgniter 4 manually

Here I am going to show you how to setup CodeIgniter 4 manually in your local environment. CodeIgniter framework version 4 is still under development and its size has been reduced significantly from its previous version. CodeIgniter 4 framework is intended to work with minimum version of PHP 7.2. You can also check the installation guide for other ways. PHP based CodeIgniter framework enables developers to develop the projects much faster, it provides the core part that can easily be extended or replaced completely to make the system work smoothly.

Continue

Single and Multiple Files Upload Example in Django REST API

Most of the applications require at least one file needs to be upload for a reason, such as, for uploading bulk data or processing file data for business requirement. This example will show you how to upload single or multiple files using Django REST framework. REST is an acronym that stands for Representation State Transfer which works on http/https protocol. It is light weight and delivers data very fast. I am assuming you have a basic knowledge on Python and Django REST framework before you proceed further down. I am…

Continue

How to avoid jQuery namespace collisions using noConflict() function

Here I am going to tell you how you can avoid namespace collision on the DOM (Document Object Model) page. You can load jQuery either via CDN (Content Delivery Network) link or by downloading the jQuery from the website and put it into your application and include in your web page. So whatever method you follow to use the jQuery library (CDN or local), this introduces the $, as a global variable, an alias for the jQuery function and namespace.

Continue

What are jQuery selectors and how to cache jQuery selectors to improve performance of your web page

Every time you use a selector the elements in Document Object Model (DOM) are searched to match your query or selector. Doing this kind of works too often or repeatedly will decrease the performance of your web page. If you refer to a specific selector too often or repeatedly you should consider to add it to a cache by assigning to a variable. Before diving into the actual example I am going to first tell you, what are elements and what are selectors?

Continue

Single or Multiple Files Upload Example in Django Framework

In your application or project there is always a requirement for uploading a file data. This file data could be in a specific format depending on your requirement. Here I am going to explain you how you can upload single or multiple files in your python based Django framework. I am assuming you have a basic knowledge on Python and Django framework before you proceed further. I am also going to show you how to implement CSRF token for uploading files.

Continue

MongoDB Aggregation Operations

You are not going to always return records from MongoDB but sometimes you need to perform some computations such as sum, count, average, etc. Here you need the aggregation operations which are used to process data that return the computed results. Therefore aggregation actually groups data from multiple documents and performs a variety of operations on the grouped data to return the single result. Aggregate operations retrieve a single value after performing a calculation on a set of values. Often aggregate functions are accompanied by group clause in the find()…

Continue

MongoDB find() method with Projection

You may not want to fetch a whole bunch of data from the document which is stored in a collection in your MongoDB database. You can restrict the number of records or data using different conditions with the help of WHERE, AND, OR and IN operators, but what if you want to restrict the data you want in your particular row or record or document. So here comes the projection that helps you to selectively choose data from a record or row or document. In MongoDB, projection means selecting only…

Continue