w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Facebook getUser returns null, but only the first time requested
Sounds like you are using a combination of JS and PHP SDK. This will happen if user logs in with the JS SDK since the server side code doesn't read the cookie that was set until the page is refreshed for the first time. You can either make an ajax call if the user successfully logs in to provide the new user id, or force the page refresh.

Categories : Facebook

Zend Framework 2: route to another controller when requested does not exist
Well you can use your ErrorController for this. If the controller or action name is not found then you will get the error 500 and you will be routed to your ErrorController. You can then redirect people to wherever you want them to go

Categories : PHP

WARNING The requested profile "projectname" could not be activated because it does not exist
This happens when you have the following in your settings.xml (in your .m2 directory), and no profile with the id projectname. <activeProfiles> <activeProfile>projectname</activeProfile> </activeProfiles>

Categories : Java

Symfony returns 301 on requested url by cUrl
As @forgottenbas mentioned, you must add / at the end of the url. But you can also add -L switch to curl so it follows the redirects like this: curl -v -H -L "Accept: application/json" -H "Content-type: application/json" -X GET http://localhost/app_dev.php/en/api/contest/new

Categories : PHP

Android Facebook SDK SSO "the page you requested cannot be displayed"
After 8 hours of scanning through my code and the facebook docs, I simply decided to update my facebook app on my tablet ( I never use it and so never bothered to update it ) and now it all works. I guess the Facebook app on my tablet was pre-SSO of Facebook on Android, but my created app was expecting it to be supported and giving the error.

Categories : Android

SocialAuth - Facebook Authentication - Specify which access rights are requested
You can add custom permission like this. graph.facebook.com.consumer_key = 152190004803645 graph.facebook.com.consumer_secret = 64c94bd02180b0ade85889b44b2ba7c4 graph.facebook.com.custom_permission = email,user_birthday,user_location No need to set other properties. But if you want to set other properties, then only you can set request_token_url (for OAuth1.0), authentication_url and access_token_url. This feature is available from socialauth-4.2 graph.facebook.com.authentication_url graph.facebook.com.access_token_url

Categories : Java

PL/SQL Group By - ORA-01422: exact fetch returns more than requested number of rows
The error occurs when more than one value is returned from the select count(registration) since you are selecting it into a single variable v_count. If you are trying to select all of the counts for the various registrations, you'll want to use an array type for v_count, like this: declare v_count number; v_counts is table of v_count Begin Select COUNT (registration) bulk collect INTO v_counts from i_booking group by registration; if (v_counts > 0) then for i in v_counts.first..last loop <do your printing> end loop; end if; end; / I also added in an optimization that uses a bulk collect since that will give you slightly faster performance.

Categories : SQL

ORA-01422: exact fetch returns more than requested number of rows in RETURNING INTO
I thought it was not possible to use aggregates in the returning clause, as I had never tried it and it isn't mentioned in the documentation, but it actually works (11gr2) !! See below in PL/SQL: SQL> CREATE TABLE my_table (created_date DATE); Table created SQL> INSERT INTO my_table 2 (SELECT SYSDATE + ROWNUM FROM dual CONNECT BY LEVEL <= 500); 500 rows inserted SQL> DECLARE 2 latestDate DATE; 3 BEGIN 4 DELETE FROM my_table tab_outer 5 WHERE tab_outer.rowid IN ( 6 -- Fetch rowids of rows to delete 7 SELECT rid FROM ( 8 SELECT rownum r, rid FROM ( 9 SELECT tab.rowid rid 10 FROM my_table tab 11 ORDER BY tab.created_date DESC 12 ) 13

Categories : SQL

Azure Table Storage SaveChanges returns "The requested operation is not implemented on the specified resource."
The problem is that float point storage is not implemented for Azure Storage Tables. Changing the amount type to a double will fix the problem. public class MyEntity : TableServiceEntity { public string Title { get; set; } public string Description { get; set; } public double Amount { get; set; } // <-- Note change here!!! public DateTime CreatedAt { get; set; } public DateTime UpdatedAt { get; set; } }

Categories : C#

Batch - IF EXIST statement not executing
You need to "quote the name" bcause it contains a space IF EXIST "%dirname%" (echo Directory already exists) ELSE (mkdir "%dirname%") although mkdir "%dirname%" 2>nul would also work - it simply suppresses the error message output on STDERR (device 2)

Categories : Batch File

if exist command is not working in batch file
It works for me. I have used this code, written in batch.bat: @ECHO OFF If exist c:11.txt ECHO 1 Please, specify "bash is crashing".

Categories : Batch File

if exist check with case sensitive in batch
Added file list parsing: @echo off for /f "delims=" %%z in ('type "namelist.txt" ') do ( if not exist "%%~z" echo "%%~z" not found if exist "%%~z" for %%a in ("%%~z") do if "%%a"=="%%~z" (echo "%%~z" is the right case) else (echo "%%~z" is the wrong case "%%a found") ) pause

Categories : Windows

batch if not exist takes out drive letter from variable
Try this: the quotes fix an issue with certain path names, and the parentheses are changed. Note that if neither of those pathfile exists then the variable will not be set. @echo off echo. echo Verifying existence of File set "bcdpath=" for %%d in (c d e f g h i j k l m n o p q r s t u v w x y z) do ( if exist "%%d:dir1dir2dir3file1" ( set "BDCPATH=%%d:dir1dir2dir3file1" ) else ( if exist "%%d:dir1_2dir2dir3file1" set "BDCPATH=%%d:dir1_2dir2dir3file1" ) ) echo "%BDCPATH%" echo "%BDCPATH%" IF NOT EXIST "%BCDPATH%" echo "%BCDPATH%" if not defined bcdpath echo no files found pause goto :eof

Categories : Windows

Why facebook access token from Spring Social returns empty array, while Facebook Graph Api token works fine
You need to submit a post request to spring social ConnectController for the specific provider e.g. http://wwww.yourdomain:8089/connect/facebook. Spring social then will redirect the user to facebook authorization page where the user will grant your app with the asked permissions and send back a code to your server. Spring social then will exchange that code for an access token. You need to establish a connection for that user to be able to perform requests against FB on his/her behalf. Here is a doc page that might help http://static.springsource.org/spring-social/docs/1.0.0.M2/reference/html/connecting.html

Categories : Java

ASP.NET MVC3 The requested name is valid, but no data of the requested type was found
I got the same error due to my connection string. It included a port number, but the correct connection string has to be like this: <add name="myConnectionString" connectionString="Server=localhost;Database=mydatabase;Uid=root;Pwd=password;Allow Zero Datetime=true" providerName="MySql.Data.MySqlClient"/>

Categories : C#

Pages are showing "The page you requested does not exist", but when I view content I can edit the page, but unable to view
When you edit a Node, look at the URL in your Browser. There must something like node/nodeID/edit, e.g. node/7/edit. Can you access the page if you call node/nodeId eg node/7 ? Second Point are the Permissions, go to Users -> Permissions, there are Permissions like "Views Page Content of Type article". Are this permissions set correctly?

Categories : Drupal

size() returns 1 where matrix dimension should not exist
size(X,3) is the size of the third dimension which in your case IS 1. Try X = rand(2, 3, 5, 23, 4,2, 6) for example, now size(X, 3) should give 5. After all a 2D matrix is really the same a a 3D matrix where the size of the third dimension is 1

Categories : Matlab

SPFolder.Exists Returns False When It Does Exist
Potential answer: ask for some more interesting property of SPFolder first, maybe even call ToString would be enough (likely since it works in debugger where ToString will be called when you hover over spFolder variable).

Categories : C#

on google drive, does folder exist always returns false
You can search for Strings only, while you are trying to search through Folder objects. function doesContainerExist(container) { var folders = DriveApp.getFolders(); var Folders = new Array(); var boolean; while(folders.hasNext()) { Folders.push(folders.next().getName()); } if(Folders.indexOf(container) == -1) { boolean = false; } else { boolean = true; } Logger.log(container); return boolean; };

Categories : Function

Post exist photo on user timeline from Facebook API
You can post to the Graph API endpoint https://graph.facebook.com/ALBUM_ID/photos to add to an existing album. See Facebook API documentation https://developers.facebook.com/docs/reference/api/photo/

Categories : PHP

is the username returned by graph facebook guaranteed to exist?
The value you should save in your database is the user id because username can be easily changed by users. https://www.facebook.com/help/162586890471598

Categories : Facebook

Function which checks if data exist returns false, while the credentials are correct
i think your function is returning false because you tell it to return fase within the if $stmt, give this a shot: function validateLogin($username, $password) { var_dump(func_get_args()); if($stmt = $this->dbh->prepare("SELECT * FROM user WHERE username = ? AND password = ?")) { $stmt->bind_param('ss', $username, $password); $stmt->execute(); if($stmt->num_rows > 0) { $user = $stmt->fetch_assoc(); return $user; } else{ return false; } } else{ return false; } }

Categories : PHP

Facebook Multiple Access Token Batch Request
Came here to ask the same question, and found the answer here: facebook batch request for multiple users The access token goes in the url instead of being a separate entry in the batch package as any sane person might expect.

Categories : PHP

Facebook Graph API batch POST_ID comment counts?
Why did facebook decide to break this? Shh, calm down, young Padawan! :-) You can use Field Expansion to achieve this. Since you want only the comment count, we will limit the number of comments returned to 1 (the minimum possible – 0 would mean no limit and therefor the default of 25(?)), and ask for the summary field of the comments as well: /facebook/feed?fields=comments.limit(0).summary(1) Only slight drawback: Since this is using the fields parameter, you have to specify other fields of the post object you want to get as well – id and created_time are included by default as you can see, but others as f.e. message you will have to specify explicitly if you want to get them returned too. Edit: Using .limit(0) is now possible directly. You will still get a data structure

Categories : Facebook

How to make expressjs support batch request like facebook
If you don't want to make loopback connections, then the simplest solution is to manually call your server with fake requests. You'll have to reimplement IncomingMessage. You should also use Async#map to wait until all requests are processed. Here's the basic idea: // You'll probably have more work to do to reimplement http basic API. function FakeRequest(request) { this.url = '/' + request.relative_url; this.method = request.method; this.headers = request.headers; } function FakeResponse() { Stream.call(this); this.statusCode = null; this.body = ''; } FakeResponse.prototype.write = function (chunk) { this.body += chunk.toString('utf8'); return true; }; util.inherits(FakeResponse, Stream); app.post('/', function (req, res) { var requests = JSON.parse(req.body.ba

Categories : Node Js

facebook sdk never returns to app in iOS5
Don't forget to set -(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication: (NSString *)sourceApplication annotation:(id)annotation { return [FBSession.activeSession handleOpenURL:url]; } and URL Types in target settings (info tab) as fbXXXXXX where XXXXXX is your fb app id

Categories : IOS

why $this->facebook->getUser(); returns 0?
Tweaking your code function __construct() { parent::__construct(); $this->data = array(); $this->master = "layout/master"; parse_str( $_SERVER['QUERY_STRING'], $_REQUEST ); $CI = & get_instance(); $CI->config->load("facebook",TRUE); $config = $CI->config->item('facebook'); $this->load->library('Facebook', $config); } function facebook_login() { $user = $this->facebook->getUser(); if($user == 0){ $loginUrl = $this->facebook->getLoginUrl(array("scope"=>"user_about_me")); redirect("$loginUrl","location"); } else { $user_info = $this->facebook->api('/me'); print_r($user_info); } }

Categories : PHP

Windows Batch File: Look for directory, if not exist, create, then move file to it
You can conditionally create the folder with: if not exist moviesshowname mkdir moviesshowname To move a file into it: move ShowName.Episode.Title.mkv moviesshowname To get more information about these commands, open a command prompt and type: help if and help move

Categories : Batch File

Facebook iOS SDK sometimes returns null for email
I have similar situation that the user object does not contains the email in response. My case is that the user email address is actually pending for verification. In Facebook graph API document in https://developers.facebook.com/docs/reference/api/user/, for the email field, it stated: note: this field will not be returned if no valid email address is available for the user See if this is also the reason for the problems you have encountered.

Categories : Misc

Facebook returns 404 error on website
I will suggest, you refer to the FB API again. Use this JavaScript API that is easy and most browsers supports it. If you are just looking for a Like button with a count, you are looking in wrong place. Refer to this Social Plugin Like Button, fill out the form and choose Iframe code/javascript code,(as FBML is not supported in all browsers). Use ready/generated code and you are ready to go. It will give you something like this example: <iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2Freference%2Fplugins%2Flike&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=true&amp;font&amp;colorscheme=light&amp;action=like&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:h

Categories : Facebook

Facebook getUrl returns 0 PHP SDK Codeigniter
Found out that facebook requires a '/' - forward slash at the end in the siteurl field in app dashboard. Most of the sites add it automatically. But not in this case. Hope it helps others!

Categories : PHP

When using CodeIgniter + Facebook PHP SDK: getUser() always returns 0
I managed to solve my problem. The questions linked to by Qweick and Stéphane Bruckert had the solution. The problem lies in the getCode() function of the base_facebook.php file. The getCode() function needs to be modified. The modifications I used are listed below. Existing non-working code: protected function getCode() { if (isset($_REQUEST['code'])) { if ($this->state !== null && isset($_REQUEST['state']) && $this->state === $_REQUEST['state']) { // CSRF state has done its job, so clear it $this->state = null; $this->clearPersistentData('state'); return $_REQUEST['code']; } else { self::errorLog('CSRF state token does not match one provided.'

Categories : PHP

On key up Ajax function for checking if name exist returns multiple identical values despite using codeigniter active record distinct query
Try adding some checks before setting a new timeout to prevent multiple triggers to your ajax call var typingTimer = null; var doneTypingInterval = 3000; $('#course_name').keyup(function () { if (!typingTimer) { typingTimer = setTimeout(check_course_name_exist, doneTypingInterval); } }); $('#course_name').keydown(function () { if (typingTimer) { clearTimeout(typingTimer); typingTimer = null; } });

Categories : Javascript

Spring Batch Update: Insert only if does not exist otherwise update
You can use an ItemProcessor to filter out duplicated items with a query, just return null if item is already present in database: objects that pass the processor can be written with ItemWriter and you are sure there are not duplicated

Categories : Sql Server

Facebook Token returns Empty Android
I've generally seen this problem happen because of the wrong hash key generation. Rather than doing all the keytool stuff try pasting this code in one of your onCreate to generate the right key and paste that to your app section on Facebook. PackageInfo info; try { info = getPackageManager().getPackageInfo("com.you.name", PackageManager.GET_SIGNATURES); for (Signature signature : info.signatures) { MessageDigest md; md = MessageDigest.getInstance("SHA"); md.update(signature.toByteArray()); String something = new String(Base64.encode(md.digest(), 0)); //String something = new String(Base64.encodeBytes(md.digest())); Log.e("hash key", something); } } catch (NameNotFoundException e1) { Log.e("name not found", e1.toString()); }

Categories : Android

Facebook Graph API returns statuses for only some friends
To get statuses, one should only need read_stream permission as described at https://developers.facebook.com/docs/reference/api/user/ and https://developers.facebook.com/docs/reference/fql/status Reading a user's status messages requires the read_stream permission. Without the id of the user's friend it's not possible to know the exact reason of the cause. Possible things to look at what would be The friend has the platform disabled in their settings (https://www.facebook.com/settings?tab=applications&section=opt_out&view) The friend has no status objects but post objects instead so the data will appear in [username]/posts with read_stream permission Permissions were never actually set in your app, this happens when developers assume "Configuring Permissions" in app setting

Categories : Facebook

Request more permission from Facebook Session returns an error
You need to call the onActivityResult() method on your current Session when asking for more permissions: @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data); uiHelper.onActivityResult(requestCode, resultCode, data); }

Categories : Android

Facebook graph API returns time out exception while authorize
The problem is we can use only one HttpWebResponse at a time. In my case i am using the same object in two times without any disposing and closing. That's make me the error. So I updated my code like this. byteArray = Encoding.ASCII.GetBytes(postData); getRequest.ContentLength = byteArray.Length; newStream = getRequest.GetRequestStream(); //open connection newStream.Write(byteArray, 0, byteArray.Length); // Send the data. getResponse = (HttpWebResponse)getRequest.GetResponse(); getresponse.Close(); This solved my error. Thanks

Categories : C#

Facebook Application returns 403 when posting to peoples walls
Try to check if you have enough authority to execute an API in / user-id/permissions. Otherwise you need to get additional permissions for your application. a link Hope that help

Categories : Facebook

Facebook Graph API returns object with missing data
An example of response data received is this (Extracted from here): "likes": { "data": [ { "name": "Mia Lusiana", "id": "100003399221230" }, { "name": "Habeeb Quazi", "id": "525927716" }, { "name": "Mert Vrss", "id": "100002500864051" }, { "name": "Nav", "id": "100000757486687" } ], "count": 8145 as you can see, count is inside likes, not inside data, so it must be this way: likecount = response.likes.count; data contains people that liked the post.

Categories : Javascript



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.