Wednesday, October 31, 2018

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 greatly help you to look for any word inside your source file in the absence of an IDE. It is the alternative way of searching things in UNIX, grep is another Linux command which provides similar functionality like find but in my opinion later is much more powerful than grep in UNIX.

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.

Tuesday, October 30, 2018

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.

Monday, October 29, 2018

Top 5 Hibernate and JPA Courses for Java Developers to Learn Online

Hibernate is one of the essential frameworks for Java and Java EE or JEE programmers, especially if you are working on the server side of a Java web development project. It's an ORM tool or a framework which allows you to deal with only objects while Hibernate takes care of your data on your behalf. For example, instead of writing classes with SQL to load, save, and update data using DAO design pattern, you can simply use Hibernate framework in your project. It will allow you to deal with just objects while it will load, save, and update data in the background. Instead of you loading and saving data to/from the database and then populating objects, Hibernate just give you a readymade object and also takes care of updating data when the state of object changes. Btw, this is just one benefit of using Hibernate, another one is that it provides inbuilt caching.

Sunday, October 28, 2018

Java 8 Certifications - Oracle Java SE 8 Programmer 1 (1Z0-808) - Latest OCAJP Exam

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? This prompted me to browse through Oracle's certification website. During my casual browsing, I noticed that even though it's almost a year since Java SE 9 was released and 6 months since Java SE 10 was released the latest Java certification is still the Java  SE 8 certification. I know, you might be thinking about Java SE 11, which will come soon, but on the certification level, I don't see this happening. Anyway, I said great, as programmers are still digesting changes from Java 8 now have a chance to be certified the on latest Java 8.

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.

Saturday, October 27, 2018

What is the role of InternalResourceViewResolver in Spring MVC?

Earlier, I have explained to you about how Spring MVC works internally and how it process HTTP request coming to your web application. One of the important parts of that processing was view resolution, which is handled by the ViewResolver interface. In this article, you'll learn more about it by explaining the InternalResourceViewResolver class. The InternalResourceViewResolver is an implementation of ViewResolver in Spring MVC framework which resolves logical view name e.g. "hello" to internal physical resources e.g. Servlet and JSP files e.g. jsp files placed under WEB-INF folder. It is a subclass of UrlBasedViewResolver, which uses "prefix" and "suffix" to convert a logical view name returned from Spring controller to map to actual, physical views.

What is the Use of DispatcherServlet in Spring MVC Framework?

If you have worked with Spring MVC then you should know what is a DispatcherServlet? It's actually the heart of Spring MVC, precisely the C of MVC design pattern or Controller. Every single web request which is supposed to be processed by Spring MVC goes through DispatcherServlet. In general, its an implementation of Front Controller Pattern which provides a single point of entry in your application. It handles all incoming requests. It is also the bridge between Java and Spring. Btw, the DispatcherServlet is like any other Servlet is declared in the web.xml with a URL pattern but the only special thing is that the URL pattern for dispatcher servlet is enough to map every single web request to DispathcherServlert.

Friday, October 26, 2018

3 Best Practices Java Developers can Learn From Spring Framework

There is no doubt that Spring Framework is one of the most popular Java frameworks and makes it really easy to create real-world, enterprise-grade Java applications easy by providing features like dependency injection and inversion of control. But, to be honest, Spring is much more than just another DI and IOC framework. It goes one more level to simplify many of Java APIs e.g. JDBC, JMS, Java Mail etc by providing a useful layer of abstraction. It's much more easy to work with JDBC with Spring's JdbcTempalte and other utility class. They remove most of the friction Java developer faces with respect to executing SQL statement and processing ResultSet to get the Java object they want.

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

This week’s task is to implement 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. Depending on which it is the algorithm then starts over but only searching the top or a bottom subset of the array's elements. If the input is not located within the array the algorithm will usually output a unique value indicating this.

Thursday, October 25, 2018

Top 5 Java 9 Courses to Learn Online - Best of Lot

The year of 2017 was the year of releases for Java developer. With releases of JDK 9, Spring 5, Spring Boot 2.0 and Spring Security 5.0 there was so much to learn for Java developers and all at once, but like many others, I didn't make a good process and I am looking to turn it around in 2018. One of my top priority goal for New Year to learn new features of Java 9 as quickly as possible to write more about it. It's also important for you to learn Java 9 quickly to improve your career prospects.

Wednesday, October 24, 2018

Top 5 Apache Kafka Courses to learn Online - Best of Lot

Hello guys, you might have heard about Apache Kafka, the next generation, Big Data messaging system which is handling billions of messages per day on companies like LinkedIn, Uber, Airbnb, Twitter etc. In past, I have shared some awesome courses on Big Data, Spark, and Hadoop and many of my readers requested me to share similar suggestions for Apache Kafka. If you are interested in Apache Kafka and looking for some awesome courses to learn online then you have come to the right place. In this article, I am going to share some of the best Apache Kafka courses to learn online. If you know about Big Data then there is a good chance that you have also heard about Apache Kafka, the software which handles data feed for any organization. It's a distributed streaming platform developed by Apache foundation for building real-time data pipelines.

10 DevOps Courses for Experienced Programmers to Learn Online - Best of Lot

DevOps is really hot at this moment and there are many job opportunities lying for distinguished engineers and DevOps professionals. If you are an experienced Java programmer and want to become a DevOps engineer then you have come to the right place. In this article, I am going to share some of the best online training courses you can take to become a DevOps professional. The most important advantage of DevOps is that it helps you to deliver better software and provide more control over your environment and software development process with the help of modern tools and automation. That's the reason the demand for DevOps professionals is growing exponentially. It's also one of the high paying jobs along with Data Science and Machine learning specialists.

Tuesday, October 23, 2018

How to do group by in Excel - COINTIF function example

The Microsoft Excel is one of the best tools to analyze data and I think every programmer should be familiar with this tool. There are a couple of genuine reasons for why I am asking you to learn and master Excel. Since most of us work in Windows and Excel is almost always available, knowing how you can use it for your data analysis and reporting can really make a difference. Managers, Directors, Clients, and People at a higher level just love reports and once your experience grows, your responsibility also grows and you need to create many reports or work on Excel sheet generated by others. It automatically becomes part of your life, especially if you are progressing on project management space.

Top 10 Courses to Learn JavaScript in 2018 - Best of Lot

There is no doubt that JavaScript is the most popular programming language at this moment and it's also confirmed by StackOverFlow's 2018 Survey. You can build static websites, web applications, native mobile applications (yes you can do that too), desktop applications and even server-side application in JavaScript. It also makes you hundred time more employer as there are tons of web development jobs out there. Becuase of that ore and more developers are learning JavaScript to become a web developer.

Monday, October 22, 2018

The 2018 React Developer Roadmap - You Guide to become a Modern Web Developer

The React JS or simply React is one of the leading JavaScript libraries for developing front-end or GUI of web applications. Backed by Facebook, React JS, also known as just React is has grown by leaps and bounds in recent years and became the de-facto library for component-based GUI development. Though there are other front-end frameworks like Angular and Vue.js available, what sets React apart from others is maybe the fact that it just focuses on component-based GUI development and doesn't invade on other areas.

Saturday, October 20, 2018

Top 30 Java Phone Interview Questions Answers for Freshers, 1 to 2 Years Experienced

Hello guys and ladies, in this article, I am sharing 30 core Java technical questions, from screening and phone round of interviews. In telephonic interviews, questions are short, fact-based and Interviewer expects a to-the-point reply and some keywords in answers. Accordingly, I have given very short answers of all these questions, only the main points; just to make this a revision post and not the main source for preparation. For thorough preparation, my master list of 140+ Java questions is a better one to start with. I am also expecting every Java programmer to know answers to all these Java technical questions if he has more than 4 to 5 years experience. it's only freshers and junior developers who need to do a bit of research to understand topics well.

Friday, October 19, 2018

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.

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 controller e.g. @RequestMapping, @RequestParam, and @PathVariable. Even though both @RequestParam and @ParthVariable 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. As the name suggests @RequestParam is used to get the request parameters from URL, also known as query parameters, while @PathVariable extracts values from URI.

Wednesday, October 17, 2018

Top 5 Spring Cloud Courses for Java Developers to Learn Online - Best Of Lot

Hello guys, if you are learning Spring Cloud for developing cloud-based Java application and looking for some good resources to start with e.g. online courses and books then you have come to the right place. In this article, I am going to share some of the best courses to learn Spring Cloud and develop a cloud-based application in Java. One of the common question when it comes to learning a new technology is how to start? I was a big fan of books earlier but nowadays I personally like to start with an online course to learn things.  It works better because you gain a lot from instructor's experience and you also have a chance to ask questions to the instructor.

Tuesday, October 16, 2018

How to Sort a HashMap by Values in Ascending and Descending Order in Java 8 - Example Tutorial

In the last article, I have shown you how to sort a Map in Java 8 by keys and today, I'll teach you how to sort a Map by values using Java 8 features e.g. lambda expression, method reference, streams, and new methods added into the java.util.Comparator and Map.Entry classes. In order to sort any Map e.g. HashMap, Hashtable, LinkedHashMap, TreemMap, or even ConcurrentHashMap, you can first get set of entries by using the entrySet() method and then you can get the stream by calling the stream() method. The entrySet()  method returns a Set which inherit the stream() method from the java.util.Collection class. Once you got the stream, you can just call the sorted() method which can sort all Map.Entry objects available in Stream using a Comparator.

Monday, October 15, 2018

Top 5 Programming Languages Every Programmer Should Learn

I have read somewhere that programmer should learn a new programming language every year ( I think it's code complete, not sure, though), but if you cannot do so, I suggest to at least learn following five programming language to do well in your career. Everybody loves polyglot programmer and an all-rounder who is versatile enough to write a quick script and can also write complex Java programs. In fact, it's almost mandatory for a senior developer to learn more than one language. Interviewers are giving more attention to an engineer who has good experience with multiple languages e.g. C++ and Java goes quite well, so is Python and Java. I personally like Software Engineers who have strong experience in either C++ or Java and can write scripts in groovy, Perl or Python.

Top 5 Online Courses to Learn Web Development in 2018

Udemy is running their flash sale this weekend, where they are offering all the courses in just $10.99 and I have been spending a lot of time going through their website to buy some of the top quality courses in this sale. If you look at the price, its nothing, if you escape snakes for 1 day you can buy a course in Udemy to learn and the best part of this is that you get the lifetime access of course. So you can use it whenever you get time, maybe this week, this month, or sometime later. I love learning and for the most part of my life, I learned by reading books but ever since I come across online courses on Udemy and Pluarlsight, I have spent most of my time learning through online courses. They are the best way to start with the new technology and get yourself up and running in no time.

Sunday, October 14, 2018

10 Example of lsof commands in UNIX and Linux

It's been a long time since I have written anything on UNIX or Linux, 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.

Friday, October 12, 2018

How to use jQuery Class and Id Selector to find DOM elements

One of the best things about jQuery is there selectors, which gives the jQuery enormous power to find and select DOM elements so easily. If you are coming from JavaScript background then you might love those classical methods to find DOM elements like getElementById() and getElementByName(). They have served very well in the old days of JavaScript coding,  but once you start using jQuery selector, which is quite similar to CSS selector, I am sure you will forget them. Searching and finding HTML elements using jQuery selectors are natural, intuitive and super easy and that's why I love them.

Thursday, October 11, 2018

Top 5 Selenium Webdriver with Java Courses for Testers and Developers to Learn Online

The days of manual testing is limited as more and more companies are shifting towards automation testing. This means all manual testing QAs needs to learn new test automation skills e.g. Selenium, Cucumber, JUnit, and TestNG to give their career a boost. If you are manual testers or non-programming testers interested in learning test automation, or a freshers/graduates who want to kick start their career in automating testing then you have come to the right place. In this article, I am going to share some of the best courses to learn Selenium Webdriver with Java and other automation testing technology e.g. JUnit, Cucumber etc.

Wednesday, October 10, 2018

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 are the benefits of getting Java certified. 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.

Monday, October 8, 2018

Top 5 Advanced SQL Books for Experienced Programmers - Best of lot, Must read

If you an experienced programmer and know how to write SQL queries and database fundamentals but want to take your SQL and database skills to the next level then you have a come to the right place. In this blog, I have shared a lot of free SQL books and courses you can use to start your SQL journey. This is also the second article about SQL books, In the first part, I have shared some of the best SQL books which are essential to learning SQL queries and fundamentals of database e.g. normalization, indexing, and other design stuff, if you haven't read it yet, I suggest to do it now. You will find some amazing book to start learning SQL. In this article, I am going to share some of the best books to learn advanced SQL programming, which can help you to write better SQL queries and understand how database process those queries.

Difference between @Component, @Service, @Controller, and @Repository in Spring

Before you learn the difference between @Component, @Service, @Controller, and @Repository annotations in Spring framework, it's important to understand the role of @Component annotation in Spring. During initial release of Spring, all beans are used to be declared in an XML file. For a large project, this quickly becomes a massive task and Spring guys recognize the problem rather quickly. In later versions, they provide annotation-based dependency injection and Java-based configuration. From Spring 2.5 annotation-based dependency injection was introduced, which automatically scans and register classes as Spring bean which is annotated using @Component annotation. This means you don't to declare that bean using the <bean> tag and inject the dependency, it will be done automatically by Spring. This functionality was enabled and disabled using <context:component-scan> tag.

Friday, October 5, 2018

Is "Java Concurrency in Practice" still valid in the era of Java 8 and 11?

One of my reader Shobhit asked this question on my blog post about 12 must-reads advanced Java books for intermediate programmers - part1. I really like the question and thought that many Java programmers might have the same doubt whenever someone recommends them to read Java Concurrency in Practice. When this book came first in 2006, Java world was still not sure of about new concurrency changes made in Java 1.5, I think the first big attempt to improve Java's built-in support for multi-threading and concurrency. Many Java programmers were even not aware of new tools introduced in the API e.g. CountDownLatch, CyclicBarrier, ConcurrentHashMap and much more. The book offered them the seamless introduction of those tools and how they can use them to write high-performance concurrent Java applications.

How to deal with ConcurrentModificationException in Java? Beware while removing elements from ArrayList in loop

One of the common problem while removing elements from an ArrayList in Java is the ConcurrentModificationException. If you use classical for loop with the index or enhanced for loop and try to remove an element from the ArrayList using remove() method, you will get the ConcurrentModificationException but if you use Iterator's remove method or ListIterator's remove() method, then you won't get this error and be able to remove the element. It's an unwritten rule in Java that while looping through the list, you should not add() or remove() elements until the collection supports fail-safe Iterator e.g. CopyOnWriteArrayList, which operate on a copy of list rather than the original list.

Thursday, October 4, 2018

Top 5 Courses to learn Angular Framework in 2018 - Best of Lot

If you are a JavaScript developer or someone who wants to learn Angular for web development and looking for some awesome resources e.g. books, online courses, and tutorials then you have come to the right place. In the past, I have shared some of the best Angular tutorials and today, In this article, I am going to share some of the best Angular courses to learn modern day web development. If you don't know what is Angular and how it helps you to develop modern day web development, let me give you a brief overview. It's a Javascript framework which allows you to build a modern-day big e-commerce web application as well as a single page web application which runs on a browser.

Wednesday, October 3, 2018

Top 5 Free Data Structure and Algorithm Courses for Java and C Programmers

Data Structure and Algorithm is one of the essential topics for programmers, both to get a job and do well on Job. A good knowledge of data structure and algorithm is the foundation of writing good code. If you are familiar with essential data structures e.g. array, string, linked list, tree, map and advanced data structure e.g. tries, AVL trees etc and know when to use which data structure and compute the CPU and memory cost of your code in terms  Even though you don't need to write your own array, linked list or hashtable, given every major programming SKD provides them e.g. JDK or C++ STL library, you will need to understand them so that you can use them in right place. Using a right data structure can drastically improve the performance of an algorithm.

Book Review - Clean Architecture by Uncle Bob Martin - Must read for Programmers

Hello Guys, today, I am very excited to talk about a new book (Clean Architecture: A Craftsman's Guide to Software Structure and Design) from one of my favorite author of programming books, you guessed it right, Uncle Bob. The same Uncle Bob (aka Robert Martin) who brought you the Clean Code and Clean Coder has been at it again. It's been a long time since I last read an Uncle Bob and somehow I wasn't aware of this book. It comes to me as a surprise yesterday when one of the colleagues mentioned it and I didn't take time to realize that I need to buy and read this book. I just cursed myself that why I didn't know about this book before, it is still new but given I love to read his books, it's just a miss for me.