Likes on comment replies with Graph API - api

I'm trying to get the number of likes for each comment reply from the graph API.
Given this JSON-reply from a thread http://graph.facebook.com/10150790362005844_23680728, I can't seem to find the correct id to use in order to get number of likes on each comment.
E.g. https://graph.facebook.com/10150791016840844 returns false.
I did some experimenting with the facebook-comments, and found out that the correct id should be *grap-link*10150790374830844_23680907, but I can't find a way to locate this id through regular means in the Graph API...

This is an interesting one. This ID is the id for a comment. You can see this by looking at the type field here: http://graph.facebook.com/10150790362005844_23680728?metadata=1
To get the like counts for the comment replies, you're going to have to drill UP to find the post_id that this comment was originally attached to, then query for /POST_ID/comments, which will give you the like count.
If you can't find the comment otherwise, You're going to have to page through /user/feed until you find the post showing this comment was created and get the post_id from there.

Related

Can a table field be founded and then updated with a value in mvc Controller

yeah so the question is pretty simple: Can a table field be found using and ID and then updated with a value in mvc Controller?
And before anyone gets downvote crazy... I have no example because I don't know how to do this... it's not a home work question or any other things that you down vote on this site. It's a simple question that I need an answer and a example.
I now you can use the .find to and pass the ID... to a dataset but there is nothing I can find that shows you how to edit the values in the table once you find it.
So this part I get, This will allow me to find the the id with in the dataset.
TEST_DS tEST_DS = db.TEST_DS.Find(id);
if (tEST_DS == null)
{
return HttpNotFound();
}
Also I know that you see a call to the database like This
db.TEST_TABLE.Add(TEST_DS);
I don't see an option for edit or anything like that.
The task is to update a table field, The field is a status field so when the user makes a change on the mvc create form. When they create a record I want to mark a different table's status field with a number that represents a record was created.
Did a search did not see anything.. thanks may be something mvc can't do because of it's limitations or something.
If you do answer question I will need an example of a link to an example on how to do it. Thanks!!
I was able to make this work some I will post It there for others as they might have the same issues when dealing that mvc limitations and such.
So the answer is to simply have your data table in the dbcontext that you need to edit...
The code would not post.. it asking for 4 spaces and I gave it 4 spaces and it did not work so I added a picture.
See CodeAnswer Image

facebook shares count not accurate

may i know why this three urls return difference of count?
https://www.facebook.com/plugins/like.php?href=http://www.rotikaya.com/iqram-dinzly-tinggalkan-jalan-jalan-cari-makan-kerana-takut-gemuk/&layout=standard&show_faces=false&width=300&action=like&colorscheme=light&height=30
https://graph.facebook.com/?id=http://www.rotikaya.com/iqram-dinzly-tinggalkan-jalan-jalan-cari-makan-kerana-takut-gemuk/
http://api.facebook.com/restserver.php?method=links.getStats&format=json&urls=http://www.rotikaya.com/iqram-dinzly-tinggalkan-jalan-jalan-cari-makan-kerana-takut-gemuk/
(deprecated but more accurate)
The Graph link is intended to reflect the number a like button would show, which is an combination of several metrics.
The getStats endpoint does a more detailed breakdown. If you look at the total value on it, you'll see they match up.
https://graph.facebook.com/?id=http://www.imdb.com/title/tt0117500/
This displays total of likes and the deprecated shares as a whole
http://api.facebook.com/restserver.php?method=links.getStats&format=json&urls=http://www.imdb.com/title/tt0117500/
This one displays all the data, as you can see if you add the like count and share count it is just the same with the previous URL

Selecting specific joined record from findAll() with a hasMany() include

(I tried posting this to the CFWheels Google Group (twice), but for some reason my message never appears. Is that list moderated?)
Here's my problem: I'm working on a social networking app in CF on Wheels, not too dissimilar from the one we're all familiar with in Chris Peters's awesome tutorials. In mine, though, I'm required to display the most recent status message in the user directory. I've got a User model with hasMany("statuses") and a Status model with belongsTo("user"). So here's the code I started with:
users = model("user").findAll(include="userprofile, statuses");
This of course returns one record for every status message in the statuses table. Massive overkill. So next I try:
users = model("user").findAll(include="userprofile, statuses", group="users.id");
Getting closer, but now we're getting the first status record for each user (the lowest status.id), when I want to select for the most recent status. I think in straight SQL I would use a subquery to reorder the statuses first, but that's not available to me in the Wheels ORM. So is there another clean way to achieve this, or will I have to drag a huge query result or object the statuses into my CFML and then filter them out while I loop?
You can grab the most recent status using a calculated property:
// models/User.cfc
function init() {
property(
name="mostRecentStatusMessage",
sql="SELECT message FROM statuses WHERE userid = users.id ORDER BY createdat DESC LIMIT 1,1"
);
}
Of course, the syntax of the SELECT statement will depend on your RDBMS, but that should get you started.
The downside is that you'll need to create a calculated property for each column that you need available in your query.
The other option is to create a method in your model and write custom SQL in <cfquery> tags. That way is perfectly valid as well.
I don't know your exact DB schema, but shouldn't your findAll() look more like something such as this:
statuses = model("status").findAll(include="userprofile(user)", where="userid = users.id");
That should get all statuses from a specific user...or is it that you need it for all users? I'm finding your question a little tricky to work out. What is it you're exactly trying to get returned?

Determining number of comments of facebook status

How do I determine number of comments on a facebook status?
I thought of doing it through "stream" table. But I do not know how to query only status updates and not other posts through "stream" table.
I can't find a way to know "post_id" of "stream" table from "status_id" of "status" table.
Go to me/feed in the graph API. In the feed (stream) item, there is a comments object. In that comments object there will be a max of 2 comments shown, however, there is a comment count property that will tell you the total number of comments for that stream item.

what is the best way to record users searches and count how many times it has been queried?

I am not sure what SQL is exactly, databases I think, would SQL be the thing to use?
I want it so that when a user types into a search box it displays a "did-you-mean" box, that also shows how many other people used that term but I will do later ;)
currently I just want the text to be saved into database (?) and also how many times it's been done.
(new to stackoverflow so sorry if format/whatever is bad)
You just need a three table named something like search_queries which has columns for: id, search_text, and count. Everytime somebody searches just increment the count column where search_text is equal to what they searched for. This is a really broad question though and you need to start by learning the basics and report back here with more specific questions.