Post an object of type Reference - json

I have had this problem for some time now and I have seen others have it as well. It has to deal with posting your custom objects that you create in Open Graph to post with your application. I am having this problem primarily on all platforms, but right now let's say I am using Android. If someone has accomplished this in C# or on IOS or even in PHP please post your answer.
An Example:
I have an object that posts a meal to Facebook. Let's say its properties are the following.
mealName = "Lunch"
mealType = "Vegetarian"
mealLocation = "Somewheresville, OH"
Now I have another object in my Open Graph and it is called DailyFood. It has properties such as the following.
day = "12/01/2012"
meal = "MyCustomMeal" // This references a meal object
Now when I go to post that I try to do the following in Java.
//Build Meal
JSONObject mealData = new JSONObject();
mealData.put("mealName", "Lunch");
mealData.put("mealType", "Vegetarian");
mealData.put("mealLocation", "Somewheresville, OH");
Bundle params = new Bundle();
params.putString("day", "12/01/2012");
params.putString("meal", mealData.ToString());
AsyncFacebookRunner request = new AsyncFacebookRunner(facebook);
This is where I generate the following error code.
{"error":
{"message":"(#3503) is an invalid value for property
\"meal\" with type \"Reference\"","type":"OAuthException","code":3503}}
Now I know that it says OAuthException but I am able to post feeds to Facebook with this app just fine. If anyone else has experienced this error on any platform and has found a solution please post it here.
Thanks!

So the answer to this question is that you actually need a website available for your app to be able to reference what its posting to Facebook. In the docs, I at least, wasn't able to find out where this was noted.

according to this official video you must have the web application to post the action using open graph,no matter in which platform we are working android,ios etc
as it fetches the meta tags and properties from the web url only which works as refrence.

Related

Load data via GET from URL in Flash / AS3

I know it's 2016 and this is a question about Flash...
Sadly a lot of the Flash AS3 resources are no longer available as the format has fallen out of favour with web devs and the tutorials I have managed to find are all done on earlier versions of Flash - I have CS6, and some of the functions/commands don't seem to work the same way.
So my question for you S.O gurus...
How do I load any kind of data into a swf movie via a GET URL.
For example :
www.example.com/mymovie.swf?loadfile=myfile.mp3
I know I can do the following to load an external file :
var url:String = "http://example.com/myfile.mp3";
var soundFile:URLRequest = new URLRequest(url);
But instead of hard coding the url how do I tell it to look for the data in the loadfile variable delivered via the incoming request?
The answer in case anybody else stumbles across this :
loaderInfo.parameters['loadfile']
Gets the variable from the url

How to display push notifications using SignalR in MVC

I am using SignalR in MVC to display information in a basic chat type device in MVC. This is all working ok but I want to display information from a Json payload that has been deserialized like this:
Dim iss As IssueObjectClass = JsonConvert.DeserializeObject(Of object)(json)
The information does not have to being displayed does not just have to be an object it could be a variable as well, for example I could also display this:
Dim key = iss.issue.key
I have the code for the connection using the chat hub device which is displaying basic information (Message and username). Is this the way that I should try and display my Json using SignalR. I know that SignalR is used for real-time web applications but I am unsure on how it could display information that has been fired from a webhook as a Json payload.
This is how I am displaying the messages in the chat hub, but I want to display information that is coming from a webhook unrelated to anything that has been typed on the application. I want to display information from a HTTP POST from JIRA:
var encodedName = $('<div />').text(name).html();
var encodedMsg = $('<div />').text(message).html();
$('#discussion').append('<li><strong>' + encodedName + '</strong>: ' + encodedMsg + '</li>');
$('#discussion').text = encodedMsg;
How can I integrate SignalR with Json to display it?
It's a pretty simple thing to do, and a common case with SignalR. In your code where to receive and deserialize your object, you just have to call something like:
var context = GlobalHost.ConnectionManager.GetHubContext<YourHub>();
context.Clients.All.broadcastIssue(iss);
On your client you'll have to define a handler this way before you start the connection:
var yourHubProxy = $.connection.yourHub;
yourHubProxy.client.broadcastIssue = function (iss) {
// ...do your stuff...
};
This is very basic code which would need to be better organized, but it should put you on the right track. My advice is you go through the official SignalR documentation, which is extensive and well done, in particular the guides to the APIs.

Extjs application with Json-server not working fine

I have a small app and I am using Rest Proxy. I set up json-server https://github.com/typicode/json-server locally.
I have not changed anything in server settings. I am able to successfully GET data from server but when I try to create data like this
var people = App.model.myModel;
var ed = new people({"id": 2,"title": "test","body": "test"});
ed.save();
Error appears in browser console is
PUT http://localhost:3000/posts/11?_dc=1427464731634 404 (Not Found)
Can some one point out why it is trying to PUT data and not POST data ?
PUT is used to update an item, Not Create.
As you have specified an id value ExtJs will presume that you need to update the record rather than create it, therefore making the PUT request.
Most RESTful API's will provide GET, PUT, POST and sometimes DELETE, LINK Endpoints for each entity.
I found the problem my self. I was sending the "id" as well and it was looking for a post with Id 2, and obviously that doesn't exist.
var people = App.model.myModel;
var ed = new people({"title": "test","body": "test"});
ed.save();
Works perfectly

Consuming SSIS Data Profile XML

I am attempting to read the output of an SSIS Data Profile task into an MVC app. To work out the kinks, I wrote a small console app to test the parsing of the xml file.
I used the following link:
http://schemas.microsoft.com/sqlserver/2008/DataDebugger/DataProfile.xsd
to download the .XSD file that should describe the .XML file that was generated in the Data Profile output file.
I then ran xsd.exe to create a C# class to include in my console app.
Following is my very simple test code:
XmlSerializer xser = new XmlSerializer(typeof(DataProfile));
DataProfile dProf = xser.Deserialize(new FileStream(#"D:\InputFiles\ProfilerDataCVD.XML", FileMode.Open)) as DataProfile;
if (dProf != null)
{
var profs = dProf.DataProfileOutput.Profiles;
foreach (ColumnValueDistributionProfileType c in profs)
{
Console.WriteLine(string.Format("Column Name: {0}, RowCount: {1}, Distinct Values: {2}", c.Column.Name, c.Table.RowCount, c.NumberOfDistinctValues));
}
}
In that code, "dProf" is never NULL, but always empty. Any assistance at getting data in dProf would possibly save a life, because I am about to jump off of a cliff trying to figure this out!
If there is some obvious XML thing that I am missing, I will be the first to admit that this is not my strongest suit. Feel free to chastise me at will as long as you tell me how to make this return data.
Regrettably, no one has been able to answer this question. And I would still really like to understand why something so simple does not work.
In the meantime, anyone else struggling with the same issue should check out the following link on MSDN forums for an alternative way of doing the same thing.
http://social.msdn.microsoft.com/Forums/en-US/sqlintegrationservices/thread/a282bb60-c099-4656-bf71-52ddc6153c28
I implemented it yesterday in just a few minutes and it works great.

Having trouble binding JSON data to a mobile list in Adobe Flash builder

Hi, i have been having some problems using JSON data in flash builder lately and I was hoping someone could help me out here.
I have spent the past month working solidly on this issue, so I HAVE been looking around, HAVE been trying out everything I can find or think of. I am simply stuck.
I have been working on a flex mobile application for the Blackberry Playbook tablet with Adobe Flash Builder 4.6. It is a reddit app, designed to give users the main reddit feed, subreddits, search function, hopefully log in stuff etc. Of course I need the aid of the reddit API to access this information, of which the documentation can be found here: https://github.com/reddit/reddit/wiki/API/ The api uses either XML or JSON formatted data.
Now onto my problem- Like mentioned above, i want to display the reddit feed inside the app. I want to be able to use a item renderer to customize the data that is shown within each entry of the list.
One entry would consist of:
1) a thumbnail of the image in the post
2) The title of the post
3) a 'like/dislike' button, but this is unimportant at the moment.
Of course to start out, i placed a spark List component onto the design view. Then i configured a new HTTP data service using the Data/Services panel. I specified http://www.reddit.com/r/all.json for the url. I configured the return type, and the did a Test Operation. Everything connected just fine. All the data came through as normal. I will give you an idea of what the data comes back as so that you may understand my issue later on.
Test Operation Results (json data structure):
NoName1
data
after
before
children
[0]
data
media_embed
score
id
title
thumbnail
url
(etc etc...)
kind
[1]
data
media_embed
score
title
thumbnail
(etc etc...)
kind
[2] (array continues)
modhash
kind
As you can see, to get to the thumnail for example, you would have to go through data.children[].data.thumnail. When I tried to bind this data to the spark List component, I specified the data service to be from the one above. Then I specified the Data provider option to be Children[], as this value is typically set to the array. Now this is where the trouble begins. The final option, Label Field, only gave me one value to choose from: 'kind'. So as you can tell, it wasnt expecting the data to go any further nested. It stops at the two value just within each array item, which would be Data and Kind, though it only offers me Kind. I need to go one level further to access Title and Thumbnail. This is my problem.
Now, I have analyzed the code for the binding, and I have tried altering it to accomodate the further nested value. No success what so ever. The following is the code that the binding generates:
<s:List
id="myList" width="100%" height="100%" change="myList_changeHandler(event)"
creationComplete="myList_creationCompleteHandler(event)" labelField="kind">
<s:AsyncListViewlist="{TypeUtility.convertToCollectionredditFeedJSONResult.lastResult.data.children)}"/>
<s:List>
Obviously i would want to have something like along the lines of:
"TypeUtility.convertToCollection(redditFeedJSONResult.lastResult.data.children.data" and then set the labelField="title" or "thumbnail".
I certainly hope someone can help me with this. I am out of my mind as to what to do. If you need any further clarification I would be happy to provide it. I tried to explain the situation above as clearly as possible. Thank you so much.
Ted
I have this situation often: get an XML or JSON data from the server, then trying to use it as a dataProvider for a spark.components.List or for a mx.controls.Menu and then they just wouldn't display the data as I want them, because something in the data is different from what they expect. And then they display wrong XML-children or [Object,Object,etc.]
And in such cases I just create an empty ArrayCollection() which serves as dataProvider instead (and can be sorted and/or filtered too). And when data comes from the server, I push() new Objects into it:
[Bindable]
private var _data:ArrayCollection = new ArrayCollection();
public function update(xlist:XMLList):void {
_data.length = 0;
for each (var xml:XML in xlist)
_data.push({label: xml, event: xml.#event});
}
This always works. And if you get your next problem - flickering of the List, then that is solvable by merging data too.
Good luck with your Playbook development, which is a cool piece of hardware :-)