Author: Dasun De Silva

I m senior software engineer with more than 5 years of experiences in software development. I used to be developed using multiple programming languages and concept my programming and software engineering life. Here I am sharing my experience with code snippets and software technical concepts.

Change label text according to radio button selected – Type script , Angular2

You might need to change a label text according to the radio button selection in same form. And further you may no need to call functions or server end to change that label and just change it run time with minimal effort. If so you can use below code snippet.



Java Static Blocks, Variables and Methods

Static Member :-

What is a static member ? Static member is a member of a class that which is not interact or associate of  an instance of a class. This can be access without creating a object of a class. Moreover static members are being executed when class load in to the memory.  Further static members are accessible from any where and certain member is common for every instances. All objects use some instance of a static member.



What is keycloak ?

This is an authentication service provided by Apache and  developers no need to worry about high secure user authentication if they are going to use keycloak.

They can set up keycloak server and get connect with keycloak server when authenticating they applications.

How to use Keycloak :-

01. Download keycloak

02. Unzip or gunzip the tar file.

03. Go  to bin and run standalone


04. Then load http://localhost:8080/auth and create admin user. Now you should be able to login as admin via http://localhost:8080/auth/admin/

05.  Now you have to create realm user as below.


06. Now create user under  the newly created realm




Now you can login to that user account under below url.


07. Now you have to a client add-client.png

This client is the web application that developer have developed and which has authentication panel to login but need to secure by keycloak. Once created the client you can edit that client profile. Click on installation tab and select Keycloak OIDC JSON and then click download button.

Downloaded file would be some thing similar to below.

“realm”: “demo”,
“auth-server-url”: “http://localhost:8080/auth”,
“ssl-required”: “external”,
“resource”: “testclient”,
“public-client”: true

This file can be placed where your project HTML file placed.

Install Jboss :- Follow below URL





































This is simply if else condition which will update html DOM elements as you need.
But more clarification this is not completely differ from ngShow or ngHide. Because this is not updating DOM elements actually.
What this does is remove existing CSS and newly adding CSS as recreated DOM. This case ngIf will completely remove the scope of DOM and reinitialize it.

Hash Map

HashMap is one of the most performing data structure in java collection framework. This provides constant time for both insertion and retrieval. This is used for large scale data since this is having high performance in insertion and retrieval. However this performance is depending on the two factors such as initial capacity and load factor. We can construct HashMap in four way and default constructor is having load factor is .75 and initial capacity as 16.


Singleton Design Pattern

This is the pattern which ensures there will be only one instance of a class in JVM and it can be accessed via globally. Generally this pattern is used to be on caching, logging, settings and configurations and so on.

Static class has below properties such as : –

  1. Static Member – this keeps the instance of class.
  2. Private constructor – this avoids creating multiple instances from this class.
  3. Static public method – the only one instance can be accessed via globally through this method.