How coding to Interface and Inheritance helped me reuse code
Before going into the details I will state the requirement: I need to fetch certain records from 3 different tables into 3 ArrayLists. I have 3 Classes which store the information: Lets name it-...
View ArticleInstalling Elasticsearch on Linux
Download the Elasticsearch distribution, note the version you want to use curl -L -O...
View ArticleJava Gotcha: Parse string using SimpleDateFormat with months greater than 12
I was the other day trying to parse a date string into a date object using SimpleDateFormat to check for the validity of the date string. I had the SimpleDateFormat defined as: SimpleDateFormat...
View ArticleNew @RequestParam annotations in Spring Boot 1.4 (Spring Framework 4.3)
Earlier in Spring/Spring Boot to Map a GET or POST or DELETE or any HTTP method request handler we would write something like below: @RestController @RequestMapping("/api/books") public class...
View ArticleCommand to find files from windows command prompt
So if you want to find files with a given extension in windows, this is how you would do: $> where /r . *.java C:\Program Files\Java\jdk-9\my-samples\sample1\src\org.astro\module-info.java...
View ArticleGotcha: Migrating from Spring Security 3.2.x to Spring Security 4.x
Here is a simple gotcha to keep in mind while migrating to newer Spring Security version 4.x from Spring Security 3.2.x What’s the problem? The Spring security configuration expressions...
View ArticleBehavior Driven Development (BDD) of Postfix calculator
What is a postfix expression? An expression where in the operator is placed after the operands is called a postfix expression. For example an expression (also called infix expression) 2 + 3 in postfix...
View ArticleA stupid Mistake
the above mistake cost me close to 1 hour. Can you spot the mistake? I tried all these possibilities: model.put("validation_success",1); model.put("validation_success",true);...
View ArticleShell Script to Detect If the IP Address Is Googlebot
1. Introduction Google has explained here on how to verify if the given IP belongs to Googlebot. So instead of hard-coding all the IPs which might change eventually, Google has suggested doing a DNS...
View ArticleIndex Data from a Relational Database into Elasticsearch – 1
Elasticsearch provides powerful search capabilities with support for sharding and replication of the data. So we would want to index data available in our DB into Elasticsearch. There are multiple ways...
View ArticleIndex Data from a Relational Database into Elasticsearch – 2
In my previous article, we showed a straight forward way to index data from the relational database into Elasticsearch. In this article we will show you: Create mappings for the index Understand the...
View ArticleGetting to know about java.nio.file.Path – 1
Introduction The last few released of Java namely Java 7, Java 8 and the upcoming Java 9 have quite a lot of features which makes the life of Java developers easier. (I know Java 9 will make it...
View ArticleInstalling Git and EPEL Packages on RHEL 5.*
I was looking to install Git on a Linux server running RHEL 5.*. And using the EPEL repos helped me to locate the required Git rpm along with its dependencies. I followed the following steps to install...
View ArticleGetting to know about java.nio.file.Path – 2
In Part 1 of this, we looked at most of the APIs in the java.nio.file.Path class. In this article, we will look at the remaining APIs. Using register() This API allows us to register an implementation...
View ArticleUsing Gmail as SMTP server from Java, Spring Boot apps
Gmail users can use Gmail’s SMTP server smtp.gmail.com to send emails from their Spring Boot apps. For this let us do some setup in the app: Provide SMTP connection properties in the...
View ArticleWebUI Popover – Useful wrapper over Bootstrap Popover
Github Project page: WebUI Popover. Some of the examples: To create a closeable popover: $("#popover-elem").webuiPopover({ content: "Closeable content", title: "Closeable", closeable:true }); To create...
View ArticleBook Review: Murach’s Javascript and jQuery 3rd Edition
Murach’s Javascript and jQuery is a book useful for those who are beginning to learn Javascript and would want to try out jQuery as well. This book is divided into three sections: The first section is...
View ArticleMy First book Java 9 Cookbook, Packt Publications – Over 100 Java recipes...
Packt Publications recently published Java 9 Cookbook co-authored by me along with my co-author, a seasoned developer, Nick Samoylov. Yes!! This is my first publication and hopefully first of much...
View ArticleAggregate and Index Data into Elasticsearch using Logstash, JDBC
Introduction In my previous posts here and here I showed you how to index data into Elasticsearch from a SQL DB using JDBC and Elasticsearch JDBC importer library. In the first article here I mentioned...
View ArticleUsing Mustache.js for Client-Side Templating
Introduction In this article, I will show you how to make use of Mustache.js for client-side templating. In this approach, we get the JSON data from an API, developed by you or a 3rd party API and...
View Article