Posts

Showing posts from 2021

Angular | Create Custom Pipes

                   Angular  | Create Custom Pipes   Our applications may have a lot of data for presentation, But for creating a good user experience it is preferable to see in a more understandable format like March 12, 2010 is better to read then Mon Mar 12 2010 15:23:40 GMT-0700 (Pacific Daylight Time). This Angular post is compatible with Angular 4 upto latest versions, Angular 7, Angular 8, Angular 9, Angular 10, Angular 11 & Angular 12 For such small and repeated tasks of transforming values in other formats we used to use Filters in AngularJS version 1, But after Angular 2 we have pipes which serve similar tasks and once defined can be used anywhere in the application. We will discuss more Pipes using Angular’s latest stable version 7. How to Create Simple Custom Pipes? First, create a new Angular application by running following in CMD Prompt using Angular CLI. Install NodeJS then Angular CLI as follows $ npm instal...

Java Generic

Image
                                                                   Java Generic  Basic Examples   Generic Class Example: NEW In this example, Box is a generic class that can hold a value of any type. The <T> in Box<T> is a type parameter, and it represents the type that will be specified when creating an instance of the Box class. Here's how you can use it:   Generic Class Example with supper class:  NEW In this example: We have a generic class called StorageBox<T>, which extends a non-generic superclass Box<T>. T is the type parameter that is inherited from the superclass. The StorageBox class has an additional field called storageLocation to store information about the storage location of the item. The constructor of StorageBox takes both the value and the storage location a...

Kafka - Kafka Streams vs. Kafka Consumer

Image
Kafka Streams vs. Kafka Consumer 1. Introduction Apache Kafka  is the most popular open-source distributed and fault-tolerant stream processing system. Kafka Consumer provides the basic functionalities to handle messages.  Kafka Streams  also provides real-time stream processing on top of the Kafka Consumer client. In this tutorial, we'll explain the features of Kafka Streams to make the stream processing experience simple and easy. 2. Difference Between Streams and Consumer APIs 2.1. Kafka Consumer API In a nutshell,  Kafka Consumer API  allows applications to process messages from topics.  It provides the basic components to interact with them, including the following capabilities : Separation of responsibility between consumers and producers Single processing Batch processing support Only stateless support. The client does not keep the previous state and evaluates each record in the stream individually Write an application requires a lot of code No ...

JavaBeans vs Spring beans vs POJOs

JavaBeans vs Spring beans vs POJOs JavaBeans : At a basic level, JavaBeans are simply Java classes which adhere to certain coding conventions. Specifically, classes that 1) have  public  default (no argument) constructors 2) allow access to their properties using accessor (getter and setter) methods 3) implement  java.io.Serializable Spring Beans : A Spring bean is basically an object managed by Spring. More specifically, it is an object that is instantiated, configured and otherwise managed by a  Spring Framework  container. Spring beans are defined in Spring configuration files (or, more recently, with annotations), instantiated by Spring containers, and then injected into applications.     Note that Spring beans need not always be JavaBeans. Spring beans might not implement the  java.io.Serializable  interface,  can have arguments in their constructors , etc. This is the very basic difference between JavaBeans and Spring beans. For m...