Answer by Hamfri for How to get the first date of the current month in Node.js?
Create a new file dates.js and add the following code. To execute this code run the command node dates.js from your terminal. You can use this function to get first and last days dates in a given...
View ArticleAnswer by Hamfri for How to determine whether a year is a leap year in...
The following code block will work well on Javascript and also on Typescript if you remove the function keyword. To understand the logic behind this implementation have a look at this link How to...
View ArticleAnswer by Hamfri for Angular ngClass multiple ternary operator conditions
If you are working on angular 8+ the following should work.[ngClass]="{'css-class' : condition1 === true || condition2 === true }">
View ArticleAnswer by Hamfri for Angular/CLI -- auto reload doesn't happen
If angular auto-reload is not working on ubuntu 20.04 and you are using nvm try running the following:sudo echo "fs.inotify.max_user_watches=524288">> /etc/sysctl.confDelete node_modules in your...
View ArticleAnswer by Hamfri for How to change border radius of bootstrap modal?
In Bootstrap 4 Try the following:.modal-content { -webkit-border-radius: 0px !important; -moz-border-radius: 0px !important; border-radius: 0px !important; -webkit-border: 0px !important; -moz-border:...
View ArticleAnswer by Hamfri for Disable click outside of bootstrap modal area to close...
If you are using @ng-bootstrap use the following: Componentimport { Component, OnInit } from '@angular/core';import { NgbModal } from '@ng-bootstrap/ng-bootstrap';@Component({ selector: 'example',...
View ArticleAnswer by Hamfri for Command `npm start` does nothing
Run this command from your console npm config set ignore-scripts false or sudo npm config set ignore-scripts false . This applies to linux or mac users.
View ArticleAnswer by Hamfri for How do I make git use the editor of my choice for...
To make vim the default editor for git on ubuntu 20:04 run the following command:git config --global core.editor vim
View ArticleAnswer by Hamfri for loading directive templates asynchronously is not...
I faced the same issue while upgrading from angularJs 1.7 to Angular 9. To fix the issue i changed template to templateUrl in the angularJS component file.
View ArticleAnswer by Hamfri for cordova Android requirements failed: "Could not find an...
Solution for linux and specifically Ubuntu 20:04. First ensure you have Java installed before proceeding:1. java -version2. sudo apt-get update3. sudo apt-get install openjdk-8-jdkOpen .bashrcvim...
View ArticleAnswer by Hamfri for Failed to find 'ANDROID_HOME' environment variable
To set ANDROID_HOME environment on ubuntu 20.04 visit Ubuntu's snap store and install Android studio and then openvim $HOME/.bashrcAnd set the environment variables as follows:export...
View ArticleAnswer by Hamfri for Support for the experimental syntax 'classProperties'...
I faced the same issue while trying to transpile some jsx with babel. Below is the solution that worked for me. You can add the following json to your .babelrc{"presets": [ ["@babel/preset-react", {...
View ArticleAnswer by Hamfri for sqllite3 install on node and macos give error
I struggled with this issue on Ubuntu 20.04, node version 14.5.0 until when i came across sqlite3 npm documentation. Simply execute the following commands if you are on Ubuntu 20.04:sudo apt-get...
View ArticleAnswer by Hamfri for Cakephp3: How can I return json data?
As of cakePHP 4.x.x the following should work assuming that your controller and routes are set as shown below:controller: <your_project_name>/src/Controller/StudentsController.phppublic function...
View ArticleAnswer by Hamfri for How to import pgp private key in PHP with gnupg?
Assuming that you are on Ubuntu/Debian based operating system this is how I would approach the situation:Install dependencies.sudo apt-get updatesudo apt-get install software-properties-common gnupg...
View ArticleAnswer by Hamfri for Angular 4: How to include Bootstrap?
If you are on Angular 6+ add the following lines of code to angular.json:"styles": ["./node_modules/bootstrap/dist/css/bootstrap.min.css","src/styles.css" ],
View ArticleAnswer by Hamfri for How to install specified version of Composer
If you are using a docker container the following method would be better:curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --version=1.10.16 Ensure...
View ArticleAnswer by Hamfri for Using “ng2-file-upload” with Angular 2 and Typescript,...
Only two things could cause this:Client sideif ng2-file-upload maxFileSize parameter is less than 1MBServer sideIf you are using PHP on the serverside adjust the following parameters in...
View ArticleAnswer by Hamfri for How to response XML with node.js express?
In ExpressJs Simply add the content-type and send a valid XML document as the xmlContentresponse.type('application/xml')response.send(xmlContent)
View ArticleAnswer by Hamfri for gyp error when I want to do React native npm install
If you are on an M1 MacBook or any Apple Silicon chip Macbook the default python installation is Python 3.8.9 or higher this might cause issues during compilation and linking of certain libraries like...
View Article