HTML

5 Spring Framework Books for Java developers (Includes Spring Security and Spring Boot) - Best of lot

Spring framework is one of the most popular frameworks in the Java world which used to develop Java application, both core Java, and web application. It is also one of the most job oriented skill for Java developer, hence many beginners and intermediate Java programmers try to learn Spring framework by their own. Though there are some good Spring training courses available online, books are still the most popular and preferred way to learn Spring frameworks like Spring core, Spring Boot, Spring MVC, Spring Batch or Spring Security.  I often receive queries for Spring book recommendations e.g. which Spring book is good for beginners, or which Spring book is good for intermediate and advanced developers, which book should I read to learn Spring boot, Spring Cloud, Spring Batch or Spring security etc?

7 Common Socket Errors and Exception in Java Application [Solved]

In this blog, I plan to talk about some common exceptions and errors that arise while using sockets. Quite often, these socket issues arise out of application bugs, system settings or system load. It might be an unnecessary delay to go to product teams, only to discover that the issue can be resolved by tuning/configuring your local settings. Understanding these messages will not only help resolve the issues but also make a conscious effort in avoiding these scenarios while developing applications.

How to Convert java.util.Date to java.time.LocalDate in Java 8 - Examples Tutorial

Hello guys, once you move to Java 8, you will often find yourself working between old and new Date and Time API, as not all the library and system you interact will be using Java 8. One of the common tasks which arise from this situation is converting old Date to new LocalDate and that's what you will learn in this tutorial. There seems to be a couple of ways to convert a java.util.Date to java.time.LocalDate in Java 8, but which one is the best way? We'll figure it out in this article, but first, let's explore these different ways to convert a java.util.Date object to LocalDate in Java 8 code.

Linux mailx + mutt command Examples - 4 ways to send Email with Attachment from RHEL 5 and 6 Server

One of the common task for programmers working in Linux machine is to send emails, for example, your Java applications are running on Linux like RHEL 5 or RHEL 6 version and you need to send a report of all the clients connecting to your application. An easy way to accomplish this is to write a shell script, which will dump all clients in the log file and then use grep command and generate a report. If you have to grep logs from multiple hosts, you can also use the SSH command to run the same command on multiple hosts. Once you have got the list of clients connecting to your application, you can just send the CSV file to yourself in an email or to your application DL, or a group of users you want to.

How to set JAVA_HOME and PATH in Linux - Step by Step Guide

Hello guys, welcome to the world of Java application programming. One of the hardest thing to mater is not any feature but environment-specific details which nobody teaches. To bridge that gap, I am going to cover a couple of very important environment variables like PATH and JAVA_HOME.  The JAVA_HOME environment variable points to the JDK installation directory and used by many Java tools and applications like TomcatMaven, Eclipse, NetBeans or IntelliJIDEA etc. to figure out Java executables as they need Java for running. Like in the previous article I explained about a Maven issue (invalid target release: 1.7, 1.8)  related to Java version which occurred even though the correct version of Java installed on the machine but JAVA_HOME was pointing to an older version.

GREP Command Example in Linux - How to Search All Files Matching Specific Text

One of the most common task while working in programming projects is finding files containing some specific text e.g. you have your application deployed in Linux server and you are migrating your database from one server to another. Now, you want to file all config files and scripts which are referencing your old database using the hostname or IP address, so that you can replace them with an alias. Well, you should always use an alias to connect to the database or any other system, but sometimes it happens you have to use hostname. Anyway, how do you find all those files containing hostname in your Linux machine? Well, the grep command is here to help you.

find + du command example Linux - How to search/print large files and directories with size to free disk space?

One of the common problem while working in Linux is to find large files to free some space. Suppose, your file system is full and you are receiving an alert to remove spaces or if your host is run out of space and your server is not starting up, the first thing you do is find top 10 largest files and see if you can delete them. Usually, old files, large Java heap dumps are good candidates for removal and freeing up some space. If you are running Java application e.g. core Java-based programs or web application running on Tomcat then you can remove those heap dump files and free some space, but the big question is how do you find those? How do you know the size of the biggest file in your file system, especially if you don't know which directory it is? We'll try to find answers for some of those questions in this article.

How to Compare String by their length in Java?

One of the common programming tasks is to compare String, sometimes by their value and sometimes by their length. The natural way to compare String is the lexicographic way, which is implemented in the compareTo() method of String class, but sometimes you need to compare String by their length. You cannot use the default compareTo() method for that task, you need to write your own custom Comparator, which can compare String by length. Don't worry, It's easy to compare multiple String by their length, all you need to do is write a Comparator implementation which calculates their length using the length() method and compares them.

Map Reduce Example in Java 8

The map-reduce concept is one of the powerful concepts in computer programming, particularly on functional programming which utilizes the power of distributed and parallel processing to solve a big and heavy problem in quick time. From Java 8 onwards, Java also got this powerful feature from the functional programming world. Many of the services provided on the internet like Google Search are based on the concept of the map and reduce. In map reduce a job is usually split from the input data-set into independent chunks which are processed by the map tasks in a completely parallel manner. The framework then sorts the outputs of the map operation, which are then supplied to the reduce tasks.

How to Convert String to LocalDateTime in Java 8 - Example Tutorial

Hello guys, today, I will talk about a common problem while working in a Java application, yes you guessed it right, I am talking about String to Date conversion in Java. I have discussed this before (see the Date to String) when Java 8 was not out but with Java 8, I don't see any reason to use old date and time API and hence I am writing this post to teach you how to convert String to Date in Java 8 or beyond. Suppose you have a date time String "2016-03-04: 11:01:20" and you want to convert this into a LocalDateTime object of Java 8 new date and time API, how do you do that? Well, if you have worked previously with String and Date then you know that you can parse String to Date in Java.

Can you add a non-abstract method on an interface in Java?

Well, prior to Java 8, it wasn't possible to add non-abstract methods in Java but nowadays you can add non-abstract static, default, and private methods in Java interface. The static and default methods were supported as part of interface evolution in Java 8 and you can add private methods on an interface from Java 9 onwards. Since long, many Java programmers feel that there is no real use of an interface, well that's completely wrong, given how interface allows you to write generic, decoupled code, most of those sentiments comes from no implementation on the interface.

Difference between include directive, include action and JSTL import tag in JSP?

There are three main ways to include the content of one JSP into another:

include directive

JSP include action

and JSTL import tag

The include directive provides static inclusion. It ads content of the resource specified by its file attribute, which could be HTML, JSP or any other resource at translation time.

Any change you make in the file to be included after JSP is translated will not be picked up by include directive.

10 Examples to Format and Parse Date Time in Java 8 using LocalDateTime and DateTimeFormatter

Parsing and formatting dates are other important topics while working with date and time in Java. Even though old Date API had SimpleDateFormat and DateFormate class to support formatting of date and parsing texts, they were not simple, or should I say there were just simple in writing bad code. You might know that SimpleDateFormat was not thread-safe and quite heavy to be used as a local variable. Thankfully, this has been sorted now with new LocalDateTime class and DateTimeFormatter class, which has several inbuilt formatter e.g. BASIC_ISO_DATE format which prints dates in yyyyMMdd format e.g. 20160616 and ISO_DATE which prints date as yyyy-MM-dd e.g. 2016-06-16. It has several useful formats to represent popular date formats around the world e.g. the date format used in the USA is different than date format used in UK and India.