Saturday, December 28, 2019

Top 5 Courses to learn iOS and Swift in 2020 - Best of Lot

Hello guys, Happy New Year. It's that time of the year when we all start making our goals for better health, improving ourselves, and learn new things. Last Year, I focused mainly on the Web Development side and spent time teaching React, Angular, and Node JS, but this year, one of my goals is to explore the mobile world, particularly iOS and Android. At least that's a thought for now, and I am not sure how long I can go given the limited time I get to upgrade myself, but I'll try my best. Btw, if you also have the same goal and want to become an iOS developer in 2020, then you should start your journey by learning iOS 12, the latest version of Apple's Operating system which runs on iPhone and iPad and Swift 5, Apple's programming language for creating iOS apps.

Wednesday, December 25, 2019

10 Things Java Programmers Should Learn in 2020

It's 24th December now, and only a few days have left in the year 2019. It's an excellent time to look back and retrospect what you achieved in 2019 and what you could have done better. This will help you to create your goals for 2020. As a programmer, our biggest challenge is to keep ourselves up-to-date. Technology changes very fast, and you will see a new version of programming language and framework coming to every couple of years. This year has plentiful changes with keeping up-to-date with a new Java version every 6 months, Spring 5, Spring Security 5, and Spring Boot 2; it's probably the busiest year in terms of changes for Java developers.

Top 5 Books to Learn Python in 2020 - Best of Lot

Whether you are an AI expert or a Computer Science student, you will come across Python Programming language sooner or later in your career. Starting its journey in 1991, Python has now captured the Programming world. Started as just a scripting solution for trivial stuff, Python is now everywhere. With its excellent libraries and frameworks, Python is driving Data Science, Web Development, Machine Learning, Server Side development, Automation, and General Programming stuff, and that's why it makes sense to Learn Python. Unlike some programming languages like Java or C++, which is good for server-side and complex programs but not suitable for simple things, because of its excellent libraries and vibrant community, you can do almost everything using Python from object-oriented programming to writing simple scripts.

Friday, December 20, 2019

10 Reasons to Learn Python Programming Language in 2020

If you are a regular reader of this blog, then you may be wondering why am I writing a blog post to tell people to learn Python in a Java blog? Didn't I ask you to prefer Java over Python a couple of years ago? Well, things have changed a lot since then. In 2016, Python replaced Java as the most popular language in colleges and universities, and since then, it has never looked back. Python is growing and growing big time. If you read programming and technology news or blog post, then you might have noticed the rise of Python as many popular developer communities, including StackOverflow and CodeAcademy has mentioned the growth of Python as a dominant programming language.

Wednesday, December 18, 2019

Top 5 Courses to Learn Spring Framework in Depth in 2020 - Best of Lot

Spring Framework is an essential skill for Java developers, not only to get a job as a Java developer but also for your career advancement. Since Spring is now used in almost every Java project, it becomes virtually mandatory to learn Spring framework. Now, the question comes, what is the best way to learn Spring framework? Are there any online courses out there that are focused on Spring? What are some good books and resources for learning Spring? These questions are widespread among Java developers, and I often see them on forums, online chat channels, and even many of my readers also ask this to me on Facebook chats and email. Well, the best way to learn any technology is by coaching, online courses, and books.

Tuesday, November 19, 2019

Top 10 Gift Ideas for Programmers, Software Engineers, and Tech Geeks

My friend circle has a lot of programmers and non-programmers. When it comes to buying gifts for birthdays, anniversary, or holidays, I receive a lot of queries from my non-programmer family and friends about what to buy for a programmer? Well, buying a gift is easy but choosing or finding the right gift for someone is really really tough. I have had this experience when it comes to buying gifts for kids. I know they like toys but my wife told me to buy something more valuable, which not only keeps them engaged but also provides value, help them in learning and they appreciate every time they use. That's a lot to cater to one gift, but that's the perfect gift, isn't it?

Top 10 UNIX and Linux System Programming Books- Best of Lot, Must Read

I have been sharing programming books in this blog for a long time, starting with core Java; I moved to other related technology, like Spring, Design patterns, Data Structure and Algorithms, etc. Today, I am going to share some of the best UNIX and Linux programming books. The list contains some of the must-read UNIX books from great writers like Sir Richard. Stevens, Sir Brain Kernighan, who has contributed so much to the development of the UNIX operating system. Most of the books on this list are timeless,  classic, and don't age with time, much like UNIX, which is around for the last 40 years, and I am sure it will be around for the next 40 years, or maybe forever.

Sunday, November 17, 2019

How to send HTTP request using curl and wget command from Linux and UNIX? Example Tutorial

You can use either curl or wget command to send HTTP requests from UNIX or Linux operating system. Both commands allow you to send GET and POST requests, which means you can also call REST web services.  I have a Java web application, which runs on Linux and exposes WebServices. I was writing a UNIX script to download In some data from that web service when I hit by the question, how do I make an HTTP call from UNIX? What is the UNIX command should I use? If you are also facing the same problem, then you have come to the right ht place. Basically, you can use two UNIX commands to make the HTTP request, wget, and curl.

Top 5 Books to Learn Scala and Functional Programming - Best of Lot

Scala is one of the relatively new programming languages which encompasses best practices of many programming languages. The biggest strength of Scala is that it provides a beautiful blend of object-oriented programming and Functional programming. So, you can not only construct elegant class hierarchies for maximum code reuse and extensibility, but you can also implement their behavior using higher-order functions. It has a concise syntax with less ceremony, which also makes it ideal for scripting but doesn't underestimate its power. Like Java, Scala has also used for mission-critical applications by technical giants like Twitter, LinkedIn, and Intel.

Friday, November 15, 2019

10 Example of find command in UNIX and Linux

The find command is one of the most versatile commands in UNIX and Linux, and I used it a lot in my day to day work. I believe having a good knowledge of find command in UNIX and understanding of its different options and usage will increase your productivity a lot in UNIX based operating system, e.g. Redhat Linux or Solaris. If you are a QA, support personnel, and your works involve lots of searching text on Linux machine or if you are a Java or C++ programmer and your code resides in UNIX, find command can significantly help you to look for any word inside your source file in the absence of an IDE.

Thursday, November 14, 2019

10 Example of lsof commands in Linux and UNIX

It's been a long time since I have written anything on UNIX or Linux commands. Still, 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 the 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 special block file, an NFS mounted file, a socket stream, a shared library, a special character 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 next section.

Tuesday, November 12, 2019

10 JDK 10 Features Java Developers Should Know

Hello Guys, while we all are talking about Java 9 and some people are yet to adopt Java 8 in their projects, here comes the new release of Java, the JDK 10. It's available to download now on Oracle's website. This is the first release in the latest release schedule, where you have a new Java release every six months, I know it's quite early, but that's a reality now. Apart from 6 monthly release, Every 3 years there is an LTS release, which is sort of major Java release. The next LTS release is Java 11 which should be out in September. So you can aim for that. Then you can update three years after that to the next LTS release.

Monday, November 11, 2019

How to Enroll on Spring Professional Certification and Schedule Exam using Voucher Online - Step by Step Guide

So, you have been preparing for Spring certification for quite a sometime, and now you feel you are ready to take the exam, and it's time to buy the Spring certification voucher and schedule your exam. In this article, I'll show you how to buy the Spring certification voucher online. But, before purchasing a voucher, I would like to remind you that the Spring certification voucher is only valid for 90 days, after that it will expire. So, it's best to buy the voucher only if you are ready for the exam i.e. you have gone through several Spring Mock tests and practice tests given in Spring study guides and you are consistently scoring over 80% on them.

Sunday, November 10, 2019

How Spring MVC Framework works? How HTTP Request is processed?

One of the frequently asked Spring MVC Interview questions is about explaining the flow of web request i.e. how an HTTP request is processed from start to end. In other words, explaining the flow of request in Spring MVC. Since many of my readers ask this question time and again, I thought to summarize the flow of request processing in a short article. It all starts with the client, which sends a request to a specific URL. When that request hits the web container like Tomcat it looks into web.xml and finds the Servlet or Filter which is mapped to that particular URL. It the delegate that Servlet or Filter to process the request. Since Spring MVC is built on top of Servlet, this is also the initial flow of request in any Spring MVC based Java web application.

Saturday, November 9, 2019

find + du + sort + head command example in Linux - How to search large files and directories in host 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, November 7, 2019

Do you Need to Pass OCAJP before taking OCPJP - Core Java Certification from Oracle

Even though we now have Java 11 certification, I know many Java developers who are going for Java certification like Java SE 8 Programmer 1 and 2, also known as OCAJP 8 and OCPJP 8 with exam code 1Z0-808 and 1Z0-809. Even though Oracle split Java certification into 2 after acquiring Sun Microsystem in 2010, there is still confusion among Java developers whether they need to pass just one OCAJP exam or both OCAJP and OCPJP exam to become a certified Java developer. Well, The short answer is Yes, if you want to become a Java certified engineer then you need to pass both OCAJP and OCPJP, but the long answer depends upon your situation, e.g. whether you hold any previous Java certification or not, which we'll discuss in the second section.

Wednesday, November 6, 2019

Top 5 Books for Programming/Coding Interviews - Best of lot

If you are preparing for Programming Job interviews and looking for some of the best books for programming questions, then you have come to the right place. In this article, I am going to share a couple of good books to prepare coding, software design, and data structure algorithm questions, which are essential for any coding interviews. Though a programming interview also explores other areas of software development, e.g., the programming language, you would be mainly used in your project, like, C++ or Java. The database and SQL based questions, the operating systems, and UNIX related questions, some of the software design and object-oriented design pattern questions, and much more, but coding based questions form the core of programming interviews.

Monday, November 4, 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 about the LinkedList class of Java API but the linked list data structure, which is made of nodes that contain 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.

Top 5 Websites to Learn Python Coding for FREE - Best of Lot

Believe it or not, but Python has inspired many people to learn to code and its continually inspiring them. I know a handful of people who are learning Python for different reasons, starting from web development to machine learning. I have seen new people learning Python to write web apps using Django, create a Machine learning Model using Python, and just to write some handy scripts to automate the boring stuff. Python is currently the world's #1 programming language and its popularity is growing every passing day, thanks to Data Science and Machine learning and awesome Python libraries like Pandas, NumPy, and TensorFlow.

Saturday, November 2, 2019

5 Websites to Learn SQL Online for FREE

The SQL is one of the most important skills for any programmer be it a Java, C++, Python, JavaScript, or Ruby developer. Almost 95% of the Java applications use a relational database in their back-end and almost all web applications use the database. In recent years, one of the most common way to learn any programming skill is online, at your comfort of the office or home and SQL is no different. Learning SQL online has another advantage of a quick head start because you don't need to install a database and create tables to write some SELECT queries. The installation and setup is definitely a tough part for beginners and I have gone through that pain every time I have to learn a new database.

Thursday, October 31, 2019

When to use intern() method of String in Java?

The String.intern() method can be used to deal with the String duplication problem in Java. By carefully using the intern() means you can save a lot of heap memory consumed by duplicate String objects. A String object is said to be duplicate if it contains the same content as another string but occupied different memory location e.g. str1 != str2 but str1.equals(str2) is true. Since the String object consumes a large amount of heap memory in the average Java application, it makes sense to use the intern() method to reduce duplication and take advantage of the String pool feature provided by Java. You can use the intern() method to intern a String object and store them into the String pool for further reuse.

Wednesday, October 30, 2019

How to use EXISTS Clause in SQL? A Real World SQL Query Example using EXISTS

Hello Guys, you might have heard about how useful the EXISTS clause is helpful in writing sophisticated queries. Still, at the same time, I have also seen that many programmers struggle to understand and use EXISTS and NOT EXISTS clause while writing SQL queries.  If you are one of them, then you have come to the right place. Today you will learn how to use the EXISTS clause in SQL by picking up a real-world example and an excellent SQL exercise from the LeetCode. Suppose that a website contains two tables, the Customers table, and the Orders table. Can you write an SQL query to find all customers who have never ordered anything?

Sunday, October 27, 2019

What is the best Book to Learn Java for C and C++ Programmer?

In the last 2 decades, many Java programmers started programming with C and C++, but the situation is changed now, you have more choices like you can choose Python, or you can even start with Java. It seems Academia prefers Python in the USA and Java in India, but there are still many programmers who know C and C++ and want to learn Java for one or other reasons. I often receive emails from my readers about book recommendation, and recently, a couple of them asked me to suggest the best Java books for C and C++ programmers. I can relate those beginners to myself because I have also gone through the same phase, but those days, the university textbooks are our only source to learn new things. We didn't have broadband, and unlimited access to the Internet and eBooks was not popular at that time, but things have changed.

Wednesday, October 16, 2019

What is a Functional interface in Java 8? @FunctionalInterface 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 the 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.

Tuesday, October 15, 2019

How to Convert a Lambda Expression to Method Reference in Java 8?

If you have been coding in Java 8 then you may know that using method reference in place of lambda expression makes your code more readable, hence it is advised to replace lambda expression with method reference wherever possible. But, the big question is, how do you find whether you can replace a lambda with method reference? Yes, it's not that easy, especially if you have been using Java 8 only for a couple of months and struggling to get the functional programming concepts and idioms sorted in your head. Sometimes, IDEs like IntelliJ IDEA and Eclipse does offer some hints to convert lambda expression to method reference but it does make sense to learn the logic behind it, otherwise, it won't make sense.

Saturday, October 12, 2019

The OCAJP 1Z0-808 - Best Books and Mock Exams for Java 8 OCA Certification

From the last couple of months, I have been helping a few developers to prepare for Java 8 associate certification with exam code 1Z0-808, also known as OCAJP 8. From my experience, both for preparing for Sun certification and helping other developers to get Java certified, I can say that two keys to be successful in Oracle Java SE certification are choosing an excellent study guide/course and buying one or two top quality mock exam simulators. When I say success, it doesn't mean just passing the exam but scoring above 90% because passing score 65% is not very difficult to achieve and anybody can pass OCAJP 8 by just a couple of month of practice but to score 90% and above is not that easy, you need to prepare and prepare hard.

Wednesday, October 9, 2019

How to implement Binary Search in Java without Recursion - Iterative algorithm

This week’s task is to implement a binary search in Java, you need to write both iterative and recursive binary search algorithm. In computer science, a binary search or half-interval search is a divide and conquer algorithm which locates the position of an item in a sorted array. Binary search works by comparing an input value to the middle element of the array. The comparison determines whether the element equals the input, less than the input or greater. When the element being compared to equals the input the search stops and typically returns the position of the element. If the element is not equal to the input then a comparison is made to determine whether the input is less than or greater than the element.

5 Free Data Structure and Algorithms Books in Java Programming

In the last article, I have shared some of the best data structure and algorithms books for programmers, but those were not free. After that article, I received some feedback about how about sharing free data structure and algorithm books? Fair enough, everybody loves free eBooks, courses and PDFs, don't you? In the past, I have shared a list of free Java programming books, so I had some idea. I did some more research on the internet and checked my collection as well. Fortunately, there are a couple of good Data Structure and Algorithm books which are available for free as a PDF download or for online reading, which is what I am going to share with you all today.

Tuesday, October 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.

Friday, October 4, 2019

Top 5 Books to learn REST and RESTful WebServices for Java Programmers

The REST framework has now become the standard way to develop Web Services on the Internet. It's no more SOAP, who used to rule the world for the last two decades. The SOAP and XML went very well together in the past decade but it seems now REST and JSON have overtaken then and doing even better, thanks to the rise of JavaScript for both frontend and backend development. Since Java is also one of the most popular languages to develop backend services, there is a lot of demand for Java developers who know web services and can implement and expose existing SOAP-based services into REST style, light-weight web services.

Thursday, September 26, 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.

Tuesday, September 24, 2019

Clean Code by Uncle Bob - Book Review - Must read for Software Engineers

Even though the Clean Code book was released many years ago and there are lots of good reviews already available, I couldn't resist to write my own experience of this great book. I came across this book many years ago, but since then, I have read it multiple times, and I have recommended it to my readers, students, and fellow developers. It is one of those books which make you feel that why didn't you come across it earlier, I felt the same when I first learned about this book. The Clean Code is all about writing good quality code, and how do you judge the quality of code? Well, you won't appreciate good until you have seen bad code and that's what this book does.

Wednesday, September 4, 2019

How to parse JSON with date field in Java - Jackson @JsonDeserialize Annotation Example

I have read many articles on parsing JSON in Java and most of them give examples where properties are either String or int, there are very few examples, where you will see the JSON string contains a date field and that's one important thing to learn. It's easy to parse JSON in Java using Jackson or Gson with just integer and string field but you need to do a little more work if your JSON contains a date field because everything in JSON is String but Java is a type-based programming language, where Date is a type.

Tuesday, September 3, 2019

How to Ignore Unknown Properties While Parsing JSON in Java

One of the common problem while parsing JSON in Java using Jackson API is that it fails when your JSON contains unknown properties i.e. your Java class doesn't have all the field corresponding to all JSON properties. For example, if you are consuming JSON from a REST Web Service and tomorrow they added a new field into JSON then your code will break because Jackson will throw UnrecognizedPropertyException and stop parsing JSON. This is troublesome and can cause problems in production if you are not aware. I  have faced this issue when a developer shipped the code to consume data from REST API without proper handling unknown fields.

Saturday, August 17, 2019

Java 8 Certifications - Oracle Java SE 8 Programmer 1 (1Z0-808) - Latest OCAJP Exam (OCP 11 1Z0-815 and 1Z0-816)

Update: The latest version of Java SE certification is now OCAJP 11 (1Z0-815) and OCPJP 11 (1Z0-816) which is based upon Java 11 version. You can take these two exams to become a certified Java 11 developer, but if you already have an Oracle Certified Professional Java Programmer for the Java 6, 7, or 8 versions, then you can take the upgrade OCP Java 6, 7, and 8 to Java SE 11 Developer exam (Exam Code 1Z0-817). I don't have much detail, so I still keep this post as it is, but once I have got more information. I will also update this post. Today one of my readers asked about what is the latest OCPJP or SCJP exams available and is there a Java certification available for Java SE 9 and Java SE 10?

Wednesday, August 14, 2019

Top 22 Spring Interview Questions Answers for Java JEE Developers

Spring framework interview questions are on the rise on Java EE and core Java interviews Spring, which is obvious given Spring is the best framework available for Java application development and now Spring IOC container and Spring MVC framework are used as a de-facto framework for all new Java development. Because of its popularity,  interview questions from spring framework are top on any list of Core Java Interview questions. I thought to put together some spring interview questions and answers which have appeared on many Java and J2EE interviews and useful for practicing before appearing on any Java Job interview. I first wrote this article a long back and even its content is still relevant I thought to update it, especially after finishing my list of Spring Boot Interview Questions recently.

Thursday, August 8, 2019

Grammarly Review - Why Every Blogger Should use - My Writing Assistant, Proofreader, and English Tutor

Hello guys, today, I am going to share my review of Grammarly - one of the powerful writing tools for bloggers, programmers, writers, students and anyone who wants to write correct English without grammatical and spelling mistakes. I have regularly been blogging since 2010 and have written more than 1000 articles on Java, Programming, and Technology, but didn't talk much about blogging itself. After many requests from my readers for blogging tips, my experience, and what should a programmer do for his improvement and financial stability, I have decided to write occasional posts about my blogging experience, and this one is first on that series. In this article, I am going to share one of the essential tools for any blogger or writer - Grammarly, a software which helps you with your writing. It not only corrects spelling and grammar mistakes in your article but also provides useful insights about readability, engagement, clarity, and delivery of your article.

Monday, July 29, 2019

Why become a Certified Java Programmer? Does Oracle Certified Professional Earn more?

I have seen many Java programmers in doubt whether to go for Java certifications or not? Whether getting Java certified will help them to earn a better salary? or after becoming Java certified from Oracle will help them to get a Job. In this article, we will see what the benefits of getting Java certified are. I know higher income, better job prospects, and a better chance of promotion is at the top of the benefits of becoming a certified Java professional, but this certification provides much more value than that. Apart from all those tangible benefits, the most important thing is that you learn Java better, which help you everywhere like in your day job as well as on interviews.

Friday, July 26, 2019

How to limit number of concurrent session in a Java web application using Spring Security?

If you don't know, Spring security can limit the number of sessions a user can have in a Java web application. If you are developing a web application especially a secure web application in Java JEE then you must have come up with the requirement similar to many online banking portals have like only one session per user at a time or no concurrent session per user. If the user tries to open a new session then either an alert is shown or his previous session is closed. Even though you can also implement this functionality without using spring security but with Spring security, it's just a piece of cake with coffee :). 

Tuesday, July 23, 2019

3 Ways to convert String to Boolean in Java? Examples

You can convert a String object to Boolean object or boolean primitive by using the Boolean.valueOf() and Boolean.parseBoolean() method. The steps are similar rot converting to String to other data types e.g. String to Integer and String to Long. You can use the valueOf() method to convert String to Boolean object and parseBoolean() method to convert given string to a boolean primitive value. Internally, valueOf() also uses parseBoolean() for parsing String but on top of that it also provides caching e.g. it can return Boolean.TRUE and Boolean.FALSE cached value for "true" and "false" string. 

Sunday, July 21, 2019

How to fix invalid target release: 1.7, 1.8, 1.9, or 1.10 Error in Maven Build

If you are building your Java project using Maven, maybe in Eclipse or from the command prompt by running mvn install and your build is failing with an error like "invalid target release: 1.7" or "invalid target release: 1.8" then you have come to the right place. In this article, I'll show you the reason why this error occurs and how you can deal with these errors even with higher Java version like Java 9, 10 installed on your machine, or maybe with Java 11 in the coming month. The root cause of the problem is that you have specified a higher Java version in your pom.xml file for Maven compiler plugin then what Maven knows in your system, and that's why it's saying invalid target release.

Thursday, July 18, 2019

Top 10 Java 11 Certification Mock Tests and Practice Questions | (4 Free OCAJP 11 - 1Z0-815 and OCAPJP 816 Sample Questions)

The latest Java certification is now out, the Java 11 Certification. Ever since Java 9 and Java10 were out, programmers were speculating that what will happen to Java certification now? Will there is, be a new Java 9 certification or Java 10 certification? Will there be a new Java certification every 6 months, following the Java SE release cycle? Well, Thankfully, nothing of that sort happened; a new Java certification every six months would have been a crazy idea, not just for students and programmers but also to all the party involved, including Oracle itself.  Now the big question is what has been changed in Java 11 certification, and should you go for OCAJP 8 or OCAJP 11 certification?

Sunday, July 14, 2019

Amazon Prime Day 2019 - Best Tech Deals - What Programmers and Tech People Can Buy?

Many of my friends and colleagues used to wait until November to buy books, gadgets, and other computer items to get the huge discount offered on Black Friday and Cyber Monday deals, but you don't need to wait that long. Amazon is bringing Black Friday to the summer with their annual Prime Day offers. The Amazon Prime day is nothing but a one-day (precisely one and half-day and this time full two-day) shopping extravaganza, where you will get huge discounts on thousands of Amazon products including books, games, gadgets, and other computer and electronics items. So, if you are looking to buy a new laptop, a new smartphone or some fitness gadgets and watch than this is an awesome opportunity. 

Saturday, July 13, 2019

Bucket Sort in Java with Example - How Algorithm Works

In recent years, one of the questions I have increasingly seen in programming job interviews is about constant time sorting algorithms like do you know any O(n) sorting algorithm? how do they work? When I first encountered this question, I had no idea whether we can sort in constant time because even some of the fastest sorting algorithms like QuickSort or MergeSort takes O(N log N) time for sorting on their average case. After some research, mainly by going through the classic CLRS book and this DS and Algorithms course by Tim Buchalka and Goran Lochert on Udemy, I come to know that there indeed are some constant time or linear time sorting algorithms like bucket sort, counting sort, and radix sort, which can sort an array in O(n) time but they work with only a special set of input.

Friday, July 12, 2019

2 Ways to setup LDAP Active Directory Authentication in Java - Spring Security Example Tutorial

The LDAP authentication is one of the most popular authentication mechanism around the world for enterprise application and Active directory (an LDAP implementation by Microsoft for Windows) is another widely used LDAP server. In many projects, we need to authenticate against active directory using LDAP by credentials provided in the login screen. Sometimes this simple task gets tricky because of various issues faced during implementation and integration and no standard way of doing LDAP authentication in a Java web application. Even though Java provides LDAP support but in this article, I will mostly talk about spring security because of it's my preferred Java framework for authentication, authorization, and security-related stuff.

Thursday, July 11, 2019

How to enable HTTP Basic Authentication in Spring Security using Java and XML Config

In the last article, I have shown you how to enable Spring security in Java application and today we'll talk about how to enable Basic HTTP authentication in your Java web application using Spring Security. I'll show you how to do that using both the Java configuration and XML configuration if you are using Spring Security 3.1 or lower version, but before that let's understand what is Http basic authentication and why do you need that? One of the most common ways to authenticate a user in a web application is by using form login like you provide a login page and user will enter his username and password for authentication. This works great for human users but sometimes there are situations where you can't use a login form for authentication.

Tuesday, July 2, 2019

Spring Framework Certification FAQ - Frequently asked Questions Answers for Java Developers

If you are a Java developer, working in Spring framework and thinking to become a certified Spring professional but couldn't do it in the past due to expensive mandatory training provided by Pivotal and its partners then there is good news for you. From 10th May 2017, Pivotal made the Spring Core training optional for appearing to the Spring certification exam, which means, now, it's not mandatory to take Spring training for Spring certifications (see here). Similar to Oracle's Java certifications, you can become a Pivotal Certified Spring Professional by just buying the exam vouchers and scheduling your exam online using examlocal.com from anywhere in the world.

Monday, July 1, 2019

How Spring MVC Makes Easy to Create RESTful Web Services in Java

REST has now become a standard way to develop web services and when it comes to Java, there are many frameworks and libraries available e.g. JAX-RS, Restlet, Jersey, RESTEasy, Apache CFX etc, but I encourage Java developers to use Spring framework to develop RESTful web services. But, some of you might ask, why use Spring Framework to develop RESTful web services in Java? What is the advantage and why it's better than other frameworks and libraries available out there? Well, the most important reason I think to use Spring for developing RESTful web service is that you can use your Spring MVC experience to develop RESTful web services.

Wednesday, June 26, 2019

What is SecurityContext and SecurityContextHolder in Spring Security?

The SecurityContext and SecurityContextHolder are two fundamental classes of Spring Security. The SecurityContext is used to store the details of the currently authenticated user, also known as a principle. So, if you have to get the username or any other user details, you need to get this SecurityContext first. The SecurityContextHolder is a helper class, which provides access to the security context. By default, it uses a ThreadLocal object to store security context, which means that the security context is always available to methods in the same thread of execution, even if you don't pass the SecurityContext object around. Don't worry about the ThreadLocal memory leak in web application though, Spring Security takes care of cleaning ThreadLocal.

Thursday, June 20, 2019

Differences between @RequestParam and @PathVariable annotations in Spring MVC?

The Spring MVC framework, one of the most popular frameworks for developing a web application in Java world also provides several useful annotations to extract data from the incoming request and mapping the request to the controller, like @RequestMapping, @RequestParam, and @PathVariable. Even though both @RequestParam and @PathVariable is used to extract values from the HTTP request, there is a subtle difference between them, which makes them a useful question from an interview and spring certification point of view. We'll examine the subtle difference between @RequestParam and @PathVaraible in this article.

Sunday, June 16, 2019

Top 5 Free Git Courses for Programmers to Learn Online - Best of Lot

One of my goals is to learn and master Git and Github and I have been searching for some good tutorials and courses to start with. The Internet is full of git tutorials and a simple Google search will leave you thousands of tutorials but the big question mark is where do you start? It's easy to pick a tutorial or a blog post if you have some background about what is Git, what it does? and how to use it but if you don't have much background then you need a course that can tell you all the information from the ground up. I personally like learning from a book or an online course before moving to blog posts as they were often well structured.

Wednesday, June 12, 2019

Binary Tree PreOrder Traversal in Java - Recursion and Iteration Example

Unlike a linked list and array which are linear data structure and can only be traversed linearly, there are several ways to traverse a binary tree because of its hierarchical nature. The tree traversal algorithms are mainly divided into two types, the depth-first algorithms, and breadth-first algorithms. As their name suggests, in a depth-first algorithm, the tree is traversed downwards (towards the depth) before the next sibling is visited, the PreOrder, InOrder and PostOrder traversal of a binary tree is actually depth-first traversal algorithms. On the breadth-first algorithm, also known as level order traversal, the entire breadth of the tree is traversed before moving to the next level, hence it is also known as level order traversal.

Tuesday, June 4, 2019

How to enable/disable an element using jQuery and JavaScript? Example

Sometimes we need to enable and disable input elements like text box, radio buttons, or checkboxes, but every time you make a change you need to reload the HTML? The question is, how can we do it dynamically without loading the page? Well, we can use JavaScript, particularly jQuery to do this. An element can be disabled in HTML by setting disable property to true and enabled again by setting disabled=false. By using jQuery, you can grab the element you want to enable or disable and change this property by using the prop() or attr() function, depending upon the version of jQuery you are using.

Sunday, June 2, 2019

How to Check/Uncheck CheckBoxes in a Page using jQuery? Example Tutorial

In the last couple of articles, I have shared a couple of useful jQuery tips like reloading web page and working with tag selectors. Today, I'll show you how to check or uncheck a particular checkbox using jQuery, one of the most popular JavaScript framework. jQuery provides CSS like selectors which can make this kind of task trivial. If you remember, in HTML a checkbox is checked if the "checked" attribute is present and its value is not false, otherwise, it's unchecked. By using jQuery function prop() you can dynamically add this attribute or if present we can change its value i.e. checked=true to make the checkbox checked and checked=false to mark the checkbox unchecked.

Tuesday, May 28, 2019

How to Create a thread-safe ConcurrentHashSet in Java 8? Example

Until JDK 8, there was no way to create a large, thread-safe, ConcurrentHashSet in Java. The java.util.concurrent package doesn't even have a class called ConcurrentHashSet, but from JDK 8 onwards, you can use the newly added keySet(default value) and newKeySet() methods to create a ConcurrentHashSet backed by ConcurrentHashMap in Java. This is better than old tactical solutions like using a concurrent hash map with dummy value or using the set view of the map, where you cannot add new elements. The Set returned by keySet(defaultValue) and newKeySet() methods of JDK 8 is a proper set, where you can also add new elements along with performing other set operations e.g. contains(), remove() etc.

Sunday, May 26, 2019

Top 5 Node.js and Express JS online courses for Web Developers

There is no doubt that JavaScript is the #1 Programming language in the world and Node.js is one of the biggest reason for that. Initially, JavaScript was considered just a client-side scripting language but Node.js has changed all that by allowing developers to create dynamic web pages on the server side using JavaScript. It is also rated as the most popular framework of 2017 on StackOverflow Developers survey. The most important benefit of Node.js is that it allows you to build a full stack application based on just one language, JavaScript. This is especially useful for start-ups which put a lot of emphasis on being able to iterate early and often.

Friday, May 24, 2019

Difference between @Autowired and @Inject annotation in Spring?

What is the difference between @Autowired and @Inject annotation in Spring is one of the frequently asked Spring questions on Java interviews? Since everybody is now moved or moving to annotation-driven and Java configuration in Spring, this question has become even more important for prospective candidates looking for a Java web development job using Spring framework. The @Autowired annotation is used for auto-wiring in Spring framework. If you don't know, autowiring is a process on which Spring framework figure out dependencies of a Spring bean, instead of you, a developer, explicitly specifying them in the application context file. You can annotate fields and constructor using @Autowired to tell Spring framework to find dependencies for you.

Tuesday, May 21, 2019

How to find all Checked checkboxes in jQuery? Example Tutorial

Hello guys, suppose you have multiple checkboxes in your HTML page and you want to retrieve all checkboxes which are checked? How will you do that in jQuery? Well, you can use the pseudo selector like :checked to get all checked checkboxes. This selector checks for the checked property of checkbox and returns only those checkboxes which have this property. For example, following jQuery selector will return all the checkboxes which are checked:

$('input[type=checkbox]:checked')

In this, we are first selecting all input elements where type is a checkbox and then adding: checked to filter only those which are checked.

Monday, May 20, 2019

Top 10 ConcurrentHashMap Questions from Java Interviews

The ConcurrentHashMap class part of concurrent collections package added on JDK 1.5 which contains utility classes like BlockingQueue, CopyOnWriteArrayList, CopyOnWriteArraySet etc. It is a replacement of synchronized hash-based map implementations e.g. Hashtable and synchronized HashMap. It implements Map and ConcurrentMap (a sub-interface of Map) interface which allows you to store key-value pairs. The class is similar to HashMap or Hashtable but it's more scalable and the right fit for concurrent Java application. Unlike Hashtable which achieves its thread-safety by compromising the scalability, ConcurrentHashMap uses advanced techniques e.g. dividing the map into segments to remain thread-safe and scalable at the same time.

Saturday, May 18, 2019

Entuware or Whizlabs? Which Exam Simulator Should you Buy for Java Certifications (OCAJP, OCPJP, and Others)?

I often receive queries from Java certification aspirants about exam simulators like whether should I go for Whizlabs or Enthuware, which one is better? If I have to buy just one exam simulator, which one would you recommend, Whizlabs or Enthuware? I thought to answer all those questions in a blog post and here you go. To be honest with you both of them are really high-quality test simulators and whichever you buy, you will do well on actual exams. But, as a programmer, I really like to analyze the situation, I compare pros and cons of each of them before I buy one of them. Since I have used both of them in the past I am sure about that in quality, they are neck to neck there, but here are couple of things which you can consider before buying Java certification simulator from Whizlabs or Enthuware

Thursday, May 16, 2019

Java 9 Example - Factory Methods for Collection - Creating Unmodifiable List, Set, and Map

Hello guys, this is my first article in Java 9 features on this blog and today you'll learn about my favorite feature "factory methods for collection", which is introduced as part of JEP 269. The JEP stands for JDK enhancement proposal. If you have worked in Groovy or Kotlin then you know that how easy is to create the list with elements using collection literals e.g. to create a list of 1, 2, 3 you can simply write val items = listOf(1, 2, 3). Unfortunately, Java doesn't support that yet but things have been improved with the factory methods for collection in JDK 9 and it's almost like that. JDK has added static factory methods like of() on to basic Collection interfaces which you can use to create a list of items.

Tuesday, May 7, 2019

How to declare and initialize a List (ArrayList and LinkedList) with values in Java - Arrays.asList() Example

Hello guys, today, I am going to share with you a useful tip to initialize a List like ArrayList or LinkedList with values, which will help you a lot while writing unit tests and prototypes. Initializing a list while declaring is very convenient for quick use, but unfortunately, Java doesn't provide any programming constructs like collection literals of Scala, but there is a trick which you can use to declare and initialize a List at the same time. This trick is also known as initializing List with values. I have used this trick a lot while declaring list for unit testing and writing demo programs to understand an API etc and today I'll you'll also learn that.

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.

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.

Saturday, March 23, 2019

Difference between Stable and Unstable Sorting Algorithm - MergeSort vs QuickSort

Recently in one on the interview, after some initial questions about sorting algorithms e.g. how do you write QuickSort or difference between QuickSort and MergeSort, the interviewer asked about do you understand the difference between stable and unstable sorting algorithm? This question was new to my reader, so he says, Sorry, never heard about that. The story ended there, and Interviewer moved on to next question but like many of us, my reader went on to find more about unanswered questions and ultimately he asks me what is the meaning of a stable and unstable sorting algorithm? Some of you might be heard about it and many of you might not know about this distinction, I'll try to answer this question in this article.

Wednesday, March 6, 2019

Spring Hello World Example in Java using Dependency Injection and XML Configuration

Hello All, In this Spring framework tutorial, you will learn how to write the hello world example in the Spring framework. This should be your first tutorial to start learning Spring framework, as it gets the ball rolling. While coding and running this example, you learn a lot about Spring framework, Spring XSD files, necessary JAR files, and more importantly how Spring framework works. This HelloWorld program in Spring framework is an extension of the classical Java hello world program, which you might have seen earlier. This program is written using the Dependency Injection design pattern by using the Spring Framework's IOC container.  Even though now you can configure Spring dependency using annotations and Java configuration, this example uses a traditional XML way to configure dependencies.

Tuesday, March 5, 2019

How to deal with java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet in Spring Application

The java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet error comes when you deploy a Spring MVC application into Tomcat or Jetty and Servlet container not able to found this class, which usually found in the spring-webmvc.jar file. The DispatcherServlet is the core of Spring MVC framework, it implements the FrontController pattern and intercept all HTTP requests sent to your Web application and subsequently route it to correct controller based upon URL mapping.

Sunday, February 24, 2019

Linux Command to Find how Long a process is Running in UNIX

Hello guys, today, I am going to share one of the useful tips to find out how long a particular process is running in Linux. This is very useful while you are troubleshooting an issue and want to know whether your process or service is restarted fine on a daily or weekly basis. So you checked your process is running in Linux operating system and it's running fine, by using ps command. But now you want to know, from how long process is running, what is the start date of that process etc. Unfortunately, PS command in Linux or any UNIX based operating system doesn't provide that information.

Sunday, January 27, 2019

Top 5 React and Redux Courses to Learn Online - Best of Lot

If you are a Web developer or someone passionate about web development and looking for some awesome courses to learn React or React JS, a popular JavaScript framework to develop component-based user interface then you have come to the right place. The Facebook's React library has taken the front-end development world by a storm. More and more people have started using React even in favor of Google's Angular, another popular front-end development framework. Well, I am not going into the classic debate of Angular vs React as both the framework has their own advantage and disadvantage but if you have chosen to learn React, you have made the right decision.

Saturday, January 26, 2019

How to close telnet terminal in Linux and Windows (quit, exit not working)

The telnet is one of the most useful Linux networking commands, which is used to check if a server is listening on a particular port and it's whether up and running or not, but it's a little bit tricky to use, especially, if you are not using it on daily basis. Though I have used telnet before, when I use it after a long time, I actually forgot how to close the telnet terminal and how to get out of it. I tried every possible  Linux commands I can think of which is used to close, cancel a command, or exit from VIM editor in UNIX, like  Ctrl + C, quit, exit, q! and even the escape character '^]', only to realize that nothing is working. It may sound silly that an experienced developer cannot even come out of a telnet terminal but this is a true story. 

Sunday, January 6, 2019

Difference between application/x-www-form-urlencoded and multipart/form-data in HTTP/HTML?

Recently in one of the Java web developer interview, one of my readers asked about the difference between x-www-form-url-encoded and multipart/form-data MIME types. In HTTP, there are two ways to send the HTML form data to the server either by using ContentType application/x-www-form-urlencoded or by using multipart/form-data. Even though both can be used to send both text and binary data to the server there is a subtle difference between them. In the case of x-www-form-urlencoded, the whole form data is sent as a long query string.

Wednesday, January 2, 2019

Top 20 Books Java Programmers Can Read in 2020

Hello guys, Happy New Year 2020. We are already in New Year and while I am busy making my goals for 2020, I am also looking back on what I have done in the last year. One of the things which I would like to share with you guys is some of the books I have read in last year on Java and related technologies and will continue to read in 2020. This includes books on Modern Java, Spring, Hibernate, Object-oriented programming, Algorithms, Soft skills, Microservice, Groovy, Scala, Agile, and UML, etc. If you haven't read them yet, you can very well read them this year, depending on what technologies and programming languages you are going to learn in 2020.