How to show local json data in chrome using angular JS??

Working with angularJS needs a JSON file to play with data. But the irony of the chrome is behind the fact that the local JSON file data can’t be displayed in simple chrome browser.

Solution of this could be using any deployment server environment on your system like Java or python. But as a front end developer this seems to be quite difficult.So the solution is ,actually there.

Yes the chrome does not display data using local file due to some security reasons but this security can be turned off using simple command prompt.

1. Find the path for chrome.exe file :-

open command prompt
type cd\
type dir chrome.exe /s /p
now with path obtained in this step goto this path
and then execute following command:-

chrome.exe –allow-file-access-from-files

Capture

Share on Google+Share on FacebookTweet about this on TwitterEmail this to someone
 

How to add google recaptcha on login form in cakephp

(1)First register your domain and create site key and secret key here

(2)Open file app/Config/bootstrap.php and add following setting

<?php
	Configure::write('google_recatpcha_settings', array(
    'site_key'=>'your-domain-site-key',
    'secret_key'=>'your-domain-secret-key'
));
?>

(3)add following script in your layout file app/View/Layouts/default.ctp

<script src='https://www.google.com/recaptcha/api.js'></script>

(4)Open app/View/Users/login.ctp and add following html inside login form

<div class="g-recaptcha" data-sitekey="<?php echo Configure::read('google_recatpcha_settings.site_key'); ?>"></div>

(5)add following function in app/Controller/AppController.php

<?php
 public function verifyRecatpcha($aData)
 {
	if(!$aData)
	{
		return true;
	} 
	$recaptcha_secret = Configure::read('google_recatpcha_settings.secret_key');
	$url = "https://www.google.com/recaptcha/api/siteverify?secret=".$recaptcha_secret."&response=".$aData['g-recaptcha-response'];	
	$response = json_decode(@file_get_contents($url));			
				
	if($response->success == true)
	{
		return true;
	}
	else
	{
		return false;
		
	}	
 }	 
?>

(6)Open file app/Controller/UsersController.php and add following code in login function after post values

<?php
if(!$this->verifyRecatpcha($this->request->data))
{
	$this->Session->setFlash(__('Captcha incorrect.'),'default',array('class' => ''));
	return $this->redirect('login');
}
?>
Share on Google+Share on FacebookTweet about this on TwitterEmail this to someone
 

How to get latitude and longitude from address in php

you can get latitude and longitude by using google map api

$userAddress = urlencode ("Malviya Nagar Jaipur");
$aAddressData = file_get_contents("http://maps.google.com/maps/api/geocode/json?address=$userAddress&sensor=false");
$aAddressDataDecode = json_decode($aAddressData);
$userLatitude = $aAddressDataDecode->{'results'}[0]->{'geometry'}->{'location'}->{'lat'};
$userLongitude =	$aAddressDataDecode->{'results'}[0]->{'geometry'}->{'location'}->{'lng'};
Share on Google+Share on FacebookTweet about this on TwitterEmail this to someone