HTML

Top 5 books to learn Java Virtual Machine, Garbage Collection, and Performance in-depth

In the last couple of years, I have seen a trend of many Java developers wants to learn more and more about JVM internals and how Java Virtual Machine and it's different component works. This trend was not so strong in the last decade, but with more and more focus on concurrency, performance, and scalability, Java developer is exploring JVM internals, Garbage collection, and Performance tuning in more detail. Unfortunately, there are not many good books to learn about JVM internals and its different components, but fortunately, we have an excellent Java Virtual Machine specification to learn fundamentals. It is also the most up-to-date reference because Java and JVM are kept changing, especially after Java 10.

How to use grep to search for text in files and directories in terminal - Recursive grep Example in Linux

One of the most common tasks while working in programming projects is finding files containing some specific text like you have your application deployed in the 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 a hostname. Anyway, how do you find all those files containing hostname in your Linux machine? Well, the grep command is here to help you.

Top 5 Courses to Learn Ruby and Rails in 2020 - Best of Lot

Hello guys, welcome to this post, here you will find some of the best free courses to learn Ruby programming language and Ruby on Rails framework online. If you don't know what Ruby is and what is Rails framework, then let me tell you that its one of the simplest programming languages with little to no syntax. If you are new to programming or never coded before, then also developing a Ruby application will be much more comfortable than choosing any other programming language like Python or Java. When it comes to developing web development, the Ruby on Rails also makes your job easy by making several useful assumptions based upon convention, which means you can do more by writing less code.

How to copy Files from one directory to other in Java

I have been programming in Java for a long time and you won't believe but there was no file copy method in the Java API until Java 7. At that time, our options were either write it ourself, using a FileInputStream, a FileOutputStream and a buffer to copy bytes from one to the other - or better yet, use the FileChannel.transferTo() method or just use the Apache Commons' FileUtils which was a life save those days and even today. JDK has evolved now and you have a decent API to copy files from one directory to another. In this article, I'll show you both the pre-Java code for copying files from one directory to other as well post Java 7 code which makes this task a lot easier.

How to test REST API from Command Line using cURL command in Linux

The curl or cURL command of Linux is a compelling and versatile command which allows you to send sophisticated HTTP request right from your Linux command line window. You can use the cURL command to test your RESTful Web Services by sending GET and POST requests, doing authentication, saving a cookie in the file, etc. The curl command is, in fact, the go-to tool for many Java and Spring developers working in web applications and consuming data from the secured RESTful Web Services. Still, you can also use it to test your simple REST Web APIs without security. I have used it many times to check if our Web service is up or not, or is there any error while accessing those services.

Top 7 Free courses to learn Selenium in 2020 - Best of Lot

Testing is an integral part of software development, and we have long been relied on manual testing by testers and QA professional to ship quality software and find bugs, but that's not sustainable anymore. There is an increased focus on automation testing nowadays, and Selenium is leading the way with its web drivers. If you don't know what selenium is, it's a free automation testing tool for web applications. It can work with different web browsers like Chrome, Firefox, Internet Explorer, Opera, and simulate human-like behavior. By using Selenium, you can programmatically interact with all the different elements on a webpage. You can click on them, input text, extract text, and so much more.

Top 10 Books Every Programmer Should Read

There is saying that if you learn from your mistakes, you will only going to learn few things, but if you learn from other's mistake, you can learn a lot of things in a short time, and what could be a better way to learn from someone's experience then reading books. Programming as a career is about constant learning and updating yourself, but unfortunately, there is no right way to begin. School and Colleges are far behind when it comes to real-world programming, and every Computer Science graduate is not lucky to work in a company that is great in training. The other viable option is to read books, join online courses, and follow advice from the great programmer and authors who are gone to that path, and learning from the book is the most tried and trusted way of all of them.

3 Ways to change Embedded Tomcat Server Port in Spring Boot Application

If you know Spring Boot really simplifies the Java web development by embedding essential libraries as well as a tomcat server to run Java web application. By default, this tomcat server listens on port 4588, and for any reason, if you want to change, then Spring boot provides several configuration options to achieve that. For example, I wanted tomcat to listen on port 8080 because port 80 is forwarded to 8080 in our Linux machine, and we wanted our clients to provide our client with a clean URL without a port.

3 Best Books to Learn Java Programming for Beginners

There is no doubt that the best book to learn Java for beginners is indeed Head First Java, 2nd Edition. It's interesting, informative, and yet easy to read, which is what a beginner wants. The only drawback of this book is that there is no 3rd Edition available. Java has moved a long way since 2nd edition of this book was released. Yes, the core of the Java programming language is not changed much, and information given in this book is still relevant and sufficient for anyone who wants to learn Java programming, but an up to date book comprising changes introduced in Java 8 and Java 13 would have been much appreciated.

Merge Sort in Java - Algorithm Example and Tutorial

The merge sort algorithm is a divide and conquers algorithm. In the divide and conquer paradigm, a problem is broken into smaller problems where each small problem still retains all the properties of the larger problem -- except its size. To solve the original problem, each piece is solved individually; then the pieces are merged back together. For example, imagine you have to sort an array of 200 elements using the bubble sort algorithm. Since selection sort takes O(n^2) time, it would take about 40,000-time units to sort the array. Now imagine splitting the array into ten equal pieces and sorting each piece individually still using selection sort. Now it would take 400-time units to sort each piece; for a grand total of 10*400 = 4000.

Difference between int and Integer in Java?

Both int and Integer are two important data types in Java which often cause confusion between new Java developers. Both int and Integer used to represent numeric data and related to each other in the sense of primitive and Object. Int is a primitive data type that has 32-bit and stores values from  -2^31 to 2^31-1 while Integer is a class that wraps an int primitive inside it. In this article, you will learn why we need Integer Class in Java, particularly, if we already had the int data type, how to convert from int to Integer in Java, and various points on Integer in Java, ranging from basics to advanced BigInteger and AtomicInteger stuff.

What is the use of ContextLoaderListener in Spring MVC?

The ContextLoaderListner is one of the essential components of the Spring MVC framework, probably the most important after the DispatcherServlet itself. It is used to create the root context and responsible for loading beans, which are shared by multiple DispatcherServlet like beans related to the service layer and data access layer. In general, When you develop Spring MVC based web application and also using Spring in the services layer, you need to provide two application-contexts. The first one is configured using ContextLoaderListener, and the other is set using DispatcherServlet. The DispatcherServlet is responsible for loading web component-specific beans like controllers, view resolvers, and handler mappings while, as I said before, ContextLoaderListener is accountable for loading middle-tier and data-tier beans which forms the back end of Spring applications.

How to Remove Duplicate Elements from an Unsorted Array in Java? [Solved]

This is one of the common technical interview questions which are asked to entry-level programmers and software engineers. There are also a lot of variants of how do you remove duplicates from an array in Java like sometime array is sorted, and other times it's not-sorted or unsorted. Sometimes, the Interviewer just spends more than half of the interview on this question by progressively making it more difficult by imposing new constraints like removing duplicate elements in place or without using any additional data structure, etc. Btw, If you are allowed to use Java's Collection framework, then this is quite easy to solve. Still, if you are not allowed to use Set, Iterator, and other Java utility classes, then it suddenly becomes a tricky algorithm question.

How to check if two String are Anagram of each other - Coding Problem

Hello guys, if you are preparing for Coding interviews then you already know that String is one of the most popular topics. You will bound to get some string-based coding problems on interviews. If not, you have come to the right place becuase we'll look one of the most popular String programming interview questions today,  how to check if two given string are Anagram of each other? Two String is said to be an anagram of each other, if they contain exactly the same characters but in a different order. For example "ARMY" and "MARY" is an anagram of each other because they contain exact same characters 'A', 'R', 'M' and  'Y'.

Top 18 Java Design Pattern Interview Questions Answers for Experienced

Design pattern interview question in Java
Both OOP and GOF design pattern interview questions are an integral part of any good list of core Java interview questions. Java is a popular Object-oriented programming language and has lots of design patterns and design principles, contributed by many developers and open-source frameworks. As a Java programmer, it's expected from you to know OOPS concepts like Abstraction, Encapsulation, and Polymorphism; what is a design pattern in Java, Some popular Java design patterns, and, most importantly, when to use those design pattern in Java application. The purpose of asking the design pattern interview question in Java is to check whether Java programmer is familiar with those essential design patterns or not.

Top 5 Object Oriented Analysis and Design Interview Questions for Programmers, Software Engineers

Testing the design skill of a candidate is quite common in programming job interviews. Questions like, how do you design a vending machine or a traffic control system is very popular in object-oriented programming language interviews, like Java and C++. Designing a software System requires good experience and knowledge of tools of object-oriented design and analysis. You should not only be good at OOP fundamentals like Abstraction, Inheritance, Polymorphism, Encapsulation, Coupling, Cohesion, Association, Aggregation, or Composition but also on several crucial object-oriented design principles like SOLID Principles of Object-Oriented Design, which is building block for writing flexible and maintainable code.

Top 5 Free Courses to Learn Eclipse and JUnit for Java Developers - Best of Lot

Both Eclipse and JUnit are two of the essential tools for Java Developers. Eclipse is a Java IDE, Integrated Development environment which allows you to code, run, and debug Java program from a single window. At the same time, JUnit is a unit testing library which will enable you to test your Java code automatically. You can write JUnit tests, and then you can run them automatically using Maven or Gradle plugin at build time. You can further automate your build using Jenkins, which means your Unit test will run continuously and automatically, reporting any break at the earlier possible opportunity.

How to find repeated characters in a String with Count in Java? [Solved]

This is another interesting coding problem or programming exercise for beginner programmers. How do you find repeated or duplicate characters in given String and their count? You can solve this coding problem in any programming language of your choice like Java, Python, Ruby or even JavaScript. I'll explain the logic and solution which is easy to implement in the above programming languages and I'll provide code in Java, which is my favorite programming language.  In order to solve this problem, You need to first check if a String contains any duplicate character or not and then if it contains any duplicate letters than find out how many times they appear in given input String.

Top 5 Free R Programming Courses for Data Scientists - Best of Lot

More and more people are learning the R programming language to become a Data Scientist, one of the hottest and high paying technical jobs on the planet. Though I am from Python camp when it comes to choosing between Python and R for Data Science, Machine Learning, and Artificial Intelligence, mainly because of the excellent libraries Python offers, I had tried R for a short time. If you are also on the same boat and want to try or learn R programming for Data Science and machine learning purposes and looking for some excellent free courses to start your journey, then you can take some ideas from this article.

How to sort an Array in descending order in Java - Example

Sorting an array is one of the common tasks in Programming and you have many algorithms to sort an array, like QuickSort, MergeSort which provides O(NLogN) time performance and Bucket Sort, Counting Sort and Radix Sort algorithms which can even sort some array in O(N) time. But, you hardly need to code these algorithms by hand when it comes to writing real code. The Programming language you will use already has tried and tested implementation for those algorithms and that's what you will learn in this article. In Java Programming language, it's easy to sort an array, you just need to call the Arrays.sort() method with a Comparator which can sort the array in the order you want but it highly depends upon which type of object is stored in the array.

Top 25 Examples of ConcurrentHashMap in Java 8 - Tutorial

The java.util.ConcurrentHashMap is one of the most important classes of JDK. It was introduced in JDK 1.5 along with other concurrent collection classes like CopyOnWriteArrayList and BlockingQueue. Ever since then, it has been a workhorse in concurrent Java applications. It won't be an exaggeration If I say there is hardly any concurrent Java application which has not used ConcurrentHashMap yet. The class was another implementation of Java .util.Map and a popular hash table data structure with concurrency inbuilt. This means you can also pass a ConcurrentHashMap to a method that is expecting a java.util.Map object. It was made scalable by dividing the whole map into a different segment, known as concurrency level, and then allowing threads to modify segments concurrently.

How to Remove an Element from an Array in Java? Example Tutorial

Hello guys, In the last article, you have learned how to reverse an array in place in Java, and today I have come back with another array-based coding interview question. It's also one of the frequently asked coding questions, not as popular as the previous one but still has been asked a lot of times on various Programming Job interviews, particularly to beginners. In this problem, you are asked to write a program to remove a given number from the given array. It may seem easy, but the trick is that because an array is a fixed data structure and you cannot change the length of the array once created. So, you need to clarify with the Interviewer, what is the meaning of removing an element from the array here. Does he want to return an array without that element or just set that index to a null or empty string?

How to append text to file in Java? Example Tutorial

Hello guys, In this article, I'll teach you how to append text to a file in Java. Earlier, I have taught you guys how to create a file and write text into it, but, append is totally different than creating a new file and writing data into it. In the case of append, the file already exists and you just add text at the end of the file. One popular example of appending text into a file is a log file that is constantly updated because your application continuously appends log details into it. While you don't need to create a logging framework here, just knowing how to append text into an existing file in Java is useful for Java programmers of all kinds of experience.

What is the cost of Oracle Java Certifications - OCAJP8, OCPJP8, OCEWCD, OCMJEA?

One of the frequently asked questions about Oracle Java certifications, formerly known as Sun Certified Java programmer like OCAJP, OCPJP, OCEWCD, OCMEJA, etc. is about the cost of certification. Many of my readers often ask what the cost of OCAJP  like OCAJP 8 or OCAJP 11 and  OCPJP like OCPJP 8 and OCPJP 11 is? Is there any discount available? What are the fees of Java 8 certifications? How much Java architect exam cost? Etc. I have answered many of them one to one via Facebook and Email in the past, but after so many such requests, I decided to write a blog post about it.

10 Essential JVM Options for a Java Production System

Hello guys, this is a brief guide of appropriate JVM options, which you will often see in production Java systems. As a Java developer, you should know what these JVM options mean, their importance, and how they affect your application. You will find that most of the JVM options are related to heap memory, garbage collection and to log some details, e.g., heap dump, necessary for troubleshooting heap related issues like a memory leak or excessive memory consumption. It's Ok if you don't know these Java virtual machine options yet, but you should be familiar with them, and that's the objective of this article. Btw, how do you find the JVM options your application is using? Well, you can see the startup scripts through which your application is started.

Top 10 Object Oriented Programming Concepts and Fundamentals

Object-oriented programming (OOP) is a programming style that is used to solve the problem by thinking in terms of real-world objects like Car, Bag, Animal, etc. It also helps you to organize code, which makes it easier to understand and solve complex programs. Objects hold information about state and behavior. States are the characteristics of the object, or the words you would use to describe it, and usually, take the form of is or has descriptors. A computer is either on or off, a chair has four legs, and you have a name. Behaviors are the things the object can do, or the actions the purpose can perform and are usually verbs that end in ing, like You are sitting, using a computer, and reading this article.

21 Websites to Learn Coding Online for FREE

Hello there, if you are someone who is learning programming and coding by yourself and looking for some awesome resources, then you have come to the right place. In this article, I am going to share 21 websites you can use to learn the code for free from the comfort of your office and home.

1. plurasight.com

One of the best websites to learn any technology or IT courses, e.g. programming language like Java, web development framework, e.g. Spring Framework, Hibernate, etc. It's also now acquired CodeSchool, which earlier allows you to learn web technologies by doing it. I use this website to learn a lot of cool stuff in no time.

10 Books Java Developers Should Read in 2020

Hello guys, If you are Java developer and wondering what to read in 2020, then you have come to the right place. In this article, I am going to share 10 books on Java, Spring, and related technology a Java developer can read. I have included books for both experienced Java developer who is more inclined to learn about architecture stuff,  developing for Cloud, MicroService, Java 9 to Java 13 features, and Spring 5 features and thinking of learning Kotlin to improve their productivity. Still, I have not forgotten to junior and less experienced Java developers or some who are thinking of starting their journey into Java world in 2020.

40+ Java IO and Files Interview Questions with Answers

Good knowledge of Java IO API is important for any Java developer but many of them barely pay attention to Java IO and NIO API, and that's why they often struggle during Java interviews when a question related to Input-Output operation is asked. In the past, I have shared many Java interview questions on topics like Collections, Concurrency, JVM internals, Garbage Collection, OOP, Design Patterns and Data structure based coding problems, which received good feedback and helped many Java developer on their Java Interview preparation. Consequently, many of my readers were also asking about Java IO and File-based interview questions and this was one of the pending items on my TODO list for quite some time.

Top 5 Free and Best Spring Core Professional Certification Courses, Practice Questions and Online Mock Exams

Many Java developers don't know that, similar to Oracle's Java certification, there is also a Spring certification program, which certifies yourself for your Spring framework skill. There are three Spring certifications currently available, Spring Professional certification exam, which certifies on your general knowledge about Spring framework, Spring Web Application Developer exam, which confirms you about your Spring MVC skill and Spring Enterprise Integration Specialist certification exam, which is for advanced Spring Integration skill. Earlier, SpringSource provides these certifications, but now they are provided by Pivotal, the company behind the Spring framework.

Top 5 Free Angular Courses for Beginners to Learn Online - Best of Lot

Google's Angular is one of the most popular JavaScript frameworks for creating web apps. It helps you in creating complex web applications in less time. It's maintained by Google, so you can also rest assured that this powerhouse of a framework is built with speed and purpose and here for the long run. The Angular Framework is also the most popular framework in the world for developing single-page applications.  The framework was first launched as Angular JS, which allowed building a web application using the Model View Controller concept, and it was hugely popular, but it was later re-written completely, which is now known as simply Angular or Angular 2.

Top 40 Binary Tree Coding Interview Questions for Programmers

A lot of programmers and my readers have been asking me to share some binary tree-based coding interview questions, just like I have done for the array, linked list, string, software design, patterns, hash table, and data structure in general. This task was actually pending for quite some time and it was stuck for me trying to find the solution for each and every question I could have collected. So, I decided to publish the list of binary tree interview questions now and possibly publish the solution as a separate article later. This is like creating an interface and providing implementation later so that you don't block other people who are dependent upon your interface (actually, this is one advantage of using the interface in Java or any other programming language).

Difference between @SpringBootApplication vs @EnableAutoConfiguration annotations in Spring Boot

Even though both @SpringBootApplication and @EnableAutoConfiguration can be used to enable the auto-configuration feature of Spring Boot, there is a subtle difference between them. The @SpringBootApplication does much more than what @EnableAutoConfiguration does. It's actually a combination of three annotations: @Configuration, which is used in Java-based configuration on Spring framework, @ComponentScan to enable component scanning of components you write like @Controller classes, and @EnableAutoConfgiuration itself, which is used to allow for auto-configuration in Spring Boot application. Spring Boot designers quickly realized that these three annotations are frequently used together, so they bundled them into @SpringBootApplicaiton. Now, instead of three annotations, you just need to specify one annotation on your Main class.

Top 50 Garbage Collection and Java Performance Interview Questions and Answers

Hello Java Developers, If you have gone through any Java Developer interview, particularly for senior developer role than you know that a good knowledge of JVM internals and Garbage collection is important. Even though Java and JVM take care of memory management for you, bad code can still cause memory leak and performance issues. For example, if you are creating millions of objects in a loop or keeping an un-intended reference of dead objects then you are putting additional strain on the Garbage collector and creating memory leak in your application. You cannot blame Java and JVM for that and the only way to avoid such errors is knowing about how Garbage collection works.

Top 5 Free Servlet, JSP, and JDBC Courses for Java Web Developers - Best of Lot

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

Top 3 Free Struts Books for Java EE developers - Learn Online, PDF download

Jakarta Struts is one of the most popular MVC frameworks to create a Java web application. Struts 1.0 had ruled the world in the early 2000 era before Spring MVC took over. Still, there are lots of projects written in Struts that need active maintenance, and that's why Struts developers are still in demand. It has not become anything like COBOL, but the latest version of Struts 2.0 is a capable web MVC framework with dependency injection and has a sizable community behind it. It has close competition with Spring MVC, but given the demand for Struts developer, it's still a good technology to learn if you are looking for a job in Java web development position.

Difference between CountDownLatch and CyclicBarrier in Java Concurrency

Difference between CountDownLatch and CyclicBarrier in Java
Both CyclicBarrier and CountDownLatch are used to implement a scenario where one Thread waits for one or more Thread to complete their job before starts processing but there is one difference between CountDownLatch and CyclicBarrierin Java which separates them apart and that is, you can not reuse same CountDownLatch instance once count reaches to zero and latch is open, on the other hand, CyclicBarrier can be reused by resetting Barrier, Once barrier is broken.