Author: Vijay SRJ

  • How do numbers differ in Javascript and Java?

    Numbers are a basic data type. You can’t have a programming language without them. Yet how these numbers are treated can vary slightly between different languages. Brendan Eich , when he created Javascript was hugely influenced by Java. In face he was asked to create a Java language for the browser by Netscape and ended…

  • How to move a file/folder to trash/Recyclebin in Java?

    Let’s say you want to move a file or a folder to the recycle bin using java and not delete it permanently. How can you do it? Starting Java 9 , you can do it using a single line of code: Here is a demo: I created a file under C:/files location using the below…

  • How to convert your Spring Boot app to a HTTPS application?

    Let’s say you have a simple spring boot app with a single API which returns the string “Hello HTTPS”. But this runs on HTTP and you want to convert this to run on HTTPS. You want your app to be more secure and the data sent over the network to be encrypted. You can do…

  • How does HTTPS work?

    One of the most basic knowledge required for web developers is to know how https protocol works (also called SSL/TLS). How does it secure your websites compared to http? Let’s first see why http is not secure. Assume you are in a public wifi network. You are using the wifi to connect to the internet.…

  • How the binary logical operators ‘&&’ and ‘||’ differ in Javascript from Java

    The binary logical operators && and || are used to determine whether an expression is true or false. && means the expression on both the side of the operator should be true. Example: Even if one of the expressions is false the final expression evaluates to false || means any of the two expressions should…

  • undefined vs null in javascript

    If you are from the background of a programming language like Java , you might feel that the way to represent a “no value” is through the value “null”. But Javascript has two ways to denote a “no value”. One is “undefined” Another is “null” “undefined” represents “no value” whereas “null” represents “no object” to…

  • How to find execution time in javascript?

    Let’s say you want to find out the time the code you wrote took to run. There is an easy way in javascript to do it. Just use console.time() and console.timeEnd() methods. Here is an example: In the above code I am using a variable totalTime to give a label (against which the total execution…

  • How to create Javascript modules? – a basic example

    Gone were the days when Javascript was a small kid on the block. We used it only for client side validation and petty stuff. Now it has grown bigger than many major languages and occupied the territory of server side programming as well. Javascript for a long time didn’t support modules. If you wanted to…

  • How to deploy HTML & Javascript code to Apache Http Server?

    If you want just a static http server to serve your web pages for development/learning purpose one of the options is to use Apache Http Server. Once deployed you can access your files at http://localhost. Follow the below steps to deploy your html and javascript files to Apache http server : STEP1: Install Apache HTTP…

  • Java 16 features every Java developer should know

    Java 16 features every Java developer should know

    Java 16 just released. Though a lot of new features were introduced only six of them need to be understood by day to day java developers. Here are those features: Records Pattern matching for instanceof Sealed classes (Second preview) jpackage packaging tool Stream.toList() method Day Period support added to java.time Formats 1.Records: If you want…