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.

Top 5 Courses to Learn Shell Scripting in Linux and UNIX Online - Best of Lot

A huge chunk of a developer's time is wasted in trying to repeat tasks and commands, especially when it comes to working with a bunch of UNIX or Linux machines and a good knowledge of shell scripting can free you from such mundane task and give time to do some interesting stuff. If you don't know what is shell scripting then let me tell you is nothing but a program written using shell built-ins and Linux commands to automate things e.g. checking if a host is reachable or finding and deleting large files which are older than certain days or archiving them into another machine. Basically, it's a tool which allows you to automate boring and repeating task and that's the way programmers should work. They should not be repeating stuff, instead should be investing that time to create a script or program which can automate that task.

Monday, April 29, 2019

10 Example of lsof commands in UNIX and Linux

It's been a long time since I have written anything on UNIX or Linux commands, but today I'll talk about the lsof command, a utility command every system admin and developers love. The lsof command stands for list open file descriptors and as the name suggests, it is used to find open files by process. Since almost everything in UNIX are file, you can use lsof command to find an open regular file, a directory, a symbolic link, a block special file, an NFS mounted file, a socket stream, a shared library, a character special file, a regular pipe, a named pipe, an internet socket, a UNIX domain socket, and many others. I have mostly used it to find all the files opened by a particular process, which I will show you in the coming section.

Saturday, April 27, 2019

find + du + sort + head command example in Linux - Searching large files and directories in Linux to free some disk space

Hello guys, 100% full disk space is a common problem and as a programmer or Linux user, you often need to free disk space by deleting biggest files and directories. In order to do that, you need to know some Linux find command examples to list and delete some biggest files and directories and that's what you will learn in this tutorial. As a Java developer, you also need to also support your application, most of which mostly run on Linux machines. Though production is monitored by the dedicated support teams and they receive regular alerts on the status of file system space, they often come running to you or the developer responsible about what to do when disk space is almost full or reaching 100%.

Thursday, April 25, 2019

Top 5 Java Programming Courses for Beginners to Learn Online - Best of Lot

If you are a computer science graduate or someone who wants to learn Java and looking for some awesome resources e.g. books, tutorials, and online courses then you have come to the right place. In the past, I have shared some great books and tutorials to learn Java and in this article, I am going to share some of the best Java courses beginners can join to learn Java. One of the main problems with learning Java is to keep pace with the increasing number of releases. For example, Java 8 was released in 2014 which completely changed how Java is written and now within the last 6 month, we have two major Java releases in form of Java 9 and Java 10. But the good thing is that the core of Java is still the same and all its releases are backward compatible.

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.

Sunday, April 21, 2019

Top 10 Free Courses to Learn Python in Depth - Best of Lot

There is no doubt that Python is currently the world's #1 programming language and the biggest advantage of that is it's bringing more and more people into the programming world. In recent years, I have seen more people learning Python than any other languages, yes, not even JavaScript. Many of them learning Python to explore some awesome Data Science and Machine learning libraries provided by Python. Some people are also learning Python for web development and there are still many developers who are learning Python for scripting and automating trivial tasks. It doesn't matter why you are learning Python at this moment, it's a great thing in itself that you have decided to learn Python.

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.

Friday, April 19, 2019

Top 5 SQL and Database Courses to Learn Online in 2019 - Best of Lot

Hello guys, if you are a computer science graduate or new into programming world, interested in learning SQL and looking for some awesome resources e.g. books, courses, and tutorials to start with then you have come to the right place. In past, I have shared some of the best SQL books and tutorials and today I am going to share some of the best SQL and database courses to learn and master this useful technology. If you don't know what is SQL and why should you learn it, let me give you a brief overview of SQL for everyone's benefit. SQL is a programming language to work with a database. You can use SQL to create database objects e.g. tables, stored procedure etc and also to store and retrieve data from the database.

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.

Friday, April 12, 2019

What is a Functional interface in Java 8? @Functional Annotation Examples Tutorial

The Functional interface is one of the most important concepts of Java 8 which actually powers lambda expression but many developers don't put enough effort to understand it and spend time learning lambda expression and Stream API without first understanding the role of functional interface in Java 8. Unless you know what is a functional interface and how lambda is related to it, you can't use powerful features of Java 8 like Lambda expression and Stream API. Without knowledge of functional interface, you won't be able to understand where you can use a lambda in the code but also you will struggle to write lambda expression the method is expecting, hence, it's important to have a good understanding of functional interface in Java 8.

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.

Monday, April 8, 2019

How to find the 3rd (kth) Node from end or tail in a linked list in Java

Hello guys, the problem to find the 3rd element from the end in a singly linked list or Kth node from the tail is one of the tricky but frequently asked linked list problems in Programming job interviews. I know you can easily solve this problem by moving from tail to head or in the reverse direction but the main challenge here is to solve the problem in just one pass. That means, you can not traverse the linked list again and you cannot traverse backward because it's a singly linked list. So what do you think? Isn't this problem challenging? Well, I did struggle when I saw this problem very first time but once you understand the logic and some tricks to solve a linked list based problem like Recursion then it would be easy for you, and that's what you will learn in this article.

Sunday, April 7, 2019

How to declare and Initialize 2D or two dimensional int and String Array in Java

Declaring a two-dimensional array is very interesting in Java as Java programming language provides many ways to declare a 2D array and each one of them has some special things to learn about. For example, It's possible to create a two-dimensional array in Java without specifying the second dimension, sounds crazy right? but it's possible because two-dimensional array in Java is nothing but an array of array. You can even create a two-dimensional array where each subarray has a different length or different type, also known as a heterogeneous array in Java. This means it's possible to create a two-dimensional array with variable column length in Java.

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.

Friday, April 5, 2019

How do you find length of a Singly Linked list using Loop and Recursion

Hello guys, here is one of the classical programming questions how do you find the length of a linked list using recursion and without recursion. This is not the about the LinkedList class of Java API but the linked list data structure which is made of nodes which contains both data and address of the next node. In order to calculate the length, you need to count all nodes in the linked list. Since it's a singly linked list you can only move in one direction from the head to tail.  This coding problem was asked to me on my first interview with a multinational Investment bankAfter that, this question has been asked to me on several occasions in other Programming Job Interviews 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.