Posts

Remove unwanted files from Git commit

Recently i came across the situation where i committed the unwanted files and would like to remove them from the commit and found the following help from google. First step is to do git reset the HEAD using the following command git reset --soft ^HEAD or git reset --soft HEAD~1 Next step is to remove unwanted files fro the commit git reset HEAD /path/to/unwanted file Then commit again as follows. It would probably open the editor inorder to change the commit message or you can use the same commit message. git commit -c ORIG_HEAD Hope this is helpful.

Environment variables for Java installation

Image
Hi, I am Malathi Boggavarapu working at Volvo Group and i live in Gothenburg, Sweden. I have been working on Java since several years and had vast experience and knowledge across various technologies. No matter how experienced you are, everyone will be freaked out while setting up Java Environment variables after migrating to new OS or trying out "Awesome" Java language for the first time by the beginners. Not all may be but atleast i get freak out for setting it up :) But here is the quick overview or help which provides complete details of Java environment setup. After downloading and installing preferred Java version from Oracle website, head over to the My Computer, right click on it and choose Properties from the menu. The below dialog will be opened. Now click on "Advanced system settings" -> Advanced -> Environment Variables. The below picture may slightly vary among different OS versions. But below picture shows for Windows

Spring Framework and ScheduledExecutorService - Load property files during startup

Hi, I am Malathi Boggavarapu working at Volvo Group and i live in Gothenburg, Sweden. I have been working on Java since several years and had vast experience and knowledge across various technologies. In this post we see how to load property files during the application startup in an efficient way using Spring framework and ExecutorService which allows you to reload properties without server restart if any properties were changed. So let's get started. How to load Property files using Spring Every application is loaded using the deployment descriptor file web.xml. So in web.xml we need to declare the DispatcherServlet class with load-on-startup as 1. servlet-name can be anything. In our example it is called as bl (business layer). So during application startup, server tries to find the bl-servlet.xm l file. web.xml <servlet>     <servlet-name>bl</servlet-name>     <servlet-class>org.springframework,web.servlet.DispatcherSer

GraphQL Vs REST and What is GraphQl?

Image
Hi, I am Malathi Boggavarapu working at Volvo Group and i live in Gothenburg, Sweden. I have been working on Java since several years and had vast experience and knowledge across various technologies. In this post we discuss little bit about GraphQl versus REST. My goal here is not to say REST is not good, use GraphQl. It's like more exploration of how we currently fetch data for apps right now and how GraphQl can help and what it does differently. So i want to start with a simple UI component and walk through about how we get data to populate that component. Let's take an example of Shopping cart. See the below picture We need lot of data to render the products in the above picture. So what kind of data exactly we need? If we see the picture we have Cart which hold some Products and each Product have title , descrition , price and bunch of other things and also the Product image which have Url of the image and it's metadata.

Install ojdbc driver to Maven local repository

Image
Install ojdbc driver to Maven local repository Hi, I am Malathi Boggavarapu working at Volvo Group and i live in Gothenburg, Sweden. I have been working on Java since several years and had vast experience and knowledge across various technologies. In recent days i have a been building the sample REST api using Spring Boot framework and Gradle. So in no time i jumped to the website Spring Initializer (https://start.spring.io/ ) immediatly and generated the project with required dependencies such as Web, Actuator, JPA and JDBC. I added the jdbc dataSoruce configuration properties to application.yml inorder to connect to Oracle database. See below spring: datasource: url: jdbc:oracle:thin:@[host_name]:[port]/[service_name] username: [user_name] password: [password]       driver-class-name: oracle.jdbc.driver.OracleDriver But once i start the Spring boot application it started complaining 'Can not load OracleDriver' and could

View events fired on an element in google chrome

Image
Hi, I am Malathi Boggavarapu working at Volvo Group and i live in Gothenburg, Sweden. I have been working on Java since several years and had vast experience and knowledge across various technologies.  Recently i came across the situation where i need to find the event that has been triggered when i try to rotate the street view of google maps which is embedded in an iframe of the application. The real issue is the user could not rotate the street view so i need a way to find out what events are being triggered when i rotate the street view or whether any events are being triggered at all when i do it. So finally did google search and found out the following steps to do in google chrome - Go to More Tools -> Developer Tools or just press F12. - Click on Sources tab - On left hand side (or right side), scroll down to 'Event Listener Breakpoints' and expand tree - You find all the events. See the below picture - Select the ev

Filter proxy addresses using SubnetUtils (Apache Commons Net 3.6 API)

Hi, I am Malathi Boggavarapu working at Volvo Group and i live in Gothenburg, Sweden. I have been working on Java since several years and had vast experience and knowledge across various technologies. This post illustrate how to filter out internal proxy addresses from the real client IP address whereas internal proxy address is represented in the form of CIDR notation in your application Example of CIDR notation of IP addresses. 10.0.0.0/8 - This represents range of IP addresses from 10.0.0.0 to 10.255.255.255 Try it out at  https://mxtoolbox.com/subnetcalculator.aspx In below example we use SubnetUtils of Apache Common Net 3.6 API to check whether particular IP address is in range of IP addresses which is represented in CIDR notation. We also illsutrate how to use Java 8 stream, Map, Filter along with the Predicate which is passed to Filter. SubnetUtils have a method called isInRange to check whether the particular IP address is in range of IP addresses. Se