Latest Questions and Answers

Npm ERR cb() never called?

Try

npm update chokidar

the older versions aint compatible with Node v14 and above

 

Pendrive paste option is not showing in mac?

There is a very easy to use pendrive in mac system. You would have faced this type of problem with a pendrive formated as NTFS. You just need to reformat your pendrive and choose the option as FAT32 and now it will be ready to use with mac as well as windows operating system.

 

Laravel controller is not working?

I also faced such issue while working on a laravel project and after several rearch I found a solution which worked for me and it was really unexpected for me and that is the below command you can use in such scenario. composer dump-autoload Additionally, you can also use these below command collectively to avoid any other cache issue of laravel. php artisan cache:clear php artisan config:cac... (more)

How to apply loop on objects in JavaScript?

When we talk about looping through objects, before ES6 we had only one option to loop through objects using for...in. But it has some drawback as it iterates through properties in the prototype chain and to check if property belongs to the object you can do this with hasOwnProperty.    for (var property in object) {   if (object.hasOwnProperty(property)) {     // Rest code   } }   Bet... (more)

How to enable .htaccess on apache server?

.htaccess is a configuration file for the Apache web server. It’s an extremely powerful tool that can be used to modify the Apache configuration without editing the Apache configuration files directly. Let us see how to create this configuration and use it to restrict directory listings and IP addresses, and to handle redirects.   Enable .htaccess file:   sudo nano /etc/apache2/si... (more)

How to edit and update reactive form in Angular?

If you have a list of records and now you want a edit screen to edit and update the record then you can do it using following steps: 1- Import forms module in component import { FormGroup, FormBuilder, Validators, FormArray } from '@angular/forms'; 2- Then declare variables of form builder and form group public testform: FormGroup;   constructor(     public share: S... (more)

Basic Concepts of JavaScript?

Here you can get a very useful javascript concepts where most of the people get confused or not aware of it. The below list will solve it:   What is NaN? NaN represents a special Not-a-Number value. It is a result of an invalid or an undefined mathematical operation,  like taking the square root of -1 or dividing 0 by 0, etc. We can check it using Number.isNa... (more)

What is view composer in laravel php?

If you want some data to be passed to a view each time when it is rendered. It helps to avoid writing code in controller 's methods repeatedly.   We can define it as below: View composers are callbacks or class methods that are called when a view is rendered. If you have data that you want to be bound to a view each time that view is rendered, a view composer can help you organize that log... (more)

Javascript ES6 interview questions and answers?

A list of important questions and answers which are frequently asked in interviews.   1) What is ES6 or ECMAScript 2015? It was released in June 2015, which is also known as the sixth edition of the language. Earlier, it was named ES6 and later renamed to ECMAScript 2015. There are several new features are introduced like modules, iterators, class, arrow functions, for...of loop, promises, an... (more)

What is an RxJS Operator?

Operators are methods that you can use on Observables/Subjects that allow you to change the original observable and return a new observable. Operators do not change the existing Observable, they simply modify it and return a new observable. Operators are known as pure functions, which are functions that do not modify the variables outside of its scope. Operatoes are of two types: Static Ope... (more)

Important React Interview Questions Part 1?

We have a list of interview questions in this section and would like to explain it thoroughly. We will keep adding multiple questions and answers into this later also.   What are the key features of React? The key features of Reactjs are:     1- It uses VirtualDOM instead of RealDOM considering that RealDOM manipulations are expensive.     2- It supports server side (SSR) rendering.    ... (more)

How to create multi select checkboxes with search feature?

Here I will show you how you can create a multi select checkbox with search feature using jQuery and bootstrap library and it is a very easy to integrate anywhere in web application. You just need to include bootstrap multi select library and few lines of configurable javascript code in your webpage. You will get that element integrated with many other features as well based on your requirement. F... (more)

Many to Many relationship structure in Laravel 7 php?

To establish Many to Many relation, laravel has given a way by creating an intermediary table that is called pivot table. It is a very simple table containing two foreign keys of related tables (Models). We can understand this relation easily with an example as stated below.   We have two entities Category and Post. A category may belongs to many posts and a post may belongs to many categories... (more)

What is difference between var and let in JavaScript?

  Var:----  The var statement declares a function-scoped or globally-scoped variable,  optionally initializing it to a value. var x = 1; if (x === 1) {   var x = 2;   console.log(x);   // expected output: 2 } console.log(x); // expected output: 2 var declarations, wherever they occur, are processed before any code is executed. This is called hoisting, and is discussed further below... (more)

What is Closure in JavaScript?

To understand concept of closure go through each line and concentrate on the code carefully:   function tempFunc() {   var name = 'Laptop'; // name is a local variable created by tempFunc   function printName() { // printName() is the inner function, a closure     alert(name); // use variable declared in the parent function   }   printName(); }   function testFunc() {   var na... (more)

What is Lexical Scoping in JavaScript?

We have described the Lexical Scoping concept very clearly using an example which everybody can find it very helpful. function tempFunc() {   var name = 'Laptop'; // name is a local variable created by tempFunc   function printName() { // printName() is the inner function, a closure     alert(name); // use variable declared in the parent function   }   printName(); } tempFunc(); te... (more)

Difference between Flux and Redux in Reactjs?

Flux and Redux are different types of workflows in reactjs. They have different concepts to develop a react application. You can see below differences in Flux and Redux:        ... (more)

Npx create-react-app not working on windows?

We have seen many people stuck in running the npx create-react-app on windows. We can resolve this issue by following below command step by step and start working on reactjs.    To fix this issue run below commands one by one: npm init npm install create-react-app npx create-react-app myapp   For global installation of react module use below commands: npm install -g crea... (more)

What is Redux and its key features?

This topic explains about redux and have briefly described its important aspects which are very helpful to understand and proceed with it further.   Redux: Redux is a predictable state container for javascript apps.   Three Core Concepts:   Store:- That holds the state of your application.   Action:- That describes the changes in the state of the application... (more)

What are hooks in React js?

Hooks in Reactjs facilitates us to achieve everything which we can do using class and functional components. It has been introduced in latest version of Reactjs which is very efficient and easy to use as compared to earlier introduced methods in reactjs. Please have a look below points to get an understanding about hooks in react:   React Hooks:   Hooks are a new feature addition in... (more)

Key points of Reactjs?

Here we have described important topics of react js briefly so that you can get an overview of building blocks of react js.   Components: Components are user interface and these can be nested, one component can exist into another component. There is a root component in React js and all other component lies under this root component and make up a complete web page. You can say a component is... (more)

What is ReactJs?

1- It is an open source javascript library for building user interfaces.

2- It is is not a framework, it is a javascript library.

3- It focuses on user interface and can create a complex UIs from small 

and isolated pieces of code called "components".

Inspirational: Quotations to inspire and give positivity?

  "Success Requires No Explanations            Failure Permits No Alibis"   "Tell The World What You Intend to Do,                   But First Show It."   "The starting point of all achievement is DESIRE.                 Keep this constantly in mind.         Weak desire brings weak results, just as        a small fire makes a small amount of heat."   ... (more)

How to resize the droplet in digitalocean?

Now a days each and every company want their website hosted on cloud server. Digitalocean is one of the very famous cloud platef orm which provides facility to host websites on cloud virtual server.  Here, first let us know what is droplet in digitalocean?  Digitalocean droplet is an individual Linux based virtual machine/server. We can create as much virtual machines as we want. After cr... (more)

How to encode URL in JavaScript?

When you are working to encode url in javascript you have following functions for encoding purpose.  encodeURI() will not encode: ~!@#$&*()=:/,;?+' encodeURIComponent() will not encode: ~!*()'   1- encodeURIComponent() is used when you want to encode query parameters in URL like var url = "http://abc.com/?param1=" + encodeURIComponent(somevalue) + "¶m2=100";   2- You need... (more)

JavaScript Array functions?

If you want to work on array in javascript you must be aware of array operating functions which we have listed here for you. These are some of those methods which are frequently used when you work with arrays in javascript.    1- concat(): This method joins two or more arrays and return a new array containing all elements. array1.concat(array2, array3, ..., arrayX) var arr1 = ["abc", "def"]... (more)

JavaScript String functions?

We know very well about javascript demand in these days among software and website development companies. If you want to work on strings in javascript you must be aware of string operating functions which we have brought to you. These are some of those functions which are frequently used when you work with strings in javascript.  1- charAt(): This function returns the character at specified in... (more)

How to integrate Textlocal API in javascript?

Textlocal is one of the very famous Indian SMS gateway provider which provides feature of bulk sms anybody can use in website to enhance feature of his business and customer interaction using sms. We can use these messages for transactional or promotional purposes like OTP and invitation of registration link of the website.  There are following features which Textlocal provides: - Easil... (more)

Image is not uploading digitalocean website?

It is a permission issue for root folder. You need to give permission  to your user to read and write so that image can be uploaded as well  as read from folders to display on front end. To resolve the issue  you need to execute some commands which are listed below and try to  execute in same sequence. Login to your server execute ... (more)

How to display PHP code in browser without executing it?

We as a developer while working on projects whether it is website or any application write  code to implement logic and execute it. But here I will you how to display complete PHP  code in browser without executing it. You can do this following below code with an example: Here main key is to pass php code into htmlspecialchars() function. $php_cod... (more)

How to zip unzip folder ubuntu command?

Before doing zip or unzip a folder or files, you will need to install zip using below command if it is not already install: $ sudo apt install zip unzip Now you can use below syntaxes to create a zip of folders/files: zip -r name.zip folder zip -r name.zip folder1 folder2 zip -r name.zip /path/to/folder1 /path/to/file2 After running the command you will get a zipped file which you can keep as... (more)

How to change your mysql root user password?

To update the mysql root user password you will need to follow below steps and it will be updated without any problem. 1- First stop the mysql server  sudo /etc/init.d/mysql stop 2- Now run command to start mysqld configuration sudo mysqld --skip-grant-tables &   Don't forget & sign at the end In some cases you will need to create /var/run/mysqld  first sudo mkdir -v /var/run/mysql... (more)

How to update mysql user password using command?

I assume you have already a mysql user which password want to update or change. You will need to login into your mysql server with your root user which has administrative privileges. So, follow below steps and you will easily be able to update the user password: 1- Open the command shell and connect to the mysql server as root user mysql -u root -h localhost -p 2- Run command ALTER USER 'us... (more)

Async/await does not work within forEach loop in nodejs?

We have also faced such problem where we want to loop through array of objects and further get a detailed information about user from user id and add this into all objects respectively. I can explain with two examples where one works but the other does not:   1- Working example:   // Here info is the array of objects var newArr = [];... (more)

How to install free SSL in website?

Suppose you have already a website running on http protocol with apache  ubuntu server and you want to install a free SSL in your website then  follow the below steps and this license will expire in 90 days so you  will need to renew it again:   1- First of all run following commands to activate SSL mode and webserver to listen on ... (more)

How to install SSL certificate on ubuntu 18.04 apache server?

I assume you have setup your apache2 server and websites is running on http protocol.  Now you want to install SSL and get your website run on https only.  For this, you will need to purchase SSL certificate from any SSL provider.  Now if you have purchased the SSL you will need to follow few steps to  complete installation on apache... (more)

How to create a rest api in wordpress?

Wordpress allow us to create a rest api that can be used in application like mobile android, iOS apps or any other javascript frameworks. There is action hook "rest_api_init" which is used to create such an API in wordpress. You can understand it more exactly by below example: // Get user details by id function get_user_details(WP_REST_Request $request ) {         $id... (more)

What is data structure in programming languages?

Data sctructure is how we store, organize and group the data so that it can be used efficiently. 

There are many ways of storing data in programming languages like linked list, queue, graph, tree, array etc.

What is annotation in javascript?

Annotation is about specifyng type of the something like variable.  We can understand it better referring below example:   var a = 10; var b = "Hello"; var c = True;   Here javascript understand/infer the type of variable by the value being passed into it.   var a: number = 10; var b: String;   Here we have specified the type of th... (more)

What is Prototypes in javascript?

Let us understand the requirement of using prototype first.  Suppose you have a person class and there are two properties inside it.  You have created multiple objects and now you want to add a new property into class and that should  be available in all created objects then you would require to use prototype. If you add the new property... (more)

How to remove duplicate items from array in javascript?

You can remove duplicate items from array in javascript using below methods: 1-  Using filter function: var items = ["1", "2", "3", "1", "2", "4"]; var newArray = items.filter(function(item, index, items){       return items.indexOf(item) === index } );   2- Using core javascript logic: function removeDuplicateItems(arr) {      var tempArr = {};      for (var i ... (more)

Argument vs Parameter?

It seems same but there is difference between parameter and argument.  Parameter is variable in the declaration of function. Argument is the actual value of this variable that gets passed to function. See an example: def test_function(abc):      return abc   // Calling the function test_function(100) Here 'abc' is parameter and '100' is argument.... (more)

What is the difference between "==" and "is" in python?

In python == checks equality of the value but "is" checks memory. You can refer to below example to understand it better: a = [1,2,3] b = [1,2,3] a == b returns true because all values are same in both the lists. a is b returns false because a and b are two different objects in memory. clone = b b is clone returns true because clone and b point to the same memory. I hope you understand n... (more)

Could not find module "@angular-devkit/build-angular" in angular?

If you face above issue while executing the ng serve  command, you can install the package as dev dependency. This is introduced in latest version of Angular 6.0.

 npm install --save-dev @angular-devkit/build-angular  

I faced the same issue and it resolved my problem and hope it will resolve your's too.

How to start with Angular Js?

First of all I would like to introduce about Angularjs and Angular. First version of angularjs is called as Angularjs but later versions are called only Angular so this is the difference. To start with Angular, you must have node.js installed in your system that should be Node.js 10.9.0 or later version and you can get the latest version from nodejs.org You also need to have installed npm ... (more)

Expected response code 250 but got code “535”, with message "535-5.7.8 Username and Password not accepted?

If you are getting the above issue while setting up google / gmail SMTP server. You need to follow below steps it will surely solve your problem. I had also faced this issue and following the below steps resolved my problem and mail getting started to come in my inbox. 1- You need to enable 2 step verification in your google account setting  URL: https://www.google.com/landing/2step/ 2... (more)

How to get unlimited child categories in structured format using recursion in PHP?

We can get all child categories in PHP using recursion. Follow below example for better understanding: public function get_child($product_categories) {     $cat = array();     if(count($product_categories) > 0)     {         foreach($product_categories as $val)         {             $cat[$val['category_id']]['id'] = $val['category_id'];           ... (more)

How to select an element with class and loop through each one in JavaScript?

We can select any element of webpage using document.querySelector  and loop through each element having same class with forEach  function. Follow below example to understand it better:     flag = 0;     idtochoose = '';     document.querySelector('.ty-shipping-options__method input').forEach(function(node) {         console.log(node.id);         i... (more)

How to create range slider using jQuery?

Range is something we frequently use it in websites for the purpose of filtering records like products in ecommerce webistes. Anybody can integrate it using jQuery range slider by including a jquery.js, jquery-ui.js and jquery-ui.css.  There is an example below of few lines which will guide you how to use it easily:       jQuery Range Slider             $( function() {   ... (more)

How to use multi select field?

I would like to share with you guys that using a multi select field is very simple easy to integrate within forms or nay where in web page. You can refer to the below shared URL from where you can see multiple types of multi select fields which you can use as per your need: https://harvesthq.github.io/chosen/#selected-and-disabled-support You can click on downloads button and you will see three... (more)