Facebook Open Graph Beta - Can't create action because I already use it - open-graph-beta

The new Open Graph beta is telling me that I cannot use the action 'want' or the object 'item'
I have used them in previous applications, however these have since been deleted and I've created a new application where I cannot use it.
Is this a bug, or am I doing something wrong?

Perhaps the types are not defined in the namespace you're using (or they were restricted to the app that defined them). If the types have not been created within the new application, you probably should use the Get Started tool that's available in the Open Graph section on the app control panel to create you Action and Object types.

Related

Vaadin UI between sessions

When I am creating a new session (or try to access from an other computer) in Vaadin Flow I get this error:
Can't move a node from one state tree to another
From this link, I read something about UI and getUIId().
However, I don't understand how I should change my application in order to fix the error.
As Denis mentioned in the forum post you linked, wrong scope sounds like the most likely culprit. In other words, you are trying to use the exact same component instance in two different UIs, when both UIs should have their own instance. It's not possible to use the same instance in two places at the same time.
You can find the documentation for Vaadin Spring scopes here: https://vaadin.com/docs/latest/flow/integrations/spring/scopes
One possible cause of errors such as that is that if you're storing a Component in a static variable. You shouldn't do that - a Component instance can only belong to a single UI. A single UI in turn (in practice) means a single browser tab.

How to get Current Page/View or topmost Page/View in Xamarin.Forms

I want to show AlertDialog(DisplayAlert) in a Xamarin.Forms project when an unhandled error occurs.
How can I get the current page instance?
You need to keep a reference of your main page as you mentioned. There are a few ways to do this.
You can have a static reference to it in your App.cs file, which is actually already there as it inherits from Application which has:
App.Current.MainPage
If you use an MVVM helper like MVVMLight you pass the page to the service so it keeps a reference of it.
ACR UserDialogs is a dialog package that can also help as it extends and adds different types of dialogs
To get around this and have a lot more flexibility add 'ACR User Dialogs' package to each of your platform's projects.
Then you can use that from anywhere :
await UserDialogs.Instance.AlertAsync ("Your question has been successfully sent", "Thankyou");

How do I access the Request object from RazorViewEngine?

I have subclassed RazorViewEngine so I can check for Request.Browser.IsMobileDevice and add a special mobile identifier to the view file name for it to grab. However I can't access the Request object. What should I do?
You can use either the HttpContext.Current.Request or Context.Request. Although understand how that IsMobileDevice works. It uses a browser file which contains a list of known user agents. As soon as a new device is built, that list is outdated, but in some cases may still identify the device to be mobile correctly. The recommended way is to use 51Degrees or to connect to the services it encompasses directly.

Pass data/object between assemblies in WP7

The Windows Phone 7 project I'm working on has 2 UIs, and a core 'engine' of functionality with some pages that are common. I'd like my user interface to pass an object into one of these common pages in the core assembly.
Currently I can navigate to pages in the core assembly from the UI assembly. However, it is my understanding that each assembly has it's own Isolated storage, is that correct?
If I can share Isolated storage, I can use that, I'm just not sure how to get the two assemblies to use it together.
What's the best practice?
I tried googling this: 'wp7 pass object between assemblies'
More Info:
This would be 1 application with two assemblies. Something like this:
CustomerUI (project)
- MainPage.xaml
- App.xaml
CoreFuncs (project)
- CustomerData.cs
- EditCustomer.xaml
SalesRepUI (project)
- MainPage.xaml
- App.xaml
Both CustomerUI and SalesRepUI would use the EditCustomer page and customerData object. So, from MainPage a CustomerData object is instantiated, then a user could click 'Edit User' which would navigate to the common EditCustomer.xaml page. We would want to pass in the already instantiated CustomerData object. (For the purpose of this discussion...)
As I know, there is one Isolated storage per application, not per assembly. So you can try pass your objects through it if you like.
It depends are these two separate applications or two assemblies?
Isolated storage is isolated around the running application. This means each app has its own storage that cannot be accessed from a different app. The only ways to share data between two apps are:
A WebService/or TCP service in 7.5: You would upload the data from one app and download the data into a separate application.
User performed tasks: Copy and Paste/Sending an Email
However if this is just one application you will be able to access the isolated storage between the assemblies just by reading and writing to the files. The only thing to be aware of is file locking, make sure you close files any before you attempt to read from them from a separate dll/assembly.
Sorry, Sorry, I found what I wanted, I was thinking too hard.
PhoneApplicationService.Current.State["keyName"] = object; was exactly what I wanted. Not sure if its the best way, but for me, it works. Just throw my settings class or whatever in there, and catch it on the other side in the page.xaml code.
I would recommend using the Messenger class in the MVVM Light toolkit:
http://blog.galasoft.ch/archive/2009/09/27/mvvm-light-toolkit-messenger-v2-beta.aspx
Both of your assemblies can reference a single shared assembly; that assembly can contain a type that you use to hold data passed via the messenger.

How to add new managed object from other app?

I have used Core Data just creating projects with "Use Core Data" checked, using the code that XCode creates by default and, if necessary, adding or modifying just a few things.
Now I have a "main" app and I have created a helper app (status bar item app, LSUIElement = 1 and Login item). The helper app is Build as main app target dependency and copied into the main app "Resources" folder.
When the status bar icon is clicked the helper app shows a window to the user to collect some info to create a new managed object according to the main app Core Data Model.
But, how can I create a new managed object from the helper app for the main app?
By now I´m thinking to:
check if main app is open or not (I don´t know if it´s possible)
if it´s open, let the main app to perfom a selector with a dictionary with the info sent from helper app (I don´t know if it´s possible)
if it´s close then (in the helper app) create a persistent store coordinator, manage object model and manage object context using the model and persistent store files from main app. Create the new managed object. And I don´t know if it´s better to terminate MOC, MOM and PSC each time the user creates a new MO to avoid conflicts when main app opens or it´s not optimal and could affect performance...
It´s a good approach? Any point to start? Thanks in advance
Do you have to create a managed object? If you're just collecting simple data in the helper app it would be much simpler to pass that input to the main app via the userinfo dictionary in a Distributed Notification. Then the main app could create the managed object and you don't have to deal with merging changes between the two contexts.
Otherwise you'd have to pass the helper app a path to your MOM, create a MOC in the helper app, create the object, save the MOC while notifying the main app to merge changes by passing the IDs of the changed objects, reloading your main app's model objects, and so on. I've gotten it to work, but it's a huge headache and prone to errors. I'd avoid that route if possible.
Edit: I just realized you want to be able to write to your main app's store even if it's not running. It sounds like you need to re-think this before writing any code. If the helper app executes on its own, it's not really a helper app. Could you go into more detail about what you're actually trying to accomplish? This kind of hackery is not really a good idea and could lead to data corruption.

Resources