Author: Vijay SRJ

  • How to watch a folder/directory for changes using Java?

    Let’s say you want to watch a folder in your computer or server for any changes. If a new file gets added you want to be notified. If an existing file is modified you want to be notified. If a file is deleted you want to be notified. And how do you do this without…

  • How to implement print functionality efficiently in Javascript?

    Javascript provides a very easy way to print your page. Just use window.print() and the entire page gets printed. But the problem is exactly that , the entire page gets printed. If you have a print button , the print button gets printed as well. If you want only a specific portion of your page…

  • How to connect to Google Firebase Realtime database from your javascript project?

    If you are looking to connect to a database on the cloud and you don’t want to spend any money in the initial stage , Google Firebase is an excellent choice.It has a generous free limit to get started. Also you don’t need a server to connect to their database. They provide SDKs (Software Development…

  • Built a tool – A No Touch QR Menu for Restaurants

    Built a tool – A No Touch QR Menu for Restaurants

    Covid-19 has disrupted our lives. And restaurants have been badly hit by it. One of the precautionary measures taken by restaurants around the world is replacing physical menus with digital menus. Here is how it works: Customers walk into the restaurant and find a table. A QR code is displayed on the table. Customers scan…

  • How to save time typing console.log() statements in Javascript?

    For a javascript developer , console.log() statement is a great companion. It helps debugging issues fast. But typing this statement can be time consuming. There are two tricks to help in reducing time , typing this statement. Trick 1: Enclose variables to print in curly braces {} . Let’s say you want to print the…

  • What is the difference between firstChild and firstChildElement in Javascript?

    I was trying to get the value of the first list item of an unordered list using “firstChild” attribute. It threw error. I tried the same using “firstElementChild” and it worked! The difference it happens to be is: “firstChild” considers text entered in between html tags as a child element too in addition to html…

  • How to create a custom element (HTML tag) in HTML?

    Until HTML5 , reusing a piece of html code was not straightforward. Thanks to HTML5 , web components came into picture. Now you can create your own custom components and include them in your HTML code using custom tags. And you can reuse them anywhere else in your application by declaring the custom tags just…

  • How to trace distributed logs using Spring Cloud Sleuth?

    In the previous post, I explained how to trace logs across distributed applications/microservices using MDC design pattern provided by all major logging frameworks like slf4j. Spring Boot has made it even easier. You just need to include the dependency spring-cloud-sleuth and do some minor changes and your logs are automatically appended with tracing ids .The…

  • How to trace logs across distributed applications/microservices in Spring Boot?

    Logging is so critical to applications. Good logging strategy can help you fix issues in production environment quickly and help you save time and money. With the adoption of microservices , proper logging has got even more importance. One of the difficulties in debugging microservices is that the flow of API requests are spread across…

  • How to retrieve URL and Query parameters in Spring Boot?

    Let’s say you want to create a Spring Boot REST API which accepts URL and query parameters. How do you retrieve those parameters in the code ? By using @RequestParam annotation for query parameter @PathVariable annotation for URL parameter Here is an example: The above method is a GET REST service which takes in a…