Announcing Microsoft ASP.NET WebHooks V1

WebHooks provide a simple pub/sub model for wiring together Web APIs and services with your code. A WebHook can be used to get notified when a file has changed in Dropbox, a code change has been committed to GitHub, a payment has been initiated in PayPal, a card has been created in Trello, and much more — the possibilities are endless! When subscribing, you provide a callback URI where you want to be notified. When an event occurs, an HTTP POST request is sent to your callback URI with information about what happened so that your Web app can act accordingly. WebHooks happen without polling and with no need to hold open a network connection while waiting for notifications.

Receiving WebHooks

Dealing with WebHooks depends on who the sender is. Sometimes there are additional steps registering a WebHook verifying that the subscriber is really listening. Often the security model varies quite a bit. Some WebHooks provide a push-to-pull model where the HTTP POST request only contains a reference to the event information which is then to be retrieved independently.

The purpose of Microsoft ASP.NET WebHooks is to make it both simpler and more consistent to wire up your API without spending a lot of time figuring out how to handle any WebHook variant:

WebHoks-Receiving

A WebHook handler is where you process the incoming WebHook. Here is a sample handler illustrating the basic model. No registration is necessary – it will automatically get picked up and called:

public class MyHandler : WebHookHandler
{
    // The ExecuteAsync method is where to process the WebHook data regardless of receiver
    public override Task ExecuteAsync(string receiver, WebHookHandlerContext context)
    {
        // Get the event type          
        string action = context.Actions.First();
 
        // Extract the WebHook data as JSON or any other type as you wish
        JObject data = context.GetDataOrDefault();
 
        return Task.FromResult(true);
    }
}

Finally, we want to ensure that we only receive HTTP requests from the intended party. Most WebHook providers use a shared secret which is created as part of subscribing for events. The receiver uses this shared secret to validate that the request comes from the intended party. It can be provided by setting an application setting in the Web.config file, or better yet, configured through the Azure portal or even retrieved from Azure Key Vault.

For more information about receiving WebHooks and lots of samples, please see these resources:

More detail on Microsoft Blog.

Microsoft's new service turns FAQs into bots

QnAMaker-HomePage

Finding customer service help online can be a pain. Filtering through a knowledge base to find the right answer to your question can be an exercise in fighting with nested frequently asked questions documents.

Microsoft is aiming to help by making it easier for companies to create intelligent bots that can answer common questions.

The QnA Maker, launched in beta on Tuesday, will let users train an automated conversation partner on existing frequently-asked-questions content. After that information is fed in, the service will create a bot that will respond to customer questions with the content from the knowledge base. Once the information is loaded into the service, users can then view how the bot has paired up questions and answers and add their own custom questions and responses.

After that, they can test it in Microsoft's web interface to see how the bot will respond.

Microsoft has been pushing hard to get companies to build intelligent, automated conversation partners, but getting intelligent bots off the ground can take time. This service lowers the barrier to entry by making it possible for people without hardcore developer skills to build a useful bot that addresses a key concern.

When the system thinks multiple answers in a knowledge base might work for one query, it will allow users training the bot to pick from different possible responses and saves the choice to the knowledge base.

The system creates an API endpoint that can be used as a bot on its own or integrated into another, larger conversational system.

Right now, the service is available for free, but limits users to 10,000 transactions per month, and 10 transactions per minute. In the future, Microsoft will offer it as a paid service.

How do I extract text that lies between two strings?

My initial prolem was to extract from a SQL string generated by MySql, all fields. I had a string like

INSERT INTO `inventoryapp`.`inventory_keys`
(`Id`,
`PropertyId`,
`AppointmentId`,
`SectionType`,
`KeysDescription`,
`FobsWorking`,
`EntryCodes`,
`AlarmCodes`,
`Notes`,
`Version`,
`CreatedDate`,
`CreatedBy`,
`UpdatedDate`,
`UpdatedBy`,
`IsDeleted`)
VALUES
(<{Id: }>,
<{PropertyId: }>,
<{AppointmentId: }>,
<{SectionType: }>,
<{KeysDescription: }>,
<{FobsWorking: }>,
<{EntryCodes: }>,
<{AlarmCodes: }>,
<{Notes: }>,
<{Version: }>,
<{CreatedDate: }>,
<{CreatedBy: }>,
<{UpdatedDate: }>,
<{UpdatedBy: }>,
<{IsDeleted: }>);


With a bit of RegEx I can extract all fields with the following function:

public IEnumerable<string> GetSubStrings(string input, string start, 
                                         string end) {
    Regex r = new Regex(Regex.Escape(start) + "(.*?)" + Regex.Escape(end));
    MatchCollection matches = r.Matches(input);
    foreach (Match match in matches)
        yield return match.Groups[1].Value;
}


Then if you want to have in a single line this query and generate the list of fields to have a list of parameters for a MySqlCommand for example, you can use the following function:

string strSQL = yoursql.Replace(Environment.NewLine, "")
                       .Replace("\r", " ");
string strParameters = "";

List<string> prm = GetSubStrings(strSQL, "<{", ": }>").ToList();
foreach(string s in prm) {
    string tmp = s.Replace("?", "");
    strParameters += Environment.NewLine + 
        $"cmd.Parameters.Add(\"?{tmp}\", MySqlDbType.VarChar)" +
        $".Value = record.{tmp}"; ;
}
this.textBoxParams.Text = strParameters;

strSQL = strSQL.Replace("`inventoryapp`.", "");
strSQL = strSQL.Replace("<{", "?").Replace(": }>", "");

Happy coding!

Amazon just launched a cashier-free convenience store

amazon_go

Amazon just unveiled a grocery store without lines or checkout counters. Amazon Go, a 1800-square-foot retail space located in the company’s hometown of Seattle, lets shoppers just grab the items they want and leave; the order gets charged to their Amazon account afterwards.

Amazon Go works by using computer vision and sensors to detect what items you’re taking out of the store. You start by scanning an app as you enter the Amazon Go shop. You do your normal shopping, and the sensors throughout the store identify the items in your cart and charge them to your account when you walk out the door. It’ll feel like shoplifting, except you’re actually being watched by more cameras than you can imagine.

It’s a Good Day to Be a C# Developer

great_time_csharp_header

Recently at Connect(), Microsoft made a slew of new announcements. First, the public availability of Visual Studio 2017 Release Candidate. This just isn't a new version of the signature developer tool, it also includes the latest bits for C# 7.0. Second, Google announced they were joining the .NET Foundation. This means that Google, technically a competitor of Microsoft, wants to be actively involved in the evolution of .NET (and indirectly C#). Third, the first public release of Visual Studio for Mac. As a native environment, Visual Studio for Mac will provide the same world class tooling support for Xamarin applications, using C# and F#.

We could go on, but there is a common thread that runs between many of these announcements. As a developer, choosing C# as a part of your technology stack is an excellent decision! But what if you are not a C# developer already? How does C# compare to other popular languages such as JavaScript, Java, Python, etc?

Migrate SQLite to MySQL

I’m developing a huge app made with Xamarin Forms in my company. A problem was to create all tables in the device with SQLite to the main database MySql.

SQLLite-To-MySql-1

I found a way to create all tables quickly with a tool called SQLite to MySQL.

SQLite-to-MySQL is a powerful and reliable tool to convert SQLite databases to MySQL, MariaDB or Percona format. The program has high performance due to direct connection to source and destination databases (it does not use ODBC or any other middleware software). Command line support allows to script, automate and schedule the conversion process.

SQLLite-To-MySql-2

SQLLite-To-MySql-3

Features

  • All versions of Linux/Unix and Windows MySQL servers are supported
  • Option to customize resulting table structure
  • Convert indexes and relationships between tables
  • Stores conversion settings into profile
  • Option to filter data using SELECT-queries
  • Option to merge SQLite data into an existing MySQL database
  • Option to synchronize MySQL database with SQLite data
  • Support for multibyte character sets
  • Option to export SQLite database into MySQL script file
  • Verified compatibility with MariaDB and Percona
  • Option to customize MySQL storage engine and MySQL charset
  • Special approach for Virtual Server users
  • Command line support
  • Easy-to-use wizard-style interface
  • Full install/uninstall support
  • Unlimited 24/7 support service
  • 1-year subscription for updates
    SQLLite-To-MySql-7

Click here to download and try it.

Microsoft's Home Hub ambitions aim to crush Google Home and Amazon Echo

homehubui-concept

In what might be the most exciting part of this whole project, Microsoft is working on bringing the connected "smart home" to Windows 10 with Home Hub. The goal is to make Windows 10 the central hub for all your smart home devices, including lights, doors, locks and more. With Cortana integration allowing you to use your voice to toggle and control the smart devices in your home, the picture for Home Hub becomes complete: it brings Windows 10 to the center of your entire home.

Microsoft is building a dedicated "Connected Home" app that will make adding smart devices to your home easy; with an overview of all the smart devices in your home and options to turn them on and off, configure them, and more. You'll also be able to group devices to individual rooms; for example, you could have Hue lights 1, 2 and 3 grouped under the Bedroom tag and tell the Home Hub to "turn off the bedroom lights". This app will work much like most other smart home apps, except this one will have deep integration with Windows 10.

Home Hub Timeline

Home Hub is a massive project for Microsoft, with a lot of it planned across for Redstone 2, 3 and 4. It's unclear when we should expect to see the whole set of Home Hub features show up for consumers. Some sources have suggested the first batch of major Home Hub bits will arrive with Redstone 3, with smaller features such as Family Desktop showing up sooner with the Creators Update.

Although Microsoft has internal projections for this stuff, that doesn't make it immune from delays or even cancellations. That's a frequent occurrence at any tech company of Microsoft's size — internal projects don't always work out, and sometimes they rise and fall entirely without public knowledge of the plans.

Most of the sources we've spoken to have all said a lot of the Home Hub stuff had been delayed for more important changes and improvements that need to be made to Windows 10, which is understandable. No single source has explicitly said that the big Home Hub stuff has been canceled, but we have heard that it might be a while before any of the interesting stuff begins to show up in public.

Read more on WindowsCentral.

Advertsing

125X125_06

Planet Xamarin

Planet Xamarin

Calendar

<<  July 2017  >>
MonTueWedThuFriSatSun
262728293012
3456789
10111213141516
17181920212223
24252627282930
31123456

View posts in large calendar

Month List