Archive For The “Programming” Category
For the longest time I recall I’ve always been prone to do this when doing String comparisons* in Java… …And furthermore, I often find myself using the .equalsIgnoreCase() method. (Yes, considering that the requirements does not care about the letter case.) There is really nothing wrong with this way of checking if the string values…
An often overlooked (perhaps) way to write cleaner if condition statements. This is not about having to go through all the refactoring into a Factory pattern, Switch statements, and other possible conditional logic methods just to avoid our classic if condition. Rather merely making it look better, when the scenario is right for it. Of…
Saw this problem on the Internet about Multiples. Thought I might solve it. Don’t know why I dislike these kinds of things, but still want to try to solve it. It always seems tricky, although elementary? For transparency I only reviewed the Maths definition of a Multiple just to make sure if memory has not…
Java Beans are eagerly created in Spring Boot applications by default. That includes dependency beans. This is something I need to remember always. I tend to forget it and take it for granted since Spring Boot is great at spoiling Java developers. While that is a boon in most times, it can easily become a…
Just recently I have been playing around with multiple active profiles. This is apart from having the main application config, plus the profile that matches the environment on which the application is running. That is quite commonplace. Instead I’m talking more of an additional profile that gets activated aside from the environment profile based on…
Consider a List of Color objects with attributes of index, name and group. This object is defined as, Group is simply an Enum of, My list of colors are the following, Now, I want to divide these colors into their own sub-lists of color grouping based on the value of the object’s Group attribute. Traditionally,…
It is not uncommon for a Java application to have a number of properties that needs to be defined for it to to run smoothly at start. While these configurable parameters that are required by the app can be set in the code, placing those outside is a more logical and cleaner approach. Things like…
Say I have these numbers in an array, for example: I want to do something with that set of numbers, such as taking out null values, and extracting only the odd ones. Too take it further, maybe I want an even number or two mixed in the processed list as well. So I have this…
Did a simple, customized SQL query builder that’s only specific for UPDATE statements some time early last year. Thought I’d just write it down here. It was a smaller part of a bigger application. It wasn’t required for all update cases, but a number of them did. I’ve mostly re-written it from memory. It should…
I recently started on the path on building content on the fly that gets sent out as soon as possible, using a template engine, but from a back-end perspective. If that makes sense? This is for an event-driven application that sits there and listens for incoming messages. A simple one. Consume the message as soon…
From time to time I get some of this odd API response from requesting information for a specific something. I expect the response data to be a simple JSON object. Instead I am looking at a JSON array. I suppose that is still simple enough and it’s not so odd. This kind of response happens…
Somebody asked me recently why their POJO validator was not working as expected. They had already followed the “code I wrote” down to a T. Emphasis on the quotes, because trust me that block of code for bean validation they used as reference from an older project I did, was pretty much a very trivial…
For some time now I’ve been planning on learning ReactJS. It is all what front-end developer talk about theses days. Heck, full stack application developer job offers always pair ReactJS with [back end programming language goes here] in the job description almost without fail. That learning plan has not happened yet, though, and unfortunately for…
There is this Java library that I utilize to quickly get values from JSON objects that is fairly easy to use. This would be Jayway JsonPath. More can be had at their GitHub page. It is still being actively maintained. There appear to be a number of contributors involved in this project at different points…
Part 2 – Accessing a Resource Recap This is a continuation of the previous post that I made some time last month. You can start reading from there to get more context – https://www.joseyamut.xyz/2021/02/24/spring-oauth2-using-password-grant-type-with-additional-headers The first part dealt with getting the access token from a 3rd party token service provider using a password grant. The…