I have implemented one application .In which i want to get latitude and longitude from the address.I dont want to use java script.Is it possble then please help me.
I'm trying to set up a pretty basic authentication logic flow with the FB JavaScript SDK to check a user's logged-in status and permissions before performing an action (and prompting the user to login with permissions if they are not)...
User types a message into a textarea on my site to post to their
Facebook feed and click's a 'post to facebook' button on my site.
In response to the click, I check user's logged in status with FB.getLoginStatus
In the callback to FB.getLoginStatus, if user is not logged in,
prompt them to login (FB.login).
In the callback to FB.login I then
need to make sure they have the right permissions so I make a call
to FB.api('/me/permissions') -- if they don't , I again prompt them
to login (FB.login)
The problem I'm running into is that anytime I try to call FB.login inside a callback to other FB methods, the browser seems to lose track of the origin of execution (the click) and thus will block the popup. I'm wondering if I'm missing some way to prompt the user to login after checking their status without the browser mistakenly thinking that it's not a user-initiated popup?
I've currently fallen back to just calling FB.login() first regardless. The undesired side effect of this approach, however, is that if the user is already logged-in with permissions and I'm still calling FB.login, the auth popup will open and close immediately before continuing, which looks rather buggy despite being functional.
It seems like checking a user's login status and permissions before doing something would be a common flow so I feel like I'm missing something. Here's some example code.
<div onclick="onClickPostBtn()">Post to Facebook</div>
<script>
// Callback to click on Post button.
function onClickPostBtn() {
// Check if logged in, prompt to do so if not.
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
checkPermissions(response.authResponse.accessToken);
} else {
FB.login(function(){}, {scope: 'publish_stream'})
}
});
}
// Logged in, check permissions.
function checkPermissions(accessToken) {
FB.api('/me/permissions',
{'access_token': accessToken},
function(response){
// Logged in and authorized for this site.
if (response.data && response.data.length) {
// Parse response object to check for permission here...
if (hasPermission) {
// Logged in with permission, perform some action.
} else {
// Logged in without proper permission, request login with permissions.
FB.login(function(){}, {scope: 'publish_stream'})
}
// Logged in to FB but not authorized for this site.
} else {
FB.login(function(){}, {scope: 'publish_stream'})
}
}
);
}
</script>
Does anyone know if it's possible to have several text fields that place the data into different spots in the same web page. If needed I could just use two pages, it doesn't really matter. I've heard this requires a PHP script, but I'm not sure how to set this up.
Hi folks,
I'm using CheeryPy in order to serve a python application through WSGI.
I tried benchmarking it, but it seems as if CheeryPy can only handle exactly 10 req/sec. No matter what I do.
Built a simple app with a 3 second pause, in order to accurately determine what is going on... and I can confirm that the 10 req/sec has nothing to do with the resources used by the python script.
__
Any ideas?
I have a .h when I map all the image files names and xib names with #defines. For example, if I have an image called "buttonBackground.png" I map it in my .h as
#define BUTTON_BACKGROUND_PNG_FILE @"buttonBackground.png"
It's possible to detect when a resource is added to the bundle and create the correspond define with a script?
Hi,
In my ant script, which runs the end-to-end integration tests, I first start a process, then do some other stuff, then run the tests, and then I need to make sure I kill the process. However, I need to make sure I kill the process even if something fails (so I need an equivalent to try finally). What is the recommended way of doing it?
I would like to convert this /bin/sh syntax into a widely compatible Windows batch script:
host=`hostname`
echo ${host}
How to do this so that it'll work on any Windows Vista, Windows XP, and Windows 2000 machine?
To clarify: I would then like to go on in the program and use the hostname as stored in the variable host. In other words, the larger goal of the program is not to simply echo the hostname.
hye im newbie here..
im looking for a hidden information in a source code..in the page, the information is visible but when i try to find it in the source code, the information is not there..but behind the code it has [script type = "text/javascript].. i believe the information i need is in between the javascript..my question is, how to get the information between the javascript?..it has the innerHtml code between the javascript..any one can help?
Hiya.
I'm using Services_Facebook pear package with php 5.3.2 to create a facebook app,
it seems that some users can see the application and the application can fetch their info properly, and on some users that script detects as they're not logged in.
using the default example as shown in the following URL:
http://wiki.developers.facebook.com/index.php/PHP
using latest Services_Facebook version.
any ideas?
thanks
Hi,
I have some piece of code which uses JNI. I can debug code wrote in Java directly in Eclipse (using ADT). I even have a script, which help me debug native code with gdb. However this is not very comfortable way for doing this.
Is it possible to configure Eclipse to use gdb (I guess gdbserver) for debbuging android native applications? Do you know where I could find any description of this?
I'm aware that it is possible to use 'readelf -d | grep RPATH' to inspect a given binary from the shell, but is it possible to do this within a process?
Something like (my completely made up system call):
/* get a copy of current rpath into buffer */
sys_get_current_rpath(&buffer);
I'm trying to diagnose some suspect SO linking issues in our codebase, and would like to inspect the RPATH this way if possible (I'd rather not have to spawn an external script).
I want to be able to download a page and all of its associated resources (images, style sheets, script files, etc) using Python. I am (somewhat) familiar with urllib2 and know how to download individual urls, but before I go and start hacking at BeautifulSoup + urllib2 I wanted to be sure that there wasn't already a Python equivalent to "wget --page-requisites http://www.google.com".
Specifically I am interested in gathering statistical information about how long it takes to download an entire web page, including all resources.
Thanks
Mark
UCCN1003Edit
<script type="text/javascript">
$(function(){
$('a.edit').click(function(event){
var change = $(this).parent('div').find('p');
var changeText = change.text();
var wrapper = $(this).parent('div');
var clone = change.clone(true);
var changeBox = $(this).parent('div').find('.editBox');
var changeBoxText = changeBox.val();
if($(this).text() == 'Edit'){
wrapper.prepend("<input class='editBox' type='text' value='"+ changeText + "'/>");
wrapper.append("<a href='#' class='save' style='margin-left:10px' >Save</a>");
change.remove();
$(this).text("cancel");
}else if($(this).text()=='cancel'){
wrapper.prepend("<p>" + changeBoxText +"</p>");
$('.editBox').remove();
$('.save').remove();
$(this).text('Edit');
}
});
$('.save').click(function(event){
var editBox = $(this).parent('div').find('.editBox');
var editBoxText = editBox.text();
var wrapper = $(this).parent('div');
wrapper.prepand("<p>" + editBoxText + "</p>");
editBox.remove();
$(this).remove();
});
});
</script>
My part that work work is
$('.save').click(function(event){
var editBox = $(this).parent('div').find('.editBox');
var editBoxText = editBox.text();
var wrapper = $(this).parent('div');
wrapper.prepand("<p>" + editBoxText + "</p>");
editBox.remove();
$(this).remove();
});
where the wrapper wont prepand the p tag and the editBox and the .save wont be remove.
i try to add alert("work") in this and it wont alert at all. anyone know why?
I am supposed to make this simple program. It produces a multiplication problem, and when the user types the correct answer, it is supposed to produce another question. Instead it goes into an infinite loop and never stops, the answer field and the button go away. Also, I am supposed to make the comment about the users answer, one of 4 different sayings. Without using Arrays how would I do that?
My professor is no help, really getting aggravated as I have no where else to turn.
<html>
<title>HW 9.27 and 9.28</title>
<head>
<script type="text/javascript">
var number1;
var number2;
var answer3;
var answer2;
function problem() {
number1 = Math.floor(1 + Math.random() * 9);
number2 = Math.floor(1 + Math.random() * 9);
document.writeln("How much is " + number1 + " times " + number2 + " ?");
answer2 = (number1 * number2);
}
function answer1() {
var statusDiv = document.getElementById("status");
answer3 = document.getElementById("answer").value;
if (answer3 != answer2) statusDiv.innerHTML = "No. Please try again";
else if (answer3 == answer2) {
statusDiv.innerHTML = "Very good!";
problem();
}
}
problem();
</script>
</head>
<body>
<form>
<input id="answer" type="text" />
<input type="button" value="Solve!" onclick="answer1()" />
<div id ="status">Click the Solve button to Solve the problem</div>
</form>
</body>
</html>
I am writing installation script for my program, which is supposed to run on Linux/Unix OS. What is the default directory for the following files:
Executable files (programs). Program should be executed by typing its name from the command line.
Shared libraries.
Third-party shared libraries (the program is not open source, so I need to redistribute third-party libraries).
Read-only program configuration files for all users.
Configuration data available for read/write access for all users.
This will be implemented in Javascript (jQuery) but I suppose the method could be used in any language.
I have an array of items and I need to perform a sort. However there are some items in the array that have to be kept in the same position (same index).
The array in question is build from a list of <li> elements and I'm using .data() values attached to the list item as the value on which to sort.
What approach would be best here?
<ul id="fruit">
<li class="stay">bananas</li>
<li>oranges</li>
<li>pears</li>
<li>apples</li>
<li class="stay">grapes</li>
<li>pineapples</li>
</ul>
<script type="text/javascript">
var sugarcontent = new Array('32','21','11','45','8','99');
$('#fruit li').each(function(i,e){
$(this).data(sugarcontent[i]);
})
</script>
I want the list sorted with the following result...
<ul id="fruit">
<li class="stay">bananas</li> <!-- score = 32 -->
<li>pineapples</li> <!-- score = 99 -->
<li>apples</li> <!-- score = 45 -->
<li>oranges</li> <!-- score = 21 -->
<li class="stay">grapes</li> <!-- score = 8 -->
<li>pears</li> <!-- score = 11 -->
</ul>
Thanks!
Trying to write a deployment script, working on a repo in a different path. The "git-dir" flag seems to work fine for most commands, but not for submodule work. Am I missing a path directive?
Works:
git --git-dir=/tmp/repo_path/.git log
Doesn't work:
git --git-dir=/tmp/repo_path/.git submodule init
Error:
No submodule mapping found in .gitmodules for path 'path_to/submodule'
Much thanks for any help.
is there an activerecord (any similar SQL-wrapper) for python? which is good for:
used in a server-side python script
light-weight
supports MySQL
what I need to do:
insert (filename, file size, file md5, the file itself) into (string, int, string, BLOB) columns
if the same file (checksum + filename) does not exist in db
thx
I tried some "add to favorties" JavaScript scripts.. With IE8, I get an "access denied" (is that even possible to add a bookmark via JS with IE8?) and it just doesn't work with IE6...
Anybody has a good script that works on most browsers?
Thanks!
In a production server there are index.html and index.php
By default index.html is getting loaded.
I want index.php to be the default script to load and if index.php is not present then index.html can load.
It is a shared hosting so we do not have access to the httpd.conf file
So i thought of creating .htaccess file which would do the above condition.
What is the directive to include in .htaccess file to do so?
Hello,
I used use Google’s slick interface to get my mail and It’s always going to be here:
https://mail.google.com/a/yourdomainhere.com
I want to write python script that send mail so i failed to configure server settings
smtp = smtplib.SMTP('what is mail server will be?', what is the port)
smtp.login('[email protected]', 'pass')
Please could any one help me ??
Thanks
when i use rspec with capybara to test my rails js page , I got the following error:
"Selenium::WebDriver::Error::WebDriverError: Could not find Firefox binary (os=linux). "
Actually my rails script are all written on the linux server, where there is on brower installed, and any desktop software is not supported on the server (since no X11 is installed).
How can I test js in this situation. Or is there and brower that works without X11 installed like wget? Thanks.
I have a YQL query that extracts data from a page and returns it to my script as JSON. The JSON is huge, and as such, here's my question:
Is JSON array parsable? So that I can iterate over the entire JSON structure?