Posts

Kotlin Crash course

 Kotlin var greeting: String = "Hi" val name: String = "Malathi" we can reassign value to variable defined using var but not val. By default Strings in Kotlin are non null values. To make them nullable, we should use ? operand like below val name: String? = "Malathi" Ex: fun main() {    var greeting: String = "Hi"    val name: String = "Malathi"    println(greeting)    println(name) } Kotlin has type inference. It means that the type is automatically detected based on the value assigned to the variable. So var greeting = "Hi" statement too works. Control loops if statement: if(greeting != null) { println("if statement")} while statement: It is similar to Switch statement in Java while(greeting) {    null -> println("Hi")    else -> println(greeting) }  val greetingToInvite = if(greeting != null) greeting else "Hi" println(greetingToInvite) val greetingToInvite = when(greeting) {    null ->

Java 13 Features

This post is the introduction of commonly used Java 13 features.  Switch expressions: This is still in Preview stage in Java 13 version. The main difference about switch expressions in Java 12 and Java 13 is the introduction of Yeild in Java 13.  Yeild is used to differentiate between Switch statements (Java 11 or less) and Switch expressions (Java 12 or more).  Primarily the new Switch expressions eliminates the need of break statement and also multiple case statements.  Eliminating the break statement reduces lot of verbosity and no need for developers to remember it whenever they use switch. Accidentally if developers forget about adding break statement, it introduces bugs and deviate application to meet business requirements. So using Switch expressions improves efficiency of the code and increases productivity.  Earlier multiple case statements introduced lot of boilerplate code. But with introduction of Switch expressions, we can simply group the related things under one case sta

Java 12 features

There are some interesting and useful features available in Java 12. However some are in Preview stage, not for production use. All Preview features are labelled accordingly. Compact Number Formatting Java 12 comes with number formatter the CompactNumberFormat. It was designed to represent number in shorter form based on patterns provided by given locale. NumberFormat shortNumber = NumberFormat.getCompatcNumberInstance(new Locale("en", "US"), NumberFormat.Style.SHORT); shortNumber.format(1000); output: 10k Try what output you get when you try Style.LONG. Teeing Collector in Stream API Collector<T, ?, R> teeing(Collector<? super T, ?, R1> downstream1, Collector<? super T, ?, R2> downstream2, BiFunction<? super R1, ? super R2, R> merger) Every element is processed by both the downstream collectors and their results are passed to merger function. The example of teeing collector is shown below If we want to calculate average from set of num

How to deploy Spring boot application to JBOSS application server

How to deploy Spring boot application to JBOSS application server Create a spring boot application Open pom.xml and add the below dependency. As you see we added spring-boot-starter-tomcat and set the scope to provided. This is to compile web related components. Make sure the packaging is WAR. <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency> </dependencies> <!-- Make sure that you changed the packaging to war --> <packaging>war</packaging> Extend SpringBootServletInitializer class in your Spring boot main class and override the configure method. @SpringBootApplication @EnableSwagger2 public class SpringBootDemoApplication extends SpringBootServletInitializer {   @Override   protected SpringApplicationBuilder configure(SpringApplicationBuilder builder){     return builder.sources(SpringBootDem

Embedded Tomcat Server configuration in Spring boot application

To modify the default configuration of Spring boot embedded Tomcat server, we can make use of below properties ·        Server.port=80 If you wish to change the port number ·        Server.address=my_custom_ip   IP address where the server would listen ·        By default spring boot provides standard error web page. This page is called white label. It’s enabled by default but if we want to disable it using Server.error.whitelabel.enabled=false ·        Default path of whitelabel is /error but it can be customized using Server.error.path=/user-error ·        To limit the number of simultaneous requests made to the server, use server.tomcat.threads.max=200 ·        Server connection timeout using server.connection-timeout=5s ·        Define max size of request header   server.max-http-header-size=8KB ·        Define max size of request body server.tomcat.max-swallow-size=2MB ·        Define max size of whole post request server.tomcat.max-http-post-size=2MB ·        To

Steps to Set Python3 as Default On ubuntu

 Steps to Set Python3 as Default On ubuntu? Check python version on terminal - python --version Get root user privileges. On terminal type - sudo su Write down the root user password. Execute this command to switch to python 3.6. u pdate-alternatives --install /usr/bin/python python /usr/bin/python3 1 Check python version - python --version

Agile principles

Hello everyone, My name is Malathi and i have been working on Agile methodologies since a decade. I prepare these posts based on experience i gained through out my professional life which provides realistic view of what actually Agile principles are. So let's get started. We have totally 12 principles.  1. Our highest priority is to satisfy the customer  through early and continuous delivery of valuable software. The main motto of Agile is to deliver the working product in smaller increments to the customer. Here we are not only delivering some value to the customer but also building confidence and trust in the customer who sees the working product literally and gets incredibly satisfied which is the ultimate target of any business. 2. Welcome changing requirements, even late in  development. Agile processes harness change for  the customer's competitive advantage. This largely prevents the risk of failure in the product development. Once we start delivering worki