Posts

Eclipse Shortcuts

Image
There are many ways to work on a system. But, it is good practice if we know about the shortcuts or I would say keyboard shortcuts to operate on a system. As being a corporate trainer, I am working on different assignments, work with different sets of people. I came to know that, shortcuts are very valuable and everyone wants to learn about them. In my current training assignment, working on eclipse. Most of the students are asking about eclipse shortcuts. Here, I am listing down the shortcuts of eclipse that I am using currently. Below   is the list : ctrl+D — to remove a line. ctrl+shift+t — to open an already existing resource or APIecli or utility class. e.g. String class, Comparator, Comparable ctrl+shift+r — to open any resource file that you have created, or that is there in your workspace ctrl+shift+o — to organize your imports in the existing current file. ctrl+o — to see the existing list of variables, constants, and methods in the current file. ctrl+alt+up arrow, ctrl+al...

Difference between npm and npx

Image
Hi All, Since, we are working on frontend technologies, we might get this question early or later stage of our working experience. What is the difference between npm and npx. Before getting into the difference, let's discuss  what is npm and npx. NPM stands for Node Package Manager , which is used to install packages from node repository into your local machine. Since, in above example, I just installed json-server package. I want to execute this package in my local system.  For that purpose, I need to execute one more command as below : NPX stands for Node Package Execute , which is used to execute package from node repository into your local machine. Now, let's see the difference or in other words, let's discuss about when can we use npm and when can we use npx. Scenario is, when you just want to execute the package, and not required to install in your local system. You can use npx command, it will execute your package directly by looking into node repository over ...

Why Axios for API integration

Image
  When i started using react, i was wondering, how to connect to Rest API from UI. I started searching library which can be used to fulfill this purpose. Then, i turn towards fetch api and axios api. I started studying about both the libraries before actually using it. Then, i decided to use the axios library, and try to compare both the libraries. Below are the some features, which makes axios more powerful : Making simultaneous requests using axios.all 2. Sending custom headers 3. Automatically transforming requests and responses in json data 4. Cancelling request 5. Axios I s  More Secure, Featuring Built In Cross Site Forgery (XSRF) Protection 6. Monitor POST Request Progress 7. Axios Has A Wider Range Of Supported Browsers 8.Better error handling Browsers Support : Stay tuned for more updates !!!! Happy reading :)

Sort map by value using java 8 features

Image
  Generally, we sort the values by using keys. In case of map in java, we have a habit to sort keys, not values. But, there can be some scenarios , where we need to sort data based on values in map. I faced this challenge while working on one of my projects, where i need to do sorting based on values in hashmap. Then, i try to search easy way to achieve that, and found the api in java to do this job. I am excited to s h are with everyone , feature of java8 which makes my life easy, infact my coding life easy. I will show you both the code, before using java 8 features, and along with java 8 features. You will see the difference. Before java 8, code was like: sort unsortedFruits map with comparator Using java 8 features : sorting using java 8 features Code is clean and one liner to sort the map by values, not keys. You can download and run the complete code by downloading from my github link  https://github.com/kavitagupta972/MyWork/blob/master/Sorting%20Map.zip Hope you find t...

Axios — API Integration in Reactjs with hooks

Image
  To fetch data from a REST API, we send the AJAX request to server through some protocol, to get the requested response. There are different ways of doing this, by basic way of creating a   XHRequest  as well. Few of the other ways are: fetch 2.  axios 3.  superagent In this article, we will discuss Axios. Axios is a Promise-based HTTP client for JavaScript which can be used in your front-end application and node.js. It makes it easy to send HTTP requests to the server, to perform CRUD operations. Features of Axios : Axios su p ports operations in a variety of ways and provides so many features to make an easy task for developers to use this library. Features Make  XMLHttpRequests  from the browser Make  http  requests from node.js Supports the  Promise  API Intercept request and response Transform request and response data Cancel requests Automatic transforms for JSON data Client side support for protecting against  XSRF Bett...