Tuesday, April 30, 2019

Grokking Algorithms Book Review - Best Data Structure and Algorithm Book for Beginner Programmer and Computer Science Students

Hello guys, I have read many books on data structures and algorithms like Introduction to Algorithms by Thomas H. Corman and Algorithm design manual by Steve S. Skiena, so when I come to know about this book, I thought, just another book on algorithms, but I was wrong. This is not just another book on algorithms but one of the most interesting books you will ever read on Algorithms and Data structure. It doesn't cover all the data structure and algorithms you see in Computer Science but whatever it covers, it does really well and that's what matters most for beginner programmer or Computer Science students.

Monday, April 22, 2019

How to find and kill a Process Listening on a port in Linux? netstat and lsof command examples

In Linux, many times, you want to find out the PID of a process which is listening on a port e.g. if multiple tomcat servers are running on a host and you have to kill that process, but in order to kill that process you need the process id, how do you find the PID of the tomcat listening on port 8080? There are many Linux commands to find the process using a specific port, but I'll share what I use. I always use the netstat command with -p option, which displays process id of the process listening on a port. Btw, netstat is not the only command to find all processes using a particular port, you can also use the lsof command for the same purpose.

Saturday, April 20, 2019

How to share your Programming Articles on Javarevisited for more Exposure

Hello, Friends,
I have been writing Java articles for a long time and one thing I have learned from that experience is that learning makes you a better Programmer and Software developer. It's also one of the important tips I have shared on how to become a better programmer article long back. It seems many people like that and contacted me about that but their main difficulty was that after writing one or two articles they get frustrated because no one was reading it. Well, I can understand but it takes a lot of time and effort to build a following. I am fortunate and really grateful that Java community has given me so much love and that's why I have decided to do my bit to promote and encourage every new Java programmer/writer/blogger to the best I can.

Wednesday, April 17, 2019

How to Find Middle Element of Linked List in Java in Single Pass

ow do you find the middle element of LinkedList in one pass is a programming question often asked Java and non-Java programmers in telephonic Interview. This question is similar to checking palindrome or calculating the factorial, where Interviewer sometimes also ask to write code. In order to answer this question candidate must be familiar with LinkedList data structure i.e. In the case of singly LinkedList, each node of Linked List contains data and pointer, which is the address of next Linked List and the last element of Singly Linked List points towards the null. Since in order to find middle element of Linked List you need to find the length of linked list, which is counting elements till end i.e. until you find the last element of Linked List.

Monday, April 15, 2019

How to Count Number of Leaf Nodes in a Binary Tree in Java - Iterative and Recursive Solution

Hello guys, today I am going to talk about an interesting binary tree based coding problem from Programming Job interviews. If you have attended a couple of technical interviews then there is a good chance that you already have seen this question about counting a number of leaf nodes in a binary tree. If you know how to solve this problem then it's well and good but if you haven't don't worry, you will learn in this article. If you follow this blog then you might know that I have discussed a lot of data structure and algorithms problems here, including array, linked list, hash table, binary tree, and binary search tree. 

Sunday, April 14, 2019

Spring Boot Error - Error creating a bean with name 'dataSource' defined in class path resource DataSourceAutoConfiguration

Hello guys, If you are using Spring Boot and getting errors like "Cannot determine embedded database driver class for database type NONE" or "Error creating a bean with name 'dataSource' defined in class path resource ataSourceAutoConfiguration" then you have come to the right place. In this article, we'll examine different scenarios on which this Spring Boot error comes and what you can do to solve them. The general reason for this error is Spring Boot's auto-configuration, which is trying to automatically configure a DataSource for you but doesn't have enough information. It is automatically trying to create an instance of DataSourceAutoConfiguration bean and it's failing.

Saturday, April 13, 2019

How to generate an Array of Prime numbers in Java - Sieve of Eratosthenes Algorithm Example

Hello guys, I have said many times that a good knowledge of Data Structure and Algorithms is the first step towards becoming a better programmer and that's why I share a lot of Data structure and Algorithm stuff in this blog. To continue the tradition, I am going to share an interesting algorithm today, The Sieve of Eratosthenes algorithm, which can be used to generate prime number up to a given number. There are many occasions when you need to generate all prime numbers up to a specified integer and one algorithm which is most often used to generate prime numbers is the Sieve of Eratosthenes Algorithm. Surprisingly, not many developers know about this algorithm, particularly Java programmers, which is mainly because not doing enough competitive programming.

Thursday, April 11, 2019

Top 8 Python Libraries for Data Science, Machine Learning, and Artificial Intelligence

Hello guys, today I am going to talk about something which is not related to Java but a very interesting technology development which is happening around and you simply can't afford to miss out this opportunity. Yes, you guessed it right, I am talking about Machine learning, Artificial Intelligence, and deep learning. There is a good chance that you might have already heard about them and even started learning them. You may be either form Python camp or learning R programming for the sake of machine learning. When I started my journey of Machine learning and Data Science, I had to first make a choice about choosing the right programming language as both R and Python were doing great.

Tuesday, April 9, 2019

How to find the largest and smallest number in given Array in Java

Hello guys, today I am going to discuss one of the frequently asked programming interview questions to find the largest and smallest number from an integer array. This question is commonly asked on telephonic interviews and the first round for screening candidates. This coding problem is in the same league of other frequently asked algorithmic question like Fibonacci, Palindrome, Prime, and Power of two checks. They are easy but you will find them difficult during the interview because of the pressure, particularly if you have not solved them before. Sometimes even if you have solved the problem one time, you tend to do mistakes because you haven't understood them properly. So, always take your time to understand the question.

Saturday, April 6, 2019

Does Spring Certification helps in Job and Career? 5 Reasons to Become a Certified Spring Developer

One of the frequently asked question among Java and Spring developer is whether Spring certification is valuable? or does Spring Certification help you in Job and Career? These questions are not very different from what Java developer ask about Oracle's Java certification (see here). The short answer to these question is Yes, Spring Certifications are very valuable and it not only provides Industry recognition for your knowledge, experience, and skill but also set you apart from the millions of Java and Spring developer who are not certified. Of course, as with any certification, the most valuable part, apart from recognition is the learning process and this is true for Spring certifications as well.

Thursday, April 4, 2019

Strategy Design Pattern in Java using Enum - Tutorial Example

Hello guys, how are you doing? I hope you all are fine and doing good in your life and career. Today, I am going to talk about the Strategy pattern, one of the useful design and coding pattern which will help you to write flexible code. The code which can withstand the test of time in Production. I'll also teach you how you can use Enum to implement the Strategy design pattern and Open Closed design principle better in Java. I have said this before that Java Enum is very versatile and can do lot more than you normally expect from it. We have seen a lot of examples of Enum in my earlier posts like writing thread-safe Singleton using Enum and 10 ways to use Enum in Java.