How to hide google adsence advert in a page for certain countries? [closed] - adsense

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am a blogger and place google ads in my blog. I do not want to these ads to show up in certain countries is there any additional code I can use in my page that can help me achieve this.
For an example i do not want advert to show in Germany. Any Advise?

You can use API from http://www.geoplugin.net/
Eg. in PHP
$xml = simplexml_load_file("http://www.geoplugin.net/xml.gp?ip=".getRealIpAddr());
$country = $xml->geoplugin_countryName ;
if($country != "Germany")
{?>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Horizontal Big Banner -->
<ins class="adsbygoogle"
style="display:inline-block;width:970px;height:250px"
data-ad-client="ca-pub-XXXXXXXXXXX"
data-ad-slot="XXXXXXXX"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<?php
}
//For getting IP Address
function getRealIpAddr()
{
if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet
{
$ip=$_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy
{
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else
{
$ip=$_SERVER['REMOTE_ADDR'];
}
return $ip;
}

Related

Flutter : Voice command to give user weather and date time update [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
I want to create an application that work on voice command. In this application there is two options when user ask for weather or time update the application get the current weather and give update about weather in voice and the same functionality for time and date. Please help me how I can achieve this in flutter.
You can either use :
https://alan.app/docs/tutorials/flutter/integrating-flutter
or use:
https://pub.dev/packages/speech_to_text
import 'package:speech_to_text/speech_to_text.dart' as stt;
stt.SpeechToText speech = stt.SpeechToText();
bool available = await speech.initialize( onStatus: statusListener, onError: errorListener );
if ( available ) {
speech.listen( onResult: resultListener );
}
else {
print("The user has denied the use of speech recognition.");
}
// some time later...
speech.stop()
Then treat specific words as commands:
void resultListener(SpeechRecognitionResult result) {
++resultListened;
print('Result listener $resultListened');
setState(() {
lastWords = '${result.recognizedWords} - ${result.finalResult}';
});
}

How to get Recent Photo? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
Currently i and doing on an Flutter Camera Project. May i know how can i get the recently photo to show on the container like Instagram stories left bottom?
var result = await PhotoManager.requestPermission();
if (result) {
// success
List<AssetPathEntity> list = await PhotoManager.getAssetPathList(type: RequestType.image);
final assetList = await list[0].getAssetListRange(start: 0, end: 1);
filename = await assetList[0].file;
setState(() {
});
} else {
// fail
/// if result is fail, you can call `PhotoManager.openSetting();` to open android/ios applicaton's setting to get permission
}
This works for me for getting the most recent image from the device as a thumbnail according to the plugin used from the website given by you.

Sending mail by button [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I want to send e-mail after confirmation box. I make a button and push after i should choice yes or no. If NO nothing do. If yes i want to start to SendAnEmail.
Please help me. How can I start the function SendAnEmail?
Thank you.
function SendAnEmail() {
var email = 'my#mail.com'
var subject = 'mySubject';
var body = 'body of mail';
GmailApp.sendEmail(email, subject, body);
}
function test(){
var ui = SpreadsheetApp.getUi();
var ret = ui.alert('Do you want send e-mail?', ui.ButtonSet.YES_NO);
if(ret == ui.Button.YES)
{GmailApp.sendEmail}
}
Thank you
You are almost there
The only thing you need to do is to call function SendAnEmail() when the button Yes is pressed.
So:
function test(){
var ui = SpreadsheetApp.getUi();
var ret = ui.alert('Do you want send e-mail?', ui.ButtonSet.YES_NO);
if(ret == ui.Button.YES){
SendAnEmail()
}
}

Use of customdata tag [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
Kindly let me know the use of tag customData
I am unable to understand the following piece of code
<Bar id="myBar">
<customData>
<core:CustomData key="sap-ui-fastnavgroup" value="true" writeToDom="true"/>
</customData>
</Bar>
How to add title in the bar.
I am newbie to UI5 technology
Thanks
customData can be used as an aggregation of a control that extends sap.ui.core.Element. Custom data are generally used as HTML data-* Attributes.
For example:
var oTextEdit= new sap.ui.commons.TextField({
//Properties
});
var oCustomData =new sap.ui.core.CustomData({
key : "fieldID",
value : "textfield1"
});
var oCustomDataEntyID =new sap.ui.core.CustomData({
key : "entitypropertyid",
value : "username"
});
oTextEdit.addCustomData(oCustomData);
oTextEdit.addCustomData(oCustomDataEntyID);
var aAllCustomData = oTextEdit.getCustomData();
$.each(aAllCustomData,function(index){
console.log(aAllCustomData[index].key +" : "+aAllCustomData[index].value)
});
https://openui5.hana.ondemand.com/#docs/api/symbols/sap.ui.core.Element.html

Auto fill my custom form using facebook data [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have a form designed which takes input values. I want people to click the button "sign up as facebook" which takes in their facebook details and as a result fills my custom form with the appropriate values. i want it to be like this one. https://www.odesk.com/signup/create-account/id/Contractor_50dbed1edc1416.20352143
Please tell me how can this be achieved?
Registration Plugin is what you are looking for. :)
UPDATED
In Case you want to have custom form. You would have to take permission from user and get his details. You can use following Code :
<div id="fb-root"></div>
<script src="https://connect.facebook.net/en_US/all.js"></script>
FB.init({appId: 'XXXXXXXXXXXXX',status : true,xfbml : true, cookie: true ,oauth : true});
function login(){
FB.getLoginStatus(function(response) {
// checks if user already authorized
if (response.status === 'connected') {
FB.api('me?fields=id,name,email', function(user) {
if(user != null) {
username = user.name;
uid = user.id;
email = user.email;
}
});
} else {
// If user is not authorized call FB.login for pop up window for authorization , scope defines list of persmission requested with user
FB.login(function(response) {
if (response.authResponse.accessToken) {
FB.api('me?fields=id,name,email', function(user) {
if(user != null) {
username = user.name;
uid = user.id;
email = user.email;
}
})
}
}, {scope:'email'});
}
});
}
You call login() at the press of your button.