Sunday, September 30, 2018

How to Find Multiple Missing Integers in Given Array With Duplicates in Java?

It's been a long time since I have discussed any coding or algorithm interview questions, so I thought to revisit one of the most popular array based coding problem of finding missing numbers in given array. You might have heard or seen this problem before on your programming job interview but there are a lot of different versions of increasing difficulty levels which interviewer normally use to confuse candidate and further test their ability to adapt to frequent changes. In the past I have demonstrated how to find the missing number in a sorted array as well on the unsorted integer array in Java using BitSet (see here), but, with just one missing number and without any duplicates.

Saturday, September 29, 2018

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

One of my goals in 2018 is to learn and master Git and I have been searching 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 which 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. When you search for Git courses in popular online course websites e.g. Udemy, Pluralsight or Coursera, you will find some good courses e.g. Git Complete: The Definitive Guide on Udemy and Git Fundamentals from Pluralsight which will teach you everything about Git step by step. These are excellent resources to start with Git.

Friday, September 28, 2018

Top 4 Books to learn Oracle PL/SQL Programming - Best, Must Read

In last summer, I had to work on a Java project which was using Oracle database at their backend. The project was a mix of Java code with Oracle PL/SQL stored procedures, where Stored procedures were quite big and complex to read. I had not worked on Oracle for a couple of years and almost forget whatever I knew before. So, to revise, update and re-learn and I looked over some of the books and online courses like The Complete Oracle SQL Certification Course which helped me a lot. In my quest to revise and re-learn Oracle SQL, I also find lots of their used books on Oracle PL/SQL which are both interesting to read as well as provides a great wealth of information to any programmer.

Thursday, September 27, 2018

Can a Non Static Method Access a Static Variable/Method in Java?

"Can a non-static method access a static variable or call a static method" is one of the frequently asked questions on static modifier in Java, the answer is, Yes, a non-static method can access a static variable or call a static method in Java. There is no problem with that because of static members i.e. both static variable and static methods belongs to a class and can be called from anywhere, depending upon their access modifier. For example, if a static variable is private then it can only be accessed from the class itself, but you can access a public static variable from anywhere. Similarly, a private static method can be called from a non-static method of the same class but a public static method e.g. main() can be called from anywhere.

Wednesday, September 26, 2018

How to Remove all Unused imports in a Java file - Eclipse Shortcut

How to remove all unused imports in Eclipse
Eclipse IDE gives warning "The import XXX is never used" whenever it detects unused import in a Java source file and shows a yellow underline. Though unused import in Java file does not create any harm, it's unnecessary increase length and size of Java source file and if you have too many unused imports in your Java source file, those yellow underline and Eclipse warning affect readability and working. In my last post on Eclipse, we have seen some Java debugging tips on Eclipse and in this post, we will see Eclipse shortcut to remove all unused imports in Eclipse. There are many options to tackle this problem e.g. you can collapse import section of code in Eclipse or you can altogether remove all unused imports from Java file, and we'll see them in this short tutorial.

How to find Length of String in SQL Server? LEN() Function Example

One of the most common task while writing SQL queries or stored procedure is to find the length of String. Since most of the columns are VARCHAR, you often need to find the length before taking any action. In Java, you can find the length of String by using the length() method but how about SQL Server? How will you find the length of String in Microsoft SQL Server in general and Microsoft SQL Server 2016 in particular? Well, you can use the LEN() function to find the length of a String value in SQL Server, for example, LEN(emp_name) will give you the length of values stored in the column emp_name. This method exists from SQL Server 2008 onwards which means you can use this function in SQL Server 2012, 2014, 2016 and latest version of Microsoft SQL Server i.e. SQL Server 2017.

Tuesday, September 25, 2018

How to Solve UnrecognizedPropertyException: Unrecognized field, not marked as ignorable - JSON Parsing Error using Jackson

While parsing JSON string received from one of our RESTful web services, I was getting this error "Exception in thread "main" com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "person" (class Hello$Person), not marked as ignorable". After some research, I found that this is one of the common error while parsing JSON document using Jackson open source library in Java application. The error messages say that it is not able to find a suitable property name called "person" in our case, let's first take a look at the JSON we are trying to parse, the class we are using to represent the JSON document and the error message itself.

Error Message:
Exception in thread "main" com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "person" (class Hello$Person), not marked as ignorable (4 known properties: , "id", "city", "name", "phone"])

Monday, September 24, 2018

How to find a Process Listening on a Specific 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, September 23, 2018

Top 5 Database design and Modelling Books for Programmers and DBAs of All level

The database design and modeling are one of those topics which rarely gets the attention they deserve, especially at the start of the project, but once things have gone out of hand then everybody talks about that. Comments like - this database are designed poorly, it is not performing well, you cannot add a new column easily etc becomes very common. The most problem with database design is that it is mainly done by application developers e.g. Java or C++ developer who knows SQL but they are not the expert of how to design tables and schema. The Database admins or DBAs know database and SQL better than application programmers but they focus on the admin part of the database rather on application part e.g. designing tables and relations between them, which is left to the application developer.

Saturday, September 22, 2018

JUnit Testing Tips - Constructor is Called Before Executing Test Methods

Even though almost all Java programmers either use JUnit or TestNG for there unit testing need along with some mock object generation libraries e.g. Mockito, but not everyone spends time and effort to learn subtle details of these testing libraries, at least not in proportion of any popular framework like Spring or Hibernate. In this blog post, I am sharing one of such detail, which has puzzled me a couple of years ago. At that time, though I had been using JUnit for a significant time, I wasn't aware that code written inside the constructor of Test class is executed before each test method.  This behavior of JUnit has caused, some of my test to failed and putting hours of investigation in my code, without realizing that this is happening because of JUnit is initializing the object by calling constructor before executing test method annotated with @Test annotation.

Friday, September 21, 2018

Top 10 Angular Tutorials and Courses for Web Developers - Best of Lot

Hello guys, if you are interested in learning the Angular framework, one of the best and most popular JavaScript frameworks for developing component-based Web GUI and looking for some awesome courses then you have come to the right place. In this article, I am going to share some of the best resources e.g. books, tutorials, and courses to learn the Angular framework, formerly known as Angular JS and now famous as Angular 2. It's backed by Google, hence you should not worry about it being out-dated and lose relevance in a couple of years. Any investment you made in learning Angular will pay you rich dividends in coming years.

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

The String.intern() method can be used to deal with String duplication problem in Java. By carefully using the intern() method 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 String object consumes a large amount of heap memory in average Java application, it makes sense to use the intern() method to reduce duplication and take advantage of String pool feature provided by Java. You can use intern() method to intern a String object and store them into String pool for further reuse.

Thursday, September 20, 2018

Top 10 Highest Paying Technical Jobs for Software Engineers, Programmers

If you are a computer science graduate or someone who is thinking to make a career in software development world or an experienced programmer who is thinking about his next career move but not so sure which field you should go then you have a come to the right place. In this article, I will tell you the top 10 highest paying technical jobs you can aim for. All you need is some programming experience and a passion for learning. Particularly the Machine learning and Data science field looking very promising for both beginners and experienced programmers. On average a machine learning specialist and Data Scientist make around anywhere from $110,000 USD to $120,000 and there is a huge demand for them and if you are interested in solving real-world problems they present an exciting opportunity.

Wednesday, September 19, 2018

Kotlin vs Java - Which language Android Developers should Learn?

Ever since Google announced Kotlin as the official language for Android development in Google IO 2017, programmers, who want to become an Android Developer are in dilemma. Now the big questions in front of them are whether they should learn Kotlin or Java? The answer to this questions depends upon your profile. If you are a complete beginner who wants to learn Android development then my answer is Java, but if you are Java developer who wants to jump into the lucrative market of Android App development then my answer is Kotlin. I'll discuss why beginner Android programmer should start with Java and why Java developer should learn Kotlin in this article.

Tuesday, September 18, 2018

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 i.e. 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.

Sunday, September 16, 2018

Top 10 Programming and Coding Interview Courses for Programmers

To be honest with you, getting your first job is never easy. It is, in fact, the hardest task and you need to put your best effort to find a job in your dream company. Most of the computer science graduates dream of working for Google, Facebook, Amazon, Microsoft, and Apple but they often not able to clear their rigors coding interviews. The single most important reason for failing those coding job interviews is lack of knowledge and practice, hence it becomes increasingly important that you prepare hard in advance. Unfortunately, I learned this little too late, after spoiling my chances at Microsoft and Amazon but you can learn from my experience and prepare better for your programming job interviews.

Saturday, September 15, 2018

The @SpringBootApplication Annotation Example in Java + Spring Boot

Hello guys, today, we'll learn about the @SpringBootApplication annotation, one of the most important annotations from popular Spring Boot framework, which has changed the way Java developers use Spring framework for writing Java applications. In this article, I'll explain you the meaning of @SpringBootApplication and it's used in a simple Spring Boot application. We use @SpringBootApplication annotation on our Application or Main class to enable a host of features e.g. Java-based Spring configuration, component scanning, and in particular for enabling Spring Boot's auto-configuration feature.

Top 5 Java SE 8 Certification Books - Best of Lot Must Read

If you are preparing for Oracle Certified Associate, Java SE 8 Programmer, also known as Java SE 8 Programmer I or OCAJP8 exam and looking for some good resources e.g. books, study notes, and mock exams then you have come to right place. I have been sharing some of the most useful resources for Java 8 certification aspirants ever since the exam was launched. You can find a lot of this exam and essential resources in this blog. To continue that tradition, I am going to share some of the best books to crack the Java SE certification i.e. OCAJP 8 (1Z0-808)  and OCPJP 8 (1Z0-89). Yes, you need to pass two exams to become Java 8 certified professional. The OCAJP is also a prerequisite for OCPJP exam, which is a professional level exam. Alternatively, if you already hold a Java certification e.g. Java SE 6 or before then you can take one of the upgrade exams e.g. 1Z0-810 to become Java SE 8 certified professional.

Thursday, September 13, 2018

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

Even though, the Clean Code book has been released many years ago and there are lots of good reviews already available, I couldn't resist to write my own experience about 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 do.

Tuesday, September 11, 2018

5 Courses to Learn Kotlin Programming language for Java and Android Developers

If you don't know Kotlin, it's a relatively new programming language that makes programming for Android or Javascript easy. Ever since Google announced Kotlin as the official language for Android Development, I received a lot of queries from my readers should Java developer learn Kotlin now? or which one is better to start with Android development, Kotlin or Java? I have answered that question in my last article but I am still receiving a lot of queries about learning Kotlin and whether Java developer should Learn Kotlin or not? Well, to be honest with you, being a Polyglot programmer i.e. a programmer who knows more than one programming language is important and distinguish skill. It not only widen your thoughts but also make you a better developer and that's why I recommend every Java developer to at least learn one more JVM language and Kotlin is a good one to start with.

Monday, September 10, 2018

3 Best Spring Security Online Training Courses for Java Developers

The Spring Security is one of the leading open source, security framework which allows you to implement security in Java based web applications. It provides several security features e.g. authentication, authorization, remember me out-of-the-box, which means you can directly use them without adding code or changing your class. Yes, Spring Security implements security at application level i.e. you can even secure your non-secure resource without modifying them. It is also the leading framework to secure RESTful Web Services. Because of all these, the demand for Java developers with good knowledge of Spring Security is very high. They are also some of the highly paid Java developers. Many Java and Spring developer, particularly those who are involved in enterprise and Java web development are learning Spring Security.

Saturday, September 8, 2018

Top 5 Android Online Training Courses for Java Developers - Best of Lot

Java has been very lucky that Android uses it as a programming language. This opened a big door of opportunities for Java developers in Android app development. Many people ask me why Java Developer should learn Android? My simple answer is that good knowledge of Android OS improves your chances of getting a job and making a difference in people's lives because Android Apps is the direct way to connect billions of people. Android is without a doubt THE biggest mobile platform in the world, with over 80% market share and over billions of devices running Android. By creating apps for such a big platform, you have great opportunity to make a difference. You can also develop for Android on a Windows, Mac or Linux, which means your existing Java development experience will not go wasted.

Top 5 Big Data and Apache Spark Courses for Java Developers to Learn Online in 2018

Slowing economy and the recent trend of job cuts in India and elsewhere have made many programmers anxious about their job security. I receive a lot of emails and Facebook chats about suggestions to improve IT skills to remain competitive and marketable. So, if you are in the same boat, you can learn Big Data and IT Automation to remain marketable. These two skills are in great demand and will generate a lot of jobs in future. I have suggested many Java developers around the world to learn Big Data Technologies e.g. Apache Spark to give their CV a new boost. Since it's not easy to learn a new technology and at a certain age, you feel a lot of restriction and resistance from both your body and mind. In order to overcome that I found a combination of books and online courses works great.