HTML

How to implement PreOrder traversal of Binary Tree in Java - Example Tutorial

The easiest way to implement the preOrder traversal of a binary tree in Java is by using recursion. The recursive solution is hardly 3 to 4 lines of code and exactly mimic the steps, but before that, let's revise some basics about a binary tree and preorder traversal. Unlike array and linked list which have just one way to traverse, I mean linearly, binary tree has several ways to traverse all nodes because of its hierarchical nature like level order, preorder, postorder and in order. Tree traversal algorithms are mainly divided into two categories, the depth-first algorithms, and breadth-first algorithms. In depth-first, you go deeper into a tree before visiting the sibling node, for example, you go deep following the left node before you come back and traverse the right node.

5 Free Database and SQL Query Courses for Programmers to Learn Online

Hello guys, I have been sharing some free programming resources e.g. books and courses in this blog for quite some time. Earlier I have shared free courses on Java, Maven, Spring, and Data Structure and Algorithms and today I'll share some of the free online training courses to learn SQL and Database. Why you should learn SQL? Well, it's one of the must-have skill for programmers, application developer, and IT professionals. Like Linux, this is one skill which is going to serve you longer than any other programming language, framework, or library. The SQL is used to interact with Database Systems like Oracle, MySQL, and Microsoft SQL Server. As per ANSI (American National Standards Institute), SQL stands for the Standard Query language for Relational Database Management Systems.

Top 5 Free React JS Courses for Web Developers to Learn Online

React JS or React is one of the most popular frameworks or Javascript library for building user interfaces. It's backed by Facebook and it's often viewed as an alternative to the great Angular framework by Google. React is also very flexible, fast, easy to learn and fun to work with. It is designed to make the process of building modular, reusable user interface components simple and intuitive and that's why most of the modern GUI and web applications are build using React framework. It is developed at Facebook and it focuses on the 'View' aspect of MVC in web applications. The component-based development is one of the biggest advantages of React library which is both rich and extensible.

5 Free Servlet, JSP, and JDBC Online Courses for Advanced Java Developers

If you are a Java developer working on a Java JEE projects like a Java Web application running on Tomcat or Glassfish, or you want to get into that by learning server-side technologies like Servlet, JSP, and JDBC then you have come to the right place. In this article, I will share some free online courses to learn Servlet, JSP, and JDBC at your own pace. If you want to become a rockstar Java web developer then you must have a good understanding of these basic web technologies before you learn frameworks like Spring and Hibernate. These frameworks work on top of these basic technologies and if you don't know them then you would often struggle to debug and troubleshoot problems in the real world.

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.

5 Good Books to Learn Java 8 Functional Programming

Hello guys, if you are learning Java 8 features like lambda expressions, Stream API, and functional programming in Java and looking for some exciting books and resources then you have come to the right place. In the past, I have shared some of the best Java 8 tutorials and courses and today I'll share some of the best books you read to learn Java 8 better. I will not only tell you which books to read but also why read that particular book. I know that online courses are getting better and better every day and even I am using to learn new technologies like Spring 5 and Java 11 but books still have its place because they provide most in-depth coverage of any topics, which is needed to master the topic and become an expert.

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.

5 Free BlockChain Online Courses for Programmers to Learn

Hello guys, how are you doing? hope you all are having a great time and working towards your goal this year. I have been sharing a lot of courses and tutorials in this blog about what to learn in 2019, starting from tools to frameworks, from libraries to programming languages, but one of the most important technology, you can learn in 2019 is the Blockchain technology. It's one of most talked about technology at the moment and considered to be the next big thing after the invention of the internet as they provide a way to attain digital trust on the Internet.

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.

Top 10 Open Source Frameworks and Libraries Java Web Developers Can Learn in 2019

Java programming language and Platform has been very lucky in terms of frameworks, standards, and libraries, I guess which is one of the important reason for its huge success. Apart from standard frameworks like Swing for desktop GUI application, JavaFX, Servlets and JSP, EJB, and JSF, there are a lot more open source framework and libraries available for Java programmers. These Open source framework, not only helps and speed up development but also enforce to use best practices required to build enterprise Java application and desktop application. Frameworks like Spring, which in my opinion gives a much-needed boost to the Java platform, enforces dependency Injection design principle at the core, which is key to build a loosely coupled system.

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.