Trending Stories For You
How to make a carousel vertical?

You can solve this problem by using a css technique and get the slides vertically rotate. I'm giving you an example and try to make you understand how you can get your problem resolved, below are some code snippets of thumbnails:                 /********* CSS ***********/ .owl-carousel{    transform: rotate(90deg);    width: 270px;     margin-top:100px;  }  .it... (more)

How to get woocommerce orders by user id in wordpress?

You can get same solution by using woocommerce built in functions. But this is the way which is independent of the woocommerce versions. Just paste the below function and get all orders made by a particular user by just providing user id. If you check the sql query, you will realize how many tables are involved to fetch the orders and how the records are stored into database. So it is also usefull... (more)

How to install and uninstall skype on Linux Ubuntu 16.04?

First let us see how to install Skype on Linux Ubuntu 16.04. Please follow below steps to run command in terminal: 1- Go to Skype download https://www.skype.com/en/get-skype/  and download ".deb" file choosing from dropdown. 2- Run the command in home directory: ~$  sudo dpkg -i /home/atif/Downloads/skypeforlinux-64.deb   OR sudo dpkg -i ~/Downloads/skypeforlinux-64.deb  If you find an... (more)

How to display HTML code on browser without executing it?

logoIf you want to print PHP or HTML codes with script or any other tags to define/state your point, you can do using following way and it works properly and perfectly. Many colleagues get stuck while developing an application where such requirement comes they use this technique to get their work done. You need to wrap your code within <xmp> Your code lies here </xmp>. Refer to below example... (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- Now cre... (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: - Easily send p... (more)

How to activate API access in CS Cart?

Cs cart comes with some basic APIs already created like fetch products, get cart contents and some more. You can create your own APIs that can communicate with database get ready to be connected with your mobile application. To access/enable APIs you need to follow below steps: API access is activated/disabled on a per-user basis. To activate cs cart API access for a user: 1- Got to the CS-Cart... (more)

How to integrate SOAP API using curl in PHP?

Yes. We can integrate a SOAP API using curl in php. I can make you understand by giving an example so that you can understand well. SOAP is its own protocol which uses XML to make requests and it is more secure that REST API. I will explain about SOAP in different section, let us see how we can make SOAP request using curl. Please check the below example to integrate any of the SOAP API and will w... (more)

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 packag... (more)

Npm ERR cb() never called?

Try

npm update chokidar

the older versions aint compatible with Node v14 and above

 

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 creati... (more)

What is PHP?

PHP is one of the famous programming language, specially used for website development. Like other programming languages it also has all oops features and properties. Multiple inheritance is not possible in this language but there is alternative way introduced to achieve the same that is traits. Trait is a mechanism to get reusability of codes in php web application. Interfaces are traits which ca... (more)

Get MySql Query to show messages, username of a chat?

Suppose there are two tables `chat` and `users`. `chat` have four columns id, sender, receiver and message and `users` have two columns id and name. chat:   users:   SELECT u1.name as sender, u2.name as receiver, c.message FROM `chat` as c LEFT JOIN `users` as u1 ON c.sender = u1.id LEFT JOIN `users` as u2 ON c.receiver = u2.id   In the result you will get sender name, receiver name ... (more)

Why do I get "No root file system is defined" when I try to install Ubuntu in a partition?

If you are getting the above alert message while installing Ubuntu on a partition, you should follow bellow steps to proceed: 1- Choose the "Ext4 journaling file system" from dropdown. 2- Choose "/" mount point from dropdown. and click ok button. Now it will start installing Ubuntu on that partition. Please refer the below image for your better understanding.    ... (more)

How much time does it take to be expert in Selenium?

Is there anybody who can assist me to know about time and way to be an expert in testing automation with Selenium web drivers?

How to start with Node Js?

I want to know how can start Node js as my career?

How to install Watchman in Ubuntu 16.04?

Follow below steps to install watchman in Ubuntu 16.04 1- Go to home directory: $ cd ~ 2- Clone using below command: $ git clone https://github.com/facebook/watchman.git 3- Get into watchman directory: $ cd watchman/ 4- Now use this command: $ git checkout v4.7.0 5- Run the commands: $ sudo apt-get install -y autoconf automake build-essential python-dev $ ./autogen.sh  $ ./configure  $ make... (more)

Why people don't prefer to go in walkins?

In walkins companies welcome a bulk of candidates to attend and take interviews. In such cases interviewer don't give proper time to listen and understand answers given by candidate. Also, they don't give options more as they are in hurry to attend all candidates soon. So, they just fire questions one by one frequently and expect answers same way. Unfortunately, a candidate having knowled... (more)

What is selenium?

Selenium is an automation tool to automate the testing process to save time and expense. This tool can be learnt taking help of internet, studying the shared examples and watching videos from YouTube or any other resource. Now a days this is very demanded among companies and IT professionals. You can make your career in this domain and earn a handsome package after few years of experience... (more)

What is computer?

As everybody know that computer is an electronic device. It is used used for multiple purposes like account management, graphical representation, programming websites or applications and many more. It is not limited anymore even these days very high performance computers have been introduced which are used in realtime like airoplane, health checkups to generate reports etc. It is comprised of so... (more)

Can't load URL: The domain of this URL isn't included in app's domains?

If you are facing an error of domain URL is not included in App's domain as shown below image, you just need to put put "Valid OAuth redirect URIs" and try to put a secure URL which uses https protocol using SSL because Facebook has updated his policy and require an https URL for this purpose.   Make sure options are chosen as displayed in below image.   And now put the OAuth redir... (more)

How to disable previous dates in datepicker jquery calendar?

You can disable the previous dates in datepicker of jquery calendar following the below line of codes: $('#date').datepicker({             changeMonth: true,             duration: 'fast',             changeYear: true,             numberOfMonths: 1,             selectOtherMonths: true,             showOtherMonths: true,           ... (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 = $_R... (more)

Why unitegallery images are zoomed bydefault?


Many people would have faced the zoom issue while using the unitgallery. Images get zoomed by default and image quality gets poor. You can solve this problem by setting up the below options and everything will be alright. 

slider_zoom_max_ratio: 2, 
slider_scale_mode: "fit", 
slider_zoom_step: 1.2 

How to do web scrapping using python?

Scrapping is a very interesting topic but serious as well. Because it is not a legal work until website owner allows you to scrap it so if you are doing it, will completely be your responsibility. I'm going to show you how you can scrap a website and store it in a csv file. You can save it into database as well its up to your choice. There are various ways to scrap but I have come with Beautif... (more)

How to calculate number of days between two dates in Python?

You can use datetime module to get number of days between two dates, refer to below example to get the result:

from datetime import date

start = date(2019, 5, 1)  //Put start date
end   = date(2019, 5, 10) // Put end date

number_of_days = end - start
print(number_of_days.days)

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)

How to add a confirm password field in woocommerce checkout form?

Presumed, you have enabled the registration setting from admin panel and password field can be seen on checkout form. Now, you need an additional confirm password field in the form, you can use below hooks to add and it will work completely fine: add_filter( 'woocommerce_checkout_fields' , 'confirm_password_field', 10, 1 ); function confirm_password_field( $fields ) {     if ( g... (more)

How to load CSS files asynchronously in WordPress?

A website developed in wordpress has a problem of speed. To speed up the website speed we use some cache plugin, optimize the js, css and image files. Optimizing these stuffs gives a good result and we see some improvement in speed no doubt. Here what i'm going to share is about loading js and css files asynchronously with the help of some scripts. It will give you a huge improvements in websi... (more)

How to create a simple addon in CS CART?

There are two main folders in cs cart app and design. All php files reside in app folder including xml which is used to create an addon in cs cart. Refer to below steps to create a simple addon in cs cart: First create a folder "first_addon" for your addon inside app folder and then create a file addon.xml file inside this folder and write some basic statements like addon name, version, priority ... (more)

How to save Arabic in MySql database?

To save an Arabic text into your MySql database table, you first check the table column is set to "utf8" or not. If not, switch to table structure tab of phpmyadmin and click change under action column, here you will see a column "Collation" and choose "utf8_general_ci" from utf8 group and save. Now if you will save any Arabic string in this column it will save properly as it should be. Please re... (more)

How to fill address field on moving map and vice versa?

Please find below line of codes to solve your problem of getting address field populated with address by moving map and also if fill any address in address field it should reflect on map. You will get same functionality as displayed in screenshot.     Now in below image all of your required code are given for your reference.   ... (more)

How to get address details from an IP address in PHP?

First of all I would like to share with you guys that getting address details from an IP address is not much reliable because it does not give one's correct address. If you require exact address of a user, get latitude, longitude and fetch address from it instead of IP. Please follow below PHP code to get address detail from IP address: //$ip = $_SERVER['REMOTE_ADDR']; //Ig gives you... (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)

Why Python is so popular to do programming in Artificial Intelligence (AI)?

Saying Python is popular in machine learning and artificial intelligence would not be wrong because Python has a lot of inbuilt libraries which deals with AI and ML. Many libraries are for high level nervous system. scikit-learn for data mining/warehousing, data examination and machine learning. pylearn2 is more suitable than scikit. There are a lot of libraries which is not possible to define her... (more)

How to add defer to Enqueued JavaScript Files in WordPress?

To apply defer on javascripts included by wordpress plugins, custom included javascripts using enqueue hook of wordpress. Suppose you have included below files as an example and how to apply defer on these files: function custom_load_these_here_scripts() {     wp_enqueue_script('cycle', get_template_directory_uri() . '/js/cycle.js');     wp_enqueue_script('magnific-... (more)

What is cs cart?

Cs Cart is a complete package for online ecommerce websites. It is available for single vendor, multiple vendors and multiple stores as well. Cs cart is not available free of cost. If you want to use cs cart for your online shopping cart, you need to purchase it's license. As there are multiple packages, it costs respectively based on the chosen package. To see demo of cs cart features and al... (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)

Screen rotation issue in Ubuntu 18.04?

To get the normal screen use below command and run in terminal:

$ xrandr -o normal

Try the below command to remove:

$ sudo apt-get remove iio-sensor-proxy

 

You will get the problem resolved.

PHP program to generate a fibonacci series?

Below PHP code that will generate the Fibonacci series.

Series:  01123581321

 

echo $a=0;

echo $b=1;

 

while($c < 21)

{

 echo $c = $a+$b;

 $a=$b;

 $b=$c;

}

Show some first N elements with more/less functionality in jQuery?

It is very common requirement when you want to show some elements with more text in jQuery. So you can get that functionality by using below  line of code very easily. You just need to make your html list items in ul and li formats with those classes mentioned in below code. If everything is setup properly your code will run exactly as expected. $('ul.topic-list').each(function(){   va... (more)

How to set, unset and get cookie in jQuery?

You can set, get and delete cookie in jQuery using a jquery plugin. This plugin is very useful, easy to use in any website and get the requirement done without any hassle. Follow below steps and your are good to go: 1- Include the below library in the file and use as below mentioned. 2- Usage: Create session cookie: $.cookie('name', 'value'); Create expiring cookie, 7 days f... (more)

How to setup a cs cart website on local machine?

It is a very simple step to setup it on local machine. You just need to backup complete website from cpanel with database and extact the zip file on your localhost root (WWW) folder. Now find the file name config.local.php on root of your extracted zip folder. Open up the file in any editor and find the line of code where you can see database name, user and host as below: // Database connectio... (more)

How to write a program in PHP to generate a star triangle pattern?

  Please get the below PHP code to generate the above star symbol.   for($r=1;$r... (more)

How React Js is different from Angular and node or what is advantage of using one of them?

Both React Js and Angular Js are front end development frameworks which work on opposite approaches and saying one is better than other directly would not be correct, it can only be understand by some key features because choosing either of them is completely depends on project behavior and requirement. Below are some key features:     Beside the above two front end frameworks, Node Js is a... (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)

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 setup an Apache web server for PHP?

To setup an Apache web server, you need to run the below commands step by step and you will get the server ready to execute PHP and host any website developed in PHP. This is not a very difficult to make ready the server just you need to focus on what you are doing. Get start doing practice and it will become usual approach and many additional things you will know about setting up the web servers... (more)

How to start with Django?

Django is a high-level Python web development framework which helps you to faster and clean development. It is developed by experienced developers, it takes care of much about hassle/irritation of web development, so you can focus on writing your app without taking care of much about reinventing the wheel. It is free and open source. 1- Django has been designed to help developers to quickly deve... (more)

How to connect with MySql database and execute query in Python?

You can connect with MySql database in Python using mysql connector python. You will need to install it first using below command and import it in your program. Refer to below example how to install and execute sql queries. pip install mysql-connector-python Example: import mysql.connector from mysql.connector import Error try:     cn = mysql.connector.connect(host='localhost',datab... (more)

What is the use of Watchman while working on React?

React Native uses watchman to detect changes made by you while writing react script and it automatically reflect on browser without refreshing it. It is also helpful to remove error when you face while working on react like when you start react and it does not work on browser with the URL http://localhost:3000 and says site can't be reached then by installing Watchman you can resolve the is... (more)

How to connect python with MySQL database?

Before using mysql, you need to install mysql.connector module. Use the below command to install it: $ sudo apt-get install python3-mysql.connector Above example is for python3 and same can be used for python2 also. Get a quick reference with an example below: import mysql.connector cn = mysql.connector.connect(user='root', password='admin@123',                     ... (more)

Python ORM with SqlAlchemy?

An ORM is Object Relational Mapper which maps with relational database management system to objects. ORM is not dependent on database which is going to be used and gives different objects to access the database to retrieve, insert and manipulate the records. Here we are going to use SqlAlchemy ORM in Python. To communicate with database, we just use ORM along with Python objects and classes. Her... (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)

Npm start and getting "Unable to connect" error in react?

If you have installed react, node npm and setup other required stuffs however getting error of "Unable to connect" in browser when you run the command "npm start".  Browser opens with the URL "http://localhost:3000/" and shows "Unable to connect" then you can resolve this problem by running below commands in terminal (I'm using Ubuntu 16.04): sudo sysctl -w fs.inotify.max_user_instances=102... (more)

PHP Program to check prime number?

Please get the below PHP code that will check number is prime or not: $n = "11411"; $len = strlen($n); $f=0; for($i=0,$j=$len-1;$i... (more)

How to create a new react app?

You can create a new react js app using below commands: npx create-react-app my-app  (This command downloads all required modules/packages to work on react) cd my-app  npm start ( This command starts the react app ). If browser doesn't open automatically, you need to hit the URL http://localhost:3000/ to see your app. If your app has been developed and ready to be live on production the... (more)

What is Cryptography?

Cryptography is a term used where we keep information secure using some encoding mechanism and getting it decoded where it is supposed to be. For example, we transmit information from one place to another and want to keep it secure and safe from unauthorized access and getting it safely at receiving end, so some encryption are applied using a secret key before sending and get it decoded using the ... (more)

How to validate a date that can't be greater than current date?

Get the jQuery code below to check a date that can't be greater than current date:   $('.ty-dob input').change(function(){                      dob          = $(this).val();          var current_date = new Date();     var arrDate = dob.split("/");     var dob = new Date(arrDate[2], arrDate[1]-1, arrDate[0]);          /*console.log(arrDate);     cons... (more)

What are Pre-requisites to build a chatbot using NLP?

If anybody is willing to build a chatbot in python, there are some topics you need to be aware about first then it will make your journey easy. You should have knowledge of scikit library and NLTK is assumed. If you are a new in this field you still need to read about it and its resources. Using NLP programmers can structure knowledge to perform tasks such as automatic summarization, translation... (more)

How to connect django with MySql database?

Django comes with sqlite as database backend but you can use any of the database as per your need. To use MySql as database in django you will need to do some modification in settings.py file in DATABASES dictionary, refer to below line of code to proceed easily: By default you will see below code: DATABASES = {     'default': {         'ENGINE': 'django.db.backends.sq... (more)

Why pen drive showing less space?

Pen drive is showing less space! this problem has been faced by many people. This problem arise because of some reasons like: 1- Removal of pen drive suddenly while it is being used. 2- Interrupt the process of pen drive formatting. 3- Installing bootable operating system, it will change the partition system of your pen drive. 4- Sometime it happens because of computer virus. Users think thay ha... (more)

PHP code to create diamond symbol?

If you want to write PHP code to get above diamond symbol you can use below code:   for($i=0;$i=$i;$k--)   {       echo "  ";     }     for($j=1;$j=1;$i--) {     for($k=5;$k>=$i;$k--)   {       echo "   ";     }     for($j=1;$j... (more)

How to install free SSL on Digital Ocean virtual server or Droplet?

If you want to install free SSL on digital ocean droplet which already has been created and setup the Linux server by installing Apache. First go to terminal or putty and login into virtual server. Now, run below commands step by step: 1- Run update command to update all packages if any:  sudo apt-get update 2- sudo apt-get install apache2 3- sudo add-apt-repository ppa:certbot/certbot 4-... (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 access raw password and username before login in Wordpress?

We can get and access raw password and username using wordpress action hook "wp_authenticate". You can get a better understanding referring the below example: function access_credential($username, $password ) {   if (!empty($username) && !empty($password)) {     // You can code here as per requirement   } } add_action('wp_authenticate', 'access_credential', 30, 2);... (more)

Latest Interview Questions and Answers of PHP, jQuery, MySql and HTML/CSS?

Please find below the Latest interview questions and answers: jQuery: 1- What is event capturing and bubbling? 2- What does Bind and Call function do? 3- What is the difference between $(document).ready and $(window).load, and which one loads faster? 4- What is Closures in js? 5- What does Cache argument do in ajax? MySql: 1- What is Primary key and Candidate key with difference? 2- H... (more)

How to encrypt and decrypt information?

We work on multiple type of data and apply manipulation on them but sometime we work on critical information that needs to be highly secure. At that moment cryptography come in picture and apply encryption on data. You can use below line of code and class to get this feature: include 'AES.php's; $inputText = "My text to encrypt"; $inputKey = "My text to encrypt"; $blockSize = 256; $a... (more)

How to customize the alert in JavaScript or jQuery?

We can customize the alert box by using a library that is sweet alert. It is easy to use and has a nice effect which anybody can use in their websites to get different look. First include the library and then use below syntaxes. There are different ways to use and get alert boxes: swal("Hello World") If you pass two arguments then first will be the model's title and other one as a alert b... (more)

How to create a project in Django?

Please find below steps to proceed work on Django, debug code and troubleshoot problems etc. $django-admin startproject mysqlweb $python manage.py startapp polls $pip install mysqlclient (for python3, when using mysql database with django) https://stackoverflow.com/questions/454854/no-module-named-mysqldb Some of these applications make use of at least one database table, though, so we need to c... (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/sites-avai... (more)

How to make a div sticky?

Sometime we need a div in sidebar to float within header and footer, in this requirement you can write your own code and in jQuery or JavaScript but if you wish to use any third party library then I would suggest you to use the below one which is really very easy and light weight to use. You can just need to include the library and put a snippet of code where you want that floating feature and you... (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)

What is the meaning of __name__ == "__main__" in Python?

When a file executes it sets some special variables and __name__ is one of them. __name__ is set as "__main__" if it is getting executed directly. But if the file has been imported then it stores the filename suppose. For example: abc.py: if __name__ == "__main__":     print("Executed directly", __name__ ) else     print("Import executed", __name__ ) ### On execution of abc.py directly _... (more)

How to integrate an API in Django?

I suppose you are aware of django url.py, views.py and models.py files. So, I'm going to show you how to use python inbuilt client to integrate API in views.py file. How to import the package and use it, please see below example: #### views.py #### import requests def testapi(request):     response = requests.get("https://api.github.com/users")     response = response.json()     c... (more)

What is NLP?

NLP stands for Natural Programming Language. NLP belongs to one of the branch of Artificial Intelligence. It is used to build a system which understand, manipulate and respond to human in his natural language. NLP is being used in many areas like Google translation, auto suggest in grammatical mistakes etc. If you are using Python, there is a very powerful library used to build such a system tha... (more)

How to print a paragraph in Python?

We can get the same format as below using print function in Python:

print("""
  A string that you "don't" have to escape 
  this 
  is a ............. multi-line 
  heredoc string -----------------> example
  """)

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 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)

How to debug in Django?

To start debugging in django while doing development you will need to follow below steps and get to go: 1- $pip install django_extensions Now include in settings.py under INSTALLED_APPS as 'django_extensions'. 2- $pip install werkzeug You have set all required things for debugging, just need to write below statement where you want to debug: 3- assert False, latest_poll_list   It wil... (more)

How to disable keypress or restrict to write in a html input element in jQuery?

If we want to disable writing in a field using jQuery we can do this by writing below code. Actually sometime we don't want anybody to edit information written in a html input element but want that field populated with some default text then use the below line code to do this: $(document).ready(function(){                  //Disable address edit on checkout page         $(".... (more)

How to change the label of wordpress login screen?

Yes you can change the wordpress login screen label like username of email address to only email address as per your choice. We have login_head action and gettext filter using combination of these hook we can modify the label. Please follow the below example for better understanding:    //Modify login label function login_screen() {     add_filter( 'gettext', 'modify_label', ... (more)

How to calculate date interval between two dates in MySql?

I'm going to share how to calculate the date intervals between two dates like calculating 1 month before, two weeks before etc. You can do this using "DATE_SUB" mysql function. Find the below example to get proper understanding, it is an example of getting all medicines which are going to expire in next two weeks: $sql = "SELECT * FROM `products` p WHERE CURRENT_TIMESTAMP >=  DATE_SUB(FROM_... (more)

How to use debugging JavaScript in Chrome DevTools?

Many time we work on JavaScript and resolve bugs debugging with console.log. It solves the problem but takes much time. To debug code quickly and solve the problems, we should use Chrome DevTools which is very powerful and convenient to solve the JavaScript in very less time. Please refer to the below URL where it has elaborated clearly in video and text format illustrating it using images. https... (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)

How to get records from certain offset up to the end of result set in MySql?

To get the all records from a specific offset up to the end of the result set, use the below MySql query and will solve your problem. The query retrieves all rows from the 95th row to the last: SELECT * FROM tbl LIMIT 94,18446744073709551615; You would be thinking why this large number has been specified but it is mentioned in MySql official document. Actually it is larger than the length of i... (more)

How to print a calendar of month from a year in python?

You can get a python program below which will take two arguments year (eg. 2019) and month (eg. 6) in integer format and will display complete calendar of the month from that year you will enter from console. import calendar year = int(input("Please enter year:")) month = int(input("Please enter month:")) print(calendar.month(year, month))   Just paste the above code in a python file and ex... (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)

What is the difference between tree and graph data structure?

How can we differentiate between tree and graph data structure?

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)

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.

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)

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)

How to know about different type of Land Measurement?

There are several type of land measurements in the world. Like Katha is used used in Bangladesh, India and Nepal. In India, generally it is used in Bihar, West Bengal and Kolkata. Except Katha there are a lot other local measurements used in different areas of India. Bigha, Acre are those terms which are generally used in local measurement among people. If you want to know more about different t... (more)

How to replace broken image with default one in website?

We can solve this problem by using jQuery. There is an event "error" which we can use to solve the problem of broken images in website. It is called when element doesn't properly. You can understand it better by referring below example and implement in your website. function handleImgError(){ if(this.alt=="author") this.src = "http://www.webonsky.com/assets/front/resources/images/user_defau... (more)

How to manage common sections in Django?

To overcome the above shared problem, we use "Custom template tags" feature of Django. It is one of the great feature to handle common section which gets display in base.html template and be available in all templates those are using base template. Suppose there is a section to display about text in sidebar and you want to write code once and use it in all templates without calling it in all views... (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)

Some example of small logical programs in Python?

##Write a Python program to get the difference between a given number and 17, if the number is greater than 17 return double the absolute difference. def get_difference(n):   if n < 17:     return 17 - n   else:     return (n - 17)*2 diff1 = get_difference(15) diff2 = get_difference(20) print(diff1) print(diff2) ########################### ##Write a Python program to calculate the sum of ... (more)

How to reorder the woocommerce checkout form fields?

Woocommerce is one of very popular plugin to create ecommerce plate form in wordpress. Developing a website in woocommece requires less time, effort and cost until any customization is made. We can get a plenty of built in themes with attractive designs and features. But sometime we don't go with readymade themes instead we ask designer to create design and get the web pages ready in bootstr... (more)

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)

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)

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 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)

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.

 

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)

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)

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)

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)

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 create-react-app ... (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)

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 check whether an image exists or not from image path?

To check image existence you can use below function. You just need to pas the image URL in this function and it will return true or false, this way you can identify and show image based on it's existence. //Check whether image exists or not function UR_exists($url){         if (@getimagesize($url)) {         return true;     } else {         return false;     } }... (more)

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)

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)

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)

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)

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)

How to work with sleep or add delay in program?

Sleep function is present in time module of python. It is very useful when you are trying to add some delay in program execution. It does not stop complete program instead it just adds some delay in particular thread only. We can understand it with some examples which you see below:   import time #Example:1 sleep_time = 1 print("Hello") time.sleep(sleep_time) print("World")   #Examp... (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 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".

What is Git Stash?

When you have been working on part of your project and things are in a messy state and you want to switch branches for some other work. The problem is that you don’t want to do a commit of half done work so you can get back to this point later. In such situations git stash command is very useful. Stashing takes the your modified tracked files and staged changes and saves it on a stack of unfini... (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)

Write a program to generate Fibonacci series in Python?

Fibonacci series is a series of numbers in which each number is addition of previous two numbers. So, lets create it with an example For example:  0 1 1 2 3 5 8 13 and so on. Lets number of terms is 8. terms = 8 a=0 b=1 print(a,b,end="") for n in range(2, terms):     next = a+b     print(next, end="")     a=b     b=next        ... (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)

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)

How to read and compare value of one csv with other csv in python?

We are giving a complete code example of reading csv and picking value from one csv and reading other csv file to compare the value. You can implement any logic to perform on values of csv files. Below is the example of using core csv module instead of using external package/module of python: import csv #Open files fb_csv = open('first.csv', newline='', encoding='utf-1... (more)

How to generate a cohort using python?

You can create a cohort to do analysis for your business repetitive customers and can make necessary decisions accordingly to improve customer retention for your business. Example below will generate the cohort which can be seen in attached image. You need to keep the csv file in same folder with python file to avoid any error.     import pandas as pd import numpy as np import mat... (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 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)

How to share password in email?

Sometime we need to share a password. Directly sharing it in email is not a good practice, we should share it using some other medium so I'm going to share one of the best way to share it. Go to the below website and put your password and apply some rules like how many days after it will expire and how many times it should be viewed, after that it will expire. Website URL: https://ppusher... (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)

Bank ATM cash withdrawal rules 2021?

As per the new order from the RBI, the interchange charge that banks can charge on automated Teller Machines (ATM) will see a growth of Rs. 2 from August 1, 2021. Note that, the RBI had elevated the interchange rate  in June from Rs 15 to Rs 17, while for non-monetary transactions the price was raised from Rs 5 to Rs 6. This fee is being charged through the banks to customers processing the bills... (more)