Steam API getting persona name - c++

I have been following the Steam documentation to a t, but I have gotten to the point where I need to retrieve player names based on the steam ID, and Steam has a function for this in their documentation:
const char *pchName = SteamFriends()->GetPersonaName(steamID);
However Visual Studio says that there is no function with that number of arguments. The only acceptable function is
const char *pchName = SteamFriends()->GetPersonaName();
Which is supposed to return the local player's persona name (which it does). I can make a way to get this from every user and store it on my server on login, but it sure seems like this should work. How am I supposed to get the persona name for a friend's uint64 SteamID? Did they change this function recently?
I am using Unreal Engine 4.7.6 from source with Steam API 1.30.

Apparently Steam is bad at updating their documentation. I opened up the isteamfriends.h header and found this function that is never mentioned in the Steam docs:
// returns the name another user - guaranteed to not be NULL.
// same rules as GetFriendPersonaState() apply as to whether or not the user knowns the name of the other user
// note that on first joining a lobby, chat room or game server the local user will not known the name of the other users automatically; that information will arrive asyncronously
//
virtual const char *GetFriendPersonaName( CSteamID steamIDFriend ) = 0;
Come on, Steam... I literally pulled this line directly from their live docs about 30 minutes ago, and it doesn't work.
const char *pchName = SteamFriends()->GetPersonaName(steamID);
So the correct way then is:
const char *pchName = SteamFriends()->GetFriendsPersonaName(steamID);

Related

How to specify the database in an ArangoDb AQL query?

If have multiple databases defined on a particular ArangoDB server, how do I specify the database I'd like an AQL query to run against?
Running the query through the REST endpoint that includes the db name (substituted into [DBNAME] below) ie:
/_db/[DBNAME]/_api/cursor
doesn't seem to work. The error message says 'unknown path /_db/[DBNAME]/_api/cursor'
Is this something I have to specify in the query itself?
Also: The query I'm trying to run is:
FOR col in COLLECTIONS() RETURN col.name
Fwiw, I haven't found a way to set the "current" database through the REST API. Also, I'm accessing the REST API from C++ using fuerte.
Tom Regner deserves primary credit here for prompting the enquiry that produced this answer. I am posting my findings here as an answer to help others who might run into this.
I don't know if this is a fuerte bug, shortcoming or just an api caveat that wasn't clear to me... BUT...
In order for the '/_db/[DBNAME/' prefix in an endpoint (eg full endpoint '/_db/[DBNAME/_api/cursor') to be registered and used in the header of a ::arangodb::fuerte::Request, it is NOT sufficient (as of arangodb 3.5.3 and the fuerte version available at the time of this answer) to simply call:
std::unique_ptr<fuerte::Request> request;
const char *endpoint = "/_db/[DBNAME/_api/cursor";
request = fuerte::createRequest(fuerte::RestVerb::Post,endpoint);
// and adding any arguments to the request using a VPackBuilder...
// in this case the query (omitted)
To have the database name included as part of such a request, you must additionally call the following:
request->header.parseArangoPath(endpoint);
Failure to do so seems to result in an error about an 'unknown path'.
Note 1: Simply setting the database member variable, ie
request->header.database = "[DBNAME]";
does not work.
Note 2: that operations without the leading '/_db/[DBNAME]/' prefix, seem to work fine using the 'current' database. (which at least for me, seems to be stuck at '_system' since as far as I can tell, there doesn't seem to be an endpoint to change this via the HTTP REST Api.)
The docs aren't very helpful right now, so just incase someone is looking for a more complete example, then please consider the following code.
EventLoopService eventLoopService;
// adjust the connection for your environment!
std::shared_ptr<Connection> conn = ConnectionBuilder().endpoint("http://localhost:8529")
.authenticationType(AuthenticationType::Basic)
.user(?) // enter a user with access
.password(?) // enter the password
.connect(eventLoopService);
// create the request
std::unique_ptr<Request> request = createRequest(RestVerb::Post, ContentType::VPack);
// enter the database name (ensure the user has access)
request->header.database = ?;
// API endpoint to submit AQL queries
request->header.path = "/_api/cursor";
// Create a payload to be submitted to the API endpoint
VPackBuilder builder;
builder.openObject();
// here is your query
builder.add("query", VPackValue("for col in collections() return col.name"));
builder.close();
// add the payload to the request
request->addVPack(builder.slice());
// send the request (blocking)
std::unique_ptr<Response> response = conn->sendRequest(std::move(request));
// check the response code - it should be 201
unsigned int statusCode = response->statusCode();
// slice has the response data
VPackSlice slice = response->slices().front();
std::cout << slice.get("result").toJson() << std::endl;

QiChat language syntax _* doesn't work, how to fix?

I want Pepper robot to understand any human input in the chat.
I know that the correct QiChat syntax is '*' and it requires Internet access. (Robot is connected via Wi-fi)
This is my topic file, where I tell the robot my name, he tells it and assigns qiChat variable to my name.
u:(My name {is} _*)
Nice to see you, $1 $name=$1
This is how I define the chat.
conversationalContents = Arrays.asList(
new NavigationControlConversationalContent(), new GestureControlConversationalContent(), new VolumeControlConversationalContent(),
new DateTimeConversationalContent(), new GreetingsConversationalContent(), new FarewellConversationalContent(),
new RepeatConversationalContent()
);
topic = TopicBuilder.with(qiContext).withResource(R.raw.talks).build(); // build topic
chatbot = QiChatbotBuilder.with(qiContext).withTopic(topic).build(); // build chatbot
chat = ConversationalContentChatBuilder.with(qiContext).withChatbot(chatbot).withConversationalContents(conversationalContents).build(); // build chat
chat.async().run();
And I do have this in the manifest
<uses-permission android:name="android.permission.INTERNET" />
When I tell the robot my name, on the action bar (where robot writes what it understands -> it shows "My name <...>") So it doesn't understand and thus won't answer nor assign $name variable, which it should.
You'll probably want to contact Softbank Customer care and give them your robot serial number, because this feature requires a special licence that they need to activate (if your contract allows that of course!).
Jonas

C++ Change Print Queue Owner

I want to know if it is possible to change the “Owner” name that is visible when you bring up the print queue to view the queued printer documents. I have a Windows Service that receives a document from a user and sends it a Windows printer, and the Owner is always the name of the user that logged into the workstation where the Service is running. I would like to change the “Owner” to something else, and this would be done in a C++ Windows DLL that the Windows Service loads and uses.
Added 8/30/16#9:14am ET
Thanks for the suggestion, Thomas. I should have mentioned my research, but it was long and empty. MSDN has a SetJob function which can take 1 of 4 structures (pJob = JOB_INFO_1…JOB_INFO_4). JOB_INFO_1, 2, and 4 have an LPSTR pUserName that appears to be what can be used to change the owner of the print job (Owner?). However, in the remarks section of SetJob it says:
“The following members of a JOB_INFO_1, JOB_INFO_2, or JOB_INFO_4 structure are ignored on a call to SetJob: JobId, pPrinterName, pMachineName, pUserName, pDrivername, Size, Submitted, Time, and TotalPages.”
And JOB_INFO_3 does not have this field in it. Nice.
I did not see any other functions that could maybe do this. Can you point me to something specific that I can research more? Or that is known to work? Thanks.
I'm not sure why MSDN says those fields are ignored. I change pUserName, pDocument, pStatus using SetJob with JOB_INFO_1 and it works perfectly.
Just be sure to set Position to JOB_POSITION_UNSPECIFIED.

Get rid of security message Outlook

I'm writing an application that needs to access to Outlook address book, however, every time I launch it a warning message is shown saying that an application is trying to access to your adress book. I've noticed this behaviour only with the machines where no antivirus is installed. How to get rid of this message?
Here is a part of the code I use to retreive some emails related informations
CApplication l_application;
l_application.CreateDispatch("Outlook.Application");
CNameSpace l_namespace = l_application.GetNamespace(_T("MAPI"));
CMAPIFolder l_mapiFolder = l_namespace.GetDefaultFolder(olFolderInbox);
CItems l_items = l_mapiFolder.GetItems();
m_mailItem = l_items.GetLast();
m_mailItem.Save();
//Get infos (mail's size, from, to, conversation topic...)
CApplication, CNameSpace, CItems are generated automatically, and m_mailItem is a CMailItem object.
See http://www.outlookcode.com/article.aspx?id=52 for a list of your options. Essentially you can either make sure an up-to-date antivirus app is installed or use Redemption (I am its author).

Failing to fetch CategorizedFacebookType

I have an application which I developed about a year ago and I'm
fetching facebook accounts like this:
facebookClient = new DefaultFacebookClient(access_token);
Connection<CategorizedFacebookType> con = facebookClient.fetchConnection("me/accounts", CategorizedFacebookType.class);
fbAccounts = con.getData();
It worked fine until about a month ago, but now it returns the
fbAccounts list empty. Why is that?
I was hoping moving from restfb-1.6.2.jar to restfb-1.6.9.jar would
help but no luck, it comes up empty on both.
What am I missing?
EDIT, to provide the code for another error I have with this API. The following code used to work:
String id = page.getFbPageID(); // (a valid facebook page id)
FBInsightsDaily daily = new FBInsightsDaily(); // an object holding some insights values
try {
Parameter param = Parameter.with("asdf", "asdf"); // seems like the param is required
JsonObject allValues = facebookClient.executeMultiquery(createQueries(date, id), JsonObject.class, param);
daily.setPageActiveUsersDaily((Integer)(((JsonArray)allValues.opt("page_active_users_daily")).getJsonObject(0)).opt("value"));
...
This throws the following exception:
com.restfb.json.JsonException: JsonArray[0] not found.
at com.restfb.json.JsonArray.get(JsonArray.java:252)
at com.restfb.json.JsonArray.getJsonObject(JsonArray.java:341)
Again, this used to work fine but now throws this.
You need the manage_pages permission from the user to access their list of adminned pages - a year ago I'm not sure you did - check that you're obtaining that permission from your users
{edit}
Some of the insights metrics were also deprecated, the specific values you're checking may no longer exist - https://developers.facebook.com/docs/reference/fql/insights/ should have the details of what is available now
Try to check your queries manually in the Graph API Explorer to eliminate any issues in your code and hopefully get more detailed error messages that your SDK may be swallowing