Posts

Showing posts from September, 2018

Nodejs auto restart server | NodeJS watch file Changes

Image
NodeJS Logo(Source: Wikipedia) When we working with nodejs application manually restarting our application is the tedious task for everyone, so everytime when we working on node application then we may think that How to watch node file changes or just simply  watch node file changes right? So we will see how can we overcome this problem with simple step by using nodemon to watch file changes. Step 1: Create sample application with the following command: $ npm init -y #-y for accpeting default configuration Wrote to /home/ubuntu/dev/blogTutor/package.json: { "name": "blogTutor", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], "author": "Vikas", "license": "ISC" } Step 2: ...

What is an objects in Javascript

Image
What is an object in Javascript? If you have read my last post about object-oriented programming in Javascript . I hope you have got some idea about what is object-oriented programming in Javascript. so Now we will see What is an object in Javascript.  First, we will look at what is meant by object: An object is a real-time object and can be a variable, a data structure, a function, or a method, and as such, is a value in memory referenced by an identifier. Let's take a look at the following code. var userName1="Vicky"; var userPassword1="VickyPassword" var userEmail1= "vicky@vicky.com" var userName2="Sagar"; var userPassword2="SagarPassword" var userEmail2= "sagar@test.com" var userName3="John"; var userPassword3="jOhnPassword" var userEmail3= "easyjohn@sample.com" As you can see if we want to use more than 100 records then it will become a tedious job to handle...

Object Oriented Programming in Javascript Tutorial

Image
Object Oriented Javascript Tutorial Hello, All as the title suggest we are going to understand what is object-oriented in JS .  for those we don't have knowledge about Object Oriented Programming language, let's understand the terminology out OOP Language. OOP language is totally based on objects where the objects contain data, methods, and its attributes. let's take a realtime example as follows: I have fruits which are as follows as Banana, Orange, Lemon, Apple, Mango etc, so if I want to find a number of fruits I have then I can use length function to find out. The same way in  Javascript fruits  array is an object which has some properties and methods like  length is a property of array and sort is the method of an object. Nowadays, the Object-oriented Programming language is the more popular style for the programming language, and Javascript has taken the OOP concept from the scratch only. If we go d...

Visual Studio: Cannot find runtime 'node' on PATH

Image
Visual Studio code error: Cannot find runtime 'node' on path Error. If you are working on NodeJS   Project and using Visual Studio Code as your IDE. Visual Studio Code provides debugging NodeJS application feature as well. To Run Debugger you just need to Select Debugger from Menu and start debugging.    But if you are using nvm on your machine then it may happen that you are using the different version to run node application and Visual Studio Code uses different node version. Sometimes Visual Studio Code doesn't find node so it will throw the following error. And if you see the launch.json file it will look like below. { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version" : "0.2.0" , "configurations" : [ { "type" : "node" , "reque...

Installation & Introduction to Crystal Language

Image
Source: Wikipedia Today, I have started exploring new programming language called Crystal . Why Crystal Language: Speed:  Crystal is compiled language based on LLVM framework so it directly gets executed on runtime. Syntax : As Crystal lang tagline suggest Fast As Slick as Ruby, Crystal uses ruby language like syntax to write code. Statically Type check :   Crystal is statically type checked language so any type of errors will be shown or caught on compile time rather than fail at runtime.  Clean : Crystal has built-in type inference, so most type annotations are unneeded. Null Reference Check:  Compiler automatically checks for null references in compile time only. Macros: We can create and use macros so it's easy to use. your dynamic method definition could be replaced with a compile-time macro in as many lines of code. Green Threads:  Crystal uses green threads, called fibers , to achieve concurrency. Fibers communicate with each other...