How do I register a custom NameResolver with the new HostBuilder in WebJobs SDK 3.x? - azure-webjobs

There are a lot of examples on the internet on how to do this with the old JobHost, but none I can find with HostBuilder.
Thanks,
George

For now I didn't found detailed documentation on the new HostBuilder.
However looks like we could use this code to do it. You could find it on github.
.ConfigureServices(services =>
{
// add some sample services to demonstrate job class DI
services.AddSingleton<ISampleServiceA, SampleServiceA>();
services.AddSingleton<ISampleServiceB, SampleServiceB>();
}
And there is an answer about it, which uses the same service to implement it, you could try it.

Related

AWS QnA Bot Solution change the Alexa welcome message

I have an AWS QnA Bot that I am using with Alexa. The default welcome message for Alexa with this solution is:
"Hello, Please ask a question".
I'd like to change this to make it more personalized for my bot but I'm not sure where to make this change in the Lambda code.
I went into the Lambda function that the built-in tutorial told me to use for the Alexa Skill endpoint. Here, I found a section called get_welcome_message that looks like this:
async function get_welcome_message(req, locale){
console.log("=================" + JSON.stringify(req));
const welcome_message = _.get(req,'_settings.DEFAULT_ALEXA_LAUNCH_MESSAGE', 'Hello, Please ask a question');
if (_.get(req._settings, 'ENABLE_MULTI_LANGUAGE_SUPPORT')){
return await translate.get_translation(welcome_message,'en',locale,req)
} else {
return welcome_message;
}
}
I thought that changing the welcome_message would change it in the Alexa skill. However, no matter what I change it to, it will still say: "Hello, Please ask a question".
I've tried clearing my history/cache in case that was an issue. I've deployed the altered Lambda, rebuilt the AWS QnA Bot, and rebuilt the Alexa Skill. I've also looked through the Lambda and this function seems to be the only place where a welcome message is set. It looks like everything that requires the welcome message calls this middleware.
This seems like it should be a simple task to change but I just can't seem to get it to show a different welcome message.
Please let me know how I can change this default welcome message. I feel like it's something simple that I'm missing.
An easier approach would be to change the value of DEFAULT_ALEXA_LAUNCH_MESSAGE from Content Designer UI. This doesn't require any code changes.
You can find the instructions to access content designer here. Here is how you can change the settings.

Where to find sample C# .NET code for Google's People API?

I have an installed app that uses .NET and the Contacts API. I'm trying to convert to the People API. I'm having trouble getting started and finding a sample that shows how to use People API with the .NET library. For example, the samples listed under the Peoples API documentation doesn't include .NET. Where can I find a .NET sample for the People API?
Start with this ;)
https://googleapis.dev/dotnet/Google.Apis.PeopleService.v1/latest/api/Google.Apis.PeopleService.v1.html
Get the nuget called Google.Apis.PeopleService.v1 https://github.com/googleapis/google-api-dotnet-client
Also, I'm sure you have seen this https://developers.google.com/people/v1/profiles
It has some .net examples.
What exactly are you trying to accomplish?
I am just about to complete converting an app that used contacts API to people API using a service account for the company.
ps. I can't copy the whole namespace in the answer hense answer with a link.
Edited: 20210608
Person person = new Person();
person.EmailAddresses = new List<EmailAddress>();
person.EmailAddresses.Add(new EmailAddress() { Type = "work", Value = "sample#domain.com" });
person.Names = new List<Name>();
person.Names.Add(new Name() { FamilyName = "Lname2", GivenName = "Fname" });
// link to peopleService code can be found in the comments
// it's basically initializing PeopleServiceService with service account credentials
Person retVal = peopleService.People.CreateContact(person).Execute();

Enabling Change Tracking for Entity

Is there a way to enable change tracking for couple of entities programmatically? I could not find any api in Dataverse which can help to do this.
You cannot do that with webapi but you can definitely achieve this programatically.
you can either create console application or you can run code now plugin for xrmtoolbox and get this done.
Below code snippet for reference.
UpdateEntityRequest updateBankAccountRequest = new UpdateEntityRequest
{
Entity = BankAccountEntity,
ChangeTrackingEnabled = true //or false here
};
_serviceProxy.Execute(updateBankAccountRequest);
Microsoft docs for ChangeTrackingEnabled

AWS Amplify federated google login work properly on browser but dont work on Android

The issues are when I am trying to run federated authentication with the help of amplify auth method on the browser it works fine, but when I try to run it on my mobile.
It throws error No user found when I try to use Auth.currentSession() but the same work on the browser.
tried to search about this type of issue but I found related to ionic-cordova-google-plugin not related to AWS Amplify Federated Login Issue.
Updating the question after closing the question with less debugging information without asking for any information.
This is issues raised in git hub with respect to my problem.
Issue No. 5351 amplify js it's still in open state.
https://github.com/aws-amplify/amplify-js/issues/5351
Another issue 3537 which is still in Open
These two issues has the same scenario like me, I hope its enough debugging information, if more required mention comment instead of closing without notification, it's bullying for a beginner not helping
I fixed the above problem by referring a comment or wrapped around fix.
Link that will take to that comment directly link to comment.
First read the above comment as it will give you overall idea of what exactly the issue is instead of directly jumping to the solution.
Once you read the comment you will be little unclear with respect to implementation as he has use capacitor and not every one are using capacitor.
In my implementation I ignore this part as I am not using capacitor.
App.addListener('appUrlOpen')
Now lets go to main step where we are fixing this issue, I am using deep links to redirect to my application
this.platform.ready().then(() => {
this.deeplinks
.route({
"/success.html": "success",
"/logout.html": "logout",
})
.subscribe(
(match: any) => {
const fragment = JSON.stringify(match).split('"fragment":"')[1];
// this link can be your any link based on your requirement,
// what I am doing it I am passing all the data which I get in my fragments.
// fragments consists of id_token, stage, code,response type.
// These need to be passed to Ionic in order for Amplify to run its magic.
document.location.href = `http://192.168.1.162:8100/#${fragment}`;
},
(nomatch) => {
console.log("Got a deeplink that didn't match", nomatch);
}
);
});
I got this idea by referring the issue in which the developer mentioned of sending code and state along with application deep linking URL.

How to properly use Google API Client on Glass XE22

I'm currently trying to use the following code to create an ApiClient connection
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(Wearable.API)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
mGoogleApiClient.connect();
but in
#Override
public void onConnectionFailed(ConnectionResult connectionResult) {
Log.d(TAG, "Connection failed");
mGoogleApiClient.reconnect();
}
I'm getting this:
ConnectionResult{statusCode=SERVICE_INVALID, resolution=null}
If I'm reading correctly in the manual, this corresponds to the version of Play being wrong to begin with.
As such, am I missing something from properly connecting running the code on Glass or this is not supported yet?
To give you a rough idea of what I want to do, I want to implement this example.
Google Play Services is not supported on Glass at this time. This is currently being tracked as issue 176 in our issue tracker, so you can follow that for more info in the future.