Visual Studio 2017 is coming on March 7

VisualStudio2017LaunchEvent

Join us at 8:00 AM PST on March 7 for a two-day online event celebrating the launch of our latest version as well as 20 years of Visual Studio. Watch the live stream featuring Julia Liuson, Brian Harry, Miguel de Icaza, and Scott Hanselman as they share the newest innovations in Visual Studio, .NET, Xamarin, Azure, and more. After the keynote, Microsoft engineers will lead interactive technical demo sessions to help you get the most out of Visual Studio 2017 and the rest of our tools and platform.

On March 8, we’ll help you get productive even faster by hosting a full day of live interactive trainings. Don’t forget to click Save the Date above and sign up for email reminders!

Whether you are new to our tools or have been with us since the beginning, we’d love to hear and share your Visual Studio story. Share a photo of memorabilia or a short video clip of your story with Visual Studio on Instagram or post your story on Twitter and Facebook using #MyVSstory. Check out Julia’s launch event announcement for more details.

C# IL Viewer for Visual Studio Code using Roslyn side project

For the past couple of weeks I've been working on an IL (Intermediate Language) Viewer for Visual Studio Code. As someone that develops on a Mac, I spend a lot of time doing C# in VS Code or JetBrains' Rider editor - however neither of them have the ability to view the IL generated (I know JetBrains are working on this for Rider) so I set out to fix this problem as a side project.

As someone that's never written a Visual Studio Code extension before it was a bit of an abmitious first extension, but enjoyable none the less.

Today I released the first version of the IL Viewer (0.0.1) to the Visual Studio Code Marketplace so it's available to download and try via the link below:

Download IL Viewer for Visual Studio Code

Download C# IL Viewer for Visual Studio Code or install it directly within Visual Studio Code by launching Quick Open (CMD+P for Mac or CTRL+P for Windows) and pasting in the follow command and press enter.

ext install vscodeilviewer

The source code is all up on GitHub so feel free to take a look, but be warned - it's a little messy right now as it was hacked together to get it working.

il_viewer_animated

For more information you can visit this link.

Global Resources problem in Xamarin projects

Today I spent a lot of time to understand why my style doesn’t work.

<Application xmlns="http://xamarin.com/schemas/2014/forms" 
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
             x:Class="myProject.App">
    <Application.Resources>
        <ResourceDictionary>
            <Style x:Key="WarmGreyLine" TargetType="BoxView">
                <Setter Property="HeightRequest" Value="1" />
                <Setter Property="HorizontalOptions" Value="Fill" />
                <Setter Property="Color" Value="#EEE9E5" />
                <Setter Property="Margin" Value="0,10,0,10" />
            </Style>
        </ResourceDictionary>
    </Application.Resources>
</Application>

I followed a video about it on Xamarin University. Everything was the same. They say you can copy your style from a ContentPage.Resources and page in the Application.Resources section

    <ContentPage.Resources>
        <ResourceDictionary>
            <Style x:Key="WarmGreyLine" TargetType="BoxView">
                <Setter Property="HeightRequest" Value="1" />
                <Setter Property="HorizontalOptions" Value="Fill" />
                <Setter Property="Color" Value="#EEE9E5" />
                <Setter Property="Margin" Value="0,10,0,10" />
            </Style>
        </ResourceDictionary>
    </ContentPage.Resources>

The XAML is correct but if you execute the code you receive an error like:

Inner Exception: Position 38:14. StaticResource not found for key WarmGreyLine Message: Exception has been thrown by the target of an invocation.

The Solution

The is a little thing in the video they forgot to say!

In the App.xaml.cs you have to call InitializeComponent();

namespace myInventories
{
    public partial class App : Application
    {
        public App()
        {
            InitializeComponent();
        }
    }
} 

Happy coding!

Microsoft's new adaptive shell will help Windows 10 scale across PC, Mobile, and Xbox

The Windows Shell is essentially the Windows environment we all know and love. In layman's terms, it gives us access to system elements and objects necessary for running applications, and houses features such as the Taskbar, Start Menu, Desktop and more. Currently, the Windows Shell is different depending on the version of Windows 10 you're using. For example, Mobile is using a different Windows Shell than desktop; but Microsoft is working to change and streamline that.

windows-10-logo-intro

Microsoft is building an "adaptive shell" into Windows 10 that'll work across PCs and tablets, phones, HoloLens, and even Xbox. As it currently stands, the Windows Shell isn't a true universal element of Windows, unlike the OneCore subsystem and Universal Windows Apps. PCs and tablets share the same shell thanks to Continuum, but Mobile, HoloLens and Xbox have their own individual shells that are updated and maintained separately.

Over the next few Windows 10 releases however, Microsoft will be bringing each of these device categories under one Windows Shell, making for a true universal Windows 10 experience no matter what device you're using. Internally referred to as "Composable Shell" or "CSHELL", this new Windows Shell will be able to scale in real-time between all types of devices, similarly to how Continuum currently works between desktop mode and tablet mode, only this time it'll scale across Xbox and Mobile as well.

For our more techy readers, the Composable Shell is essentially a shell modularized into sub-components. The system can transition between each component if it is required, making for a much more flexible experience on devices like 2-in-1's or something that has multiple form-factors.

Microsoft’s Channel 9 introduces .Game, a new series focused on game development using .NET

Game-Host-Development-1031x580

Microsoft has introduced a new show to its Channel 9 video platform aimed at teaching and showing off Microsoft’s products and services. The new show is called .Game and aims to teach people how to develop games using .NET.

In this new series, viewers will be able to watch along and discover how game development works and how to do it themselves. The first episode of the show is already available and focuses on the basics with Unity, a popular game engine.

The above video introduces the .Game show. Stacey Haffner explains that the show will provide tips and tricks, as well as access to files on Github to make use of, in addition to resources and other tutorials that people may find helpful when it comes to game development.

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?

Advertsing

125X125_06

Planet Xamarin

Planet Xamarin

Calendar

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

View posts in large calendar

Month List