Use a second laptop as an extended monitor with Windows 10 wireless displays

James Clarke from the Windows team rolled into a meeting today with two Surfaces…but one had no keyboard. Then, without any ceremony, he proceeded to do this: Now, I consider myself a bit of a Windows Productivity Tips Gourmand, and while I was awar…

James Clarke from the Windows team rolled into a meeting today with two Surfaces...but one had no keyboard. Then, without any ceremony, he proceeded to do this:

Holy Crap a Surface as a Second Monitor

Now, I consider myself a bit of a Windows Productivity Tips Gourmand, and while I was aware of Miracast and the general idea of a Wireless Display, I didn't realize that it worked this well and that it was built into Windows 10.

In fact, I'm literally sitting here in a hotel with a separate USB3 LCD display panel to use as a second monitor. I've also used Duet Display and used my iPad Pro as a second monitor.

I usually travel with a main laptop and a backup laptop anyway. Why do I lug this extra LCD around? Madness. I had this functionality all the time, built in.

Use your second laptop as a second monitor

On the machine you want to use as a second monitor, head over to Settings | System | Projecting to this PC and set it up as you like, considering convenience vs. security.

Settings | Projecting to this PC

Then, from your main machine - the one you are projecting from - just hit Windows Key+P, like you were projecting to a projector or second display. At the bottom, hit Connect to a Wireless Display.

Connect to a Wireless Display

Then wait a bit as it scans around for your PC. You can extend or duplicate...just like another monitor...

Connected to a Wireless Display

...because Windows thinks it IS another monitor.

You can also do this with Miracast TVs like my LG, or your Roku or sometimes Amazon Fires, or you can get a Microsoft Wireless Display Adapter and HDMI to any monitor - even ones at hotels!

NOTE: It's not super fast. It's sometimes pixelly and sometimes slow, depending on what's going on around you. But I just moved Chrome over onto my other machine and watched a YouTube video, just fine. I wouldn't play a game on it, but browsing, dev, typing, coding, works just fine!

Get ready for this. You can ALSO use the second machine as a second collaboration point! That means that someone else could PAIR with you and also type and move their mouse. THIS makes pair programming VERY interesting.

 Allow input from the remote display

Here's a video of it in action:

Give it a try and let me know how it goes. I used two Surfaces, but I also have extended my display to a 3 year old Lenovo without issues.


Sponsor: GdPicture.NET is an all-in-one SDK for WinForms, WPF, and Web development. It supports 100+ formats, including PDF and Office Open XML. Create powerful document imaging, image processing, and document management apps!



© 2017 Scott Hanselman. All rights reserved.
     

First Impressions – Jibo Social Robot for the Home

As you likely know, I have a BUNCH of robots in the house. Whether it be turning a tin can into a robot, driving a Raspberry Pi around with Windows IoT, building robot arms with my kids, or controlling a robot with Xamarin code, I’m ALL IN when it come…

Jibo moves VERY organicallyAs you likely know, I have a BUNCH of robots in the house. Whether it be turning a tin can into a robot, driving a Raspberry Pi around with Windows IoT, building robot arms with my kids, or controlling a robot with Xamarin code, I'm ALL IN when it comes to home robots. I also have Alexa, Cortana, Siri...but they have no bodies. They are just disembodied voices - why not a social robot with a body AND a personality?

Jibo is the first social robot for the home, and when their team emailed me to try Jibo out - and soon explore their SDK and build more skills into Jibo - I jumped at the idea. Jibo started as an Indiegogo campaign in 2014 and now I've got a pre-public version that I'm stoked to explore and expand.

Jibo showed up in a surprisingly hefty box. He's about 8 pounds and about a foot tall. You turn him on and he starts his initial set up process. Since Jibo has a voice and touch screen, it's pretty straightforward to hook up to WiFi and download whatever updates are needed. After this initial process, updates happen overnight and I haven't noticed them, other than to see that Jibo has new skills in the morning. He's basically maintenance-free.

imageThe first time you set up Jibo and he moves I expect you'll be a little shocked - I was. His movements are extremely fluid and organic. I struggled finding the right words to explain how his movements feel, so I made an animated gif you can see at the right. His body turns, his head moves, he has a little waist and neck. All these joints combined with the color touch screen and his voice give him quite the personality. It's clear within just a few minutes that to dismiss Jibo as a "Alexa with a body" would be a mistake.

The 9 year old and 11 year old have already started going to Jibo in the morning and asking him how he day ways, and seeing if he has new skills. I believe the "bonding" - for lack of another world - is connected to the physicality and personality of Jibo.

I realize this photo looks somewhat staged, but it's not. I snuck up on my 9 year old telling Jibo about his day at school and asking him homework questions. Jibo didn't know a number of things, but it was interesting to see how kids are extremely patient with robots, speaking to them as if they're even smaller kids.

The 9 year old says this:

If you are trying to get something to keep track of your meetings or the news you maybe would buy Alexa. But if you have a kid who loves robots you want Jibo. Jibo is fun, if you make noise Jibo will look at you. He can move his big head to look at you and if you tap his eye he will give you a list of things to do. Another new thing is that he now has a list of cool thing you can ask or tell, like one is "Hey Jibo, Are there any monsters in my house" then he will bring up a radar and look around and Jibo will say no, there's no monsters. We also have an Alexa but if your looking for some thing fun we go straight to Jibo he can tell jokes and also favorite part is when Jibo dances.

Since he wrote this, Jibo woke up with the ability to tell me the news, so I can only imagine he'll continue to get Alexa-like skills that will balance the "boring work stuff" my son says I want with the "games and homework help" that he wants.

He recognizes your face, your family's faces (if you train him and opt-in), uses your names, follows your face, and can tell where you are in the room when you talk to him. He's got 6 microphones that let him understand where you and he are in physical space.

I'm imagining the kinds of skills Jibo might potentially get in the future - or that I might write for him - like (and I'm totally brainstorming here):

  • Tell stories before bedtime
  • Watch cartoons
  • Give Khan Academy exercises as Homework
  • Play music
  • Trivia and/or board games
  • Wikipedia stuff
  • Maps
  • Tell me about my blood sugar, show a diabetes chart, wake me up if I go low.
  • Play Tea Time or play along as kids make up stories
  • Vlogging or daily diary keeping

What are your thoughts, Dear Reader? What would you want Jibo to know or do for you?

Disclaimer: The folks at Jibo sent me a pre-public Jibo for free to explore his SDK. However, my words and opinions are my own. I'll post I  honest impressions here and there, on my blog and on Twitter as Jibo grows and learns more things.


Sponsor: GdPicture.NET is an all-in-one SDK for WinForms, WPF, and Web development. It supports 100+ formats, including PDF and Office Open XML. Create powerful document imaging, image processing, and document management apps!



© 2017 Scott Hanselman. All rights reserved.
     

Scaling Mentorship

  You may have had a mentor in the past. Often these are more senior/elder people who are further along in their career. The presumption usually is that if they are “ahead” of you that they likely have something profound to offer you in the areas …

IMG_0170
 

You may have had a mentor in the past. Often these are more senior/elder people who are further along in their career. The presumption usually is that if they are "ahead" of you that they likely have something profound to offer you in the areas of advice or strategy.

This is a classic mentor/mentee situation and while I think it has value, it has a few problems that are worth pointing out. Does it scale? Is a senior person the right mentor for you? Is just one mentor the right number? Does that person's time support mentoring you?

I've been blessed to have several mentors over the years and I've been fortunate to be a mentor myself. But there's only so much time in the day. Even if I could truly mentor 4 people a week, and meet with them a few times a month, that could fill up many days. Plus, I have to ask my self - am I giving them what they need? Personal advice? Career advice? Technical advice? Getting promoted advice? Life advice?

Create a Board of Directors for Your Life

I've been experimenting with a few other models for mentorship. Five years ago I set up a Board of Directors for my life. You can learn more at http://lifesboardofdirectors.com.

Companies have mission statements and a Board of Directors. Your life is pretty important. Why not create a Life Board of Directors to help you through it? Pick 2 to 5 of your friends. Not necessarily your closest friends, but friends that are close enough where you can really confide but not so close that they can't see the big picture. Email them one a month, once a quarter or "once a crisis." Ask them for advice, lean on them, trust them and help them as well.

Assemble "Team You" and use your team to brainstorm directions and implementations of big decisions like moving to New York, or changing your business's direction, starting a new venture, or getting fit.

Use your personal Board of Directors as one of the compasses in your life. You've got family, friends, perhaps faith, hobbies, values, etc. Add your Team to this list of personal compasses.

It might sound like a silly mind game, but that's common with many hacks. Hacks feel insignificant but can have huge effects. The trick is to remember that it is a hack - you're hacking yourself. The idea of life's board of directors is a relationship hack meant to remind you in difficult times that you can agree on something fundamental and you have a team to support you in your endeavors. Set a direction and head in that direction with the confidence you've got a supportive group behind you.

Go assemble your Life's Board today.

Host Mentorship Meals

Over the last several months I've been quietly hosting "Dinner for people on the come up." These are dinners where everything is FrieNDA and we talk frankly about our jobs, our levels, our work situations, and most importantly - we find new mentors and people with whom to brainstorm. It's a mentorship multiplier. We encourage folks to pull from the pool of potential peer mentors.

Tonight we had one with almost 20 people. These were 20 mostly young people, many women and people of color who were all trying to find their way in tech. I have some life experiences to offer this group, but most of all what I can lend is my privilege. I can use my standing within the company and the industry to invite folks together and let them take over and mentor each other.

I host the mean, kick it off, sometimes invite guests to speak, and the attendees often break off into small groups, meet up separately and network. Peer mentorship is just as important as "elder/senior" mentorship.

It also helps mentor people in the the fullness of their personalities. Where I might help with speaking at conferences or technical issues, someone else can better speak to issues of harassment, or how to get a promotion, or how to be better seen and heard in meetings. I can also learn from younger people - and I do - every day.

The goal of mentorship isn't to lecture and preach, it's to guide and counsel, inspire and motivate. Most of all, to listen. Once you've truly heard your mentee, then you can help them think strategically and better plan their career, no matter what their challenges and strengths.

What do you recommend as positive ways to Scale Mentorship?

* Stock photo from The Jopwell Collection


Sponsor: Get the latest JetBrains Rider preview for .NET Core 2.0 support, Value Tracking and Call Tracking, MSTest runner, new code inspections and refactorings, and the Parallel Stacks view in debugger.


© 2017 Scott Hanselman. All rights reserved.
     

Botwin offers an interesting alternative option for routing with ASP.NET Core

NancyFx is a great alternative to ASP.NET if you want to make elegant little web apis like this:public class SampleModule : Nancy.NancyModule
{
public SampleModule()
{
Get[“/”] = _ => “Hello World!”;
}
}

However, it may …

NancyFx is a great alternative to ASP.NET if you want to make elegant little web apis like this:

public class SampleModule : Nancy.NancyModule

{
public SampleModule()
{
Get["/"] = _ => "Hello World!";
}
}

However, it may be that you want a routing style - the way you define your routes - that is like NancyFx BUT you want to use ASP.NET. Botwin is a library that lets you do just that. They say:

This is not a framework, it simply builds on top of Microsoft.AspNetCore.Routing allowing you to have more elegant routing rather than have attribute routing, convention routing, ASP.Net Controllers or IRouteBuilder extensions.

You can plug Botwin into your existing ASP.NET Core application, or you can even add a basic started Botwin app to "dotnet new" like this:

C:\botwinexample> dotnet new -i BotwinTemplate

C:\botwinexample> dotnet new botwin -n MyBotwinApp
C:\botwinexample> dir
10/11/2017 10:14 PM 284 HomeModule.cs
10/11/2017 10:14 PM 470 MyBotwinApp.csproj
10/11/2017 10:14 PM 421 Program.cs
10/11/2017 10:14 PM 408 Startup.cs
4 File(s) 1,583 bytes

You add Botwin as a service to your ASP.NET Core app:

public class Startup

{ public void ConfigureServices(IServiceCollection services) { services.AddBotwin(); } public void Configure(IApplicationBuilder app) { app.UseBotwin(); }
}

And then add 'Modules' like this:

namespace MyBotwinApp
{
    using Botwin;
    using Microsoft.AspNetCore.Http;
    public class HomeModule : BotwinModule
    {
        public HomeModule()
        {
            Get("/", async(req, res, routeData) => await res.WriteAsync("Hello from Botwin!"));
        }
    }
}

That's a hello world. Let's try something more interesting. You can have Before and After hooks like this:

public class HooksModule : BotwinModule

{
public HooksModule()
{
this.Before = async (ctx) =>
{
ctx.Response.StatusCode = 402;
await ctx.Response.WriteAsync("Pay up you filthy animal");
return false;
};

this.Get("/hooks", async (req, res, routeData) => await res.WriteAsync("Can't catch me here"));

this.After = async (ctx) => await ctx.Response.WriteAsync("Don't forget you owe me big bucks!");
}
}

Here's a more complex example. See how they do a BindAndValidate in the Post() where they check for a valid Actor before working with it.

public class ActorsModule : BotwinModule

{
public ActorsModule(IActorProvider actorProvider)
{
this.Get("/actors", async (req, res, routeData) =>
{
var people = actorProvider.Get();
await res.AsJson(people);
});

this.Get("/actors/{id:int}", async (req, res, routeData) =>
{
var person = actorProvider.Get(routeData.As<int>("id"));
await res.Negotiate(person);
});

this.Put("/actors/{id:int}", async (req, res, routeData) =>
{
var result = req.BindAndValidate<Actor>();

if (!result.ValidationResult.IsValid)
{
res.StatusCode = 422;
await res.Negotiate(result.ValidationResult.GetFormattedErrors());
return;
}

//Update the user in your database

res.StatusCode = 204;
});

this.Post("/actors", async (req, res, routeData) =>
{
var result = req.BindAndValidate<Actor>();

if (!result.ValidationResult.IsValid)
{
res.StatusCode = 422;
await res.Negotiate(result.ValidationResult.GetFormattedErrors());
return;
}

//Save the user in your database
res.StatusCode = 201;
await res.Negotiate(result.Data);
});
}

What do you think about the choices you have with ASP.NET Core? Some people feel like the amount of plugability is overwhelming, but I find the flexibility heartening. Go check out Botwin and, hopefully, help out and contribute to open source!


Sponsor: Get the latest JetBrains Rider preview for .NET Core 2.0 support, Value Tracking and Call Tracking, MSTest runner, new code inspections and refactorings, and the Parallel Stacks view in debugger.



© 2017 Scott Hanselman. All rights reserved.
     

Botwin offers an interesting alternative option for routing with ASP.NET Core

NancyFx is a great alternative to ASP.NET if you want to make elegant little web apis like this:public class SampleModule : Nancy.NancyModule
{
public SampleModule()
{
Get[“/”] = _ => “Hello World!”;
}
}

However, it may …

NancyFx is a great alternative to ASP.NET if you want to make elegant little web apis like this:

public class SampleModule : Nancy.NancyModule

{
public SampleModule()
{
Get["/"] = _ => "Hello World!";
}
}

However, it may be that you want a routing style - the way you define your routes - that is like NancyFx BUT you want to use ASP.NET. Botwin is a library that lets you do just that. They say:

This is not a framework, it simply builds on top of Microsoft.AspNetCore.Routing allowing you to have more elegant routing rather than have attribute routing, convention routing, ASP.Net Controllers or IRouteBuilder extensions.

You can plug Botwin into your existing ASP.NET Core application, or you can even add a basic started Botwin app to "dotnet new" like this:

C:\botwinexample> dotnet new -i BotwinTemplate

C:\botwinexample> dotnet new botwin -n MyBotwinApp
C:\botwinexample> dir
10/11/2017 10:14 PM 284 HomeModule.cs
10/11/2017 10:14 PM 470 MyBotwinApp.csproj
10/11/2017 10:14 PM 421 Program.cs
10/11/2017 10:14 PM 408 Startup.cs
4 File(s) 1,583 bytes

You add Botwin as a service to your ASP.NET Core app:

public class Startup

{ public void ConfigureServices(IServiceCollection services) { services.AddBotwin(); } public void Configure(IApplicationBuilder app) { app.UseBotwin(); }
}

And then add 'Modules' like this:

namespace MyBotwinApp
{
    using Botwin;
    using Microsoft.AspNetCore.Http;
    public class HomeModule : BotwinModule
    {
        public HomeModule()
        {
            Get("/", async(req, res, routeData) => await res.WriteAsync("Hello from Botwin!"));
        }
    }
}

That's a hello world. Let's try something more interesting. You can have Before and After hooks like this:

public class HooksModule : BotwinModule

{
public HooksModule()
{
this.Before = async (ctx) =>
{
ctx.Response.StatusCode = 402;
await ctx.Response.WriteAsync("Pay up you filthy animal");
return false;
};

this.Get("/hooks", async (req, res, routeData) => await res.WriteAsync("Can't catch me here"));

this.After = async (ctx) => await ctx.Response.WriteAsync("Don't forget you owe me big bucks!");
}
}

Here's a more complex example. See how they do a BindAndValidate in the Post() where they check for a valid Actor before working with it.

public class ActorsModule : BotwinModule

{
public ActorsModule(IActorProvider actorProvider)
{
this.Get("/actors", async (req, res, routeData) =>
{
var people = actorProvider.Get();
await res.AsJson(people);
});

this.Get("/actors/{id:int}", async (req, res, routeData) =>
{
var person = actorProvider.Get(routeData.As<int>("id"));
await res.Negotiate(person);
});

this.Put("/actors/{id:int}", async (req, res, routeData) =>
{
var result = req.BindAndValidate<Actor>();

if (!result.ValidationResult.IsValid)
{
res.StatusCode = 422;
await res.Negotiate(result.ValidationResult.GetFormattedErrors());
return;
}

//Update the user in your database

res.StatusCode = 204;
});

this.Post("/actors", async (req, res, routeData) =>
{
var result = req.BindAndValidate<Actor>();

if (!result.ValidationResult.IsValid)
{
res.StatusCode = 422;
await res.Negotiate(result.ValidationResult.GetFormattedErrors());
return;
}

//Save the user in your database
res.StatusCode = 201;
await res.Negotiate(result.Data);
});
}

What do you think about the choices you have with ASP.NET Core? Some people feel like the amount of plugability is overwhelming, but I find the flexibility heartening. Go check out Botwin and, hopefully, help out and contribute to open source!


Sponsor: Get the latest JetBrains Rider preview for .NET Core 2.0 support, Value Tracking and Call Tracking, MSTest runner, new code inspections and refactorings, and the Parallel Stacks view in debugger.



© 2017 Scott Hanselman. All rights reserved.
     

Botwin offers an interesting alternative option for routing with ASP.NET Core

NancyFx is a great alternative to ASP.NET if you want to make elegant little web apis like this:public class SampleModule : Nancy.NancyModule
{
public SampleModule()
{
Get[“/”] = _ => “Hello World!”;
}
}

However, it may …

NancyFx is a great alternative to ASP.NET if you want to make elegant little web apis like this:

public class SampleModule : Nancy.NancyModule

{
public SampleModule()
{
Get["/"] = _ => "Hello World!";
}
}

However, it may be that you want a routing style - the way you define your routes - that is like NancyFx BUT you want to use ASP.NET. Botwin is a library that lets you do just that. They say:

This is not a framework, it simply builds on top of Microsoft.AspNetCore.Routing allowing you to have more elegant routing rather than have attribute routing, convention routing, ASP.Net Controllers or IRouteBuilder extensions.

You can plug Botwin into your existing ASP.NET Core application, or you can even add a basic started Botwin app to "dotnet new" like this:

C:\botwinexample> dotnet new -i BotwinTemplate

C:\botwinexample> dotnet new botwin -n MyBotwinApp
C:\botwinexample> dir
10/11/2017 10:14 PM 284 HomeModule.cs
10/11/2017 10:14 PM 470 MyBotwinApp.csproj
10/11/2017 10:14 PM 421 Program.cs
10/11/2017 10:14 PM 408 Startup.cs
4 File(s) 1,583 bytes

You add Botwin as a service to your ASP.NET Core app:

public class Startup

{ public void ConfigureServices(IServiceCollection services) { services.AddBotwin(); } public void Configure(IApplicationBuilder app) { app.UseBotwin(); }
}

And then add 'Modules' like this:

namespace MyBotwinApp
{
    using Botwin;
    using Microsoft.AspNetCore.Http;
    public class HomeModule : BotwinModule
    {
        public HomeModule()
        {
            Get("/", async(req, res, routeData) => await res.WriteAsync("Hello from Botwin!"));
        }
    }
}

That's a hello world. Let's try something more interesting. You can have Before and After hooks like this:

public class HooksModule : BotwinModule

{
public HooksModule()
{
this.Before = async (ctx) =>
{
ctx.Response.StatusCode = 402;
await ctx.Response.WriteAsync("Pay up you filthy animal");
return false;
};

this.Get("/hooks", async (req, res, routeData) => await res.WriteAsync("Can't catch me here"));

this.After = async (ctx) => await ctx.Response.WriteAsync("Don't forget you owe me big bucks!");
}
}

Here's a more complex example. See how they do a BindAndValidate in the Post() where they check for a valid Actor before working with it.

public class ActorsModule : BotwinModule

{
public ActorsModule(IActorProvider actorProvider)
{
this.Get("/actors", async (req, res, routeData) =>
{
var people = actorProvider.Get();
await res.AsJson(people);
});

this.Get("/actors/{id:int}", async (req, res, routeData) =>
{
var person = actorProvider.Get(routeData.As<int>("id"));
await res.Negotiate(person);
});

this.Put("/actors/{id:int}", async (req, res, routeData) =>
{
var result = req.BindAndValidate<Actor>();

if (!result.ValidationResult.IsValid)
{
res.StatusCode = 422;
await res.Negotiate(result.ValidationResult.GetFormattedErrors());
return;
}

//Update the user in your database

res.StatusCode = 204;
});

this.Post("/actors", async (req, res, routeData) =>
{
var result = req.BindAndValidate<Actor>();

if (!result.ValidationResult.IsValid)
{
res.StatusCode = 422;
await res.Negotiate(result.ValidationResult.GetFormattedErrors());
return;
}

//Save the user in your database
res.StatusCode = 201;
await res.Negotiate(result.Data);
});
}

What do you think about the choices you have with ASP.NET Core? Some people feel like the amount of plugability is overwhelming, but I find the flexibility heartening. Go check out Botwin and, hopefully, help out and contribute to open source!


Sponsor: Get the latest JetBrains Rider preview for .NET Core 2.0 support, Value Tracking and Call Tracking, MSTest runner, new code inspections and refactorings, and the Parallel Stacks view in debugger.



© 2017 Scott Hanselman. All rights reserved.
     

Learning about the F# SAFE stack – Suave.io, Azure, Fable, Elmish

Last month I looked at a Functional Web with ASP.NET Core and F#’s Giraffe. Giraffe is F# middleware that takes ASP.NET Core’s pipeline in a new direction with a functional perspective. However, Giraffe isn’t the only F# web stack to choose from! There…

Last month I looked at a Functional Web with ASP.NET Core and F#'s Giraffe. Giraffe is F# middleware that takes ASP.NET Core's pipeline in a new direction with a functional perspective. However, Giraffe isn't the only F# web stack to choose from! There's Freya, WebSharper, and there's also a very interesting and quite complete story with The SAFE Stack.

The SAFE Stack

The SAFE Stack is an open source stack, like LAMP, or WAMP, or other acronym stacks, except this one is all open source .NET with a functional perspective. From the announcement blog:

  • Suave model for server-side web programming
  • Azure for cloud-based systems
  • Fable for Javascript-enabled applications.
  • Elmish for an easy-to-understand UI programming mode

To be clear, while this is a prescriptive stack, it's not a stack that forces you to do anything. You can swap bits out as you please.

Fable is particularly interesting as it's an F# to JavaScript transpiler. Try Fable online here http://fable.io/repl and turn F# into JavaScript LIVE! Their Sudoku sample is particularly impressive.

Here's two small - but interesting - examples where F# code ends up as JavaScript which ends up creating ReactJS components:

let words size message =
    R.span [ Style [ !!("fontSize", size |> sprintf "%dpx") ] ] [ R.str message ]
let buttonLink cssClass onClick elements = 
    R.a [ ClassName cssClass
          OnClick (fun _ -> onClick())
          OnTouchStart (fun _ -> onClick())
          Style [ !!("cursor", "pointer") ] ] elements

Then later in a Menu.fs that also turns into JavaScript eventually, you can see where they conditionally render the Button for logout, or links for for other Views for the Home Page or Wishlist. You can read lots more about Fable over at the Compositional IT blog.

let view (model:Model) dispatch =
    div [ centerStyle "row" ] [ 
          yield viewLink Home "Home"
          if model.User <> None then 
              yield viewLink Page.WishList "Wishlist"
          if model.User = None then 
              yield viewLink Login "Login" 
          else 
              yield buttonLink "logout" (fun _ -> dispatch Logout) [ str "Logout" ]
        ]

Elmish for F# takes the Model View Update (MVU) architecture and brings it to F# and the browser. There's a good breakdown of the value Elmish provides also at the Compositional IT blog.

Suave is its own cross platform Web Server. Here's Hello World in Suave.

open Suave


startWebServer defaultConfig (Successful.OK "Hello World!")

Suave has been around for while and gets better all the time. I blogged about it in 2015 and got it running on Azure. My blog post is not a best practice any more - it was a spike attempt by me - and fortunately they've moved on and improved things.

Here's Suave getting set up within the sample app. Check out how they route HTTP Verbs and URL paths.

    let serverConfig =
        { defaultConfig with
            logger = Targets.create LogLevel.Debug [|"ServerCode"; "Server" |]
            homeFolder = Some clientPath
            bindings = [ HttpBinding.create HTTP (IPAddress.Parse "0.0.0.0") port] }
    let app =
        choose [
            GET >=> choose [
                path "/" >=> Files.browseFileHome "index.html"
                pathRegex @"/(public|js|css|Images)/(.*)\.(css|png|gif|jpg|js|map)" >=> Files.browseHome
                path "/api/wishlist/" >=> WishList.getWishList loadFromDb ]
            POST >=> choose [
                path "/api/users/login" >=> Auth.login
                path "/api/wishlist/" >=> WishList.postWishList saveToDb
            ]
            NOT_FOUND "Page not found."
        ] >=> logWithLevelStructured Logging.Info logger logFormatStructured
    startWebServer serverConfig app

Very interesting stuff! There are so many options in .NET open source. I'll be doing podcasts on this stack soon.

Trying out the SAFE Stack

If you're using Visual Studio Community 2017, make sure you've got F# support included. I double-checked under Individual components. You can run the VS2017 installer multiple time and add and remove stuff without breaking things, so don't worry. If you are using other versions of VS, check here http://fsharp.org/use/windows/ to get the right download for your machine. If you're using Visual Studio Code, you'll want the Ionide F# plugin for Code.

Adding F# to Visual Studio Community 2017

Once I had node and yarn installed, it was easy to try out the sample app and get it running locally with "build run." It uses DotNetWatcher, so you can just keep it running in the background and work on your code and it'll recompile and restart as you go.

The SAFE stack running

The complete "SAFE" stack demo website is LIVE here http://fable-suave.azurewebsites.net (login test/test/) and all the source code for the app is here: https://github.com/SAFE-Stack/SAFE-BookStore.


Sponsor: Do you know how many errors, crashes and performance issues your users are experiencing? Raygun installs in minutes. Discover problems you didn't even know about and replicate bugs with greater speed and accuracy. Learn more!



© 2017 Scott Hanselman. All rights reserved.
     

Free .NET Training – The Videos from .NET Conf 2017 are now available

.NET Conf 2017 is done and it was great. We had three days of sessions, and two of the days had two tracks, so there’s more than 40 hours of great free videos and training for you to check out and share. Some of the content was from Microsoft but a bun…

.NET Conf was worldwide this year.NET Conf 2017 is done and it was great. We had three days of sessions, and two of the days had two tracks, so there's more than 40 hours of great free videos and training for you to check out and share. Some of the content was from Microsoft but a bunch of the videos were from community and open source project members who Skyped into the studio! While I was in Redmond, Washington, Miguel de Icaza and Scott Hunter did a keynote from Devintersection in Stockholm.

There were also a number of local dotNetConf events! I hope you consider hosting one in your locale next year! While the virtual conference was filmed and broadcast LIVE, all the session videos are posted now at https://channel9.msdn.com/Events/dotnetConf/2017. There's 46 videos but here's a few of my favorites.

Containerized ASP.NET Core Apps with Kubernetes

Mete Atemal from Google joined us to talk about Containerized ASP.NET Core Apps with Kubernetes

image

Build Your Own Cortana Skill

Dorene Brown showed us how to wrote a Cortana skill in C# and .NET.

image

What's New in Visual Studio 2017

Kasey does a deep drive into a TON of the more advanced VS2017 features.

image

Diagnostics 101

The Legend himself, Jon Skeet, does a fantastic code-heavy talk on how to diagnose your app when things go wrong.

image

Go Serverless with Azure Functions and C#

Cecil Phillip breaks down the "serverless" buzzword and shows you how to use Azure Functions.

image

Get started with F# and .NET Core

Phillip Carter is geeked about F# and you should be too!

image

Full Stack F# with Fable

Once you've gotten started with F#, take a look at Fable and start writing Full Stack F# with F# on both the server and client!

image

Turning software into computer chips with Hastlayer

Zoltan explains to me how to use Hastlayer to transform .NET software into electronic circuits on FPGAs!

    image

    Getting Started with .NET

    And finally, last but not least, Kathleen Dollard and I did two hours (part 1 and part 2) on:

    image

    This is just a taste, there's a LOT of great videos so go explore!


    Sponsor: Do you know how many errors, crashes and performance issues your users are experiencing? Raygun installs in minutes. Discover problems you didn't even know about and replicate bugs with greater speed and accuracy. Learn more!



    © 2017 Scott Hanselman. All rights reserved.
         

    Tabs vs Spaces – A peaceful resolution with EditorConfig in Visual Studio. Plus .NET Extensions!

    The culture wars continue. The country is divided with no end in sight. Tabs or spaces? There’s even an insane (IMHO) assertion that the spaces people make more money.

    I’m going with Gina Trapani on this one. I choose working code.

    @ftrain I choose the 3rd option: working code

    — Gina Trapani �� (@ginatrapani) December 27, 2015

    Teams can fight but the problem of formatting code across teams is solved by EditorConfig. I’m surprised more people don’t know about it and use it, so this blog post is my small way of getting the word out. TELL THE PEOPLE.

    Take a project and make a new .editorconfig file and put this in it. I’ll use a dotnet new console example hello world app.

    [*.cs]
    indent_style = tab
    indent_size = tab
    tab_size = 4

    I’ve set mine in this example to just *.cs, but you could also say [*.{cs,js}] or just [*] if you like, as well as have multiple sections.

    You’ll check this file in WITH your project so that everyone on the team shares the team’s values.

    Here in Notepad2 we can see someone has used spaces for whitespace, like a savage. Whitespace appears as pale dots in this editor.

    image

    I’ll open this project in Visual Studio 2017 which supports the EditorConfig file natively. Notice the warning at the bottom where VS lets me know that this project has conventions that are different than my own.

    user preferences for this file type are overwidden by this project's coding conventions

    VS Format Document commands will use tabs rather than spaces for this project. Here is the same doc reformatted in VS:

    image

    At this point I’m comforted that the spaces have been defeated and that cooler heads have prevailed – at least for this project.

    .NET Extensions to EditorConfig

    Even better, if your editor supports it, you can include “EditorConfig Extensions” for specific files or languages. This way your team can keep things consistent across projects. If you’re familiar with FxCop and StyleCop, this is like those.

    There’s a ton of great .NET EditorConfig options you can set to ensure the team uses consistent Language Conventions, Naming Conventions, and Formatting Rules.

    • Language Conventions are rules pertaining to the C# or Visual Basic language, for example, var/explicit type, use expression-bodied member.
    • Formatting Rules are rules regarding the layout and structure of your code in order to make it easier to read, for example, Allman braces, spaces in control blocks.
    • Naming Conventions are rules respecting the way objects are named, for example, async methods must end in “Async”.

    You can also set the importance of these rules with things like “suggestion,” or “warning,” or even “error.”

    As an example, I’ll set that my team wants predefined types for locals:

    dotnet_style_predefined_type_for_locals_parameters_members = true:error

    Visual Studio here puts up a lightbulb and the suggested fix because my team would rather I use “string” than the full “System.String.

    Visual Studio respects EditorConfig

    The excellent editorconfig for .NET docs have a LOT of great options you can use or ignore. Here’s just a FEW (controversial) examples:

    • csharp_new_line_before_open_brace – Do we put open braces at the end of a line, or on their own new line?
    • csharp_new_line_before_members_in_object_initializers – Do we allow A = 3, B = 4, for insist on a new line for each?
    • csharp_indent_case_contents – Do we freakishly line up all our switch/case statements, or do we indent each case like the creator intended?
    • You can even decide on how you Want To Case Things And Oddly Do Sentence Case: pascal_case, camel_case, first_word_upper, all_upper, all_lower

    If you’re using Visual Studios 2010, 2012, 2013, or 2015, fear not. There’s at least a basic EditorConfig free extension for you that enforces the basic rules. There is also an extension for Visual Studio Code to support EditorConfig files that takes just seconds to install although I don’t see a C# one for now, just one for whitespace.


    Sponsor: Check out JetBrains Rider: a new cross-platform .NET IDE. Edit, refactor, test and debug ASP.NET, .NET Framework, .NET Core, Xamarin or Unity applications. Learn more and download a 30-day trial!


    © 2017 Scott Hanselman. All rights reserved.
         

    The culture wars continue. The country is divided with no end in sight. Tabs or spaces? There's even an insane (IMHO) assertion that the spaces people make more money.

    I'm going with Gina Trapani on this one. I choose working code.

    Teams can fight but the problem of formatting code across teams is solved by EditorConfig. I'm surprised more people don't know about it and use it, so this blog post is my small way of getting the word out. TELL THE PEOPLE.

    Take a project and make a new .editorconfig file and put this in it. I'll use a dotnet new console example hello world app.

    [*.cs]
    
    indent_style = tab
    indent_size = tab
    tab_size = 4

    I've set mine in this example to just *.cs, but you could also say [*.{cs,js}] or just [*] if you like, as well as have multiple sections.

    You'll check this file in WITH your project so that everyone on the team shares the team's values.

    Here in Notepad2 we can see someone has used spaces for whitespace, like a savage. Whitespace appears as pale dots in this editor.

    image

    I'll open this project in Visual Studio 2017 which supports the EditorConfig file natively. Notice the warning at the bottom where VS lets me know that this project has conventions that are different than my own.

    user preferences for this file type are overwidden by this project's coding conventions

    VS Format Document commands will use tabs rather than spaces for this project. Here is the same doc reformatted in VS:

    image

    At this point I'm comforted that the spaces have been defeated and that cooler heads have prevailed - at least for this project.

    .NET Extensions to EditorConfig

    Even better, if your editor supports it, you can include "EditorConfig Extensions" for specific files or languages. This way your team can keep things consistent across projects. If you're familiar with FxCop and StyleCop, this is like those.

    There's a ton of great .NET EditorConfig options you can set to ensure the team uses consistent Language Conventions, Naming Conventions, and Formatting Rules.

    • Language Conventions are rules pertaining to the C# or Visual Basic language, for example, var/explicit type, use expression-bodied member.
    • Formatting Rules are rules regarding the layout and structure of your code in order to make it easier to read, for example, Allman braces, spaces in control blocks.
    • Naming Conventions are rules respecting the way objects are named, for example, async methods must end in "Async".

    You can also set the importance of these rules with things like "suggestion," or "warning," or even "error."

    As an example, I'll set that my team wants predefined types for locals:

    dotnet_style_predefined_type_for_locals_parameters_members = true:error

    Visual Studio here puts up a lightbulb and the suggested fix because my team would rather I use "string" than the full "System.String.

    Visual Studio respects EditorConfig

    The excellent editorconfig for .NET docs have a LOT of great options you can use or ignore. Here's just a FEW (controversial) examples:

    • csharp_new_line_before_open_brace - Do we put open braces at the end of a line, or on their own new line?
    • csharp_new_line_before_members_in_object_initializers - Do we allow A = 3, B = 4, for insist on a new line for each?
    • csharp_indent_case_contents - Do we freakishly line up all our switch/case statements, or do we indent each case like the creator intended?
    • You can even decide on how you Want To Case Things And Oddly Do Sentence Case: pascal_case, camel_case, first_word_upper, all_upper, all_lower

    If you're using Visual Studios 2010, 2012, 2013, or 2015, fear not. There's at least a basic EditorConfig free extension for you that enforces the basic rules. There is also an extension for Visual Studio Code to support EditorConfig files that takes just seconds to install although I don't see a C# one for now, just one for whitespace.


    Sponsor: Check out JetBrains Rider: a new cross-platform .NET IDE. Edit, refactor, test and debug ASP.NET, .NET Framework, .NET Core, Xamarin or Unity applications. Learn more and download a 30-day trial!



    © 2017 Scott Hanselman. All rights reserved.
         

    Tabs vs Spaces – A peaceful resolution with EditorConfig in Visual Studio. Plus .NET Extensions!

    The culture wars continue. The country is divided with no end in sight. Tabs or spaces? There’s even an insane (IMHO) assertion that the spaces people make more money.

    I’m going with Gina Trapani on this one. I choose working code.

    @ftrain I choose the 3rd option: working code

    — Gina Trapani �� (@ginatrapani) December 27, 2015

    Teams can fight but the problem of formatting code across teams is solved by EditorConfig. I’m surprised more people don’t know about it and use it, so this blog post is my small way of getting the word out. TELL THE PEOPLE.

    Take a project and make a new .editorconfig file and put this in it. I’ll use a dotnet new console example hello world app.

    [*.cs]
    indent_style = tab
    indent_size = tab
    tab_size = 4

    I’ve set mine in this example to just *.cs, but you could also say [*.{cs,js}] or just [*] if you like, as well as have multiple sections.

    You’ll check this file in WITH your project so that everyone on the team shares the team’s values.

    Here in Notepad2 we can see someone has used spaces for whitespace, like a savage. Whitespace appears as pale dots in this editor.

    image

    I’ll open this project in Visual Studio 2017 which supports the EditorConfig file natively. Notice the warning at the bottom where VS lets me know that this project has conventions that are different than my own.

    user preferences for this file type are overwidden by this project's coding conventions

    VS Format Document commands will use tabs rather than spaces for this project. Here is the same doc reformatted in VS:

    image

    At this point I’m comforted that the spaces have been defeated and that cooler heads have prevailed – at least for this project.

    .NET Extensions to EditorConfig

    Even better, if your editor supports it, you can include “EditorConfig Extensions” for specific files or languages. This way your team can keep things consistent across projects. If you’re familiar with FxCop and StyleCop, this is like those.

    There’s a ton of great .NET EditorConfig options you can set to ensure the team uses consistent Language Conventions, Naming Conventions, and Formatting Rules.

    • Language Conventions are rules pertaining to the C# or Visual Basic language, for example, var/explicit type, use expression-bodied member.
    • Formatting Rules are rules regarding the layout and structure of your code in order to make it easier to read, for example, Allman braces, spaces in control blocks.
    • Naming Conventions are rules respecting the way objects are named, for example, async methods must end in “Async”.

    You can also set the importance of these rules with things like “suggestion,” or “warning,” or even “error.”

    As an example, I’ll set that my team wants predefined types for locals:

    dotnet_style_predefined_type_for_locals_parameters_members = true:error

    Visual Studio here puts up a lightbulb and the suggested fix because my team would rather I use “string” than the full “System.String.

    Visual Studio respects EditorConfig

    The excellent editorconfig for .NET docs have a LOT of great options you can use or ignore. Here’s just a FEW (controversial) examples:

    • csharp_new_line_before_open_brace – Do we put open braces at the end of a line, or on their own new line?
    • csharp_new_line_before_members_in_object_initializers – Do we allow A = 3, B = 4, for insist on a new line for each?
    • csharp_indent_case_contents – Do we freakishly line up all our switch/case statements, or do we indent each case like the creator intended?
    • You can even decide on how you Want To Case Things And Oddly Do Sentence Case: pascal_case, camel_case, first_word_upper, all_upper, all_lower

    If you’re using Visual Studios 2010, 2012, 2013, or 2015, fear not. There’s at least a basic EditorConfig free extension for you that enforces the basic rules. There is also an extension for Visual Studio Code to support EditorConfig files that takes just seconds to install although I don’t see a C# one for now, just one for whitespace.


    Sponsor: Check out JetBrains Rider: a new cross-platform .NET IDE. Edit, refactor, test and debug ASP.NET, .NET Framework, .NET Core, Xamarin or Unity applications. Learn more and download a 30-day trial!


    © 2017 Scott Hanselman. All rights reserved.
         

    The culture wars continue. The country is divided with no end in sight. Tabs or spaces? There's even an insane (IMHO) assertion that the spaces people make more money.

    I'm going with Gina Trapani on this one. I choose working code.

    Teams can fight but the problem of formatting code across teams is solved by EditorConfig. I'm surprised more people don't know about it and use it, so this blog post is my small way of getting the word out. TELL THE PEOPLE.

    Take a project and make a new .editorconfig file and put this in it. I'll use a dotnet new console example hello world app.

    [*.cs]
    
    indent_style = tab
    indent_size = tab
    tab_size = 4

    I've set mine in this example to just *.cs, but you could also say [*.{cs,js}] or just [*] if you like, as well as have multiple sections.

    You'll check this file in WITH your project so that everyone on the team shares the team's values.

    Here in Notepad2 we can see someone has used spaces for whitespace, like a savage. Whitespace appears as pale dots in this editor.

    image

    I'll open this project in Visual Studio 2017 which supports the EditorConfig file natively. Notice the warning at the bottom where VS lets me know that this project has conventions that are different than my own.

    user preferences for this file type are overwidden by this project's coding conventions

    VS Format Document commands will use tabs rather than spaces for this project. Here is the same doc reformatted in VS:

    image

    At this point I'm comforted that the spaces have been defeated and that cooler heads have prevailed - at least for this project.

    .NET Extensions to EditorConfig

    Even better, if your editor supports it, you can include "EditorConfig Extensions" for specific files or languages. This way your team can keep things consistent across projects. If you're familiar with FxCop and StyleCop, this is like those.

    There's a ton of great .NET EditorConfig options you can set to ensure the team uses consistent Language Conventions, Naming Conventions, and Formatting Rules.

    • Language Conventions are rules pertaining to the C# or Visual Basic language, for example, var/explicit type, use expression-bodied member.
    • Formatting Rules are rules regarding the layout and structure of your code in order to make it easier to read, for example, Allman braces, spaces in control blocks.
    • Naming Conventions are rules respecting the way objects are named, for example, async methods must end in "Async".

    You can also set the importance of these rules with things like "suggestion," or "warning," or even "error."

    As an example, I'll set that my team wants predefined types for locals:

    dotnet_style_predefined_type_for_locals_parameters_members = true:error

    Visual Studio here puts up a lightbulb and the suggested fix because my team would rather I use "string" than the full "System.String.

    Visual Studio respects EditorConfig

    The excellent editorconfig for .NET docs have a LOT of great options you can use or ignore. Here's just a FEW (controversial) examples:

    • csharp_new_line_before_open_brace - Do we put open braces at the end of a line, or on their own new line?
    • csharp_new_line_before_members_in_object_initializers - Do we allow A = 3, B = 4, for insist on a new line for each?
    • csharp_indent_case_contents - Do we freakishly line up all our switch/case statements, or do we indent each case like the creator intended?
    • You can even decide on how you Want To Case Things And Oddly Do Sentence Case: pascal_case, camel_case, first_word_upper, all_upper, all_lower

    If you're using Visual Studios 2010, 2012, 2013, or 2015, fear not. There's at least a basic EditorConfig free extension for you that enforces the basic rules. There is also an extension for Visual Studio Code to support EditorConfig files that takes just seconds to install although I don't see a C# one for now, just one for whitespace.


    Sponsor: Check out JetBrains Rider: a new cross-platform .NET IDE. Edit, refactor, test and debug ASP.NET, .NET Framework, .NET Core, Xamarin or Unity applications. Learn more and download a 30-day trial!



    © 2017 Scott Hanselman. All rights reserved.