الجمعة، 29 مايو 2020

Java String offsetByCodePoints​() Method Example

1. Java String offsetByCodePoints​() Method Overview

offsetByCodePoints​() method returns the index within this String that is offset from the given index by codePointOffset code points.
Unpaired surrogates within the text range given by index and codePointOffset count as one code point each.

Java String API offsetByCodePoints​() Method Example

1.1 Syntax


Here is the full syntax for this method and part of java.lang package.

public int offsetByCodePoints​(int index, int codePointOffset)

Article on Java Package

Java 8 Stream allMatch() Method Example

1. Introduction


In this tutorial, We will see the example program on Java 8 Stream allMatch() method. allMatch() method checks whether all elements of Stream is matched to the given predicate then it returns true. Otherwise returns false.

Predicate is nothing but a condition.

This is called Terminal Operation because this is executed at the end of the stream. That means Stream is closed after the execution of allMatch() method.


Java 8 Stream allMatch() Method Example


Java 8 Stream allMatch()


الاثنين، 25 مايو 2020

Optional ofNullable() method (With Examples)

1. Introduction


In this tutorial, We'll learn Optional ofNullable() example on how to create new Java 8 Optional object for any value or null value. Optional is part of java.util package.

Java 8 Optional ofNullable() Method Example


API Note: Returns an Optional describing the given value, if non-null, otherwise returns an empty Optional.

الجمعة، 22 مايو 2020

Java Program To Insertion Sort With Example

1. Introduction


Insertion sort is a simple sorting algorithm that builds the final sorted array (or list) one item at a time. It is much more efficient than Bubble Sort and less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or merge sort.

We can implement  Insertion sort using iterative and recursive approach. We will do in this post using Iterative approach. It is easy to understand when compared to recursive.

The insertion sorts repeatedly scans the list of items, each time inserting the item in the unordered sequence into its correct position.

Java Program to Bubble Sort 

Java Program To Insertion Sort With Example

Java 8 Optional orElseGet() Example

1. Introduction

In this tutorial, We'll learn java 8 Optional API orElseGet() method examples and where to use.

2. Syntax


public T orElseGet(Supplier<? extends T> other)

Return the value if present, otherwise invoke other and return the result of that invocation. This method takes the Supplier Functional Interface.

if the Supplier is null, it throws NullPointerException.

Filtering with Optional in Java 8

Java 8 Optional orElseGet() Example

الثلاثاء، 19 مايو 2020

Jackson API @JsonAnyGetter Annotation - Map Example

1. Introduction


In this Jackson Annotation Series, You'll be learning @JsonAnyGetter annotation and example program to demonstrate @JsonAnyGetter annotation with Map Example in Jackson API.

Jackson API is mainly integrated with Java tech stack.

Mainly @JsonAnyGetter is used on Map<String, String> property which holds the additional properties which are apart from the normal properties.

Please note that @ JsonAnyGetter is a method level annotation and can not be used on the filed level. If you use so on field level will cause a compile-time error.

This is the first annotation in our series.


Jackson API @JsonAnyGetter Annotation - Map Example

الأحد، 17 مايو 2020

Java Reading Environment Variable - System.getEnv() Examples

1. Introduction 


In this tutorial, We will learn how to read System environment variables programmatically in java. We do set the PATH or JAVA_HOME values in system-level and now we want to retrieve them in java for further usage.

Java API has System class and has two methods to work with environment variables. The following are the methods and both are defined as static methods so which can be accessed directly with the class name.

getEnv(String keyName)
getEnv()

Example:

String value = System.getEnv("PATH");

Joda Datetime Jackson DeSerialization - @JsonDeserialize

1. Introduction


In this tutorial, You'll learn how to deserialize the Joda DateTime object when working with Jackson JSON to Object conversion java 8.

Jackson String JSON to Object

Jackson API @JsonDeserialize annotation is to use for the custom deserializer and also is to parse the dates using " com.fasterxml.jackson.databind.deser.std.StdDeserializer<DateTime>" class from to Joda API datetime to String.


Joda Datetime Jackson DeSerialization - JSON to Object @JsonDeserialize



Java Var args (Variable Arguments) With Examples

Java Varargs (Variable Arguments) With Examples

Java 5 In-Depth usage of Var-Args - Variable Argument.


Java Varargs (Variable Arguments) With Examples


Varargs is introduced in Java 5 version. In this tutorial, we will discuss the following concepts on it.

1) Earlier versions what they had alternative for Varargs and its drawbacks.
2) Introduction to Varargs
3) Rules 

4) Advantages 
5) Disadvantages
6) Examples


In-Depth Tutorial on Var- Args in Java


More Core Java Concepts

Before Var-args concept:

First, Let us understand how these are implemented before var args concepts in java.
We have facility to use the same using the two options.

1) Method Overloading
2) Object array




How to Find The Workspace Location in Eclipse (Mac OS or Windows)

1. Introduction


In this article, We'll learn how to see the current workspace location in eclipse. This is needed if you do not know how to find it. We will also try to find out the list of all workspaces used in your eclipse. This solution works for any operating system like windows and mac os x.

Java 14 Features With Examples - New JDK 14 Tutorial

1. Introduction


In this tutorial, We'll be learning what are the new features in java 14 and example programs in each area. This may be asked in the interview to check whether you are seeing regular updates on java and its latest changes.

Below are the features are added to the new JDK 14.

  • Switch Expressions (Standard) – JEP 361
  • Pattern Matching for instanceof (Preview) – JEP 305
  • Helpful NullPointerExceptions – JEP 358
  • Records (Preview) – JEP 359
  • Text Blocks (Second Preview) – JEP 368
  • Packaging Tool (Incubator) – JEP 343
  • NUMA-Aware Memory Allocation for G1 – JEP 345
  • JFR Event Streaming – JEP 349
  • Non-Volatile Mapped Byte Buffers – JEP 352
  • ZGC on macOS – JEP 364
  • ZGC on Windows – JEP 365
  • Foreign-Memory Access API (Incubator) – JEP 370


Java 14 Features With Examples - New JDK 14 Tutorial

Java 11 Shebang example - Run As Shell Program

1. Introduction


In this tutorial, You'll be learning today how to run the java program as shell script files (shebang) from java terminal from Unix or mac os. Even you can run from docker as well. Copy the files to docker and make sure you have OpenJDK 11 installed and run with java 11 single source files command.

At the present time, You might have seen a lack of knowledge on shell programming or a bit difficult to maintain the scripts for back end jobs.

Now, Java 11 comes up with the new concept to execute the java files as shell script files like batch-job.sh file. Inside batch-job.sh file, you can write all your java code and it is completely understandable at runtime by the operating system.

Java 11 Shebang example - Run As Shell Program



السبت، 16 مايو 2020

Java 8 – How to convert Iterable to Stream

1. Introduction


In this article, You'll be learning how to convert Iterable to Stream API.

Iterable is an interface in java and a method spliterator() is added to in Java 8 release.

Iterable to Stream in Java


2. Convert Iterable to Stream in Java 8

Since the Iterable interface has a spliterator() method and it is easier to convert it into a Stream.

Iterable to Stream in Java 8

Syntax:

default Spliterator spliterator()

Creates a Spliterator over the elements described by this Iterable.

First of all, Let us create a List and can assign to the iterable.

Iterable<String> iterable = Arrays.asList("Iterable", "to", "Stream", "in", "Java 8");

Next,  Convert iterable to Stream using StreamSupport.stream() method and pass iterator.spliterator() to it.

Stream<String> stream = StreamSupport.stream(iterable.spliterator(), false);

3. Performing Stream Operations


Next, let us perform a simple Stream operation after converting Iterable to Stream with StreamSupport.stream() method.

package com.javaprogramto.java8.streams.iterable;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;

public class IterableToStream {

    public static void main(String[] args) {

        Iterable<String> iterable = Arrays.asList("Iterable", "to", "Stream", "in", "Java 8");

        Stream<String> stream = StreamSupport.stream(iterable.spliterator(), false);

        List<String> list = stream.map(string -> string.toLowerCase()).collect(Collectors.toList());

        list.forEach( value -> System.out.println(value));

    }
}

Output:

iterable

to

stream

in

java 8

4. Conclusion


In this article, You've seen how to convert Iterable of Strings into Stream of Strings using java 8 Stream API.

All the code is shown in this article is over GitHub.

You can download the project directly and can run in your local without any errors.



If you have any queries please post in the comment section.

الجمعة، 15 مايو 2020

Python Program to Print Hello world!

1. Introduction


In this tutorial, You'll learn a beginner's Python program to print Hello World program. The example program can be executed from python IDE or shell prompt.

You can download the latest python version from the official website here.

You no need prior experience or knowledge on the python concepts. Because this is the first program for beginners. So, You'll get the basics of python scripting here.

Python Program to Print Hello world!-min

Print hello world! in Python Programming


الأربعاء، 13 مايو 2020

How to Break or return from Java Stream forEach in Java 8

1. Introduction


In this tutorial, You'll learn how to use a break or return in Java 8 Streams when working with the forEach() method.

Java 8 forEach() method takes consumer that will be running for all the values of Stream.

Once forEach() method is invoked then it will be running the consumer logic for each and every value in the stream from a first value to last value.

java 8 custom forEach() methd for Stream API


For each keeps the code very clean and in a declarative manner.

But, when you working with a traditional loop, you can use a break or return from loop based on a condition.

How to Break or return from Java Stream forEach


But, you might have noticed that missing equivalent break or return statement to stop the loop execution based on a condition.

If the stream is an extremely long one then you need to traverse till last value to end the loop.

Our requirement is to stop the loop once out condition is met then forEach does not much help on this.

There are few ways to do even using Java 8 and java 9 API techniques or methods.

الثلاثاء، 12 مايو 2020

Java 8 ArrayList forEach Examples

1. Introduction


In this tutorial, You'll learn how to iterate ArrayList using the forEach() method in Java 8. Now ArrayList comes up with a handy utility method to traverse all the elements of List using arraylist foreach.

forEach() is added as part of java 8 changes.

Java 8 ArrayList forEach() Examples


Read more articles on ArrayList.

forEach() method iterates the values till last value or it throws an exception.

This is a complete replacement for the traditional Iterator concept. Internally, It does the looping around the list values.

First, We will see the syntax, its internal implementation, and examples to use forEach() method.

Iterating List, Map or Set with forEach() method

الاثنين، 11 مايو 2020

Mockito – Using Spies Examples: Mock Vs Spy

1. Introduction


In this tutorial, You'll be learning how to use Mockito Spy() method and @Spy annotation. How to mock a stub with spy and At last what is the difference between mock() and spy().

Example of Mock Vs Spy methods of Mockito. Many of the developers don't know when to use which one.

Add maven mockito dependency in the pom.xml file.

Please read the full article then at the end once you see the Mock Vs Spy, you will get a clear understand of both methods. Both are very powerful methods.

<dependency>
  <groupId>org.mockito</groupId>
  <artifactId>mockito-core</artifactId>
  <version>3.3.3</version>
  <scope>test</scope>
</dependency>


Mockito – Using Spies Examples Mock Vs Spy

Mockito – Using Spies

2.  Mockito.Spy() Method Example


Now, You'll see how to use the spy() method. This is a static method that can be invoked by its class name such as Mockito.spy().

This is mainly used to spy the real object rather than working with dummy objects.

To create ArrayList spy object, just use Mockito.spy(ArrayList.class). Actually, This creates a real ArrayList object.

When use spy() method on any class then you can call the real methods of that class.

In the below example, you have spied ArrayList class so you can invoke actual ArrayList add(), remove() methods.

We have added three string objects to the List and printing the list to see its values.



package com.javaprogramto.mockito;


import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;

import java.util.ArrayList;
import java.util.List;

public class MockitoSpyTest {

    @Test
    public void spyArrayList() {


        List<String> spyList = Mockito.spy(ArrayList.class);

        spyList.add("Hello");
        spyList.add("mockito");
        spyList.add("spy");

        System.out.println("Spy list : "+spyList);
        Assert.assertEquals(3, spyList.size());
    }
}


Output:

[Spy list : [Hello, mockito, spy]]

Observe the output which prints the actual values that are added to the list. In the above example, the real add() method called three times to add values.

And also you can verify whether the add method is invoked with a specific value as below.

@Test
public void spyArrayListVerify() {

    List<String> spyList = Mockito.spy(ArrayList.class);

    spyList.add("Hello");
    spyList.add("mockito");
    spyList.add("spy");

    Mockito.verify(spyList).add("spy");
    Mockito.verify(spyList).add("Hello");
    Mockito.verify(spyList).add("mockito");

    Assert.assertEquals(3, spyList.size());
}

3. @Spy Annotation Examples


Next, you'll see now how to use @Spy annotation on the spy objects. This is an alternative to the spy() method.

@SpyList<String> spyAnnotation = new ArrayList<>();

@Testpublic void spyArrayListAnnotation() {

    spyAnnotation.add("Hello");
    spyAnnotation.add("spy");

    Mockito.verify(spyAnnotation).add("spy");
    Mockito.verify(spyAnnotation).add("Hello");

    Assert.assertEquals(3, spyAnnotation.size());
}

If you run this test method without enabling the needed configurations then it will give an error.

You must annotate the test class with @RunWith() annotation and pass JunitMockitoRunner.class to the annotation before using @mock or @Spy annotations.

or

@RunWith(MockitoJUnitRunner.class)

public class MockitoSpyTest {


4. Stubbing a Spy


Now, You'll learn how to stub a spy object with a spy() method. By using the stub() method, you can override the actual behavior of the original methods.

Let us write a example stub() method to return size 50 when ArrayList.size() method is invoked.

@Testpublic void stubSpyArrayList() {

    List<String> stubList = Mockito.spy(ArrayList.class);

    Assert.assertEquals(0, stubList.size());

    Mockito.doReturn(50).when(stubList).size();

    Assert.assertEquals(50, stubList.size());

    Mockito.doReturn(false).when(stubList).isEmpty();

    Assert.assertEquals(false, stubList.isEmpty());
}


This code works and returns 50 when the stubList.size() method is called.

And also, this list is empty but we have overridden the isEmpty() value to false even though the list is not having the values.

5. Mock VS Spy in Mockito


Looks mock() and spy() method looks the same but really both are not the same and work in different styles.

As of now, you have seen the spy() method which works exactly the same as the original ArrayList instance and all methods will be executed as regular.

But, When you mock ArrayList with the mock() method will work differently. Whatever you call the methods on the ArrayList to add() method will be the actual calls.

A simple ArrayList mocking with mock() methods.

@Testpublic void mockArrayList() {

    List<String> mockList = Mockito.mock(ArrayList.class);

    mockList.add("mock");

    Assert.assertEquals(1, mockList.size());
}

Output:

This code produces the error message saying actual mockList size is 0 but we added a value "mock" to it.


java.lang.AssertionError:
Expected :1
Actual   :0
<Click to see difference>


at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.failNotEquals(Assert.java:743)
at org.junit.Assert.assertEquals(Assert.java:118)
at org.junit.Assert.assertEquals(Assert.java:555)
at org.junit.Assert.assertEquals(Assert.java:542)
at com.javaprogramto.mockito.MockitoSpyTest.mockArrayList(MockitoSpyTest.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.mockito.internal.runners.DefaultInternalRunner$1$1.evaluate(DefaultInternalRunner.java:46)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.mockito.internal.runners.DefaultInternalRunner$1.run(DefaultInternalRunner.java:77)
at org.mockito.internal.runners.DefaultInternalRunner.run(DefaultInternalRunner.java:83)
at org.mockito.internal.runners.StrictRunner.run(StrictRunner.java:39)
at org.mockito.junit.MockitoJUnitRunner.run(MockitoJUnitRunner.java:163)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)


Actually added value to the List but those are reflected in the list. The mock () method does not run any actual methods.

Let us change the mock() to spy and see the output.

spy() method will wrap the existing instance into a spy object and it will behave the same as the original list object. add() method will be called from original ArrayList and value will be added to the underlying ArrayList.

@Testpublic void spysArrayList() {

    List<String> mockList = Mockito.spy(ArrayList.class);

    mockList.add("mock");

    Assert.assertEquals(1, mockList.size());
}

This code works perfectly fine without any errors.

As a result of Mock Vs Spy is You should prefer using the mock() method instead of spy() method because if you don't override the behaviors then it executes the original core logic methods.

6. understanding Most Common Mockito NotAMockException


The most commonly seen error is "Mockito NotAMockitoException" when any method is called on a non mocked object as below.


    Mockito.doReturn(50).when(stubList).size();


If the stubList is not a mocked or spy object then it will throw a runtime exception.

org.mockito.exceptions.misusing.NotAMockException:
The argument passed to when() is not a mock!
Example of correct stubbing:
    doThrow(new RuntimeException()).when(mock).someMethod();

at com.javaprogramto.mockito.MockitoSpyTest.spysArrayList(MockitoSpyTest.java:97)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.mockito.internal.runners.DefaultInternalRunner$1$1.evaluate(DefaultInternalRunner.java:46)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.mockito.internal.runners.DefaultInternalRunner$1.run(DefaultInternalRunner.java:77)
at org.mockito.internal.runners.DefaultInternalRunner.run(DefaultInternalRunner.java:83)
at org.mockito.internal.runners.StrictRunner.run(StrictRunner.java:39)
at org.mockito.junit.MockitoJUnitRunner.run(MockitoJUnitRunner.java:163)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)


7. Conclusion


In this article, You've seen how to mock an object with a spy() and mock() methods.

What are the common errors you get when you working with the Mockito framework?

And also we've seen what is the difference between mock() vs Spy() methods with examples.


Ref

All the code is shown in this article is over GitHub.

You can download the project directly and can run in your local without any errors.



If you have any queries please post in the comment section.

السبت، 9 مايو 2020

Spring Boot Data MongoDB: Projections and Aggregations Examples

1. Introduction


In this tutorial, You'll learn how to use Spring Data MongoDB Projections and Aggregation operations with examples.

Actually, Spring Boot Data MongoDB provides a plain and simple high-level abstraction layer to work with Mongo native queries indirectly.

If you are new to Spring Boot MongoDB, then refer the previous article on "MongoDB CRUD Operations in Spring Boot"

Spring Boot Data MongoDB: Projections and Aggregations Examples


First, We'll see what is Projection and a few examples on this. 
Next, What is an aggregation along with some examples such as to do grouping, sort, and limit operations.

We are going to use the Employee document in this article, showing the data already present in the table.

الجمعة، 8 مايو 2020

Scanning Multiple Paths Or Packages with @ComponentScan Annotation in Spring Boot

1. Introduction

in this article, You'll learn how to scan multiple packages in spring boot application with @ComponentScan annotation.

All the classes and sub-packages will be scanned automatically under Spring Boot main class package. During the scan, it will detect @Component, @Configurations, @Bean annotated classes, and methods.

If you have many packages or paths in your application and all of them are outside the spring boot main class will not be scanned automatically.

By using @ComponentScan annotation, we can autowire the classes from another project or another jar.


Scanning Multiple Paths Or Packages with @ComponentScan Annotation in Spring Boot

2. Adding Single Package Package to @ComponentScan in Spring Boot


Creating a new class EmployeeOne in "com.javaprogramto.packagee.one". This is not under the main boot application.

الخميس، 7 مايو 2020

Spring Boot MongoDB CRUD Operations Example

1. Introduction


In this tutorial, You'll learn how to do CRUD operations in MongoDB database as part of the Spring Boot Application.

MongoDB is a NoSQL database that uses JSON as a schema.

CRUD operations have been considered in computer programming as create, read, update, and delete (CRUD) are the four basic functions of persistent storage

Another example of How to generate auto-increment id in MongoDB Spring Boot App

Let us see step by step how to do it in a simple way.

Spring Boot MongoDB CRUD Operations Example


الأربعاء، 6 مايو 2020

Java 8 - How to convert Iterator to Stream

1. Introduction


In this tutorial, You'll learn how to convert Iterator to Stream in java 8. Actually, Iterator does not have a utility method to convert to Stream.

To achieve this, you should a set of classes and those are Spliterators and StreamSupport classes.

Check out latest Articles on Java

2. Example To convert Iterator to Stream in Java 8


When you work with the collection api, you mostly have seen many times using the iterator for getting the values from List or Set through the iterator.

الأحد، 3 مايو 2020

Quarkus (Native Image + Docker Deploy OpenShift)

1. Introduction


In this article, you will learn a new hot technology Quarkus IO how it became alternatively to bring the java applications to the cloud.

You will learn
  • Creating Quarkus Application with Quarkus init.
  • Auto Hot Reload Chances feature
  • Build and Start the container
  • Building Docker container
  • Deploying docker image to Openshift.


This gives more clear to use where the instances are created and destroyed frequently. And also boot time and serving the first request gives a much better user experience.

Always, Python and javascript are coming in the first place to deploy the apps into the cloud. But, let us see how to use Quarkus to deploy the apps into the cloud.

Guide to QuarkusIO (Native Image + Docker Deploy OpenShift)


السبت، 2 مايو 2020

C Programs To Print Triangle, Pyramid, Pascal's Triangle, Floyd's Triangle for Freshers

1. Introduction


In this tutorial, You'll learn how to print the different types of patters in C programming language.

The following programs are shown in this article. These patterns can be Half or left or right or full pyramid patterns.


  • Half Pyramid Of Numbers
  • Half Pyramid Of stars(*)
  • Full Pyramid Of stars(*) or Other Symbol
  • Pascal's Triangle
  • Floyd's triangle


Read more on Koltin programs which is mostly used in android.

C Programs To Print Triangle, Pyramid, Pascal's Triangle, Floyd's Triangle


الجمعة، 1 مايو 2020

Spring Boot ActiveMQ Standalone Application Example

1. Introduction


In this article, You'll learn how to create a Standalone ActiveMQ Demo application in spring boot using the Producer-Consumer model.

Versions used for spring boot activemq standalone application:

/usr/local/Cellar/activemq/5.15.12
Java 1.8
Spring Boot 2.5

In the previous article, we have shown how to implement ActiveMQ in-memory application in Spring Boot. In this example, Leveraged spring boot builtin active MQ instead of using local or remote active MQ.

Spring Boot ActiveMQ Standalone Application Example