Posts

Showing posts from 2021

How to install Angular to local machine?

  For installation of Angular to local machine refer the below link:    https://angular.io/guide/setup-local

How to see unused variables in Visual Studio Code for AngularJs?

 Looking for the unused variables in VS code editor, need to add below line to tslint.json file  under "rules" add "no-unused-variable":true

What is a Good Load Page Time?

 2 seconds time is Good Load Page Time.

How to Build an AngularJs App?

 For creating build in Angular Js, run the below command in project directory:   ng build --prod --aot --output-hashing=all

How to set and get log in MySQL?

Using below MySQL statement, we can set and get the MySQL log: For getting the log, we must need set global log using command as below: SET global general_log = 1 ; Now need execute command using storing output:     SET global log_output = 'table' ;   Now you can see the log using below query: SELECT * FROM mysql.general_log; If you want to disable log, then need to run below query:      SET global general_log = 0 ;

How to increase the security for login and prevention for SQL injection in PHP?

Sometimes developers are set the user name and password directly to query without using any plain text checking function like addslashes() of PHP function or mysqli_real_escape_string()  of mysqli functions for entered username and password by user. And some time end uses are setting the password very poorly like set our simple name or birthday and name etc. So we need care about below things: For end user, password should not be be your personal details like birth date or your first or last name. For developer, Should to set restriction like allowed three wrong attempts after that block the user for 24 hours. From preventing SQL injection, Should to add addslashes()  for PHP and for My SQL  mysqli_real_escape_string() before executing the query to database. Understanding with examples: <?php /* For query */ $con = mysqli_connect ( "localhost" , "user" , "password" , "dbname" ); $user_name = mysqli_real_escape_string( $c

Changing upload_max_filesize on PHP

Using below lines, we can set the upload_max_filesize at run time in php: First of all you need to check current set upload_max_filesize: <?php echo "Upload max file zise =  " . ini_get("upload_max_filesize") ; ?> Now set the upload_max_filesize 200 MB: <?php ini_set('upload_max_filesize', '200MB'); ?> Now check the changed size: <?php echo "Upload max file zise =  " . ini_get("upload_max_filesize") ; ?> We can also get and set the post_max_size as per above example.

How to get the Time Zone from IP address in PHP?

Using below PHP script, we can get the time zone based on IP address: $ip = '192.168.11.121';  # any working IP address $ipContent = file_get_contents('http://ip-api.com/json/' . $ip); $ipJsonInfo = json_decode($ipContent); $timeZone = $ipJsonInfo->timezone; #Print the $timeZone echo $timeZone; Here, also can set this time zone as default using below function: date_default_timezone_set($timeZone);

What is fully qualified name in MySQL database query?

 In query the field name aliased  by table name know as Fully Qualified name. Ex. SELECT employee.address FROM employee;

What is conjunctive operators in SQL?

 The SQL AND and OR conditions may be combined to test multiple conditions in query. These two operators are called conjunctive operators.

How to generate the random password in PHP?

 Using below PHP script, you can generate the random password: <?php  function generateRandomPassword() {         $salt = "abcdefghijklmnopqrstuvwxyz0123456789";         srand((double) microtime() * 1000000);         $i = 0;         while ($i <= 7) {              $num = rand() % 33;             $tmp = substr($salt, $num, 1);             $pass = $pass . $tmp;             $i++;         }         return $pass;     } echo generateRandomPassword();  // Calling the function ?>

How to use remote validation in JQuery?

 As per below example, we can use the remove validation into JQuery: email: { remote: { type: "POST", url: 'http://test.domainname.com/check_email.php', dataType: "json", beforeSend: function () {                                        // set loading image }, complete: function () {                                 // hide loading image }, data: { 'email': function () { return $('#email').val() } } } } Here, "check_email.php" is your remote file where you will verify the email. Which exist or not to your particular database table

How to set Timezone in .htaccess file?

Using below line, we can set the Timezone to .htaccess file. SetEnv AE Asia/Dubai

How to Drop or Delete the database by shell command in windows XAMPP?

 Generally, we can pass any query to mysql from shell with -e option as below: 1. First need to go in mysql/bin using cd mysql/bin command 2. mysql -u username -p -D "database name" -e "DROP DATABASE database name"

How to add new file in git ignore?

 For steps to add file in git ignore: 1. Go to .gitignore file and add the entry for the files or folder path you want to ignore. 2. git rm -r --cached . 3. git add . Note:  Whenever you find the file which is in git ignore file and still you are getting in git status then run the command as above.