Quantcast
Channel: Scott Hanselman's Blog
Viewing all 1148 articles
Browse latest View live

An update on ASP.NET Core 1.0 RC2

$
0
0

What's going on with ASP.NET Core 1.0 RC2? Why is RC2 taking so long over RC1 and what's going to happen between now and the final release? I talked to architect David Fowler about this and tried to put together some clear answers.

This stuff is kind of deep and shows "how the sausage gets made" so the TL;DR version of this is "the guts are changing for the better and it's taking longer than we thought it would to swap out the guts."

That said, ASP.NET Core RC2 has some high level themes:

Re-plat on top of the .NET CLI

This is the biggest one and there are quite a few changes and tweaks made to the hosting model to support this. The way your application boots up is completely different. I'd encourage you to take a look at the https://github.com/aspnet/cli-samples. Some of the changes are very subtle but important. We baked a bunch of assumptions into DNX specific for web applications and now we're building on top of a tool chain that doesn't assume a web application is the only target and we have to account for that.

There were a couple of fundamental things affected by this move:

  • Acquisition
    • How do you get the tool chain and shared runtime?
  • Runtime
    • The API used to find dependencies at runtime ILibraryManager
    • The API used to find compilation assemblies at runtime ILibraryExporter
  • Tooling
    • There's no dnvm replacement
    • Visual Studio Tooling (UI) support needs to use the new CLI
    • OmniSharp needs to use the new CLI
    • What's the dnx-watch successor?

The list goes on and on. I'd suggest watching the ASP.NET Community stand up as we're pretty transparent about where we are in the process. We just got everyone internally using builds of Visual Studio that have CLI support this last week.

The new .NET CLI (again, replacing DNX) will be the most de-stabilizing change in RC2. This is a good intro to where things are headed https://vimeo.com/153212604. There's been tons of changes since then but it's still a good overview.

Moving to netstandard

This has been a long time coming and is a massive effort to get class library authors to move to the next phase of PCL. This is critical to get right so that everyone can have their favorite packages working on .NET Core, and as such, working everywhere. 

https://channel9.msdn.com/Events/ASPNET-Events/ASPNET-Fall-Sessions/Class-Libraries

https://github.com/dotnet/corefx/blob/master/Documentation/architecture/net-platform-standard.md

.NET Standard Library means a modular BCL that can be used on all app models

Polish

We're looking at all of the patterns that we have invented over the last 2 years and making sure it's consistent across the entire stack. One example of that is the options API. We went through the entire stack and made sure that we were using them consistently in middleware and other places. That is a breaking change but it's an important one.

Other examples of this include things like making sure we have the right extension methods in places and that it looks like they were designed in a coherent manner (logging is an example).

Other small things:

  • Remove the service locator pattern as much as we can. Some of this requires API change.
  • Making sure we have the right set of DI abstractions so that DI vendors can properly plug into the stack.
  • Taking the time to look at feedback we're receiving to make sure we're doing the right things. This is ongoing, but if there are small changes we can make that solve a common issue people are having, we'll make that change while we still have this freedom.
  • Change how we plug in and configure servers in our Hosting APIs https://github.com/aspnet/KestrelHttpServer/pull/741

Fundamentals - Stress, Security, Performance

This is always ongoing but now that most of the features are done, we have more time to spend on making things like Kestrel (the web/app server) rock solid and secure.

We're also doing more stress runs to make sure the stack is very stable memory wise and to make sure nothing crashes .

More Performance

This is part of fundamentals but deserves to be called out specifically. We're still making changes to make sure things are very "performant." Some of these are tweaks that don't affect consuming code, others are actual design changes that affect API. MVC is getting tons of love in this area (https://github.com/aspnet/Mvc/pull/4108). HttpAbstractions and other higher level APIs are also getting lots of love https://github.com/aspnet/HttpAbstractions/pull/556 to make sure we reduce allocations for things like file upload.

We're also looking at higher level scenarios to make sure that not only focusing on microbenchmarks. You can see some of them at https://github.com/aspnet/Performance/tree/dev/testapp.

Techempower is still on our radar and we're running the plain text benchmark on similar hardware now and comparing against the competition (we're in the top 10 right now!) and we'll hope to be there and official for RTM.

I hope this gives you some context. We'll cover this and more every week on the Community Standup as we move towards RC2, then on to RTM on three platforms!


Sponsor: Big thanks to RedGate and my friends on ANTS for sponsoring the feed this week! How can you find & fix your slowest .NET code? Boost the performance of your .NET application with the ANTS Performance Profiler. Find your bottleneck fast with performance data for code & queries. Try it free


© 2016 Scott Hanselman. All rights reserved.
     

Chatting with Prince on AOL in 1999 - "this way is modern"

$
0
0

Erica Kennedy chats with Prince on AOL in 1999Before the Internet as we know it today, before social media, there was AOL. Specifically there was AOL chat rooms. The digital world was smaller but Prince was always there. He was so ahead of his time digitally. The Purple One did group chats with fans all the time on AOL. A "room" in AOL chat parlance was like a Twitter DM - a private chat room.

Six years ago my friend Erica Kennedy and I were talking about what she was going to write for her next book. She had just released her second book, Feminista, and was pretty well known for her first book, Bling that satirized the music industry that she came up in. We had the idea of  a Kindle Single detailing her interactions with Prince while she was working on a profile for InStyle Magazine. You can see photos of Prince's Spanish Villa and a few lines of Erica's AOL chats with Prince over at InStyle now.

This is the AOL chat log detailing her interactions with Prince that Erica emailed me while we were planning her novella.

Here, of course, "NPG---" was Prince's private AOL chat handle at that time while Ekj4 is Erica. I have kept all the typos exactly as they occurred in 1999.

Erica K to me - u r the 1st person 2 c this outside of the N style staff.

NPG---:   high
Ekj4:       hi 2 u
NPG---:  is ur last name kennedy?
Ekj4:       no it's my middle name that i use for writing, trying to stay on the dl
NPG---:  r u alone?
Ekj4:       sure am
NPG---:  have u ever spoke in private chat space?
Ekj4:       all the time!
Ekj4:       i'm a terrible typist though
NPG---:  would u like 2 go a room?
Ekj4:       what room? what's wrong with this way?
NPG---:  don't like
Ekj4:       ok, where's the room?
NPG---:  it's called...
NPG---:  amatteroftime
Ekj4:       how do i get THERE?
NPG---:  use the icon that says....people
NPG---:  c it?
Ekj4:       yes. and...
NPG---:  start ur own chat
NPG---:  private
NPG---:  type in the space....amatteroftime
Ekj4:       is it only going to be u and i?
NPG---:  yes
Ekj4:       ok
NPG---:  scared?
Ekj4:       no
NPG---:  yea,right!
NPG---:  r u there?
Ekj4:       yep
 
IN THE PRIVATE CHAT ROOM
NPG ---: is ur hair done?
EKJ4:       it’s up in a ponytail and truth be told, it’s lookin’ kinda busted.
NPG---:  lol!
EKJ:        my hair doesn’t have the bounce of your ‘do.
NPG---:  do u stay up late?
EKJ:        24-7.  Actaully more like 20-7.
NPG---:  good.
EKJ:        y?
NPG---:  my flight gets in at 1 am
EKJ:        great, ur  coming 2 ny?  u want me 2 meet u at 2?
NPG---:  I can send a car 4 u
NPG---:  if u like
Ekj4:       yes, that would be great. don’t have a sister trying to hail a cab in crooklyn at all hours.
NPG ---:  r u a sista?
Ekj4:        haven't we been over this?  u will c
NPG---:   what do u look like?
NPG---:   describe urself!
Ekj4:        i'm skinny
NPG---:   u eat meat?
Ekj4:        on occasion
NPG---:   then y r u skinny?
Ekj4:        just got it like that
NPG---:   skinny parents
Ekj4:        i actually eat way too much junk food
Ekj4:        i'm skinnier than everyone in my family
NPG---:   do u think we could complete an interview like this?
Ekj4:        no, we cannot do the interview this way, but doesn't matter. u'll be here in a minute
NPG---:   y
NPG---:   then u have direct quotes

but this way is modern

Ekj4:        it neesd to be face to face
NPG---:   y?
Ekj4:        yes, but i have to set the scene. you get better feeling about the person that way
Ekj4:        anyway, this could be aaron for all i know.
NPG---:   but this way is modern
Ekj4:        yes, it is. i love to chat online
NPG---:   eye am not a liar
NPG---:   this way is cooler
NPG---:   and eye don't get motion sickness
Ekj4:        so u think we will just have some time tonight or would you be down to...
Ekj4:        hang over the weekend if i need more time?
Ekj4:        ur not going to be all drowsy, r u?
NPG---:   eye have 2 fly 2 oakland
NPG---:   2morrow
Ekj4:        for what? the all star game?
NPG---:   eye am never drowsy
NPG---:   yes ...the game
Ekj4:        u r going?
Ekj4:        i watch all teh games. i love the t-wolves and kg
Ekj4:        but i root for the knicks
NPG---:   eye maybe cannot go if eye go 2 new york
NPG---:   2 much flying makes me barf
Ekj4:        npg---, u sleepin'?
NPG---:   eye wanna c the slam dunk competition up close
Ekj4:         is kg in it?
NPG---:   no doubt
Ekj4:        you hang with him in minn?
NPG---:   if u were me...would u fly thamuch
Ekj4:        no i don't like to fly that much.  the loss of control and everything
Ekj4:        y ru coming here for 1 day? to do the interview?
NPG---:   yes, eye am coming unless u allow me 2 do something cooler
Ekj4:        i think u should come
NPG---:   eu
Ekj4:        eu?
NPG---:   do u know what that means
Ekj4:        please explain
NPG---:   this:
NPG---:   :P*******
NPG---:   me barfing
Ekj4:        lol!!!!
Ekj4:        why r u barfing?
NPG---:   HEY,not so loud!
Ekj4:        so r u coming or not?
NPG---:   yes, eu
Ekj4:        GREAT!

u type like me

NPG---:   we will call when eye ge there
Ekj4:        1derful
NPG---:   u type like me
Ekj4:        now that u have my e-mail, don't send me any spam!
Ekj4:        chain letters and nonsense
NPG---:   won't send u any mail
NPG---:   ever
NPG---:   many people use this screenname...
Ekj4:        ok, npg---
NPG---:   it's secret, so don't divulge it, ok?
Ekj4:        oh, good so you can maintain your privacy. of course, bro
NPG---:   ever go 2 prince. org?
Ekj4:        can't say that i have. do u?
NPG---:   once or twice
NPG---:   interesting?
NPG---:   yes
Ekj4:        i don't think i would like 2 c what random people r saying about me
NPG---:   sometimes it is funny
Ekj4:        taht would be strange but i guess you have become accustomed 2 it
NPG---:   yes
NPG---:   so, eye must go and pack, then
NPG---:   bye bye
NPG---:   c u 2night
Ekj4:        c ya later, inshallah
NPG---:   peace

I loved these chats because they are a reminder that our legends are also real people. He loved technology, Prince started YesWeCode with Van Jones to inspire more Black Youth to get involved in tech.

I talked to Erica on the phone just two day before she passed away. I miss our regular talks and her energy but most of all I miss my friend.  Prince is gone now as well, and even though he was a legend he was also a real human who loved people. He was a tech visionary who appreciated very early on how technology could bring us all together.

20 years later Prince would still reply to fans directly on Twitter (and often delete the tweets, adding to his air of mystery.) He was known to even engage in lengthy private DMs with fans and superfans.

I love what InStyle said about these Prince's AOL chats.

Internet chat from a rock star looks like Internet chat from anybody else.

I miss you two and what you brought to our lives. I'm glad we have your legacy and your work to remember you by.



© 2016 Scott Hanselman. All rights reserved.
     

10 years and over 520 episodes of podcasting - Tech is a marathon, not a sprint

$
0
0
Hanselminutes

I try not to be prideful, as a rule, but darnit, I'm REALLY proud of my podcast. As of this writing I've done 526 episodes. Each one 30 minutes long. Every Thursday, for the last decade. That's over 250 hours of technology talk that promises not to waste your time.

I started Hanselminutes: Fresh Air for Developers almost as a joke. Podcasting was just starting up and I felt at the time that it was largely kind of a vapid copy of talk radio. Hours of directionless rambling. I said to my buddy Carl Franklin that a show shouldn't waste your time and force you to fast-forward 20 minutes in to get to the meat. He said, you should start a show. I laughed, and I did.

HanselminutesOver 10 years later, here we are, having built a significant piece of creative, informational, and pseudo-journalistic work. While other podcasts come and go, many with the "two dudes on Skype" format, I've chugged along. While I do over a million downloads a year, I've never cracked into any mainstream technology podcasting charts or iTunes Top Ten. I think about that sometimes, a little bummed, but I realize that this show and it's content is as much for me as it is for you, Dear Listener. This isn't a popularity contest...as much as one can appreciate recognition.

I talk to anyone and everyone about all things tech. The show started before I went to work at Microsoft and will continue long after, I'm sure. It's a non-denominational technology show.

The show also aims to be intentionally inclusive without being heavy-handed. Showcasing diversity in technology isn't about "hey, we need a Black guy this week, know anyone?" That's insulting to everyone. Instead, I've cultivated an amazing network of amazing people from all over the world, and I talk to them about what they love to do. This has some wonderful side effects when recently without planning, 7 of the last 8 shows featured women!

The faces on this archive page go on and on. I'd encourage you to scroll and explore the wall of topics. There's hundreds of highlights, but here's a few favorites:

I am also proud of the show talking to people before (sometimes) they went mainstream or got famous. From interviews with Tim Ferriss in 2007, Kimberly Bryant from BlackGirlsCode in 2012Baratunde Thurston in 2010, Dr. Michio Kaku, author Lauren Beukes, as well as the now legendary show on Geek Relationship Tips with my wife, I've got you covered! You'll often hear it here first.

We were also one of the first podcasts to have a transcriptions/PDFs of the show for the hard of hearing and folks who like to read along while they listen. I struggle with keeping transcripts up to date and we're about a year behind but I'm looking for sustainable solutions. I'd like to get the transcripts available in HTML and posted on the side next to the shows so they'd be more easily searchable.

I want to thank you and remind you and yours that the show exists and continues weekly in earnest, every week with amazing topics and powerful guests. Above all, don't just keep listening, but please, share episodes socially and do encourage your friends and colleagues to listen and subscribe. Your letters and your kindness (as well as your guest suggestions) keep me going.

THE HANSELMINUTES PODCAST: Fresh Air for Developers

Thanks everyone for your support and help over the last decade. Here's to another ten years, eh?


Sponsor: Big thanks to SQL Prompt for sponsoring the feed this week! Have you got SQL fingers? Try SQL Prompt and you’ll be able to write, refactor, and reformat SQL effortlessly in SSMS and Visual Studio. Find out more.



© 2016 Scott Hanselman. All rights reserved.
     

Playing with TensorFlow on Windows

$
0
0

TensorFlow is a machine learning library from Google. There are no Windows builds but I wanted to run it on Windows. There are some other blog posts that show people trying to get TensorFlow running on Windows with VMs or Docker (using a VM) but they are a little complex. This seems like a great chance to see of I can just run Bash on Windows 10, build TensorFlow and run it.

TensorFlow on Ubuntu on Windows 10

I'm running Windows 10 Insiders Build 14422 as of the time of this writing. I launched Bash on Windows and followed these pip (Python) instructions, just as if I was running Linux. Note that the GPU support won't work so I followed the CPU only instructions from my Surface Pro 3.

$ sudo apt-get install python-pip python-dev

$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl

It built, then I tested it like this:

$ python

...
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))
Hello, TensorFlow!
>>> a = tf.constant(10)
>>> b = tf.constant(32)
>>> print(sess.run(a + b))
42
>>>

Cool, but this is Hello World. Let's try the more complex example against the MINST Handwriting Models. The simple demo model for classifying handwritten digits from the MNIST dataset is in the sub-directorymodels/image/mnist/convolutional.py. You'll need to check when your mnist folder is.

$ cd tensorflow/models/image/mnist

$ python convolutional.py
Successfully downloaded train-images-idx3-ubyte.gz 9912422 bytes.
Successfully downloaded train-labels-idx1-ubyte.gz 28881 bytes.
Successfully downloaded t10k-images-idx3-ubyte.gz 1648877 bytes.
Successfully downloaded t10k-labels-idx1-ubyte.gz 4542 bytes.
Extracting data/train-images-idx3-ubyte.gz
Extracting data/train-labels-idx1-ubyte.gz
Extracting data/t10k-images-idx3-ubyte.gz
Extracting data/t10k-labels-idx1-ubyte.gz
Initialized!
Step 0 (epoch 0.00), 9.3 ms
Minibatch loss: 12.054, learning rate: 0.010000
Minibatch error: 90.6%
Validation error: 84.6%
Step 100 (epoch 0.12), 826.7 ms
Minibatch loss: 3.289, learning rate: 0.010000
Minibatch error: 6.2%
Validation error: 7.0%
...

This set appears to be working great and is currently on Step 1500

There's bugs in the Bash on Windows 10, of course. It's in Beta. But it's not a toy, and it's gonna be a great addition to my developer toolbox. I like that I was able to follow the Linux instructions exactly and they just worked. I'm looking forward to seeing how hard I can push Ubuntu and Bash on Windows 10.


Sponsor: Big thanks to SQL Prompt for sponsoring the feed this week! Have you got SQL fingers? TrySQL Prompt and you’ll be able to write, refactor, and reformat SQL effortlessly in SSMS and Visual Studio.Find out more.


© 2016 Scott Hanselman. All rights reserved.
     

.NET Core 1.0 RC2 - Upgrading from previous versions

$
0
0

.NET Core at http://dot.net.NET Core RC2 is out, it's open source, and it's on multiple platforms. I'm particularly proud of the cool vanity domain we got for it. http://dot.net. ;) It makes me smile.

Here's the important blog posts to check out:

Head over to http://dot.net and check it out. A great aspect of .NET Core is that everything it does is side-by-side. You can work with it without affecting your existing systems. Be sure also explore the complete .NET Downloads Page for all the manual downloads as well as SHA hashes

The best way to develop with .NET Core on Windows is to download the Visual Studio official MSI Installer and the latest NuGet Manager extension for Visual Studio. If you don't have Visual Studio already, you can download Visual Studio Community 2015 for free.

We'll have documentation and insights on how to moving from ASP.NET 4.x over to ASP.NET Core 1.0 soon, but for now I've collected these resources for folks who are upgrading from previous versions of .NET Core and ASP.NET Core (the framework formerly new as ASP.NET 5).

Enjoy!


Sponsor: Build servers are great at compiling code and running tests, but not so great at deployment. When you find yourself knee-deep in custom scripts trying to make your build server do something it wasn't meant to, give Octopus Deploy a try.



© 2016 Scott Hanselman. All rights reserved.
     

White House Visit - Foster Care and Technology Hackathon

$
0
0

Going to the White HouseHey friends! I am so proud to be a technology advisor for the the White House Foster Care and Technology Hackathon this week!

While I'm participating in this event and advising as a private citizen, there is a Microsoft team. Here is a brief statement about the Microsoft team's involvement in this cause:

The Microsoft team is honored and excited to participate in this year’s White House Foster Care and Technology Hackathon on May 26th-May 27th. It is a wonderful opportunity for top technical talent across different industries to work together in collaboration with the White House, the Dept of Health and Human Services, Annie E. Casey Foundation, and Think of Us, with the goal of improving the US foster care system and outcomes for children and families who experience care.

The hackathon participants are tackling the biggest problems in the foster care system including topics such as empowering foster youth and alum with decision-making abilities, getting more innovative technology into child welfare agencies, and preventing homelessness and unplanned pregnancy for youth.

Another huge area of concern in the foster care system is that of substance exposed infants and children. Each year, nearly 440,000 infants are affected by prenatal alcohol or illicit drug exposure. Oftentimes, the mothers of these children who are battling substance abuse struggle with seeking care and treatment for themselves and the children. Many of these mothers are young and do not have the support system that they need to get advice and help to both overcome their additions, and take care for their children. Even if they have the inclination to get help, where do they start? And how can they do this without being stigmatized?
The Microsoft hacking team is looking to create a streamlined process by which mothers can access the resources they need, and easily ask for help.

Mothers with addiction problems often struggle to keep their addiction and pregnancy secret, and are therefore hesitant to seek the help they and their children so desperately need. The solution must take this sensitivity into account. Locating relevant information about available resources is another problem. It must aggregate resources into a single place that is simple and easy to use but also non-judgmental.

The team seeks to create a marketplace for social services that will be useful to the mothers in need. Rather than solely aggregate data, the marketplace will include a recommendation system based on the anonymous inputs of the users’ needs, backed by a rating system that is commonly seen online. Influenced by the ratings systems of websites like Yelp, the team seeks to create an atmosphere that younger generations are used to by allowing them to anonymously rate the services they used, and benefit from the feedback of others.

The team is made up of Program Manager, Yossi Banai, along with technologists Paul DeCarlo, Mostafa Elzoghbi, Stacey Mulcahy, Heather Shapiro and tech advisor Scott Hanselman. Several members of the team have been personally touched or affected by the problem of pregnant and parenting mothers dealing with substance abuse and are passionate about improving the current situation for struggling mothers and their children. They will continue their efforts after the hackathon by maintaining the resources and programs created.

I'll take as many photos and instagrams as I'm allowed. Many thanks to Sixto Cancel from Think of Us, Kishau Rogers, and Vida Williams for including me on this project. I'll be speaking on Thursday along with a room full of amazing folks across the Child Welfare System and the Administration.

I'm excited to meet all the teams including the folks from StackOverflow, Slack, Clef, Uber, Twillio, Prek12Plaza, and more!


Sponsor: Build servers are great at compiling code and running tests, but not so great at deployment. When you find yourself knee-deep in custom scripts trying to make your build server do something it wasn't meant to, give Octopus Deploy a try.



© 2016 Scott Hanselman. All rights reserved.
     

Is technology killing curiosity?

$
0
0
Photo via WoCinTechChat used under Creative Commons

I was talking with Kishau Rogers this week at a Hackathon we were helping with at The White House for ThinkOfUs. (See how I dropped The White House in there like it was nothing? It was everything. More on that later.)

You'll remember Kishau from her excellent podcast where she proposed that we should NOT teach kids how to code...but rather we need to teach kids (and people) how to think about systems. Folks just don't know how stuff works. Maybe we're old(er) but we found ourselves asking, is tech killing curiosity? This post has more questions than answers, so I hope you sound off in the comments!

I have this glorious pocket super computer with me now. It connects to all the world's collected knowledge, has an advanced battery, radio transmitter, and so much more. But most people have no idea how it works? Yes, technically you don't have to know how it works, but aren't you curious?

We can make lists about how "there's two kinds of people in the world" and split them up into techie and non-techie, or computer literate or non-computer literate...but I'm thinking it's simpler. There's the curious and the not-curious.

I took apart my toaster, my remote control, and a clock-radio telephone before I was 10. Didn't you? What's the difference between the people that take toasters apart and the folks that just want toast? At what point do kids or young adults stop asking "how does it work?"

As each new layer of abstraction becomes indistinguishable from magic we may be quietly killing curiosity. Or shifting its focus. Is the stack so deep now that we can't know everything?

There's a great interview question I love to give. "When you type foo.com into a browser, what happens? Then what happens? Then what happens?" I ask this question not because I care how deep you can go; I ask because I care how deep you care to go. Where does your interest stop? How do you THINK it works? Where does technology end and where does the magic (for you) begin? HTTP? TCP? DNS? Voltage on a wire? Registers in chips? Quantum effects?

I do an Exploring Engineering class at local colleges each year. I love to open up a text file, type the alphabet, then open that text file in a hex editor and go "hey, the letter 'a' is 61 in ASCII, why?" Then I add a carriage return/line feed (13/10) and ask a room of confused 18 year olds "what's a carriage and why does it need to return?" I take a record player in and talk about the similarities between how it works versus how a hard drive or blu ray works. I see where the conversation takes the class. Inevitably the most engaged kids (regardless of their actual knowlegde) will end up being great engineering candidates. But where did their curiosity come from?

Perhaps curiosity is an innate thing, perhaps it's taught and encouraged, but more likely it's a little of both. I hope that you're stretching yourself and others to ask more questions and explore the how and why of the world around you.

What do you think? Is 21st century technology making it too easy? Are iPhones so magical sitting atop the last millennium of technology that it's not worth teaching - or even wondering - how it all fits together?


Sponsor: Many thanks to Stackify for sponsoring the feed this week! Stackify knows developers are the center of the universe. That’s why Stackify built Prefix and will give it out free forever. No .NET profiler is easier, prettier, or more powerful. Build better—now!



© 2016 Scott Hanselman. All rights reserved.
     

MSBuild Structured Log: record and visualize your builds

$
0
0

MSBuild has been open source for a while (over a year now!) and is used to build .NET and .NET Core projects. In fact, MSBuild is used to build the .NET Core Runtime itself.

MSBuild Structured Log

Recently Kirill Osenkov published a new tool called MSBuild Structured Log that makes it easy to visualize your builds and the build process. Install and run MSBuild Structured Log from here.

It is an MSBuild logger that can be passed to MSBuild during a build and it records information about everything that happens in the build. But instead of just dumping everything into a huge text file it preserves the structure and relationships between elements, and lets you save and open the structured log in .xml format. This has significant advantages to help you understand and navigate large build logs.

It's easy to install and auto-updates itself. You can open a log file directory or it will build your project and show you the results in a friendly and searchable tree format:

MSBuild Log visualized as a tree view

Here's a more complex multi-project example. You can see what ran, what didn't, dependencies, and the logs themselves.

A complex MSBuild example visualized

Tools

There is a great list of MSBuild-related resources and tips and tricks including these tools:


Sponsor: Many thanks to Stackify for sponsoring the feed this week! Stackify knows developers are the center of the universe. That’s why Stackify built Prefix and will give it out free forever. No .NET profiler is easier, prettier, or more powerful. Build better—now!


© 2016 Scott Hanselman. All rights reserved.
     

The Promising State of Diabetes Technology in 2016

$
0
0

Glucopilot helped PalmPilots users in the 90sI've been a Type 1 Diabetic now for nearly 25 years. The first thing that every techie does once they've been diagnosed with Diabetes is they try to solve the problem with software or hardware. Whatever tool they have, they use that too to "solve their Diabetes." Sometimes it's Excel, sometimes it's writing a whole new system. We can't help ourselves. We see the charts and graphs, we start to understand that this is a solvable problem.

However, innovation in Diabetes technology has two sides. There's the "what can we do within the medical establishment" side, and there's the "what components do I, the actual diabetic, have to work with" side. We are given insulin pumps, glucose meters, and drugs but we aren't involved in the development, which makes sense to a point.

Fifteen years ago (yes, really, 15) I went on a trip with a PalmPilot, OmniSky wireless modem, Blood sugar meter, and insulin pump and quasi-continuously sent my blood glucose numbers back to a server and my doctor. Many many years later I demonstrated on stage at a Microsoft conference (video) how a remote management system like NightScout along with other innovations in IoT are taking these concepts so much further. It's through the work of hundreds of innovators and tinkerers that I think we're on the cusp.

Aside: If you are wholly unfamiliar with how Type 1 Diabetes works, please take a moment and read Diabetes Explanation: The Airplane Analogy. This post pretty clearly explains how blood sugar rises and falls and why fixing this isn't a simple problem.

Four years ago - four years ago this week in fact - I wrote a post called The Sad State of Diabetes Technology in 2012, largely in frustration. It became one of my most popular posts. For some it was a turning point and was called "seminal." For most Diabetics, though, the post said what everyone already thought and already knew. Diabetes sucks deeply, the technology we are given to manage it sucks deeply, and we are pretty much tired of waiting. We've been told a "cure" (or at least, a mostly fool-proof way to manage it) is just 5 years out. I've been told this, personally, every year for the last 25.

Here we are four years after I wrote my angry post and I'm actually feeling like we are on the edge of something big.

I believe that now we are inside a 5 year window of time where we WILL make Type 1 Diabetes MUCH MUCH easier to deal with.

Using this generation diagram from the JDRF, it's totally clear that the open source diabetes community is making Stage 4 happen today.

6 stages of "Artificial Pancreases"

Let's stop and level set for a moment. Here's a generalization of your day if you're not diabetic.

The "Normal Sugared" have it easy.

Here's what a Type 1 diabetic (like me) does:

Diabetics have to constantly manage their sugar, manually

What we need is for the "loop to be closed."

Is a Closed-Loop System for Diabetes Management like a Self-driving Car?

You know how the press just loves to call the Tesla a "Self-driving car?" It's not. I've driven one for over 15 thousand miles. It has two main features and they are both effectively cruise-control. There's the cruise control that slows down when there's a car in front of you, and then there's the "Tesla Auto-Pilot" feature. Amazing, sure, but realistically it's effectively "side to side cruise control." It will keep you in the lanes, usually, to a limit. You can't go to sleep, you shouldn't be texting. You are in charge. This isn't to minimize the amazing work that Tesla has done, but using a closed-loop insulin stages above as a parallel, a Tesla is barely stage 3 or 4.

However, this is still a fantastic innovation and for a diabetic like myself, I *would* like to take my hand off the diabetic wheel as it were, at least for the easy stuff like staying in the lanes on the freeway while going straight. Automatic basal insulin dosing (background insulin dosing) would free my mind up a LOT.

It's possible and it's happening.

What's required for a closed loop?

In order to close the loop, what are the components we need? For this simple exercise please assume that "safely and securely" applies to all of these statements.

  • The ability to tell an insulin pump to deliver insulin
  • The ability to read data from the insulin pump.
  • The ability to read current blood sugar from a continuous glucose meter
  • Some CPU or "brain" where an algorithm or controller lives to coordinate all this.
  • Storage, cloud or otherwise, to keep all this historical data

There are a number of issues to think about, though, if the open source community wants to solve this before the commercial companies do.

  • Most pump manufacturers don't like the idea of remotely controlling them after a series of insulin pump proof of concept "attacks."
    • This means that some systems require the use of an older pump to allow remote control. We, the community, need to encourage pump manufacturers to create pumps that allow secure remote control.
  • Most CGM manufacturers don't publish their specifications or like 3rd party apps or systems talking to their stuff.
    • We, the community, need to encourage manufacturers to create glucose meters that allow secure access to our sugar data. 'Cause it's our data.
  • Universal concern that someone will accidentally hurt or kill themselves or someone else.
  • Where should the "closed loop brain/algorithm" live? The cloud? Your phone? Another CPU in your pocket?

What happened in the Diabetes Technology Ecosystem in the last 4 years to make this possible?

The interesting part about this problem is that there are many ways to solve this. In fact, there are multiple closed loop OSS systems available now. Lots of things have made this possible.

Here's a rough timeline of the Open Diabetes Ecosystem.

  • Insulaudit -  Ben West starts an open source driver to audit medical devices
  • Decoding CareLink -  Driving an insulin pump with Python, Oct 2012
  • Decoding Dexcom - Pulling data off a Dexcom CGM 3 years ago!
  • CGM-Simple-Reader - Using Windows 8 DLLs from Dexcom Studio to get CGM data. Next step was uploading it somewhere!
  • Pebble - Being able to remotely view Nightscout Data on your wrist on a pebble.
  • Nightscout - Remote viewing of glucose data by pulling from a CGM and uploading to a web app. The addition of a REST API (Web API) was the killer that kick started other apps.
  • Parakeet Google App Engine - Gets data from The Parakeet Unit and talks to xDrip over the cell network. "OnStar for diabetes"
  • Nightscout Share Bridge - Takes Dexcom G5 data and copies it over to Nightscout.
  • xDrip - Talk to a CGM without a Receiver. Pulling the signal off the air itself. Can we improve their algorithm ourselves?
  • PingRF - Talking to the Animas Ping Pump via RF
  • OpenAPS - Open Artificial Pancreas System. A platform for building a closed-loop with open tools. There are almost 100 people running their own closed loops, today.
  • Watch Dana Lewis talk about OpenAPS at OSCON this year!
  • RileyLink - A bridge that can talk a Medtronic Pump. Make a the pump's RF programmatically available via Bluetooth
  • Loop - iPhone-based closed loop that uses RileyLink
  • xDripG5 - iOS Framework for talking to Dexcom CGMs over Bluetooth
  • OmniAPS - Talking to an OmniPod Pump

I realize this isn't comprehensive, but the point here is to understand there are dozens of ways to solve this problem. And there are dozens (hundreds?) of excited and capable people ready to make it happen.

Here's the systems that I have. This is my Dexcom G5 on my iPhone showing my blood sugar in near-realtime. Here I can see my sugar, but I have to make my own decisions about dosing.

Dexcom G5 on an iPhone

Here is a Raspberry Pi running OpenAPS. This is the brain. The algorithm runs here. It's talking to my Dexcom, to Nightscout in the cloud, and to my Medtronic Pump via RF via a USB device called a CareLink.

OpenAPS on a Raspberry Pi

Here is OpenAPS again, this time running on an Intel Edison sitting on a SparkFun Block with a battery and a TI C1111 RF transmitter. The Edison is the brain and has Bluetooth. The TI transmitter can replace the CareLink.

IMG_0058

As an alternative to OpenAPS, here is a RileyLink custom board that can also talk to the pump, but doesn't have a brain. There is no algorithm here. Instead, this is a bridge with RF in one hand and Bluetooth in the other. It makes a pump controllable and readable. The brain lives elsewhere.

RileyLink

Here's the RileyLink in a 3D printed case. I can keep it all in my pocket and it will run all day.

RileyLink in a 3D printed case

Here is a build of Loop from Nathan Racklyeft that uses Bluetooth to talk to both my CGM (Glucose Meter) and the Pump via the Riley Link. In this example, the phone is the brain. This is good and bad. You can't really trust your phone to keep stuff running if it also runs Candy Crush AND has a crappy battery. However, if both my Pump AND CGM spoke Bluetooth, we can imagine a world where the brain of my "artificial pancreas" is just an app on my phone. No additional hardware.

Loop puts the brain on your phone

The most important point here is that a LOT of stress could have been avoided if the manufacturers had just created open APIs in the first place.

There's also amazing work happening  in the non-profit space. Howard shared this common on my original "Sad State" Diabetes Post:

Great article, Scott. You've accurately captured the frustration I've felt since my 12 year old daughter was diagnosed with T1D nine months ago. She also wears a pump and CGM and bravely performs the ritual you demonstrate in your video every three days. The technology is so retro it's embarrassing.

Since then, Howard created Tidepool and recently spoke at the White House! On the commercial side, there are lots of players rushing to market. Medtronic may '>'>'>have a hybrid closed loop called the 670g by spring next year although trials move slowly so I'm thinking later or possibly 2018. Lane Desborough from Bigfoot Biomedical has also closed the loop and they are bringing it to market...soon we hope!

For more information, go watch Mark Wilson's talk at D-Data Exchange 2016. It is an excellent 30 minute overview of the ecosystem and a call to action to everyone involved.

Check out this visualization of 6 years of Hacking Diabetes. These are all the projects and commits as folks dump into Open Diabetes Hacking Community.

What's the take away? It's an exciting time. It's happening. It can't be stopped.

More Diabetes Reading


Sponsor: Big thanks to Redgate for sponsoring the feed this week. How do you find & fix your slowest .NET code? Boost the performance of your .NET application with ANTS Performance Profiler. Find your bottleneck fast with performance data for code & queries. Try it free!



© 2016 Scott Hanselman. All rights reserved.
     

Stop saying learning to code is easy.

$
0
0
WoC in Tech Stock Photos used under CC

I saw this tweet after the Apple WWDC keynote and had thought the same thing. Hang on, programming is hard. Rewarding, sure. Interesting, totally. But "easy" sets folks up for failure and a lifetime of self-doubt.

When we tell folks - kids or otherwise - that programming is easy, what will they think when it gets difficult? And it will get difficult. That's where people find themselves saying "well, I guess I'm not wired for coding. It's just not for me."

Now, to be clear, that may be the case. I'm arguing that if we as an industry go around telling everyone that "coding is easy" we are just prepping folks for self-exclusion, rather than enabling a growing and inclusive community. That's the goal right? Let's get more folks into computers, but let's set their expectations.

Here, I'll try to level set. Hey you! People learning to code!

  • Programming is hard.
  • It's complicated.
  • It's exhausting.
  • It's exasperating.
  • Some things will totally make sense to you and some won't. I'm looking at you, RegEx.
  • The documentation usually sucks.
  • Sometimes computers are stupid and crash.

But.

  • You'll meet amazing people who will mentor you.
  • You'll feel powerful and create things you never thought possible.
  • You'll better understand the tech world around you.
  • You'll try new tools and build your own personal toolkit.
  • Sometimes you'll just wake up with the answer.
  • You'll start to "see" how systems fit together.
  • Over the years you'll learn about the history of computers and how we are all standing on the shoulders of giants.

It's rewarding. It's empowering. It's worthwhile.

And you can do it. Stick with it. Join positive communities. Read code. Watch videos about code.

Try new languages! Maybe the language you learned first isn't the "programming language of your soul."

Learning to programming is NOT easy but it's totally possible. You can do it.

More Reading


Sponsor: Big thanks to Redgate for sponsoring the feed this week. How do you find & fix your slowest .NET code? Boost the performance of your .NET application with ANTS Performance Profiler. Find your bottleneck fast with performance data for code & queries. Try it free!



© 2016 Scott Hanselman. All rights reserved.
     

Forgotten (but Awesome) Windows Command Prompt Features

$
0
0

It's always the little throwaway tweets that go picked up. Not the ones that we agonize over. I was doing some work at the command line and typed "dotnet --version | clip" to copy the .NET Core version number into the clipboard. Then I tweeted a little "hey, remember this great utility?" and then the plane took off. I landed two hours later and it had over 500 RTs. Madness.

It's funny that 10 year old command prompt utility (this was added in Vista) that everyone's forgotten elicits such an enthusiastic response.

Since you all love that stuff, here's a few other "forgotten command prompt features."

Some of these have been in Windows since, well, DOS. Others were added in Windows 10. What did I miss? Sound off in the comments.

Pipe command output to the clipboard

In Vista they added clip.exe. It captures any standard input and puts in the clipboard.

That means you can

  • dir /s | clip
  • ver | clip
  • ipconfig /all | clip

You get the idea.

Piping to Clip.exe puts the standard output in your clipboard

F7 gives you a graphical (text) history

If you have already typed a few commands, you can press F7 to get an ANSI popup with a list of commands you've typed. 4DOS anyone?

More people should press F7

Transparent Command Prompt

After Windows 10, you can make the Command Prompt transparent!

It's see through

Full Screen Command Prompt

Pressing "ALT-ENTER" in the command prompt (any prompt, cmd, powershell, or bash) will make it full screen. I like to put my command prompt on another virtual desktop and then use CTRL-WIN-ARROWS to move between them.

The Windows 10 Command Prompt supports ANSI natively.

The cmd.exe (conhost in Windows 10 1511+, actually) now supports ANSI directly. Which means BBS Ansi Art, of course.

Word wrapping

Oh, and the Windows 10 command prompt supports active word wrapping and resizing. It's about time.

Little Fit and Finish Commands

  • You can change the current command prompt's title with "TITLE"
  • You can change its size with MODE CON COLS=x LINES=y
  • You can change the colors from a batch file with COLOR (hex)

What did I miss?


Sponsor: Working with DOC, XLS, PDF or other business files in your applications? Aspose.Total Product Family contains robust APIs that give you everything you need to create, manipulate and convert business files along with many other formats in your applications. Stop struggling with multiple vendors and get everything you need in one place with Aspose.Total Product Family. Start a free trial today.



© 2016 Scott Hanselman. All rights reserved.
     

Adding a Custom Inline Route Constraint in ASP.NET Core 1.0

$
0
0

ASP.NET supports both attribute routing as well as centralized routes. That means that you can decorate your Controller Methods with your routes if you like, or you can map routes all in one place.

Here's an attribute route as an example:

[Route("home/about")]

public IActionResult About()
{
//..
}

And here's one that is centralized. This might be in Startup.cs or wherever you collect your routes. Yes, there are better examples, but you get the idea. You can read about the fundamentals of ASP.NET Core Routing in the docs.

routes.MapRoute("about", "home/about",

new { controller = "Home", action = "About" });

A really nice feature of routing in ASP.NET Core is inline route constraints. Useful URLs contain more than just paths, they have identifiers, parameters, etc. As with all user input you want to limit or constrain those inputs. You want to catch any bad input as early on as possible. Ideally the route won't even "fire" if the URL doesn't match.

For example, you can create a route like

files/{filename}.{ext?}

This route matches a filename or an optional extension.

Perhaps you want a dateTime in the URL, you can make a route like:

person/{dob:datetime}

Or perhaps a Regular Expression for a Social Security Number like this (although it's stupid to put a SSN in the URL ;) ):

user/{ssn:regex(d{3}-d{2}-d{4})}

There is a whole table of constraint names you can use to very easily limit your routes. Constraints are more than just types like dateTime or int, you can also do min(value) or range(min, max).

However, the real power and convenience happens with Custom Inline Route Constraints. You can define your own, name them, and reuse them.

Lets say my application has some custom identifier scheme with IDs like:

/product/abc123

/product/xyz456

Here we see three alphanumerics and three numbers. We could create a route like this using a regular expression, of course, or we could create a new class called CustomIdRouteConstraint that encapsulates this logic. Maybe the logic needs to be more complex than a RegEx. Your class can do whatever it needs to.

Because ASP.NET Core is open source, you can read the code for all the included ASP.NET Core Route Constraints on GitHub. Marius Schultz has a great blog post on inline route constraints as well.

Here's how you'd make a quick and easy {customid} constraint and register it. I'm doing the easiest thing by deriving from RegexRouteConstraint, but again, I could choose another base class if I wanted, or do the matching manually.

namespace WebApplicationBasic

{
public class CustomIdRouteConstraint : RegexRouteConstraint
{
public CustomIdRouteConstraint() : base(@"([A-Za-z]{3})([0-9]{3})$")
{
}
}
}

In your ConfigureServices in your Startup.cs you just configure the route options and map a string like "customid" with your new type like CustomIdRouteConstraint.

public void ConfigureServices(IServiceCollection services)

{
// Add framework services.
services.AddMvc();
services.Configure<RouteOptions>(options =>
options.ConstraintMap.Add("customid", typeof(CustomIdRouteConstraint)));
}

Once that's done, my app knows about "customid" so I can use it in my Controllers in an inline route like this:

[Route("home/about/{id:customid}")]

public IActionResult About(string customid)
{
// ...
return View();
}

If I request /Home/About/abc123 it matches and I get a page. If I tried /Home/About/999asd I would get a 404! This is ideal because it compartmentalizes the validation. The controller doesn't need to sweat it. If you create an effective route with an effective constraint you can rest assured that the Controller Action method will never get called unless the route matches.

If the route doesn't fire it's a 404

Unit Testing Custom Inline Route Constraints

You can unit test your custom inline route constraints as well. Again, take a look at the source code for how ASP.NET Core tests its own constraints. There is a class called ConstrainsTestHelper that you can borrow/steal.

I make a separate project and setup xUnit and the xUnit runner so I can call "dotnet test."

Here's my tests that include all my "Theory" attributes as I test multiple things using xUnit with a single test. Note we're using Moq to mock the HttpContext.

public class TestProgram

{

[Theory]
[InlineData("abc123", true)]
[InlineData("xyz456", true)]
[InlineData("abcdef", false)]
[InlineData("totallywontwork", false)]
[InlineData("123456", false)]
[InlineData("abc1234", false)]
public void TestMyCustomIDRoute(
string parameterValue,
bool expected)
{
// Arrange
var constraint = new CustomIdRouteConstraint();

// Act
var actual = ConstraintsTestHelper.TestConstraint(constraint, parameterValue);

// Assert
Assert.Equal(expected, actual);
}
}

public class ConstraintsTestHelper
{
public static bool TestConstraint(IRouteConstraint constraint, object value,
Action<IRouter> routeConfig = null)
{
var context = new Mock<HttpContext>();

var route = new RouteCollection();

if (routeConfig != null)
{
routeConfig(route);
}

var parameterName = "fake";
var values = new RouteValueDictionary() { { parameterName, value } };
var routeDirection = RouteDirection.IncomingRequest;
return constraint.Match(context.Object, route, parameterName, values, routeDirection);
}
}

Now note the output as I run "dotnet test". One test with six results. Now I'm successfully testing my custom inline route constraint, as a unit. in isolation.

xUnit.net .NET CLI test runner (64-bit .NET Core win10-x64)

Discovering: CustomIdRouteConstraint.Test
Discovered: CustomIdRouteConstraint.Test
Starting: CustomIdRouteConstraint.Test
Finished: CustomIdRouteConstraint.Test
=== TEST EXECUTION SUMMARY ===
CustomIdRouteConstraint.Test Total: 6, Errors: 0, Failed: 0, Skipped: 0, Time: 0.328s

Lots of fun!


Sponsor: Working with DOC, XLS, PDF or other business files in your applications? Aspose.Total Product Family contains robust APIs that give you everything you need to create, manipulate and convert business files along with many other formats in your applications. Stop struggling with multiple vendors and get everything you need in one place with Aspose.Total Product Family. Start a free trial today.


© 2016 Scott Hanselman. All rights reserved.
     

.NET Core 1.0 is now released!

$
0
0
Code .NET in the Cloud!

I feel like it's the culmination of all these years of work in .NET and Open Source. This is why I came to work at Microsoft; we wanted to open source as much as we could and build a community around .NET and open source at Microsoft. 15 years and the work of thousands of people later, today we released .NET Core 1.0.

Take a moment and head over to http://dot.net and check out the download page. It's got a really nice place you can try out C# directly in the browser without having to install anything! There's also a great C# Tutorial with interactive browser-based tools as well.

.NET Core 1.0 runs on Windows, Mac, and several flavors of Linux including RedHat Enterprise Linux and Ubuntu. It supports C#, VB, and F# and modern constructs like generics, Language Integrated Query (LINQ), async support and more. The Core Runtime, libraries, compiler, languages and tools are all open source on GitHub where contributions are accepted, tested and fully supported.

Getting started with .NET Core

What is .NET Core? Here's some details from the .NET Blog:

.NET Core is a new cross-platform .NET product. The primary points of .NET Core are:

  • Cross-platform: Runs on Windows, macOS and Linux.
  • Flexible deployment: Can be included in your app or installed side-by-side user- or machine-wide.
  • Command-line tools: All product scenarios can be exercised at the command-line.
  • Compatible: .NET Core is compatible with .NET Framework, Xamarin and Mono, via the .NET Standard Library.
  • Open source: The .NET Core platform is open source, using MIT and Apache 2 licenses. Documentation is licensed under CC-BY. .NET Core is a .NET Foundation project.
  • Supported by Microsoft: .NET Core is supported by Microsoft, per .NET Core Support

.NET Core is composed of the following parts:

  • A .NET runtime, which provides a type system, assembly loading, a garbage collector, native interop and other basic services.
  • A set of framework libraries, which provide primitive data types, app composition types and fundamental utilities.
  • A set of SDK tools and language compilers that enable the base developer experience, available in the .NET Core SDK.
  • The ‘dotnet’ app host, which is used to launch .NET Core apps. It selects and hosts the runtime, provides an assembly loading policy and launches the app. The same host is also used to launch SDK tools in the same way.

Blogs

Here are the major blogs carrying the announcement.

We are also releasing .NET documentation today at docs.microsoft.com, the new documentation service for Microsoft. The documentation you see there is just a start. You can follow our progress at core-docs on GitHub. ASP.NET Core documentation is also available and open source.

Have fun!


Sponsor: Build servers are great at compiling code and running tests, but not so great at deployment. When you find yourself knee-deep in custom scripts trying to make your build server do something it wasn't meant to, give Octopus Deploy a try.



© 2016 Scott Hanselman. All rights reserved.
     

VIDEO: How to run Linux and Bash on "Windows 10 Anniversary Update"

$
0
0

Ya, I'm not a fan of the name Windows 10 "Anniversary Update" but it has been a year since Windows 10 came out. It's my daily driver and it gets better every month. This year it's gonna get better (like Windows 10.1 better if you ask me) with an update that's coming August 2nd!

In that update (or in the Windows 10 Insider Builds you can get if you're a techie or adventurous) you're going to get a lot of nice polish AND the ability to optionally run Linux (ELF) Binaries on Windows 10 at the command line. The feature is the Linux Subsystem for Windows or "Bash on Windows" or sometimes "Ubuntu on Windows." Call it what you like, they're real, and they're spectacular.

We first saw Bash on Windows 10 in march of this year at the BUILD conference.

Developers can run all their Linux user-mode developer tools like Redis or even TensorFlow (without GPU support).

I went and recorded a 20 min video screencast showing what you need to do to enable and some cool stuff that just scratches the surface of this new feature. Personally, I love that I can develop with Rails on Windows and it actually works and isn't a second class citizen. If you're a developer of any kind this opens up a whole world where you can develop for Windows and Linux without compromise and without the weight of a VM.

I hope you enjoy this video! Also check out (and share) my other Windows 10 videos or my Windows 10 playlist at http://hanselman.com/windows10.

Sponsor: Build servers are great at compiling code and running tests, but not so great at deployment. When you find yourself knee-deep in custom scripts trying to make your build server do something it wasn't meant to, give Octopus Deploy a try.



© 2016 Scott Hanselman. All rights reserved.
     

Is your stuff backed up? Recovering from a hardware failure

$
0
0

My computer died and I am sadI had a massive hardware failure over the holiday weekend. I can only tell you what I think happened. I'm not an electrical engineer so if you know more (and I'm sure you do), do feel free to share your thoughts in the comments.

For my main machine in my home office I'm running the Ultimate PC that Jeff Atwood was so kind to build for me a few years back. It's not the Ultimate anymore, but I will say it's still VERY competent. I've upgraded the memory, video card, and SSD (more on the SSD in a moment) and it's a great machine and very very fast.

The tower was connected to an APC 850VA UPS that had worked nicely for a while. I replace just the batteries in my UPS's every 18-24 months. This last week the UPS started a low "scream" so I went over to check it out. It had turned off suddenly, so the PC and all the accessories were also off. I turned it back on and there was a series of snaps and pops, another screen, followed by a non-trivial amount of smoke and a burning electrical smell.

When it was all over, the main fuse of the house had popped, the UPS was dead and smoking, and the power supply in my computer was dead and smoking. Ugh.

I headed down to the local electronics shop and bought a new 1000W power supply, a new APC BR1000G, and went to town, rebuilding my machine. After redoing all the cables and stuff...it didn't boot. I didn't even see the hard drive (SSD). The drive is a Crucial c300. I loved this drive and it worked great for like 6 years...and now it's dead. Turns out that these Crucial drives are known to die when they lose power quickly. I tried to bring it back to live using all the various forums and whitepapers about this known issue, but nope. It's dead.

OK, so have I lost data? What now? Fortunately I backup my systems. And I hope you, Dear Reader, also backup as well.

Stop reading this now and please, think about your backups. Do you have one? Have you tested to see if you can restore from your backups?

Backups always succeed. It's restores that fail. Test your backups by restoring from them.

I've got a number of backups because I practice the Backup Rule of Three.

  • 3 copies of anything you care about - Two isn't enough if it's important.
  • 2 different formats - Example: Dropbox+DVDs or Hard Drive+Memory Stick or CD+Crash Plan, or more
  • 1 off-site backup - If the house burns down, how will you get your memories back?

Here's what my backup situation is/was and how I restored.

While you can use Imaging Software and restore an entire image of Windows or Mac, I find that reinstalling Windows takes less than an hour. I keep a bootable USB key of Windows 10 around. You can also download an ISO and make a USB key quickly. You don't usually need an activation key if you're reinstalling Windows. In my case, I installed the new drive, booted off the USB, signed into Windows with my Live ID (Microsoft Account) and it picked up my Windows license already.

Windows File History

I have a 4TB external drive on my desk that uses Windows 10 File History. This is like the Mac Time Machine feature. It's one of the best little "hidden" features of Windows 10 and everyone should use it. It's actually been around for years. My Documents, Desktop, and any other folders I want are automatically backed up as often as I want. I have a backup going every 30 min and I never think about it. It just works, and I don't notice any performance issues.

In this case, I *did* have crap on my desktop that wasn't in Dropbox and wasn't yet backed up to the cloud. I just hooked up the drive and restored from File History. I literally lost nothing. All my desktop crap was restored in place. If you have an external drive that you always have hooked up but it's not really getting use, setup File History in just minutes.

Multiple Cloud-based Backups

I have a number of clouds in my backup rotation:

  • GitHub - I have github repos, both private and public for code.
  • DropBox - My primary cloud files backup
  • OneDrive for Business - My work cloud files backup
  • Synology - I love my Synology. It's a complete home NAS Server with massive storage, RAID, VPN, Docker, and so much more. A daily joy and a local cloud.
  • CrashPlan - I keep TBs up there and pay them happily for the service.

Related Links

Here's some additional reading on ways to back up your system. Please do also help non-technical relative back up their stuff as well. Every week I hear about someone working on their PhD thesis losing their whole life's work an instant. Backup is a system and it CAN be automatic.

What do you do for backup?


Sponsor: Many thanks to my friends at Stackify for sponsoring the feed this week! it’s what being a developer is all about so do it the best you can. That’s why Stackify built Prefix. No .NET profiler is easier or more powerful. You’re 2 clicks and $0 away, so build on! Prefix.io.



© 2016 Scott Hanselman. All rights reserved.
     

Where's DNVM? Safely running multiple versions of the .NET Core SDK and Tooling with global.json

$
0
0

On June 27th both the ASP.NET Core and .NET Core 1.0 runtimes were officially released. They are now version 1.0 and are both supported frameworks. However, the "tooling" around .NET Core remains in a Preview state. However, it's really easy and safe to swap between command-line tooling versions.

  • NET Core SDK = Develop apps with .NET Core and the SDK+CLI (Software Development Kit/Command Line Interface) tools
  • .NET Core = Run apps with the .NET Core runtime

You'll see over on the .NET Advanced Downloads page the complete list of downloads including those for Windows, Mac, and several flavors of Linux. It's even supported on RedHat Enterprise Linux...it's surreal to see that RedHat even has .NET Core docs on their site.

Where's DNVM List?

A year ago before ASP.NET Core and .NET Core fully merged and the "dotnet" command line was created, there was a command line tool called "dnvm" or the .NET Version Manager. It would give you a list of the .NET Core runtimes you had installed and let you switch between them. While that exact style of functionality may return as the SDK and tools continues development, you can easily have multiple .NET Core SDKs and CLIs installed and switch between them on a per project basis.

For now, if you want the equivalent to "dnvm list" to see what .NET Core SDKs are installed at a system level, you'll look here.

Where is the .NET Core SDK installed?

When you install the .NET Core SDK on Windows it shows up in C:\Program Files\dotnet\sdk.

C:\Program Files\dotnet\sdk

In this screenshot I have four .NET Core SDKs installed. The SDK that ships with .NET Core 1.0 is 1.0.0-preview2-003121. However, you'll note that I have two newer .NET SDKs installed. Since it's all open source, you can head over to https://github.com/dotnet/cli and scroll down a bit.

There are CI (continuous integration builds) and a complete table of versions that you can download. Be sure to check the Build Status and see that things are passing and healthy, but also have a reason for downloading a daily build.

Know WHY you want a daily build of the .NET Core SDK. Are you checking on a specific bug to see if it's fixed? Is there a new feature that you require?

image

I noticed a specific bug that was bothering me in the Preview 2 tooling. I like to use the new logging system and I like that it uses ANSI Colors when logging to the console. When I go "dotnet run" I get very nice ANSI-colored output. However, when I used "dotnet test" or "dotnet watch," I would lose all my ANSI colors from the same logging calls and just get plaintext. I commented on the GitHub issue here as it's clearly a bug.

ANSI Colors are lost with dotnet watch

It's a cosmetic bug on the way dotnet.exe works with child processes, but it was still annoying to me. The cool part is that when it was/is fixed, as it was with this pull request, I can get a build and install it without fear.

Side by Side .NET Core SDK installs and global.json

I can check the version at the command line like this:

C:\>dotnet --version

1.0.0-preview2-003121

C:\>dotnet --info
.NET Command Line Tools (1.0.0-preview2-003121)

Product Information:
Version: 1.0.0-preview2-003121
Commit SHA-1 hash: 1e9d529bc5

Runtime Environment:
OS Name: Windows
OS Version: 10.0.143xx
OS Platform: Windows
RID: win10-x64

Here I've got the version that shipped with .NET Core 1.0. I want to use the latest one, then go back to my app and use "dotnet watch" or "dotnet test" and see if the bug was really fixed in this version. But what if want my app to be driven by this new dotnet CLI?

I've got a global.json in the root of my solution in c:\lab2 that looks like this. I'm going to change the version to the new one in a moment.

{

"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-preview2-003121"
}
}

My projects are in src and my tests are in test, all underneath the main solution folder that contains this global.json file. If the "sdk" section didn't exist, running dotnet --version would pick up the latest one.

If the sdk is "pinned" to a specific version that means that when I run dotnet --version while in this folder or below, I'll get the specific version I've asked for.

Now I'll go to https://github.com/dotnet/cli and install (for example) 1.0.0-preview3-003180. This daily build has the fix for that ANSI bug I care about. Again, you can see this version is installed by looking in the first Windows Explorer screenshot above, and in c:\program files\dotnet\sdk.

Remember that my global.json in my c:\lab2 folder specifies (pinned) preview2? Now running dotnet.exe looks and works like this...read carefully.

C:\lab2>dotnet --version

1.0.0-preview2-003121

C:\lab2>cd ..

C:\>dotnet --version
1.0.0-preview3-003180

C:\>where dotnet
C:\Program Files\dotnet\dotnet.exe

See that? I get preview2 inside the lab2 folder but I get the latest anywhere else. But how?

A little known Windows command line trick is the "where" command. You can say "where notepad" and if there are more than one on the PATH, you'll get a list. However, here there's just one dotnet.exe, but I get different results when I run it in different folders. Exactly how this works is explained in exquisite detail in Matt Warren's post "How the dotnet CLI tooling runs your code" but it LOOKS like this, as viewed in Process Explorer:

DotNet.exe picks up the SDK version from global.json

And when I change the version in global.json to the daily I downloaded?

Here dotnet.exe uses the a newer installed SDK

The dotnet.exe application will look at global.json and then do the right thing. This way I can have lots of projects bring driven by different versions of the "dotnet" command without having to type anything other than "dotnet run" or "dotnet test."

It also allows me to keep using the .NET 1.0 runtime that is released and supported, while quickly testing new tooling features and checking on fixed bugs like this ANSI one that was annoying me.


Sponsor: Many thanks to my friends at Stackify for sponsoring the feed this week! it’s what being a developer is all about so do it the best you can. That’s why Stackify built Prefix. No .NET profiler is easier or more powerful. You’re 2 clicks and $0 away, so build on! Prefix.io.


© 2016 Scott Hanselman. All rights reserved.
     

Self-care matters: Pay yourself first

$
0
0

My sonI was meeting with a mentee today and she was commenting how stressed out she was. Overwhelmed with work, email, home, life, dinners, the news, finances...you know. LIFE. I am too. You likely are as well.

We spent about on the phone talking about how to make it better and it all came down to self-care. Sometimes we all need to be reminded that we matter. It's OK to take a moment and be selfish. You are the center of your universe and it's important to take time for yourself - to appreciate your value.

Depending on your personality type, you may give so much of yourself to your family, your work, your family and friends that you forget what's at the core! You! If you don't take care of yourself then how will you take care of everyone else?

This may seem obvious to you. If it does, that's cool. Click away. But sometimes obvious things need to be said and for my mentee and I, today, we needed to hear this and we needed a plan.

Here's some of our ideas.

  • Cancel a meeting.
    • Maybe cancel two. If you look at your day with absolute dread, is there a ball that you can drop safely? Perhaps ask a coworker if they can handle it for you?
  • Pay yourself first
    • Finances are a stressor for everyone. My wife and I used to argue about little $5 debit card things because they not only added up but they filled up the register, were hard to track, and generally distracted us from important stuff like the rent. Now we get an allowance. I don't use a credit card, I have a certain amount of cash each week (we get the same amount). I can buy Amazon Gift Cards or iTunes cards, I can eat at Chipotle whenever, or buy an Xbox game. Now when an Xbox game shows up she is interested in hearing about the game, not sweating how it was purchased. Pay yourself first.
  • Setup Formal Me-Time
    • Once a week my wife and I have a day off. From each other, from the family, just...off. I leave at 5pm and come back late. She does the same. Sometimes I see a movie, sometimes I walk around the mall, sometimes I code or play Xbox. The point is that it's MY TIME and it's formal. It's boxed and it's mine. And her time is hers. You shouldn't have to steal an hour when you're super stressed. PAY yourself an hour, up front.
    • We also do a weekly date night. Always. Gotta prioritize. I hate hearing "we haven't seen a movie or had a dinner in years...you know, kids." Nonsense. Get a sitter from the local uni and pay yourself first with TIME.
  • Self-care
    • Schedule a massage. Have your nails done (everyone should do their nails at least once). Get a haircut. Dance. Clean your office. Sleep. Do whatever it is that feeds your spirit.
  • Say no
    • Sometimes "No. I just can't right now." is enough to stop an email thread or a something when you feel you just can't. Drop the ball. Life is somewhat fault tolerant. Use your judgment of course, but truly, unless your software is saving babies, maybe take a break. Even an hour or a "mental health day" helps me no burn out.

Do you pay yourself first? Do you need to be reminded that you deserve health and happiness? Let me know in the comments.


Sponsor: Big thanks to Redgate for sponsoring the feed this week. Have you got SQL fingers? Try SQL Prompt and you’ll be able to write, refactor, and reformat SQL effortlessly in SSMS and Visual Studio. Find out more!



© 2016 Scott Hanselman. All rights reserved.
     

Exploring dotnet new with .NET Core

$
0
0

I'm very enjoying the "dotnet" command line. Mostly I do "dotnet new" and then add to the default Hello World app with the Visual Studio Code editor. Recently, though, I realized that the -t "type" and -l "lang" options are there and I wasn't use them. I think they are a little awkward, in that you have to:

dotnet new -t Web

when I think it should be more like dotnet new [type] as in

dotnet new web

What do you think? I find the -t a little heavy. I like the idea of "web" being empty, and "web/mvc" or "web/webapi" having more fleshed out stuff. Even "web/angular," you get the idea. Sound off in the comments. Regardless, there's cool templating tooling coming, I hear, but for now there's more there than I realized.

Of course, there's the default "dotnet new" which is a Hello World console app with a program.cs and project.json. In the future I think it will just run the app, and you'll have to do something like -v verbosity to get the details that we don't usually need to see.

C:\Users\scott\Desktop\test\console>dotnet run

Project console (.NETCoreApp,Version=v1.0) will be compiled because expected outputs are missing
Compiling console for .NETCoreApp,Version=v1.0

Compilation succeeded.
0 Warning(s)
0 Error(s)

Time elapsed 00:00:01.1591124

Hello World!

You can add -l (lang) to it and "dotnet new -l F#" and get an F# Console app rather than a C# one:

C:\Users\scott\Desktop\test\fsharp>dotnet run fabu!

Project fsharp (.NETCoreApp,Version=v1.0) was previously compiled. Skipping compilation.
Hello World!
[|"fabu!"|]

C:\Users\scott\Desktop\test\fsharp>type Program.fs
// Learn more about F# at http://fsharp.org

open System

[<EntryPoint>]
let main argv =
printfn "Hello World!"
printfn "%A" argv
0 // return an integer exit code

There's also "dotnet new -t lib" which is super basic and gives you a quick new project with a Class1 and an Empty Method. Not so useful, but good to know.

You can also "dotnet new -t xunittest" to make a new test project. Nice that this is built-in! Now I just "dotnet test" after a "dotnet restore" and I get test results!

xUnit.net .NET CLI test runner (64-bit win10-x64)

Discovering: testing
Discovered: testing
Starting: testing
Finished: testing
=== TEST EXECUTION SUMMARY ===
testing Total: 1, Errors: 0, Failed: 0, Skipped: 0, Time: 0.146s
SUMMARY: Total: 1 targets, Passed: 1, Failed: 0.

Side Note: If the folder name of the project is the same as one of the dependencies, it can confuse the resolver. For example, I did my new test project in a folder creatively named "XUnit." This is also the name of a dependency. I got the error: Errors in C:\Users\scott\Desktop\test\xunit\project.json Cycle detected:  xunit (>= 1.0.0) -> xunit (>= 2.1.0) -> xunit (>= 2.1.0). Note that 1.0.0 there. That's my project, which is 1.0.0. Solution? Rename my project's containing folder.

There's ASP.NET Core Hello World, which is "dotnet new -t Web." This will give you a nice simple ASP.NET Core app with some simple defaults that's setup for bower, gulp, and npm usage. I anticipate we'll see varying levels of what folks consider "complete."

yo aspnet: dotnet new -t web isn't the only way to make a new ASP.NET Core project from the command line (CLI). You can also use the Yeoman generator or "yo aspnet" to make very interesting projects, as well as create your own generators. In fact, Steve Sanderson has some impressive generators like his "aspnet-spa" generator for making Angular, React, and Knockout Single Page Apps (SPA) with ASP.NET Core.

image

All these generators work on Windows, Mac, and Linux, of course. I believe the intent is to reconcile them all such that Visual Studio proper and Visual Studio Code via the CLI will all get the same "File | New Project" results. Visual Studio will still be more "visual" but everything you can do in one world can and should be possible in another.


Sponsor: Big thanks to Redgate for sponsoring the feed this week. Have you got SQL fingers? Try SQL Prompt and you’ll be able to write, refactor, and reformat SQL effortlessly in SSMS and Visual Studio. Find out more!



© 2016 Scott Hanselman. All rights reserved.
     

Windows 10 "Developer Mode"

$
0
0

imageThe new Windows 10 update coming in a few weeks. It's called Windows 10 "Anniversary Edition" (I would have just called it 10.1, because, I dunno, monotonically increasing numbers and all, but whatever) and it has a LOT of really nice refinements.

Windows 10 is continuously updated and has been a few times since release, but this most recent one adds a lot of cool stuff like support for Bash on Ubuntu for Developers. For some folks who say they "wait for version 3" - this coming update is that version 3.

One thing I've noticed - and I'm personally rooting for - is a specific section in Windows Settings that seems to be getting some more love. I'm hoping we (developers and power users) will see some real investment here. If you agree after reading this post, sound off in the comments and maybe someone at Microsoft will notice and agree.

If you go to the Settings app on these newer Windows 10 builds, you'll notice "For Developers" as a new menu item. Now, to be clear, I'm reading into this and likely adding meaning where there may not be, but I love this. It's a formal place in the operating system where I can TELL IT THAT I AM A DEVELOPER. 

I can say "I want this machine to be in developer mode."

image

Under Developer Mode in the Insiders' Builds there is a nice collection of developer and power-user related settings brought together under one roof. What's great about this is that you already know these settings. As a developer you likely install Windows and then immediately go around to Windows Explorer, the Registry, and a bunch of other places to tweak Windows to how you work as a developer.

For example, Windows Explorer. Non-technical parent doesn't need to see Hidden Files or have the Full Path in the Title Bar. But I DO, and those settings are all in one place.

image

Seriously, the "Full path in the title bar" thing is super useful. I used to say "that should be the default." Now I realize that it shouldn't be. It should be the default for Developers.

image

There's other options as well for Remote Desktop, PowerShell, and remote diagnostics.

image

Today this new Developer Mode settings page looks like a nice collection of conveniences, but I really think it's got amazing potential, again as a formal declaration that I am a developer.

In the future I'd love to see (totally brainstorming here as I am not in the Windows department) a quick way to turn on Bash on Ubuntu on Windows 10, or quickly download VSCode or Visual Studio Community, get .NET Core, install Python, install mobile device emulators, install SysInternals or prep my system for remote debugging.

What do YOU think?


Sponsor: Do you deploy the same application multiple times for each of your end customers? The team at Octopus have been trying to take the pain out of multi-tenant deployments. Check out their 3.4 beta release.



© 2016 Scott Hanselman. All rights reserved.
     

Making YouTube videos look sharp and professional on a budget

$
0
0

My team is doing some videos to show off some features in Visual Studio. Most of my videos or YouTubes are screencasts so the video quality of the people parts aren't a huge deal. I REALLY try to make my audio sound good but I've been somewhat lax on the video side, usually just using a webcam. While the Logitech 930e is amazing as webcams go, it's not really "pro." It looks good but it still looks and feels like a webcam in both field of view and depth of field.

image

I went looking for videos that had the look and feel I wanted and asked those folks that I admired how they did it.

I always love the way my friend Chescaleigh's YouTube videos look. They are clear and in focus, with amazing lighting and the background is "blown." That means there is a shallow depth of field with just Franchesca in focus and the background is a somewhat blurry.

Franchesca's videos are very professional

Franchesca pointed me to the Canon T3i DSLR HD camera. This is not just a nice still camera but also a very competent HD Video Camera that puts out fantastic 1080p video directly to an SD Card along with the ability to use alternate lenses. It also has options you can add on later like a remote control for focusing and starting/stopping recording.

The trick with the T3i is that it's a little older and you can find them for as little as $200-$250 on Craigslist. I've seen them cheap on Amazon as well. That makes them reasonable for a budget but again, the results look AMAZING.

I also love this video by Rachel Weil doing an overview Visual Studio Code. She steps it up with an interesting background and razor sharp focus. Her audio is also fantastic.

Rachel adds this Canon EF 50mm lens to her Canon DSLR to get a really tight focus. I haven't bought this lens yet but it's on my Amazon wishlist for the future.

Rachel's video is top notch

Good audio is so important. I tried cheap lavaliere microphones but I find I get the best results with a condenser mic held just out of frame. I like the Samson C01U but you can get decent USB Mics for <$50. Record your video and audio in separate files, and before you start talking *CLAP* very loud to make a spike in your audio, then you can line up your audio and video/audio files in your editor like iMovie or Movie Maker. Then mute the audio in your main audio/video file so you'll be hearing the high quality audio from your good mic and the high quality video from your camera.

Lining up video and audio

Finally, you need GOOD LIGHTING. ZOMG it matters so much. Even if you ignore all these tips and just use a webcam, get a nice light. Maria from my team recommended this CowboyStudio Dual Mount Brackets to let me mount a mic and lights to my camera, then I picked up this FANTASTIC 160 LED Power Panel. It's perfect because it's dimmable and includes color filters for getting different color temperatures or a diffuse effect.

image

I feel like the result is very close to the look I wanted and looks much more professional given a reasonable budget. Again, if you keep your equipment module (mic, camera, lenses, stands, lights, etc) you can improve your setup, as I have, as you have the cash.

image

How do YOU make videos that look sharp? Let me know in the comments.


Sponsor: Do you deploy the same application multiple times for each of your end customers? The team at Octopus have been trying to take the pain out of multi-tenant deployments. Check out their 3.4 beta release.



© 2016 Scott Hanselman. All rights reserved.
     
Viewing all 1148 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>