Test-driven development is a pretty awesome design process. And while building your code, you may want to mimic the logged-in user. In Spring Security, the logged-in user principal is stored inside the Authentication object. This Authentication object can be accessed from any part of your application using SecurityContextHolder. The SecurityContextHolder is a singleton … [Read more...] about How To Mock SecurityContextHolder in Spring Security using Mockito?
While working on a legacy project, sometimes it becomes so hard to find such small pieces of stuff. Recently I faced a similar problem where I had to load spring beans based on the loaded profiles respectively. With Spring Boot and annotation, it has become really easy. Just put the @Profile("profile1, profile2") and it works. Similarly, it is done in XML as well. All you … [Read more...] about Load Spring Beans Based On Different Profiles Via XML
There will be times when you will realize "Oh, no! What've I done?". That moment is a classic moment in every developer's life. Usually, it happens right after when you do something silly, and it costs you hours of re-work. We tend to become careless in tasks that we do on a regular basis. And one such task for me was Git Squash. I like my commits to be clean and … [Read more...] about How to Fix A Blunder and Get Squashed Commits Back (Git Undo)
It is always good to sharpen your blade from time to time. Data structures and algorithms is my sword. Recently, I visited all the elementary sorting algorithms. And it is always fun to understand the complexity and mindset behind it. This time I thought of writing a small program to run all the algorithms against a variable set of inputs to generate the time complexity … [Read more...] about Time Complexity Comparison Sheet Of Elementary Sorting Algorithms
Gitlab CI is a pain in the ass sometimes. It was a pain in my ass too. I was stuck for more than 2 hours trying to figure out how to SSH into my own server with my own private key. I tried so many things. And the shit becomes even more frustrating when the same piece of code works on your local but not on Gitlab CI. In my case, it went a step further to test my sanity. … [Read more...] about Gitlab CI – SSH Into Virtual Private Server (VPS) Using Private Key From Gitlab CI Pipeline Job
Long polling is a concept that was being used aggressively in the past. It was the technique that made web feel like real-time. I think a little history would help you to understand better. The Brief History Of Internet If you are old enough then you would know that web in its early days was very boring. And by boring I mean static, no moving parts. It simply … [Read more...] about Long Polling Implementation With Java and Spring Boot
These are hard times. It has almost been a month now that I'm locked in my own house. Only stepping out for the essentials. Whenever we step outside, we make sure to wear masks and gloves. And after returning back home, clean our hands with soap and sanitizers. These times make you think about everything that we take for granted. I'm an IT engineer working from home … [Read more...] about Make Money During A Crisis
Do you own any public blog? Do you write often? Do you find peace when you sit down with your laptop and start pouring your thoughts on to the white canvas of your screen? Do you love telling stories? Do you enjoy when some stranger comments on your writing/article? Or you simply enjoy writing. If yes, then there is no reason why you shouldn't start your own … [Read more...] about Why and How To Start Your Own Blog? (Less Than 10 Dollars)[With Images]
Every enterprise has its own principles. Principles that takes it towards the goals. Principles that give birth to practices which are the underlying foundation for all the implementation. Similarly, Microservices has its own set of principles that helps its implementer to make the correct decision when given multiple options to choose from. Principles are like … [Read more...] about Principles Of Microservices: How To Architect A Solution
Microservice is a new hot trend in the Application Architecture Landscape. Everyone in the IT world is talking about microservices. Every enterprise is either working on a microservice or porting their existing monolith to Microservices. This term has become really popular that people outside of the organization are also using it to explain something or the other. In any … [Read more...] about Why Would You Use Microservices (Advantages and Disadvantages)?
It feels like travelling back in time like 6-7 years when we had to configure the Spring Web MVC using XML. It was so dreadful for me back then. It is dreadful for me now as well. I know many of you might be struggling to set up the Spring Web MVC older versions (versions from 3.x) and so on. I know this because I'm struggling with it myself. Mostly because I'm … [Read more...] about Spring Web MVC (3.x) Configuration From Scratch (Using XML)
I visited my hometown after 18 months of constant IT grilling. It always feels good to come back home, I get to eat all the tasty delights my Mom make for me. I like the way people live here - simple and boring. I always visit the nearby ground to play with my brother and friends. But every coming year I see lesser and lesser people coming out of their houses in the … [Read more...] about Is Technology Taking Life Away From The People
This is the most basic stuff that every college grad student must know. Public key authentication is the most secure way of logging into any server. And it doesn't require you to remember your password or type it every time you want to login to the server, which actually saves valuable seconds of your time. This article is going to be all about Logging into your servers … [Read more...] about Login To Any Server Without Using Password
Hey folks, I've been wanting to write an article on this topic for a long time but always find myself stuck with something or the other. Mostly because a lot of things have changed lately and it takes time to find the lost balance. So finally, I got some time out to craft this article for you. It is good that you are putting some time aside to actually read about setting … [Read more...] about How To Setup Your MacOS Machine For Any Development
Hi folks, after a long time I revisited Spring MVC because of some project requirement and in the next moment, I was dealing with all sorts of configurations. If you have worked on Spring MVC before (not SpringBoot), you will know what am I referring to. All sorts of XML files (web.xml and spring-context etc). And to be clear I hate all that clutter. So, instead of dealing … [Read more...] about Spring MVC – Build Project In Java With Gradle From Scratch (No XML)
Recently I lost my JBL C200SI In-Ear Headphones. I really liked those earphones and all of a sudden it was gone (:() So, this time I didn't want to spend any more bucks on the earphones. I was just looking for a decent earphone with deep bass and mic that would replace the JBL C200SI. While searching for those I read a few articles and went through half-a-dozen review videos … [Read more...] about Top 5 Wired Earphones With Mic Under 500 INR [August 2019]
Finally, I have picked out a topic that might attract many pseudo-feminists. To all the pseudo feminists, please don't bother commenting because your views will not be considered (:p) This question has become a rather huge and interesting point of debate nowadays... especially in India. And I really want you all to participate in this discussion (only except … [Read more...] about Should Girls Wear Short Clothes?
Before you proceed reading the article, please make sure that you are aware of the Redux Hooks. This article is going to be very short. You will be creating a 'hello world' application with the help of Redux and React Hooks. I would recommend you to develop an understanding of the React Hooks first and then proceed with the article. Following video explains about the React … [Read more...] about Getting Started With Redux And React Hooks
I live in Pune. And let me tell you a fact - This is hell. I know many of you won't be happy after reading that statement but try travelling from Baner to Magarpatta during peak hours and you will know what I mean. One day while I was travelling through the hell, a thought came to my mind. And that is what I'm going to discuss in this article - I wondered Did Humanity … [Read more...] about Did Humanity Started Off On The Wrong Foot
This article is going to be all about Undirected Graphs. It is in the succession of the previous article Getting Started With The Algorithms that sets you up to learn algorithms. I suggest you read that article to learn about the origin of algorithms, why they are important and needs to be studied. In this article, I'll be talking about one of the most interesting topics in … [Read more...] about Undirected Graphs [Examples, Implementation & Graph Processor]