Windows.System.UserProfile.UserInformation what happens if not logged in? - windows-store-apps

Seems like a simple/obvious question but I can't find the answer in the docs or anywhere else. If I use this:
https://msdn.microsoft.com/en-us/library/windows/apps/windows.system.userprofile.userinformation.aspx
Mostly GetDisplayNameAsync, what happens if the user isn't logged in? Do I need to use some other classes to handle login and add a some login/change account options to my UI?
All I need is the display name, for a leaderboard/high scores list. I thought about using the Xbox Live API for leaderboards, but I guess that isn't open to the general public, so making my own.

Based on comments: It always returns something, unless blocked by privacy settings.
It's not very useful for my intended usage, since I was looking for more of a "screen name" or "gaming name" or "profile name". Currently you would need to be a MS partner and use the XBox/Live SDK for that type of thing.

Related

How do you work with resource ownership with adonis-acl

How do you manage the owner of a resource when using adonis-acl? In my application the typical pattern is that if you own the resource you have full CRUD over it but Admins also have Updated and Delete control over the resource even though they are not the owners.
Ideally I want to manage this control though middleware rather than having to then re-check ACL in my Controllers. Ideally I'm looking for something like
Route
.get('/users')
.middleware(['auth:jwt', 'is:(administrator)' 'can:read_resouce_{SOMEKINDOFID}'])
Currently is seems that the only way I can do this is to setup a permission for every single resource which for my use case seems unnecessary.
Thanks

Is it possible to use the cast API from a chome app? how to bypass the receiver selection popup?

Does anyone know, is the cast API supported for use from a chrome app? It initializes fine, says there are receivers available but I can't get a session - when I call requestSession nothing happens at all, neither success nor error callbacks are called, no window is displayed.
Maybe I'm approaching this all wrong...what I'm trying to do seems like it should be relatively straight-forward, but it really seems like google has deliberately prevented this. All I'm trying to do is hook my IR remote up to my chromecast for media playback controls (play/pause/seek). Even if the requestSession method worked, it really wouldn't give the user experience I want - it would still require the user to select the receiver from the popupmenu UI whenever they want to use their IR remote - far from friendly. Instead I'd like to be able to pre-configure which chromecast the IR remote is bound to...and then it would always just connect to whatever app/session is currently running on that receiver to issue play/pause/seek commands.
I could implement this as a browser extension instead, and I'm sure I could get it functional that way...but that would be even less user-friendly (not to mention I'm already using some app-only APIs for the IR-receiving side of it which would have to be re-worked to other methods).
edit: Ok, after a bit more looking I've found this which I guess mostly answers my question https://code.google.com/p/chromium/issues/detail?id=287254 ....but the question about the popup still stands...even if using an extension is there any way to bypass the reciever-selection popup that requires user interaction?

What is chrome.identity.getProfileUserInfo meant to return?

With Chrome 37 now released, there is a new API available, identity.getProfileUserInfo. I am not really sure what information this is meant to return or what it represents.
From the documentation, I thought it would return the email address and id of the user signed into Chrome(i.e. from the hamburger menu), however this is not really true- when I call it(from the context of an extension, which requests the "identity" permission), I get the id of the user signed in that way(and if I paste that after plus.google.com/ I get their G+ page), but the email field is blank. Is that intended?
Figured it out. There is an undocumented (in the official developer.chrome.com docs at least) need to request the "identity.email" permission as well in order for that field to be filled.
https://groups.google.com/a/chromium.org/forum/#!topic/apps-dev/WS-5GRw0RkI

How can I use the Box Java SDK to create a shared link without specifying the share type?

In Box API v1, it was possible to request creation of a shared link for a file or folder, without caring about what kind of sharing was required. In fact, it was not possible to ask for a particular type of share - you just used the public_share method and passed in the target type (file/folder) and target ID, and optionally a share password. In an Enterprise Account, for instance, this might result in the maximum access level being "company" or "collaborators", if public links are disallowed.
With Box API v2, according to the docs here, you need to specify an access parameter that has to be "open", "company", or "collaborators".
The problem is, using the wrong type may cause the share to fail. For instance, in a folder/account that only allows collaborators, I get a 400 error if I ask for a "open" share.
What I really want is to get exactly the same result as if the user clicked the "Share" link in the Box web site. Which is, it should enable sharing for the file but default the level appropriately.
Is there a way to do this with v2, without the admin having to tell us their "preferred" access level for shared links we create? I'm using the Java SDK, like this:
BoxItemRequestObject req = BoxItemRequestObject.createSharedLinkRequestObject(BoxSharedLinkRequestObject.createSharedLinkRequestObject("open"));
BoxItem item = itemsManager.createSharedLink(<ID>, req, BoxResourceType.FILE);
Thanks,
Ben Gilbert
Smartsheet.com
Just set the access to the empty set {}
So your request would look like this:
{"shared_link": {}}
I figured out how to make this work. I need to set access to null when creating the BoxSharedLinkRequestObject, like this:**
BoxItemRequestObject req = BoxItemRequestObject.createSharedLinkRequestObject(BoxSharedLinkRequestObject.createSharedLinkRequestObject(null));
This doesn't produce quite the same JSON as was recommended (shared_link: {}), but it does produce JSON that is apparently equivalent: shared_link: { access: null }. I couldn't figure out any way to produce an empty shared_link object using the SDK -- I either had to have a null shared_link (which didn't work at all) or some value for the access field.

Scraping data after filling out form?

I'm doing a little project for my class and I'm just a beginner, so please forgive me if I mix up some of my terminology.
Basically, I'm creating an interactive journey planner for my city's public transit system. Unfortunately, they haven't made all the data I need publicly available. So instead of putting all my time into gathering the data for personal use, I've opted to do some screen scraping - letting their servers calculate the journey info from a START and STOP variable and then displaying the selected info on my page.
So is it possible to fill out a form's fields remotely, and then scrape the data on the page that subsequently loads? And if so, what would be the quickest, most convenient way? This happens to be a case where the data can't be manipulated via the URL, so it has to access the data by filling out the form first.
The website in question:
http://jp.translink.com.au/travel-information/journey-planner
Here is what you can do:
1.) Send a POST Request to the journey-planner with some data like that (be aware that CORS might jump in, then you could use cURL via PHP or whatsoever):
Start:Wickham Tce, Spring Hill
End:Upper Edward St, Spring Hill
SearchDate:10/05/2013 12:00:00 AM
TimeSearchMode:LeaveAfter
SearchHour:7
SearchMinute:40
TimeMeridiem:AM
TransportModes:Bus
TransportModes:Train
TransportModes:Ferry
MaximumWalkingDistance:1500
WalkingSpeed:Normal
ServiceTypes:Regular
ServiceTypes:Express
ServiceTypes:NightLink
FareTypes:Standard
FareTypes:Prepaid
FareTypes:Free
2.) You will get a new response location. This seems to be a REST link. Important for you is the id at the end. You will have to call that page and parse the HTML and look for a div with the HTML-id option-summaries, where you will find more information within the divs travel-option-1 to travel-option-n. You have to look at it carefully in order to find out which information is stored whee and how you will be able to use it.
In order to find such things you should learn how to use Firebug or Chrome's development tools.
This is one way to solve your problem. Probably not the best but still better than "screen-scraping" anything. But it will ask you for a lot of skills and effort. Furthermore if the data provider is going to change just a bit your solution will not work anymore. Additionally they might prevent your access by CORS or anything else (blocking your IP etc.)