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.

Microsoft is working on a new design language for Windows 10 codenamed Project NEON

comparison_metro_vs_mdl2_a

Microsoft has made several adjustments to its design language over the last few years, starting with Windows 8 and evolving into what we now know as "Microsoft Design Language 2" or MDL2 in Windows 10. With MDL2 being the current design language used throughout Windows 10, Microsoft has plans to begin using a much more streamlined design language with Redstone 3, codenamed Project NEON.

A Metro 2.0?

Cassim Ketfi at Numerama.com confirms our information and has heard Project NEON called "basically Metro 2". That designation refers to the first Metro design language (née Modern) that harkens to Windows Media Center up through Windows Phone 7 and Windows 8.

Metro was the defining look of the Windows Phone OS with strict principles and guidelines. It also kicked off the design movement of flat, chrome-less design focused on simplicity that even iOS and Android now mimic.

Per our sources, Project NEON has been in the works for over a year internally at Microsoft. It builds upon the design language introduced with Windows 10, with its simple and clean interfaces, but adds some much-needed flair to the UI that the current design language just lacks.

Details are still scarce, but we hear some of the new designs in the plans include adding more animations and transitions, with the overall goal of making the UI very fluid and "beautiful" compared to the current, almost static UI that is MDL2. One source familiar with Microsoft's plans described NEON as "Very fluid, lots of motion and nice transitions."

Other things we've heard include app-elements being able to "escape" the borders of a window making for a much more unique experience.

Some more information about NEON reveals that it serves as a bridge between holographic and augmented reality (AR) and the desktop environment. It's a "UI that transports across devices" with a UX that maps to the physical world. It uses textures, 3D models, lighting and more.

groovedesign

Timeline

Internal plans appear to suggest that the bulk of this new design language will start showing up with Redstone 3 in the early Fall of 2017, but Insiders will likely start seeing these new changes a lot sooner, as Insiders are supposed to start receiving RS3 builds in April-May. There is also a reasonable chance we may see some NEON bits begin to appear in Redstone 2 in early 2017.

Microsoft will continue working on Project NEON throughout Redstone 3's development cycle and leading into Redstone 4 in 2018, where 3rd-party developers will also be able to take advantage of the new design language.

Satya Nadella: Microsoft building the 'ultimate mobile device'

Sadella-Melbourne

Microsoft CEO Satya Nadella has again reaffirmed the company's commitment to developing smartphones. Unfazed by its market share dropping beneath 1 percent, Nadella said Microsoft is planning a revolutionary "ultimate mobile device."

Nadella made the comments during an interview with the Australian Financial Review. He visited Sydney last week to address a local developers conference about Microsoft's cognitive computing systems and Azure cloud services.

Nadella outlined his plans for Microsoft's future involvement with smartphones. He suggested the company has stopped trying to rival the established leaders in the field. Instead, Microsoft is working on something for the future that it thinks will give it the upper-hand in the long term.

lumia1

Nadella hinted at an "ultimate mobile device" that could give Microsoft a credible presence in the industry. The company seems keen to develop a product with unique capabilities that aren't replicated by its rivals. A key feature that already fits this description is the company's Continuum tech, Windows 10 Mobile's ability to transform itself into a desktop PC at a moment's notice.

"We will continue to be in the phone market not as defined by today's market leaders, but by what it is that we can uniquely do in what is the most ultimate mobile device," Nadella said. "Therefore [with Nokia assets], we stopped doing things that were me-too and started doing things, even if they are today very sub-scale, to be very focused on a specific set of customers who need a specific set of capabilities that are differentiated and that we can do a good job of."

Xamarin Forms and Google Mobile Ads for iOS: update

In my previous post I explaind how to add on your application advertising. In those days Xamarin has removed from the Component Store the component called Google Mobile Ads for iOS.

Now you have to install another component called Firebase AdMob for iOS.

Firebase_admob_ios

After installed this component you can see in your Output window a similar info without see an advert in your app:

2016-11-18 11:28:14.853 WordBankEasy.iOS[11103:2250070] <Google> You must set the rootViewController property of <GADBannerView: 0x1034702c0; frame = (-10 0; 320 50); clipsToBounds = YES; layer = <CALayer: 0x174e39d40>> before loading a request.

To fix this issue you have to find before the right UIViewController. For that you can use the following code:

    UIViewController viewController = null;
    foreach (UIWindow rootView in UIApplication.SharedApplication.Windows) {
        if (rootView != null) {
            viewController = rootView.RootViewController;
        }
    }

    adView = new BannerView(size: AdSizeCons.Banner,
                            origin: new CGPoint(-10, 0))
    {
        AdUnitID = AdmobID,
        RootViewController = viewController
    };

Happy coding!

Advertsing

125X125_06

Planet Xamarin

Planet Xamarin

Calendar

<<  September 2017  >>
MonTueWedThuFriSatSun
28293031123
45678910
11121314151617
18192021222324
2526272829301
2345678

View posts in large calendar

Month List