Category: Microsoft Azure

Integrating Machine Learning APIs in Microsoft Bot framework Apps

bot, is a software application that runs automated tasks over the Internet. Typically, bots perform tasks that are both simple and structurally repetitive, at a much higher rate than would be possible for a human alone. The largest use of bots is in searching, in which an automated script fetches, analyzes and files information from web servers at many times the speed of a human.

In this blog we will guide the reader in creating a bot that will enable you to quickly do data analytics. e.g. to begin with steps for doing text based sentiment analysis.

Solution being developed using following Microsoft Technologies:
1. Microsoft Bot Framework
2. Machine Learning APIs for Sentiment analysis

Here are the steps:
Microsoft Bot framework application

1. Add a Bot template in Visual Studio 2015 Community edition as per instructions given from this link

2. Create a bot template based Visual Studio C# solution using the downloaded template. add and update the following code to the template created code to update the messages:

public class MessagesController : ApiController{
/// POST: api/Messages
/// Receive a message from a user and reply to it
public async Task Post([FromBody]Message message) {
if (message.Type == "Message") {
// calculate something for us to return
int length = (message.Text ?? string.Empty).Length;
string sentimentResponse = GetSentimentResponse.GetSentiment(message.Text);
return message.CreateReplyMessage($"Your message {length}. " + sentimentResponse);
}
else {
return HandleSystemMessage(message);
}
}

3. Using bot emulator ensure that bot is responding to messages as per the code. Now that the bot is created we will integrate it in Skype so that we can use an existing application that makes our bot immediately usable Refer to this link for registering the bot with Skype.

Machine Learning APIs for Sentiment analysis

4. Next step is to integrate the Microsoft Machine API’s check this link for details:

5. The user text (e.g. entered in Skype) is used for sentiment analysis as shown in the code below:
public static String GetSentiment(string message) {
try {
string myComment = message.Replace(' ', '+');
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

string key = "AccountKey:" + "";
byte[] creds = System.Text.Encoding.UTF8.GetBytes(key);
client.DefaultRequestHeaders.Add( "Authorization", "Basic "+ System.Text.Encoding.UTF8.GetString(creds));
HttpResponseMessage response = client.GetAsync("https://api.datamarket.azure.com/data.ashx/amla/text-analytics/v1/GetSentiment?Text=" + myComment).Result;
if (response.IsSuccessStatusCode) {
var data = response.Content.ReadAsStringAsync().Result;
var product = JsonConvert.DeserializeObject(data);
return $"Your sentiment is {product.Score}. Have a good time";
}
else message = response.ReasonPhrase;
}
catch (Exception ex) {
Console.WriteLine(ex.Message);
}
return message;
}
}

6. This code demonstrates how we can integrated Machine Learning API using the Microsoft bot framework

Many More such use case can be integrated similarly e.g. SMS being sent for some specific activity in a Industrial establishment.

Advertisements

Windows Azure Virtual Machine Limitations

Hi, Every one we are here for Sharing the knowledge, ParallelMinds as a company believe in Sharing the knowledge and keep the word in same page. So in the previous blog I have started to share knowledge about Windows Azure. Now I will continue that …………………!!!

As we know windows Azure are not too much stable right now. there are number of challenges, today I will cover Windows Azure Virtual machine limitation which I faced in my current project as follows …

Limitation :-

  1. Custom domain which we have created inside the Windows Azure Virtual machine, it goes to off line time by time, So when you will deploy any application on another domain joined machine some time it will give you an error like. ” can not find any domain controller in domain.”. it means your DC is going off line.
  2. We can’t change the IP address of Virtual Machine. Because on the Windows Azure DHCP is enabled, So it will assign one Internal IP and one External IP address(one to one Natting between internal IP address and Public IP address)  at the configuration of New Virtual Machine .Windows Azure not provides the facility to change the IP Address or Add the New IP address.
  3. Suppose for any Application you want to configure two IP address inside the same virtual machine. So unfortunately Windows Azure not provides this facility to add one more internal IP address inside the Virtual Machine. Because  one to one Natting between internal IP address and Public IP address on virtual machine.
  4. We cant ping the any Public IP Address from inside the Windows Azure virtual machine and We can’t ping Virtual machine Public IP Address outside the Windows Azure.
  5. Widows Azure provides single Network Adapter card with Virtual machine. Suppose you want to configure SIP inside the virtual machine , it requires two Network Adapter card or Edge Server inside the Virtual machine , edge server also requires two network adapter card one for connecting to internal network and another is connected to DMZ network . So currently its not possible to configure Edge server Inside the Windows Azure virtual machine.

I hope this information will help you. be tune with us and we will try to share More information with you.

Enjoy …… 🙂 🙂 🙂

Sql Server Services, The remote procedure call failed (0x800706be)

Hi Currently I got the chance to work on Azure and I met with one interesting Problem. So I want to share with all.

For the uploading .vhd file (image of virtual machine) he have need to install SDK of windows Azure. So after Installing I am able to upload image of virtual machine successfully. but suddenly due to some SharePoint work I was visited to  SQL Server Configuration manager when I saw that I was amazed. I was saw something more like that.

Sql Server Configuration manger

After Searching about that here I got that its happened due to Azure SDK. then I goes to services from start — > administrative Tool — >Services  and from here I am able to start my services

sql services

After Starting the services every thing is working fine as of now.

stay tuned with us for more ….. 🙂 🙂 🙂