Skip to main content

Posts

Java 8 Optional Class: Why and When to use?

If you have developed any project Java, or if you have been maintaining enterprise application written in java, you must have encounter NullPointerException at some point in your programming life. They are a pain! I have encountered many production bugs which were because of NullPointerException and so should many of you who have been working in Java for some time. However, we do not know if anything that we could do here as NullPointerExceptions are a side effect of using 'null' reference which is very useful in representing an absence of value.  Null reference was first invented by Tony Hoare in 1965 while developing language Algol W. It was subsequently added to other languages. Tony Hoare himself called the invention of null reference  a billion-dollar mistake! Source: https://en.wikipedia.org/wiki/Null_pointer Problems with Null reference

Where is the favicon edit option in new blogger (2020)?

Favicon edit option on the new blogger 2020? In an earlier version of the blogger, there was an option to edit favicon from a layout view. However now in new blogger UI that doesn't seem to be a case! If you go to the layout page you will see that the favicon gadget is missing. In new blogger, It has been moved under overall Settings, so now if you want to edit the favicon you need to go to Settings, In settings in under the Basic section, you will see the Favicon link, click it. Clicking it will take to the Configure Favicon page, where you can upload a square image for your favicon. Once saved you will start seeing it on your browser.' Happy blogging! :)

Building reactive Spring API (CRUD) with Spring Webflux and reactive PostgreSQL (Step-By-Step)

Why reactive programming in Spring? In Spring 5.0, spring added another parallel web-stack to the existing servlet based MVC web-stack. This new stack is fully reactive, non-blocking, and based on the project reactor library .  Now the question is why a new stack? Non-blocking code doesn't block any threads and hence it can scale with very few threads . This lets developers take advantage of multi-core, modern processors—handling huge numbers of concurrent requests.  With this, you can satisfy more concurrent users with fewer microservice instances. All the way reactive: When we build reactive we need to make sure that we use all the libraries in the stack which are non-blocking. If code is doing any blocking operation anywhere in sequence then we will lose the advantage of using reactive stack. Sping has added various libraries to support this complete stack. We are going to use Spring Webflux and R2DBC here. Building a Rest API using spring boot and PostgreSQL: here, we are...