Question: In my xaml code, inside the `Window.Resources` section, I have defined a Data Template with a `x:key`.

```
<Window.Resources>
    <DataTemplate x:key>
     ...
    </DataTemplate>
</Window.Resources>

```

I have a list box to which I have to assign this data template inside the .xaml.cs code. How is this done?

Answer: 
> 
> However, Facebooks API to post, was slooooowing my user experience down
> 
> 
> 

First of all, how is it slowing it down? Are you making a server-side or client-side call to the API?

If you’d do it client-side, it’d already be asynchronous, so there shouldn’t be much slowing down that would affect user experience.

> 
> How do I get PHP to run CURL (or something) on the above Asynchronously, i.e. not wait for facebook to respond, so I can churn through say 100 in a minute (should I be so lucky)?
> 
> 
> 

I haven’t use cURL “asynchronously” yet, but a quick google search suggest that you can try it setting CURLOPT\_TIMEOUT or on up-to-date systems even CURLOPT\_TIMEOUT\_MS to a value of 1. But I can’t tell you how reliable that’ll be; if Facebook’s API will process it correctly if the client (your server in this case) closes the connection quickly, etc.

I’m not sure if doing this by cron is such a good idea.

If you can’t do the API call client-side, as suggested above, because you require your app access token to be send for your actions to be published, then I’d suggest still doing it server-side, but not via cron, but triggered by the user himself, by embedding an IMG or SCRIPT element into you’re page (put out by PHP if you’re directing the user to a new page, or created and put into the DOM client-side via JavaScript), which has it’s source set as the address of your PHP script publishing the action. If you use a SCRIPT element you could even control the outcome of the operation and react to it client-side, by just returning appropriate JavaScript code in the response.

I’d think this approach should not slow down user experience noticably, and I’d also guess it might be more reliable, than “asynchronous” cURL request fired in the hundreds by a cron-called script.

> 
> oh and b) should I replace "/me/" with the persons fb user id?
> 
> 
> 

With a user access token provided in the call the API can figure this out by itself.

But if you’re using an app access token, then you have to use the user-id, because otherwise the API has no way of knowing which user is meant in the call.
You should store the user session somewhere(db, etc). Then you can send through cron worker as long as the user session is active. And use the token while posting actions. (you should use token belonging to user only :))

> 
> b) should I replace "/me/" with the persons fb user id?
> 
> 
> 

then you can use /me or /id

To make the aynbchronus http call, see this post
[Asynchronous PHP calls?](https://stackoverflow.com/questions/124462/asynchronous-php-calls)

But there is rate limit, which would stop you from posting based on this condition (600 calls per 600 seconds, per token & per IP to be about where they stop you)  

Source: <http://www.quora.com/Whats-the-Facebook-Open-Graph-API-rate-limit>