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 t...

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.so...

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 head...

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 deliv...

Agile Software Development

Image
Software crisis and evolution of Agile methodology The popularity of Agile methodology is gained when software crisis emerged where software teams are managed with the same methods used by manufacturing or construction projects. Generally manufactured products are identical. In our example, if you think about manufacturing cars of the same make and model coming down on assembly line one after another, Design engineers and managers typically produce well defined checklists with well defined processes and tools that workers are expected to follow. Comprehensive system documentation is produced so defects can be tracked and fixed easily. And in construction projects, once you sign a contract to build a house or any building, the requirements are frozen and if you want something to be changed or added then there would be an additional cost. All early software development projects tried to mimic the approach followed by con...

Highlights of Scrum - Scrum guide at scrum.org

Highlights of Scrum Please note, the following points are learnt and noted down by me from Scrum guide at scrum.org. Anyone can download the Scrum guide from scrum.org and read it. I noted down the most important points to remember from Scrum guide which is defined at scrum.org. Scrum is not a process, technique or definitive method  Scrum is a framework for developing, delivering and sustaining complex products. Ken schwaber and Jeff sutherland developed Scrum Scrum is lightweight, simple to understand and difficult to master. Scrum is a framework which employs several processes and techniques Scrum is a framework within which people can address complex adaptive problems while productively and creatively delivering product with highest possible value. Scrum has been started in early 1990  Scrum has been used to develop software, hardware, embedded software, autonomous vehicles, schools, government, marketing and managing the operations of organ...

Agile software development -Scrum for developers

Image
Scrum is one of the most widely adopted Agile frameworks used by organizations to deliver high quality products to their customers faster and more often. Combining Scrum with Software tools like JIRA and Confluence can take your organization agility to another level. The beauty of Scrum lies in its simplicity. It's emphasis on transparency, inspection and adaptation leads to continuous improvement and effective team work. Scrum Roles Scrum has 3 Roles. Product owner Scrum master Development team member All three together form a scrum team. Product Owner (PO): PO is accountable for product backlog which is the to-do list of items for the development team. Product backlog is the list of features, enhancements, defects and any kind of action items for the scrum teams but more specifically the development team. The PO owns the product backlog. Scrum does not prohibit anyone from making changes to product backlog but PO is eventually responsible for the co...

Agile Scrum - Q&A

How to change the date and name of ongoing Sprint Go to Jira Backlog Hover over start or end date. Updates the dates and press Enter Similarly you can also change the Sprint Name.

Remove unwanted files from Git commit

Recently i came across the situation where i committed the unwanted files and would like to remove them from the commit and found the following help from google. First step is to do git reset the HEAD using the following command git reset --soft ^HEAD or git reset --soft HEAD~1 Next step is to remove unwanted files fro the commit git reset HEAD /path/to/unwanted file Then commit again as follows. It would probably open the editor inorder to change the commit message or you can use the same commit message. git commit -c ORIG_HEAD Hope this is helpful.

Environment variables for Java installation

Image
Hi, I am Malathi Boggavarapu working at Volvo Group and i live in Gothenburg, Sweden. I have been working on Java since several years and had vast experience and knowledge across various technologies. No matter how experienced you are, everyone will be freaked out while setting up Java Environment variables after migrating to new OS or trying out "Awesome" Java language for the first time by the beginners. Not all may be but atleast i get freak out for setting it up :) But here is the quick overview or help which provides complete details of Java environment setup. After downloading and installing preferred Java version from Oracle website, head over to the My Computer, right click on it and choose Properties from the menu. The below dialog will be opened. Now click on "Advanced system settings" -> Advanced -> Environment Variables. The below picture may slightly vary among different OS versions. But below picture shows for Windows ...

Spring Framework and ScheduledExecutorService - Load property files during startup

Hi, I am Malathi Boggavarapu working at Volvo Group and i live in Gothenburg, Sweden. I have been working on Java since several years and had vast experience and knowledge across various technologies. In this post we see how to load property files during the application startup in an efficient way using Spring framework and ExecutorService which allows you to reload properties without server restart if any properties were changed. So let's get started. How to load Property files using Spring Every application is loaded using the deployment descriptor file web.xml. So in web.xml we need to declare the DispatcherServlet class with load-on-startup as 1. servlet-name can be anything. In our example it is called as bl (business layer). So during application startup, server tries to find the bl-servlet.xm l file. web.xml <servlet>     <servlet-name>bl</servlet-name>     <servlet-class>org.springframework,web.servle...