Thursday, April 2, 2015

Disable click outside of bootstrap model area to close modal

Disable click outside of bootstrap model area to close modal

making a bootstrap project, with a couple of Bootstrap 'Modals'. someone  trying to customize some of the default features.

they want to disable click on outside of model area to close modal

$('#myModal').modal({
    backdrop: 'static',
    keyboard: false  // to prevent closing with Esc button (if you want this too)
})
 
happy Coding :)

Friday, March 27, 2015

How to connect from windows command prompt to mysql command line

The cd in your question is invalid 


cd CD:\MYSQL\bin\
 
You can't cd to CD:\ anything, because CD:\ isn't a valid directory in Windows. CD: would indicate a drive, except that drives are restricted to a single letter between A and Z

If your \MYSQL\BIN is on drive C:, then your commands need to be:


C:\>cd \MYSQL\Bin

C:\MYSQL\Bin>mysql -u root -p admin

-
 
If you're not already on C: (which you'll know by looking at the prompt in the cmd window), or your MySQL folder is on another drive (for instance, D:), change to that drive too:


C:\> cd /d D:\MYSQL\Bin

D:\MYSQL\Bin>mysql -u root -p admin

-
 
 
The .exe after mysql is optional, since .exe is an executable extension on Windows. If you type mysql, Windows will automatically look for an executable file with that name and run it if it finds it.

Saturday, March 21, 2015

create an animated scroll to top

In this tutorial you will learn how you can create an animated scroll to top button with jQuery.

create the button.


 
<a href="#" class="scrollToTop">Top</a> 
 
//----------------------------------------------------
// CSS  PART
// ---------------------------------------------------
 
.scrollToTop{
 width:100px; 
 height:130px;
 padding:10px; 
 text-align:center; 
 background: whiteSmoke;
 font-weight: bold;
 color: #444;
 text-decoration: none;
 position:fixed;
 top:75px;
 right:40px;
 display:none;
 background: url('arrow_up.png') no-repeat 0px 20px;
}
.scrollToTop:hover{
 text-decoration:none;
}
 
 //-----------------------
//  Jquery part  
//---------------------------- 
 
$(document).ready(function(){
 
 //Check to see if the window is top if not then display button
 $(window).scroll(function(){
  if ($(this).scrollTop() > 100) {
   $('.scrollToTop').fadeIn();
  } else {
   $('.scrollToTop').fadeOut();
  }
 });
 
 //Click event to scroll to top
 $('.scrollToTop').click(function(){
  $('html, body').animate({scrollTop : 0},800);
  return false;
 });
 
});
 
 


 

Friday, March 20, 2015

Remove nginx and re activate apache

Remove nginx and re activate apache

 
//First, you need to stop nginx so it releases port 80 so that apache2 can listen to it later on.
-------------------------------------
sudo service nginx stop                                                           

//Next, if nginx was installed with apt-get, removing it would be as simple as

sudo apt-get remove nginx

//Instead, you can also use

sudo apt-get purge nginx

//First one removes all package files, while the second also removes the configuration files.
//If you intend to use nginx later on with the configuration you did, use remove. Else, I would suggest using purge.

//After removing nginx, you can restart apache to make sure it is listening to port 80.

sudo apache2ctl restart

//If you had removed apache before installing nginx, you can re-install it with

sudo apt-get install apache2 
 
 

Wednesday, February 25, 2015

Cross-Origin Request Blocked ?

ERROR : Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at the url. This can be fixed by moving the resource to the same domain or enabling CORS.



Solution :

If you are working on web project  and want to get data from different site , Sometime you get such type of error 

" Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at the url. This can be fixed by moving the resource to the same domain or enabling CORS. "

then you have to use .htaccess file 

update code

<FilesMatch "\.(php)$">
  <IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
  </IfModule>
</FilesMatch>           




if you havn't    .htaccess file then create a file in root folder and update following code 
Following code for wordpress project please change according to your Project 


# BEGIN WordPress
<IfModule mod_rewrite.c>
  RewriteEngine On

 RewriteBase /
  RewriteRule ^index\.php$ - [L]
  RewriteCond
   %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]
</IfModule>
<FilesMatch "\.(php)$">
   <IfModule mod_headers.c>   
     Header set Access-Control-Allow-Origin "*"
   </IfModule>
</FilesMatch>
# END WordPress



Enjoy Coding  :) 



comment please :)

Wednesday, February 11, 2015

Subtracting a certain number of hours, days, months or years from date

Subtracting a certain number of hours, days, months or years from date


you can subtract For hours:
function get_offset_hours($hours)
{
    return date('Y-m-d H:i:s', time() + 3600 * $hours);
}
Something like that will work well for hours and days (use 86400 for days), but for months and year it's a bit trickier...
Also you can also do it this way:
$date = strtotime(date('Y-m-d H:i:s') . ' +1 day');
$date = strtotime(date('Y-m-d H:i:s') . ' +1 week');
$date = strtotime(date('Y-m-d H:i:s') . ' +2 week');
$date = strtotime(date('Y-m-d H:i:s') . ' +1 month');
$date = strtotime(date('Y-m-d H:i:s') . ' +30 days');
$date = strtotime(date('Y-m-d H:i:s') . ' +1 year');

echo(date('Y-m-d H:i:s', $date));
you get required result .  :) 
Happy Coding   

Tuesday, February 10, 2015

How to Install and Configure phpMyAdmin on Ubuntu 14.04

phpMyAdmin is an open source tool used for the administration of MySQL. In addition to offering the capability to perform administration tasks such as creating, editing, or deleting databases, and managing users and permissions

Step 1: Install phpMyAdmin

apt-get -y update                                                                       
apt-get -y install phpmyadmin                                                            

Step 2: Basic Configuration

select apache2 by using the space bar, then hit enter to continue.  
At the second screen, which asks “configure the database for phpmyadmin with dbconfig-common?”, select Yes , then hit enter to continue. 
At the third screen enter your MySQL password, then hit enter to continue. 
And finally at the fourth screen set the password you’ll use to log into phpmyadmin, hit enter to continue, and confirm your password.

Step 3: Finish the Configuration of Apache

vim /etc/apache2/apache2.conf                                                         

# phpMyAdmin Configuration                                                            

Include /etc/phpmyadmin/apache.conf                                                   



Then exit and save the file with the command :wq .
And, restart Apache 2 with the following command:
 
service apache2 restart                                                               

  update curl                                                                 


I believe that the package php5-curl should do the trick. Use the package manager of your choice and the deps should be taken care of.

sudo apt-get install php5-curl
 
You will need to restart the server afterwards:

sudo service apache2 restart
 
Alternatively, if you are using php-fpm, you'll need to restart php5-fpm instead

sudo service php5-fpm restart
 
 
 
Error reporting Strat 
 
 
<?php

ini_set('display_errors', 1);
error_reporting(E_ALL);

?> 





                       eNJOY :)  HAPPY coding ... ...                                    

                                                                  


How to Host a Laravel Project on Hostinger’s hPanel: A Step-by-Step Guide

How to Host a Laravel Project on Hostinger’s hPanel: A Step-by-Step Guide If you're looking to host a Laravel project on Hostinger’s hPa...