To clear the Material UI text field Value in React, we can set the value property of the input to an empty string. Example
Since ES6 when you try to import JSON file you might face this error. To fix this error simple add the flag –experimental-json-modules to your node.js run command.
To list down all blocking objects with status as ‘is blocking’, we can run the following query. There is a handy query that would frame ‘KILL’ queries for the blocking […]
pstree is a command that shows the running processes as a tree. It is used as a more visual alternative to the ps command. The root of the tree is […]
Using a built-in variable: Using a tilde:
Using a built-in variable: Using a command:
We know how to filter on an array of objects on specific fields. In some cases we might want to filter on all fields. This code snippet would help.
This command queries the configured processor values using the getconf command. Example
To view the list of NVM installed in your machine: To make an NVM version default:
I would like to convert 1.2 to 1.5 and 1.7 to 2. This is basically rounding a decimal number to nearest decimal that is divisible by 5.
To fix the error – Error: algorithms should be set – just add the algorithms to the JWT constructor.
The playonyt() function in pywhatkit module is used to play a Youtube video either from a URL or from a keyword. Syntax Example
SyntaxError: Cannot use import statement outside a module – This error occurs when you use ES6 imports in your node.js code. To fix this just add “type”: “module” to your […]
When you connect to a MySQL Database with MariaDB npm package you might face this error. To fix this just add “allowPublicKeyRetrieval”: true to your connection properties. In my case […]
Moving average is the average of the current element and the previous elements in an array. We can use the following code snippet to achieve it.
Check if a user’s device is in dark mode with the following code snippet.
To fix the ‘unexpected console statement’ error in Vue.js, open package.json and under section eslintConfig put no-console under rules and restart dev server (npm run serve or yarn serve). This is a same way as we have fixed in Node.js
To fix the ‘unexpected console statement’ error in Node.js, just create a .eslintrc.js in the directory of the project and put the following configuration in it.
In this tutorial we are going to use an npm package called express-rate-limit. Install it using the following command. This library provides a brute-force protection for express routes by rate-limiting […]
Pandas csv module
Use the following syntax to use a string/ varchar column as a number for ordering in MySQL. Example Here Box is of VARCHAR type. Hence I need to cast it […]
Call math.log(x) on a number x to return the natural logarithm of x.
This snippet fetches the list of files in a directory sorting them by their names using os.listdir(). Earlier we used glob() to do this.