Scott Hanselman

Reality TV for Developers - Where is Twitch.tv for Programmers?

January 17, '15 Comments [41] Posted in Musings
Sponsored By

Twitch.tv is basically YouTube where you can watch other folks play video games. It initially sounds ridiculous but it's actually surprisingly compelling. You can see how other people solve problems LIVE. Interestingly "watching interesting people solve interesting problems" is a good description for many of my favorite movies and TV shows.

Where is Twitch.tv for programmers? I'd like to watch a reality TV show where a competent and interesting programmer creates something interesting. There is CodersTV but somehow it isn't quite there. Minecraft's famous creator "Notch" has used Twitch to stream some of his crash coding sessions for gaming events like Ludum Dare. There is a small "Game Development" category on Twitch but it's not exactly Must-See-TV.

While I haven't seen any videos from Microsoft of developers live coding, maybe there should be. Certainly there's been a lot more transparency around design meetings lately. There was a great tweet recently that pointed out an unusual video on Channel 9, Microsoft's "inside the cockpit" website. The video is a nearly 2 hour API Review for the .NET Core Libraries.

Drink that in for a second. A compliment on a video of a two hour meeting? And the video has over 15,000 views...folks like to be a fly on a wall in meetings like this!

The ASP.NET Team has been hosting weekly Community Standup meetings using Google Hangouts. You can watch the archives here, or join us every Tuesday (unless someone is travelling, then we'll move things a bit).

Do you like this kind of video? Would you like to watch some real coding with or without running commentary? Do you enjoy seeing design meetings and real decisions being made...complete transparency?


Sponsor: Welcome this week's feed sponsor, Stackify! - The only developer-friendly solution that fully integrates .NET error & log management with application monitoring. Easily isolate issues and focus your efforts – Support less, Code more. Free trial

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

How to map an Insert Key on your Surface Pro 3 Keyboard

January 13, '15 Comments [30] Posted in Tools
Sponsored By

I'm very happy with my Surface Pro 3 and continue to use it happily. However, the Type Keyboard on the Surface Pro 3 lacks an Insert Key.

Surface Pro 3 Type Cover

For some this may feel like a real problem, but remember your computer (and the internet itself) is not a black box. You can remap the keys if you like. The Windows, via the registry, supports keymapping at its core. SharpKeys is a free little utility that lets you easily create the registry entries you want to remap the keys the way you'd like them.

Here's a screenshot of my registry where I've remapped Right Alt to be Insert. But who wants to edit the registry manually, right?

The Registry is scary

Here's SharpKeys, where I mapped Right Alt to Insert on my Surface Pro 3 Keyboard. Then SharpKeys writes the Scancode Map key for me. Just log in and log out to see your changes in action.

Disclaimer: You can do dumb stuff and mess yourself up if you disable a key you REALLY need. That's why I changed just Right Alt, since I still have Left Alt. HOWEVER, some apps (VMWare, etc) you use may need specific keys, and you'll want to be smart about what you map to other keys.

You can click Type Key and map left to right, or pick from the list yourself as I've done here.

Mapping Right Alt to Insert in SharpKeys for my Surface Pro 3

It works great! Hope this helps you.


Sponsor: Welcome this week's feed sponsor, Stackify! - The only developer-friendly solution that fully integrates .NET error & log management with application monitoring. Easily isolate issues and focus your efforts – Support less, Code more. Free trial

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

NuGet Package of the Week: Polly wanna fluently express transient exception handling policies in .NET?

January 13, '15 Comments [13] Posted in NuGet | NuGetPOW
Sponsored By

LOL at my own post title. Pardon me.

Install-Package Polly

Michael Wolfenden has a very clever open source library called Polly. Polly is a .NET 3.5 / 4.0 / 4.5 / PCL library that allows developers to express transient exception handling policies such as Retry, Retry Forever, Wait and Retry or Circuit Breaker in a fluent manner.

Handling exceptions can be a hassle sometimes. Not just setting the try/catches up, but deciding on the policy for the catch can make the exception management code more complex than the method itself!

Polly has a fluent interface to make expressing rules like that much easier. For example:

// Single exception type
Policy
.Handle<DivideByZeroException>()

// Single exception type with condition
Policy
.Handle<SqlException>(ex => ex.Number == 1205)

// Multiple exception types
Policy
.Handle<DivideByZeroException>()
.Or<ArgumentException>()

// Multiple exception types with condition
Policy
.Handle<SqlException>(ex => ex.Number == 1205)
.Or<ArgumentException>(ex => x.ParamName == "example")

Then you can add Retry() logic, which is fantastic.

// Retry multiple times, calling an action on each retry 
// with the current exception and retry count
Policy
.Handle<DivideByZeroException>()
.Retry(3, (exception, retryCount) =>
{
// do something
});

Even do retries with multiplicative back off!

// Retry a specified number of times, using a function to 
// calculate the duration to wait between retries based on
// the current retry attempt, calling an action on each retry
// with the current exception, duration and context provided
// to Execute()
Policy
.Handle<DivideByZeroException>()
.WaitAndRetry(
5,
retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)),
(exception, timeSpan, context) => {
// do something
}
);

Once you have set up a policy, you execute on it.

Policy
.Handle<SqlException>(ex => ex.Number == 1205)
.Or<ArgumentException>(ex => ex.ParamName == "example")
.Retry()
.Execute(() => DoSomething());

Polly also supports the more sophisticated "Circuit Breaker" policy. For more information on the Circuit Breaker pattern see:

Circuit breaker tries and then "Trips the circuit breaker" so you'll get a BrokenCircuitException for some amount of time. This is a great way to give an external system to chill for a minute if it's down. It also externalizes the concept so that you could theoretically handle a down database the same as you handle a down external web API.

// Break the circuit after the specified number of exceptions
// and keep circuit broken for the specified duration
Policy
.Handle<DivideByZeroException>()
.CircuitBreaker(2, TimeSpan.FromMinutes(1))

You can explore the code, of course, up on Github in the Polly repository. Go give the Polly project a star. They've recently added async support for .NET 4.5 as well!


Sponsor: Welcome this week's feed sponsor, Stackify! - The only developer-friendly solution that fully integrates .NET error & log management with application monitoring. Easily isolate issues and focus your efforts – Support less, Code more. Free trial

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Refresh Your PC in Windows, AppData, and my missing Minecraft worlds

January 8, '15 Comments [32] Posted in Win8
Sponsored By

I thought I lost everything today. Well, not really, I have a very regular Backup Strategy (stop reading this blog post NOW and back your stuff up!) so I could get stuff back if I really needed to.

But a laptop died today. It just wouldn't start up and I had to run "Refresh my PC," a very cool feature of Windows that basically mostly reinstalls Windows without reinstalling. It promises not to lose your files. And it's (99%) true, because when I got Windows back up later my Documents and Desktop were just as I left them, untouched by the this major operation.

Refresh your PC - Windows 8.1

Fortunately I used Boxstarter, Chocolately, and a list of the programs I have installed as a Gist and was able to get my Windows machine with all my desktop programs back up and running in a few hours. All my files were backed up to the cloud and every file was where I left it.

Except the most important ones. ;)

I launched Minecraft, and saw this. And almost died.

My minecraft worlds are missing!

Where's my Minecraft save games/worlds?

I thought Windows promised to not change my files!? Well, sadly Minecraft doesn't save worlds in "My Documents\Minecraft," where it should. It puts them instead in c:\Users\YOURNAME\AppData\Roaming\.minecraft\saves which is basically like a temp folder of sorts for config data.

Fortunately after my initial freak out, even these files aren't lost, they are in C:\Windows.old\users\YOURNAME\AppData\Roaming\.minecraft\saves along with all your other AppData stuff including the npm-cache, .emacs.d, and other config data you might want.

Move them back, and you're (I'm) all set!

To the (Minecraft) Cloud!

Whew.

Related Links

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Getting Started with Robots for kids and children in STEM this holiday season

December 26, '14 Comments [26] Posted in Parenting
Sponsored By

Now's the perfect time to buy your kids/nieces/cousins some robots. Robots are a great way to get children excited about computers. Robots get them stoked in a way that a simple Hello World console app just can't.

If you're not careful you can spent hundreds on robots. However, I'm notoriously frugal and I believe that you can build some amazing stuff with children with a reasonable budget.

Here's some of the robot and electronics kits I recommend and have built with my kids.

4M Tin Can Robot

This is just a teaser but it's less than a trip to the movies. This silly little kit takes 2 AAA batteries and will take an aluminum can and animate it. It gets kids thinking about using found objects in their robots, as opposed to them thinking custom equipment is always required.

tincan

Quadru-Bot 14-in-1 Solar Robot

One of the challenges is "what age should I start?" and "how complex of a robot can my __ year old handle?" Kits like this are nice because they are starting with batteries and gears and include two levels of building, basic and experienced. It's also a nice kit because it includes solar power as an option and also can work in water (the bath).

713-IOSBdAL._SL1500_

OWI Robotic Arm Edge

This isn't a kit but it's a reasonably priced robotic arm to get kids thinking in terms of command and control and multiple dimensions. OWI also has a cool 3in1 robot RC kit if you prefer driving robots around and more "rebuildability."

51LAkVypvAL

Mirobot

This Christmas my 7 year old and I built a Mirobot. You can get pre-soldered and solder-yourself kits. We got the main Mirobot Kit PLUS the Addons Kit which includes clever additional modules for Line Following, Sound, and Collision Detection.

The whole Mirobot execution is brilliant. The hardware and software are all open source, so if you want to acquire the parts and make it yourself you can. You can get kits in various levels of preassembly.

It's built on an Arduino but is preloaded with some very clever software that takes advantage of its onboard Wifi. You can program it in C with Arduino tools, of course, but for kids, they can use JavaScript and an in-browser editor, much like Logo. It will create its own ad-hoc wifi network by default, or you can join it to your home network.

image

The creator is also building an Apps Platform so you can control the Mirobot from other apps within your browser and websocket your way over to the robot.

It took us about a weekend to build and you can see in the pic below that my 7 year old was able to install a pen and get the bot to draw a stickman. He was THRILLED.

10838706_883990588298288_1242836197_n

Edison

This isn't the Intel Edison, although you can make some great robots with it as well. No, this is Edison, a little LEGO compatible robot from the makers of Microbric, a great robot platform from a few years ago. I actually made a Microbric robot in 2007 and blogged about it.

Edison is fantastic and just $50. If you're a teacher and can get a multiples pack, you can get them as cheap as $35 each. You program Edison with a clean drag and drop icon system then download the program to your robot with a cable from your computer's headphone jack.

Out of the box you can have it follow a flashlight/torch, follow lines on paper, fight each other in a sumo ring, avoid walls, and lots more. In this picture there's two Edison's stacked on each other. The top one has the wheels removed and replaced with Lego elements to make robot arms.

image

LEGO Mindstorms

OK, yes, LEGO Mindstorms are $350, so that's not exactly frugal. BUT, I've seen parents buy $500 iPads without a thought, why not consider a more tactile and engineering-focused gift for a girl or boy?

This is THE flagship. It's got Wifi, Bluetooth, color sensors, iPad apps, collision detection, motors galore and unlimited replayability. There's also a huge online community dedicated to taking Mindstorms to the next level. If you can swing it, it's worth the money and appropriate for anyone from 6 to 60.

81Hn0H3SyAL._SL1500_

Snap Circuits

I couldn't love Snap Circuits more. I started with the Jr. Snap Circuits and we eventually graduated to Snap Circuits Pro. They are my #1 go-to gift idea for kids of friends and relatives.

While this isn't a robotics kit, per se, it really builds the basic understanding of batteries, electronics, and motors that kids will need to move to the next level.

91lfaA93v0L._SL1500_

What robot kids do YOU recommend?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.