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

Google Chromecast Review - The race is on to wirelessly throw video to your TV

$
0
0

Google ChromecastThe Google Chromecast is simple and brilliant. It's one of those perfect little "duh! Why didn't someone do that before?" ideas.

I didn't realize I needed one until I realized that I've been chasing the idea for years. In fact, I put together a poor man's "AirPlay Raspberry Pi" Chromecast last year. By plugging my Raspberry Pi running RaspBMC into my Receiver and using it just for Airplay, I was effectively using it as a Chromecast.

You can agree or disagree in the comments, but here's their idea - most of us don't need set-top boxes. The world's big technology companies clearly want to control the largest screen in the house. So far, that's the TV (if you own one.) If TVs go away, it'll be the largest monitor in the house. What's the best way to control this screen?

  • You can get a PS3 or an Xbox. (I have both.)
  • You can get a TiVo. (check.)
  • You can get an Apple TV. (I did the XBMC Airplay thing instead.)

But each of these devices is a darn-near full computer with an OS, and storage, and a life and ecosystem of its own. What we really want is to use our TVs as wireless displays and use the power of our phones, tablets, and computers. Until one of the world's wireless display formats is finally declared the winner, they'll keep making set-top boxes portable computers to connect to our TVs.

We could wait for $1000 receivers to include Wireless Display functionality, or build it into HDTVs. No! Let's make a $35 dongle that capitalizes on the fact that HDMI has finally won. It'll plug into any monitor and we suddenly that HDMI connection is available over wireless. It's open, in fact, to anyone who is on the network.

You just plug the Chromecast into any free HDMI port and get power via micro-USB. Many TVs have a USB port that can provide this power. I used the always-on USB port from my TiVo as it was open.

The Chromecast contains the Marvell 88DE3005 system on a chip. This integrated circuit includes hardware decoding of VP8 and H.264 codecs. Radio communication is handled by AzureWave NH–387 Wi-Fi which supports 802.11b/g/n (2.4 GHz). The device has 512 MB of Micron DDR3L RAM and 2 GB of flash storage. - Wikipedia

When you plug the Chromecast into your TV you'll connect to its initial ad-hoc wireless network and teach it about your wireless network. Then it'll reboot and jump sideways onto your network and most of your config work is done. The only way to change the Chromecast at this point is to hard reset it. The wireless setup process is very similar to other embedded wireless devices like the Nest Thermostat, FitBit Aria Scale, or Twine Wi-Fi device - connect to ad-hoc, setup locally, jump. It took all of 2 minutes.

Ready to cast

Here's my Chromecast plugged into my Onkyo TX-SR674 Receiver's front HDMI port.

The Chromecast in my Receiever

Make sure your phone's YouTube and Netflix apps are updated. They all got Chromecast support automatically last month.

From inside the Google Chrome browser you add the Google Cast extension that lets you play content from within Chrome to the Chromecast. You can cast a browser tab to the screen and show a friend what you're browsing, which is actually very cool and useful...when it works. More on that in a second.

The Good

When it works, it's fabulous. For example, at a recent party someone mentioned a funny YouTube video. Within 30 seconds I had it up on my iPhone, then threw it to the Chromecast. That's exactly how it should work, right?

YouTube Casting Netflix Chromecasting

I've thrown video to the Chromecast from all my iDevices in both the Netflix and YouTube apps. There is a hand-off and then, interestingly, the Chromecast takes over the stream. Rather than the phone or tablet pulling the content down then pushing it again laterally to the Chromecast, there's a little YouTube applet or NetFlix applet running on the Chromecast. The Chromecast inherits or hijacks the stream. All of this is transparent to the user, of course, but it's a clever implementation which allows you to close the app and do other things with your phone.

Each app looks a little different. The YouTube iPhone app shows Views, avatars, and the date when pushed to the Chromecast.

YouTube on a Chromecast

Being able to use your Tablet as a remote is great. Myself, I get this functionality in three totally different ways across my devices, but the result is the same - tablets are good remotes. I have the Tivo App on my iPad, I have the Xbox Smartglass app on my iPad and Surface, and I have the YouTube and Netflix apps on my iPad talking to the Chromecast.

HDMI-CEC is the ability for the Chromecast to automatically tell my receiver to switch to the right HDMI input when content starts playing. It would be amazing if my receiver supported it. If your system has HDMI-CEC the Chromecast will set your inputs for you and remove a step which has a high WAF (Wife Acceptance Factor or Non-Gender-Specific Spouse Acceptance Factor).

The Bad

My computers just can't see the Chromecast anymore. They could last week. This is extremely odd considering we are all on the same wireless network and that the phones and tablets work reliably. You'll find the forums filled with people fighting with this issue. They're having to disable firewalls on MacBooks and turn off IGMP Proxies on FIOs Routers. I've done all that and while on the first day my first laptop was able to cast its Chrome Tabs to the TV, a few days later either Chrome or the Chromecast auto-updated itself and now it's just dead.

No cast devices found

No matter, for $35 it's a great device. It works as advertised on both iPhone, iPad and Android, although the settings for casting from iPhones are a little inconsistent and hard to find in Netflix and YouTube. The Chromecast troubleshooting should be more polished (today it's just a link to a FAQ, with no diagnostics) but since Chrome and the Chromecast both appear to be updating quite often, we should see improvements soon. If I had paid $80 or more, I would be more frustrated with my inability to use the device from my desktop and laptops, but the tablets and phones have been rock solid.

I'd love to see the Chromecast become a more generic wireless receiver and be extended to support Apple's Airplay, as well as Miracast which is now built into Windows 8.1, and WiDi that Intel supports (although Wi-Di also supports Miracast as of WiDi 3.5). Unfortunately though, here we are again with FOUR companies each betting on a format to win while the consumer is left to pick a horse.

Which wireless display format will become Bluray and which will become HD-DVD? It's anyone's guess. I'd like to see an open format win. However, for now, and for only $35, I'm happy with the Chromecast.


Sponsor: A big thanks and a warm welcome to Aspose for sponsoring the feed this week! Check out their Aspose.Total for .NET has all the APIs you need to create, manipulate and convert Microsoft Office documents and a host of other file formats in your applications. Curious? Start a free trial today.



© 2013 Scott Hanselman. All rights reserved.
     

Am I really a developer or just a good googler?

$
0
0
Photo by Hugh Ryan McDonald used with CC Attribution

I got a very earnest and well-phrased email from a young person overseas recently.

Some time in my mind sounds come that Is that I am really a developer or just a good googler. I don't know what is the answer I am googler or I am developer. Scott Please clear on my mind on this please.

This is a really profound question that deserved an answer. Since I only have so many keystrokes left in my life, I am blogging my thoughts and emailing a link.

I've felt the same way sometimes when playing a video game. It'll get hard as I progress through the levels, but not crushingly hard. Each level I squeak by I'll find myself asking, "did I deserve to pass that level? I'm not sure I could do it again."

You get that feeling like you're in over your head, but just a bit. Just enough that you can feel the water getting into your nose but you're not drowning yet.

First, remember you are not alone. I think that we grow when we are outside our comfort zone. If it's not breaking you down, it's not building you up.

Second, anything that you want to be good at is work practicing. Do Code Katas. Do a Project Euler problem every few weeks, if not weekly.

Third, try programming for a day without Googling. Then two days, maybe a week. See how it feels. Remember that there was a time we programmed without copying our work.

Fourth, think about the problem, deeply. Read about algorithms, read Programming Pearls, read about Design Patterns. Rather than copying code from Stack Overflow, copy patterns from the greats.

Fifth, get involved. Go to User Groups, Nerd Dinners, meet with others who feel the same way you do about technology. Stretch.

What do you think?


Sponsor: A big thanks and a warm welcome to Aspose for sponsoring the feed this week! Check out their Aspose.Total for .NET has all the APIs you need to create, manipulate and convert Microsoft Office documents and a host of other file formats in your applications. Curious? Start a free trial today.



© 2013 Scott Hanselman. All rights reserved.
     

Hanselman's Newsletter of Wonderful Things: August 5th, 2013

$
0
0

I have a "whenever I get around to doing it" Newsletter of Wonderful Things. Why a newsletter? I dunno. It seems more personal somehow. You can view all the previous newsletters here.

Here's the newsletter that I sent out August 5th. You can sign up here to the Newsletter of Wonderful Things or just wait and get them weeks later on the blog, which hopefully you have subscribed to. Subscribers get the goodness first!


Hi Interfriends,

Thanks again for signing up for this experiment. Here's some interesting things I've come upon this week. If you forwarded this (or if it was forwarded to you) a reminder: You can sign up at http://hanselman.com/newsletter and the archive of all previous Newsletters is here.

Remember, you get the newsletter here first. This one will be posted to the blog as an archive in a few weeks.

Scott Hanselman

(BTW, since you *love* email you can subscribe to my blog via email here: http://feeds.hanselman.com/ScottHanselman DO IT!)

P.P.S. You know you can forward this to your friends, right?


Sponsor: A huge thank you to my friends at Red Gate for their support of the site this week. Check out Deployment Manager! Easy release management - Deploy your .NET apps, services and SQL Server databases in a single, repeatable process with Red Gate’s Deployment Manager. There’s a free Starter edition, so get started now!



© 2013 Scott Hanselman. All rights reserved.
     

A Cloud and Azure Glossary for the Confused

$
0
0
Cloud by Karen Ka Ying Wong used under CC via Flicker

A parody Twitter account called Confused .NET Dev last week tweeted:

A "crazy" learning curve? CDN? Table? Drive? OK, if you say so, but still, point taken, there's maybe some terms in there that may not be immediately obvious. Here's a few things you should remember when developing for the cloud as well as a small glossary that I hope helps this "confused .net dev" and his or her mixed case Twitter account.

Cloud Concepts

IAAS

Infrastructure as a Service. This means I want the computers in my closet to go away. All that infrastructure, the boxes, network switches, even software licenses are a maintenance headache. I want to put them somewhere where I can't see them (we'll call it, The Cloud) and I'll pay pennies per hour. Worst case, it costs me about the same but it's less trouble. Best case, it can scale (get bigger) if my company gets popular and the whole thing will cost less than it does now.

IAAS is Infrastructure like Virtual Machines, Networking and Storage in the cloud. Software you wrote that runs locally now will run the same up there. If you want to scale it, you'll usually scale up.

PAAS

Platform as a Service. This means Web Servers and Web Frameworks in the cloud, SQL Servers in the cloud, and more. If you like Ruby on Rails, for example, you might write software against Engine Yard's platform and run it on Azure. Or you might write iOS apps and have them talk to back end Mobile Services. Those services are your platform and will scale as you grow. Platform as a service usually hides the underlying OS from you. Lower level infrastructure and networking, load balancing and some aspects of security is abstracted away.

SAAS

Software as a Service. Like Office 365, SharePoint, Google Docs or Adobe Creative Cloud, you pay a subscription and you always get the latest and greatest.

Scale Up

Get more CPUs, more memory, more power. Same computer, but bigger. Like, one 8-processor machine with 128 gigs of RAM, big. Gulliver.

Scale Out

More computers, perhaps lots of them. Maybe eight 1-processor machine with 2 gigs of RAM. No, maybe 32. More little machines, like Lilliputians working as a team to move Gulliver.

Compute

If a computer is working for you, its CPU is working and that's compute. If it's a Virtual Machine or a Web Server it doesn't matter. You get charged pennies per hour, more for larger CPUs.

IOPs

Input/Output Operations Per Second, pronounced "eye-ops." This is unit of measurement used to describe the maximum number of reads and writes to a disk or storage area.

Queue

Just like a Queue in computer science, it's a holding place that lets you store messages and read them back asynchronously.

Content Delivery Network (CDN)

Taking binary blobs within storage and caching them nearest where the content is request. If your customers are in Asia, serve the file from a data center in Asia.

Azure Specific Glossary

Web Sites

Web Sites are "PAAS," that's platform as a service. It's the IIS Web Server in the sky. This is the "Easy Button" as Jon Galloway says. You can take virtually any website and move them up to Azure using Azure Web Sites. You can run ASP.NET, PHP, node.js and lots more.

Azure Table vs SQL Azure

Azure Tables are similar to a document database or NoSQL store. Then there's SQL Azure, which is SQL Server in the sky. Great for SQL-like data with relationships and indexes, etc. There's Azure Storage Tables which is nice when you have a huge pile of records that maybe doesn't have a lot of interrelationships, but there's a LOT of it.

Access Control

Controls Access. Just kidding. No, actually I'm not. Also know as ACS, it's a hosted service that integrates with Microsoft ID, Google, Facebook, Yahoo and other identity providers as well as Active Directory. It supports .NET, PHP, Python, Java, Ruby, etc and you can use it as a centralized authorization store. You can call it with web services from any app and manage users and identities from the portal.

Notification Hubs

Push notification services for any mobile platform. Windows Store, Windows Phone, iOS and Android. Broadcast messages to a user across apps or send single notifications to a user,  a platform or any combination.

AppFabric Caching

In memory caching for apps that run on Azure. You can use existing memory on web roles or dedicate all of a worker roles memory to in-memory caching.

Mobile Services

This is a complete Backend in a Box for apps. This isn’t a great name because it’s not just for mobile devices. It’s a complete backend-as-a-service including authentication and CRUD data access with a dynamic schema in the backend. The services are server-side JavaScript and totally managed for you. Supports iOS, HTML, Windows Phone, Win8, Android, and more. 

Media Service

Media squishing and delivery in the cloud. Production and transcoding workflow, secure delivery to any device, scale up and down elastically.

Service Bus

Secure messaging across firewalls and NAT gateways. It also offers relayed messaging services. Most large hosted and reliable systems need messaging services, sometimes request/response, sometimes peer-to-peer, and sometimes one-way.

X-Plat CLI

An open source JavaScript-written command line tool for Azure management. With node.js and npm installed go "npm install azure-cli --g" and get a complete management console for Azure that runs on Linux, Mac and Windows.

Big Data and HDInsight

Apache Hadoop in the Sky, running on Azure. Hadoop is a giant Java-based MapReduce system for creating data-intensive distributed apps. Azure adds lots to augment with .NET support, LINQ, reporting and more.

Blob

Binary Large Object...it's any binary blob you've put in Azure storage. Throw them in, get them back.

VHD

Virtual Hard Drive. Just like a VHD in Hyper-V or Virtual PC, this binary file represents a complete virtual disk.

Adding more than one disk to a Virtual Machine is a quick and easy way to get more speed for free. For example, if you've got a Virtual Machine running Windows AND a Database like MySQL, you'll have the database application and the Operating System competing for the maximum number of IOPs supported by the disk. Instead, make a new disk and mount it, putting the database on its own drive. This way you've doubled your IOPs with the OS on one drive and the database gets the maximum from its down drive.

Drive

You can mount an single Azure VHD as a disk drive within a Virtual Machine or you can mount Blob Storage as a virtual drive of its own.

Related Links

Did I miss anything major? I'm sure I did, but I wanted to show folks that it's a glossary, sure, but it's not rocket surgery.


Sponsor: A huge thank you to my friends at Red Gate for their support of the site this week. Check out Deployment Manager! Easy release management - Deploy your .NET apps, services and SQL Server databases in a single, repeatable process with Red Gate’s Deployment Manager. There’s a free Starter edition, so get started now!



© 2013 Scott Hanselman. All rights reserved.
     

The Magic of using Asynchronous Methods in ASP.NET 4.5 plus an important gotcha

$
0
0

First, I encourage you to listen to episode 327 of the Hanselminutes podcast. We called it "Everything .NET programmers know about Asynchronous Programming is wrong" and I learned a lot. I promise you will too.

Often we'll find ourselves doing three or four things on one page, loading stuff from a number of places. Perhaps you're loading something from disk, calling a web service, and calling a database.

You can do those things in order, synchronously, as is typical. Add up the duration of each Task:

public void Page_Load(object sender, EventArgs e)
{
var clientcontacts = Client.DownloadString("api/contacts");
var clienttemperature = Client.DownloadString("api/temperature");
var clientlocation = Client.DownloadString("api/location");


var contacts = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Contact>>(clientcontacts);
var location = Newtonsoft.Json.JsonConvert.DeserializeObject<string>(clientlocation);
var temperature = Newtonsoft.Json.JsonConvert.DeserializeObject<string>(clienttemperature);

listcontacts.DataSource = contacts;
listcontacts.DataBind();
Temparature.Text = temperature;
Location.Text = location;
}

Each of this three calls takes about a second, so the total type is 3 seconds. They happen one after the other.

Intuitively you may want to make these async by marking the public void Page_Load with async and then awaiting three tasks.

However, Page_Load is a page lifecycle event, and it's a void event handler. Damian Edwards from the ASP.NET team says:

Async void event handlers in web forms are only supported on certain events, as you've found, but are really only intended for simplistic tasks. We recommend using PageAsyncTask for any async work of any real complexity.

Levi, also from the ASP.NET team uses even stronger language. Basically, DO NOT use async on void event handlers like this, it's not worth it.

Async events in web applications are inherently strange beasts. Async void is meant for a fire and forget programming model. This works in Windows UI applications since the application sticks around until the OS kills it, so whenever the async callback runs there is guaranteed to be a UI thread that it can interact with. In web applications, this model falls apart since requests are by definition transient. If the async callback happens to run after the request has finished, there is no guarantee that the data structures the callback needs to interact with are still in a good state. Thus why fire and forget (and async void) is inherently a bad idea in web applications.

That said, we do crazy gymnastics to try to make very simple things like Page_Load work, but the code to support this is extremely complicated and not well-tested for anything beyond basic scenarios. So if you need reliability I’d stick with RegisterAsyncTask.

Using async with voids is not stable or reliable. However, all you have to do is call Page.RegisterAyncTask - it's not any trouble and you'll be in a better more flexible place.

public void Page_Load(object sender, EventArgs e)
{
RegisterAsyncTask(new PageAsyncTask(LoadSomeData));
}

public async Task LoadSomeData()
{

var clientcontacts = Client.DownloadStringTaskAsync("api/contacts");
var clienttemperature = Client.DownloadStringTaskAsync("api/temperature");
var clientlocation = Client.DownloadStringTaskAsync("api/location");

await Task.WhenAll(clientcontacts, clienttemperature, clientlocation);

var contacts = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Contact>>(await clientcontacts);
var location = Newtonsoft.Json.JsonConvert.DeserializeObject<string>(await clientlocation);
var temperature = Newtonsoft.Json.JsonConvert.DeserializeObject<string>(await clienttemperature);

listcontacts.DataSource = contacts;
listcontacts.DataBind();
Temparature.Text = temperature;
Location.Text = location;
}

You can simplify this even more by removing the (in this case totally unnecessary) Task.WhenAll and just awaiting the result of the Tasks one by one. By the time Task.WhenAll  has happened here, the tasks are already back. The result is the same. This also has the benefit of reading like synchronous code while giving the benefits of async.

public async Task LoadSomeData()
{

var clientcontacts = Client.DownloadStringTaskAsync("api/contacts");
var clienttemperature = Client.DownloadStringTaskAsync("api/temperature");
var clientlocation = Client.DownloadStringTaskAsync("api/location");

var contacts = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Contact>>(await clientcontacts);
var location = Newtonsoft.Json.JsonConvert.DeserializeObject<string>(await clientlocation);
var temperature = Newtonsoft.Json.JsonConvert.DeserializeObject<string>(await clienttemperature);

listcontacts.DataSource = contacts;
listcontacts.DataBind();
Temparature.Text = temperature;
Location.Text = location;
}

This now takes just a hair over a second, because the three async tasks are happening concurrently. Async stuff like this is most useful (and most obvious) when you have multiple tasks that don't depend on one another.

Do remember to mark the .aspx page as Async="true" like this:

<%@ Page Title="Async" Language="C#" CodeBehind="Async.aspx.cs" Inherits="Whatever" Async="true" %>

Related Links


Sponsor: A huge thank you to my friends at Red Gate for their support of the site this week. Check out Deployment Manager! Easy release management - Deploy your .NET apps, services and SQL Server databases in a single, repeatable process with Red Gate’s Deployment Manager. There’s a free Starter edition, so get started now!



© 2013 Scott Hanselman. All rights reserved.
     

The Broken Windows Theory of App Stores

$
0
0

Fart

Imagine that the web itself had an app store, and your clicked "New Releases" to see the latest websites that the web just published. It would be 99% crap. And that's being generous.

Having a section in your App Store called "New Releases" is always going to make your store look bad, just like it would the web. Most of the web is random garbage. It's curation - both professional and social - that makes the internet great.

  • Professional curation are sites like BoingBoing that have a team of folks that go looking for awesome. If you only hang out at BoingBoing, the whole internet is awesome.
  • Social curation are sites like Reddit that have a mob of anonymous strangers that go looking...for stuff. If you only hang out at Reddit, the whole internet is...different.
  • Another kind of Social curation is discovery by hanging out with your tribe. Your friends on Facebook and Twitter, even those crazy links your parents insist on emailing you (while including the cc: list from the previous 15 forwards.) We see the internet through these filters: our friends, and our trusted news sources.

Notice that the Chrome Web Store doesn't have this "latest" or "newest" section. The whole thing is curated. You can't find garbage on that store unless you go searching for garbage. Nothing makes it to the front unless it's picked, selected, loved.

The same is true for the iTunes/iOS App Store. It feels high quality because only high quality apps are ever put in front of you. You have to actively LOOK for crappy apps (there's a whole iceberg of them). The larger the iOS store gets, the more "Hall of Fames" and "Best of the Best" collections are created by humans who work there, thereby increasing the general sense of awesome.

These Halls of Fames and Recommended Apps are the App Store equivalent of preferred shelf placement at a physical store. Awesome stuff, popular stuff, or influential stuff is at eye-level or on an end-cap. Crappy stuff is buried - you have to look for it. I don't want to see an aisle at the grocery store that's "newest releases." It would be totally random and likely not give me a good impression of the store.

Intense curation is good and bad. First, it is exclusionary by its nature. Curation is filtering. You're counting on humans to basically check out every app there is and decide what's awesome. There's likely also some "who you know" type stuff going on. That's gotta stress the indie developer out. How do you get noticed? Word of mouth sometimes works, but not until there's some critical mass. It's not like Angry Birds would submit a new app and then cross their fingers and hope it gets noticed. For every discovered gem that the iTunes store declares "New and Notable" there's surely ten that are "Knew Someone at the App Store" or "Had a PR Person."

Without solid curation, nearly every list sucks. NetFlix works so hard on their recommendation engine -even giving $1M prizes to anyone who could make recommendations better - and I still end up going to http://instantwatcher.com more than I go to NetFlix. Why? Curation.

Certainly if you go looking for crap, you'll find it, but if you're an App Store, try to hide your shame.

iPhone Fart Apps

In the take no prisoners (new) world of App Stores, good curation is perception management. It also sets publishers up for success. Read about the story of the iOS app "A Beautiful Mess" and how they have been playing Whack-a-Mole with evil copy-cat apps. Apps with the same name and icon trying to get downloads on the back of A Beautiful Mess's success. With a more aggressive policy on this kind of stuff, the iOS App Store could help the folks at A Beautiful Mess focus on their app, and not an endless defense of their own online brand.

A Beautiful Mess - Clones and Grifters

That's a mess, even with the victim actively trying to fix the problem. It's worse if the brand in question isn't paying attention. Look in fear at the Windows 8 App Store when you search for "Facebook." Every single one using the Facebook name and Facebook icon. And every single one likely sucks.

image

Remember Broken Windows Theory, with my modifications.

The theory states that maintaining and monitoring [App Stores] in a well-ordered condition may stop further vandalism and escalation into more serious crime.

You gotta fix those broken windows before your App Store turns into a bad neighborhood.


Sponsor: A huge thank you to my friends at Red Gate for their support of the site this week. Check out Deployment Manager! Easy release management - Deploy your .NET apps, services and SQL Server databases in a single, repeatable process with Red Gate’s Deployment Manager. There’s a free Starter edition, so get started now!



© 2013 Scott Hanselman. All rights reserved.
     

A month with an Intel Haswell prototype

$
0
0
haswell

Intel sent me a Haswell Developer Prototype Ultrabook to review a little over a month ago. In order to effectively review this, given my experience, I need to separate the Haswell Chipset and Processor from this specific machine that they send folks to review.

I did not receive a very good unit - definitely not one ready for production.

Now, to be fair, it's marked as an "Intel Software Development Platform" prototype. This is not a machine that will ever be built, and it's also (they tell me) still getting drivers developed. It's a fairly regular looking gunmetal Ultrabook with no markings other than the Intel and Ultrabook logos. It's a lot like my Lenovo X1 Carbon Touch except it has a 1080p (vs. 900) screen and it's a Haswell. This review platform is a new i5 vs. last year's i7 in my X1.

Last year I looked at the 3rd gen "Ivy Bridge" ultrabooks and was impressed. So impressed that I eventually bought a Lenovo X1 Carbon Touch:

First: This particular Haswell Reference Platform device

This year's Haswell review unit has been nothing but trouble for me. Such trouble, in fact, that they've sent me THREE separate laptops as the first two both were unacceptable for different reasons. The first laptop had the SSD fail completely within a week. The second laptop had a bad Synaptics touchpad where only the right side worked. While the third one is workable, it turns off randomly, doesn't want to support standby/sleep and has a wonky keyboard with an unreliable "A" key.

Again, they're reference review laptops, but let's just say they aren't production quality Lenovo X1s or MacBook Airs. To be very frank, these not-ready review/prototype laptops and the experience I have had with them actively do the product a disservice. I'm sure Haswell as a platform is lovely and I would like to see how a Haswell-enabled system makes my life as a developer better. However, in order to do that I expect the mouse to work, the Bluetooth to be reliable and for the screen to stop rotating to the left without warning (even though I keep setting auto-rotate off.)

With the Ivy Bridge reference platform I saw constant and consistent improvements in system behavior with regularly updated drivers. With this Haswell reference platform I have seen just one driver drop, been told to not upgrade to Windows 8.1, and only updated the BIOs once. I have no idea if this device will ever become usable in the future because I have no communication or indication when new drivers are coming.

Second: Using Haswell every day...and the power promise

Ok, now that that's over. I've been using this every day running Windows 8 and have presented at two conferences with this device. I've run both VS2012 and VS2013 on it.

Even though Windows 8.1 does away with the WEI (Windows Experience Index) and I think that's a shame as it's a totally useful and built-in way to get a sense of how a computer will perform, I'm running Windows 8 on this Haswell machine and can still run it.

Surprising new device gets almost an identical WEI as my Lenovo X1 differing significantly only in memory ops/sec. I've heard this elsewhere that an i5 Haswell can perform as well as an Ivy Bridge i7 *and* with a much improved power profile. Haswell isn't (to me) about pure speed, it's about speed, power, and lightness.

image

This is very light laptop. As my second laptop around 3lbs it's cemented my conviction that I'll never own a big heavy luggable laptop again. There's just no reason for a 10 pound device anymore.

Performance, however, does seem dramatically different when on batteries. It appears to be extremely aggressive trying to saving power. This is definitely a laptop where changing Power Profiles makes a huge difference.

The greatest difference in how long this device will last has been screen brightness. When I'm on Power saver on the lowest brightness, I could get a full work day out of this device. However, the lowest brightness is just not feasible. I got between 6 and 7 hours with brightness at about one-third.

balanced-power

Switching to the Balanced Profile with the brightness at the level where Windows warns you it might be a problem, I got about 5 to 6 hours of typing.

power-power2

It's getting to around half-battery where you start getting uncomfortable and wondering if you're going to make it. Changing brightness and profile can get you an easy extra hour on Haswell, where it's just been a matter of 15-20 minutes (in my experience) on other devices.

power-balance power-power

Does Haswell deliver the all-day battery laptop?

  • Yes, if you write prose for a living.
  • Yes, if you aren't running at full brightness.
  • Yes, if you work in SSH or VIM and a remote Linode machine is actually doing the work while your Haswell waits.
  • No, if you're writing and compiling a 3D game locally.
  • No, if you're playing Steam and running TorchLight II.

Should you get a Haswell machine? Absolutely. If you're in the market for a machine and there's a Haswell version of your favorite coming soon, wait. You'll get the same speed and better battery life. Maybe not all day, but 50% more than before. I'm looking forward to the refreshed Lenovo T and X series to have Haswell on board.

All day power? My expectations perhaps aren't reasonable. Haswell and aggressive power management is the future, no doubt. I think, however, that it will be a combination of this plus improvements in battery density that will finally give me a 24 hour device (or 8 hours working hard at full brightness).

ASIDE: From a reviewer perspective, while it's always fun to answer the "what laptop is that?" question with "it's an Intel prototype," the folks at Intel should, when possible, loan reviewers machines that are closer to production that don't have all these driver quirks and hardware quality issues. Why? Well, I really value the opportunity to to review new and prototype hardware, the question always comes up...am I reviewing the keyboard and mouse and screen or am I reviewing the chipset and processor. Of course, there's drivers to hold it all together. This review unit has a loud fan, and iffy construction. But, it has great speed and I didn't think about memory once even though I was running only 4 gigs. I was able to run multiple instances of VS, Outlook and many browsers without even a thought. Even two Virtual Machines and it still felt fast.

I want to get my hands on a device like a Lenovo Yoga 2 Pro or a Thinkpad Yoga. These Haswell devices are going to rock. I have extremely high hopes, but rest assured, your next machine is a Hawell.


Disclosure of Material Connection: Intel sent me this Haswell Ultrabook in the hope that I would review it on my blog. Regardless, I only recommend products or services I would use and think you would find useful. This opinions are mine and mine alone as is this entire post. I am disclosing this in accordance with the Federal Trade Commission’s 16 CFR, Part 255: Guides Concerning the Use of Endorsements and Testimonials in Advertising.


© 2013 Scott Hanselman. All rights reserved.
     

Visual Studio 2013 RC for Web Developers - One ASP.NET, Browser Link, and our Direction

$
0
0
Browser Link connects the IDE and Browser

ASP.NET and Web Tools for VS2013RC is out today. You can feel free to install it over the top of VS2013 Preview if you like. That's what I did.

Be sure to check out http://www.asp.net/vnext for release notes and docs, as well as updated tutorials. There will be a lot more docs and videos coming, as well as details on how to extend and use everything. Since this is the Release Candidate (rather than the final release) there's still some work to be done.

One of my favorite features, and a feature that I think is the most representative of the direction we are going, is Browser Link and best of all, its extensibility model.

For example, you remember how you can select Browse With, and set multiple browsers as your default browser? (Some folks haven't noticed that feature yet) Here I've made a regular side and selected IE and Chrome as my defaults with the Browse With dialog (hold Ctrl for multi-select within Browse With).

image

Now, Ctrl-F5 to launch both browsers:

image

Notice that Bootstrap is the default template now. We'll have Bootstrap 3.0 for the final release.

I'll change some text in the Index.cshtml. Hover over the Browser Link button in the toolbar:

image

It knows two browsers are talking to VS using SignalR and JavaScript. No magic, just web standards.

Now, you can type code and html and press Ctrl+Alt+Enter to refresh all connected browsers, or you can click Browser Link Dashboard:

image

Here's the dashboard. I've clicked on IE:

image

Even more interesting, is that Browser Link is itself extensible.

That menu in the Browser Link Dashboard where we're talking to a specific browser? You can add things to that. Mads Kristensen has done just that with Web Essentials and added extensions to Browser Link (Make sure to get the VS Web Essentials 2013 RC build, or you can build it from source!)

Here's what the Browser Link Dashboard looks like with a Browser Link Extension installed. See the added menu items?

image

Aside: Note also the Error List, we can add a new class of error in VS and even fix them with a double-click.

image

If I click Design Mode, check out what happens. The "Design Surface" potentially moves to the browser itself, using JavaScript, but with bi-directional communication between VS and the browser.

Remember that Web Essentials is open source, so I can get an idea of what's going on by reading the source. Without getting too deep, I can look at Inspect Mode and see it's using MEF.

[Export(typeof(BrowserLinkExtensionFactory))]
[BrowserLinkFactoryName("InspectMode")] // Not needed in final version of VS2013
public class InspectModeFactory : BrowserLinkExtensionFactory
{
...
}

And that is a list of actions:

public IEnumerable<BrowserLinkAction> Actions
{
get
{
yield return new BrowserLinkAction("Inspect Mode", InitiateInspectMode);
}
}

And that it's using SignalR to talk to injected JavaScript:

private void InitiateInspectMode()
{
Clients.Call(_connection, "setInspectMode", true);
_instance = this;
}

And I can see in the browser's JavaScript that as I hover over elements in the browser, I can select the source in VS and even bring VS to the front:

inspectOverlay.mousemove(function (args) {
inspectOverlay.css("height", "0");

var target = document.elementFromPoint(args.clientX, args.clientY);

inspectOverlay.css("height", "auto");

if (target) {
while (target && !browserLink.sourceMapping.canMapToSource(target)) {
target = target.parentElement;
}

if (target) {
if (current && current !== target) {
$(current).removeClass("__browserLink_selected");
}

current = target;
$(target).addClass("__browserLink_selected");
browserLink.sourceMapping.selectCompleteRange(target);
}
}
});

inspectOverlay.click(function () {
turnOffInspectMode();

browserLink.call("BringVisualStudioToFront");
});

This is just a taste of what's coming. One ASP.NET is a journey, not a destination. We'll have more refinements, more scaffolding, and continued improvements as we head in this directions and in future updates (Update 1, etc).

Browser Link is just one feature, be sure to check out (and subscribe to) the Web Dev Blog where ASP.NET and Web Tools lives on MSDN. Today's post talks about:

  • One ASP.NET
  • Authentication
  • The new HTML5 editor
  • Azure Web Site tooling
  • Scaffolding
  • MVC5, Web Forms, SignalR 2, Web API 2
  • Entity Framework 6
  • OWIN Support and Self-Hosting
  • ASP.NET Identity
  • NuGet 2.7

Remember, even thought it feels like a lot, these are almost all additive changes that you can take or leave. You can still make and develop ASP.NET 2 apps in VS 2013. You can use your own View Engine, your own ORM, your own Identity, you own Scaffolding, your own components. You decide.

image

We'll have docs and updates soon for scaffolding, modifying and customizing File New Project to add your own, as well as a list of what's new and released as NuGet packages. Watch http://www.asp.net/vnext and the Release Notes for lots of details and any breaking changes.


Sponsor: Big thanks to Infragistics for sponsoring the feed this week! Download Your Free HTML5/jQuery Grid:  Prepare to launch eye-popping, performance-driven HTML5 applications with Ignite UI. Believe your eyes - you can download the world's fastest, most reliable jQuery Grid now - no strings attached



© 2013 Scott Hanselman. All rights reserved.
     

Trying a Nokia Lumia 1020 - A Camera with a Phone Inside

$
0
0

My current Lumia 1010 tile layoutI've had an iPhone since the iPhone 3G. My main personal phone is an iPhone 4S. I'm always checking out new phones, however, most recently the Blackberry Z10. The last time I tried a Windows Phone was a Lumia 800, where I made a list of apps I would need before I would ever consider switching from iPhone. I also checked out one of the first Windows Phones in 2010.

My family is a mixed one, with two iPads, my wife's Lumia 920 phone, my iPhone 4S, the kids' iPod touches, a Surface RT, an Xbox and a PS3. I'm also spending a month testing a Samsung Galaxy S4.

However, last week a buddy loaned me a yellow Nokia Lumia 1020 running Windows Phone 8. A good friend recently switched to the 1020 solely for the camera. Let me repeat that. He has been #teamiphone since the beginning but he decided the camera was good enough to switch. That got my attention as my 4S camera kinda sucks. It's fine for Instagram but not for capturing two growing kids.

I swapped the SIM card from my iPhone and customized the crap out of my home screen. I can't stand defaults. Live Tiles really are the star of the Windows Phone.

I'll do a full review when I've spent time with this phone, but I can talk about the camera now. Insane.

Full sized images are 7712x4352 and about 10 megs. The deal, it seems, isn't that you necessarily want to  keep the 34 megapixel images, but rather that you can zoom and crop them and still see thing clearly. Phrased differently, rather than an optical zoom, you take a super super high res image then digitally zoom. It's amazing. You can zoom in on a license plate from 100 feet away.

Here's an example (I've blurred these people as I don't know them).

A picture at a cafe

Now, zooming in on the red car, digitally.

Zoomed way in on a license plate

That's just a silly example. A more significant one is taking a picture of a group, then wanting to crop a shot of just some of the people and having it NOT looking like a crappy crop. These kind of operations are trivial.

If you want to download the full 10 megabyte version of this image, try over here at ImgUr.

Here's the original file, copied straight off the Lumia 1020 via a USB Cable.

Lego Jabba

Let's zoom in - only by cropping.

Jabba's buddy close up

Seriously, I could do this all day.

LEGO Hobbit

And then cropping.

LEGO Hobbit close up

I also tried the Camera Grip for the Lumia 1020. It's an extended battery, grip and a button that makes the phone act more like a camera. You get the whole half-button press to focus" then "full press to snap" behavior. This also speeds up the shutter actuation feel to instantaneous, since the half-squeeze starts the focus. The continued full press is instant. It really feels like a Point and Shoot.

Disclaimer/Disclosure: I do work for Microsoft, in the Azure division. However, I am not my job. I review lots of tech and gadgets and I stand on my record of impartiality. I use what I like. This review (and future and past) is my own, and done on my own, outside of work. No one reviews or edits these. Misspellings and errors are mine.

The Nokia Lumia 1012 Camera Grip

I'll keep trying it out and explore the actual phone features, but I am deeply impressed with the camera. In order to consider switching though (and I assume you'd feel the same way) I would need:

  • 95% of the apps (or equivalents) that I use in an average week.
  • Reliable Bluetooth phone and audio in the cars my wife and I have
    • Streaming audio works fine in my Prius. Having some trouble with the phone, but working on it.
  • Good battery life
    • It's OK, but the camera flash definitely hurts the battery if you spend all day taking pics.
  • Support for Google Mail and Calendar (personal) and Outlook (work)
    • Check.

More review and details to come as I explore. Your thoughts?


Sponsor: Big thanks to Infragistics for sponsoring the feed this week! Download Your Free HTML5/jQuery Grid:  Prepare to launch eye-popping, performance-driven HTML5 applications with Ignite UI. Believe your eyes - you can download the world's fastest, most reliable jQuery Grid now - no strings attached!



© 2013 Scott Hanselman. All rights reserved.
     

Teaching Kids Electronics, Computers, and Programming Fundamentals with Snap Circuits

$
0
0

I'm not particularly interested in my kids being programmers or computer people. I'd rather they be interested in life and totally geeked about something. If that's  computers, fine. If that's ballet, also fine.

That said, I think if they are going to be effective users (If not builders) I think they should have a basic sense of how electronics work.

I bought them a basic set of Snap Circuits, specifically Snap Circuits Jr. SC-100, which is just about US$20 on Amazon.

These are brilliant. Check this picture, as it's worth a thousand words and you'll get its genius immediately.

Snap Circuits SC-100

The 5 year old loves the motor and fan, as well as the speaker and noise makers. The boys have made doorbells, a light-controlled fan, lit-up LEDs and made an AM radio. Here's an Instagram Video of the 5 year old explaining his creation:

The pieces snap onto the grid with little buttons. The pieces are plastic and the wires run through them. They're not extremely resilient, in that they can break, particularly the capacitors, but it's actually nice to be able to see the resistors and other parts exposed through the plastic. It strikes a reasonable balance between being friendly to little hands, being sturdy, and actually working reliably as electronic components.

WP_20130912_18_01_15_Pro

The 5 year old is no prodigy, to be clear, but he's already getting a general sense of electrical movement. He'll say that the resistors "slow down the electricity" and that the capacitors "store it up." He knows positive and negative, and how to use a multimeter to measure voltage. (I recommend a $10 multimeter as well for debugging your projects.) He's starting to look at doorbells and remote controls differently now, which means these little projects have already achieved my goal in just a few weeks. I anticipate they'll play with them for some months, forget about them, and then rediscover Snap Circuits every few years. These toys are great for a 5 or 6 year old, but even a 12 to 14 year old could totally appreciate them. I'm even running through some of the experiments and using the millimeter to remind myself of long-forgotten concepts.

We quickly outgrew the 30 parts in the Snap Circuits Jr. Even though it has 100 projects, I recommend you get the Snap Circuits SC-300 that has 60 parts and 300 projects, or do what we did and just get the Snap Circuits Extreme SC-750 that has 80+ parts and 750 projects. I like this one because it includes a computer interface (via your microphone jack, so any old computer will work!) as well as a Solar Panel.

The Snap Circuits SC-750 is a bargain at prices like US$75 if you can find it, especially considering how many tablets, Kindles and iPads some kids have.

WP_20130910_19_23_04_Pro

The next Snap Circuits kids we're considering are either Snap Circuits "Light" that includes LEDs and Fiber Optics, although the 5 year old is pressuring me for the Snap Circuits Robot Rover. It'll likely be the Rover for the holidays around here.

I have no relationship with Snap Circuits, I bought these kits on my own and am reviewing them because they are awesome. If I could invest in Elenco Electronics, I would. The links here are Amazon affiliate links. If you use them, I can buy more Snap Circuits! ;)


Sponsor: Big thanks to Infragistics for sponsoring the feed this week! Download Your Free HTML5/jQuery Grid:  Prepare to launch eye-popping, performance-driven HTML5 applications with Ignite UI. Believe your eyes - you can download the world's fastest, most reliable jQuery Grid now - no strings attached!



© 2013 Scott Hanselman. All rights reserved.
     

The New Turbo Button - Balancing Power Management and Performance on Windows Servers

$
0
0

TurboButtonDo you remember the Turbo Button? I actually thought of it is the "be slow button" because we always kept it on Turbo. Why wouldn't you want a fast computer all the time? The Turbo Button was actually an "underclock" button. When it was off, you were setting your 286 or 386 to XT speeds so older DOS games would work at their designed speed.

Power Management, both software and hardware, seems to be the new Turbo Button. My laptops get way faster when I plug it in - like very noticeably faster to the point where I just don't like using them on battery. For typing documents, it's fine, but for development, compiling, running VMs, it's unacceptable to me. I'll end up spending more power to get more performance. 

It's important to remember that Power Management affects servers as well.

Recently Mike Harder, a development manager, noticed that stuff he does every day was taking longer on the "Balanced" power option than the "High Performance" option. He said:

My naïve belief was that “Balanced” is supposed to save power when your machine is idle, but give full power when needed, so the overall perf hit should be small.

Here's a very basic benchmark Mike did:

Hardware/OS
Hardware: HP z420, Intel Xeon E5 1650 @ 3.2GHz, 32GB RAM, SSD
OS: Windows Server 2012 Standard

(in seconds)High PerformanceBalancedDelta
7-Zip, LZMA, 2 Threads55115109%
7-Zip, LZMA2, 12 Threads284975%
Build Source Tree, 48 Threads375549%

This started a fascinating thread on power management and the balance between getting good performance from a system (desktop or laptop or server) and wasting power and heat. Here's the best parts of that internal thread here for all of our education.

Bruce Worthington said:

Depends on the workload.  The full performance of the system is available, but (for example) if the workload is very bursty you will take an initial hit at the beginning of each burst as the power management algorithms determine that more resources need to be brought on line.  Or if it is a low-utilization steady state workload, you will run at a lower CPU frequency throughout.

There is no free lunch, so there is always a tradeoff that is being made.

There is also an excellent thread on this at ServerFault. Jeff Atwood asks:

Our 8-cpu database server has a ton of traffic, but extremely low CPU utilization (just due to the nature of our SQL queries -- lots of them, but really simple queries). It's usually sitting at 10% or less. So I expect it was downclocking even more than the above screenshot. Anyway, when I turned power management to "high performance" I saw my simple SQL query benchmark improve by about 20%, and become very consistent from run to run.

imageThis makes sense to me. The CPU isn't working hard enough for long enough for the power management algorithms to put full power to the CPU. But, if Jeff sets power management to High Performance he's effectively saying "full speed ahead...always."

In the last half-decade power management in servers has become more of an issue. With high power comes heating and cooling as well as power costs. Windows Server 2008's default power is "Balanced."

Bruce again in an excellent explanation with emphasis mine:

I'll try to give a quick perspective below as to why we use Balanced mode as our default and how we arrive at the tunings for that mode.

As of Windows Server 2008, the default setting of the OS was switched from High Performance to Balanced.  Energy efficiency was becoming a larger factor in the real world, and our ability to balance between the oft-opposing poles of Power and Perf was improving.  That being said, there will always be environments where our recommendation is that the power policy should be switched back to High Performance.  Anything super latency sensitive will clearly fall into that bucket, such as banking, stock markets, etc.

OEMs have the flexibility to add custom tunings onto their factory settings if they want to put in the additional effort to find a balance that works better for their specific customers.  System administrators also have that flexibility. But tuning the power/perf knobs in the OS is a very tricky business, not for the faint of heart. 

<snip…>


Some of us on the Windows "power" teams were performance analysts before we become power analysts, so we are very sensitive to the tradeoffs that are being made and don’t like seeing any perf lost at all.  But there is no free lunch to be had, and there are big electric bills being paid (and polar bears falling into the water) that can be helped through sacrificing some level of performance in many environments.

<snip>

We will continue to provide multiple power policies because one size clearly does not fit all servers.

Another great point made for why have "Balanced"  be the default, from Sean McGrane:

[We're] looking at an industry landscape where servers in data centers are very underutilized, typically somewhere below 20% utilization. By going with balanced mode we saved a lot of energy and cost and improved their carbon footprint more or less for free. There was very strong support from customers to do this.

Virtualization has helped raise the utilization levels and most cloud DCs now operate at higher levels of utilization. However the majority of servers deployed are still running a single workload and that will be the case for a while.

This get to the point of measuring. Are your servers working hard now? Perhaps they'll perform better on High Performance. Are they often idle or at lower levels of utilization? Then Balanced is likely fine and will save power. Test and see.

As with all things in software development, it's a series of trade offs. If you blindly switch your servers' power options to High Performance because you read it on a random blog on the Internet, you're of course missing the point.

Change a variable, then measure.

Consider your workloads, how your workloads cause your CPUs to idle and how hard they work the CPU when pushed. Are you doing single threaded low CPU work, or massively parallel CPU intensive work?

I'm now going to pay more attention to power management profiles when developing, putting machines into production, stress testing and benchmarking. It's nice to have a Turbo Button.


Sponsor: Thank you to RedGate for sponsoring the feed this week! Easy release management: Deploy your .NET apps, services and SQL Server databases in a single, repeatable process with Red Gate’s Deployment Manager. There’s a free Starter edition, so get started now!



© 2013 Scott Hanselman. All rights reserved.
     

Generating complex math visualizations in SVG using C# and ILNumerics

$
0
0

I was recently turned on to the ILNumerics library. It's a high performance math library for .NET developers that my math skills can barely comprehend. It has a clean and elegant syntax, but more importantly, it's visualization graphics engine is thoughtful, flexible, and well-factored.

Having worked on a lot of websites, including ones that do a lot of backend image generation, resizing and analysis (like check imaging almost 10 years ago) I was impressed at how easily I was able to get an equation onto a basic website with ILNumerics and SVG.

Of course, it's not just a web library, in fact, most of the samples are WPF and WinForms, so it's an engine that you can use anywhere. Regardless, as a web person, I wanted to see how quickly I could get something into my browser.

The ILNumerics website has a cool sample 3D graph on their home page that was generated with this code:

var scene = new ILScene {
new ILPlotCube(twoDMode: false) {
new ILSurface(ILSpecialData.sincf(40, 60, 2.5f)) {
}
}
};
scene.First<ILPlotCube>().Rotation = Matrix4.Rotation(
new Vector3(1f,0.23f,1), 0.7f);
scene;

However, you'll notice in their sample they just end with the variable "scene." That's a no-op there, but it's their coder way of saying "at this point, the scene variable holds a representation of our plot. Do with it as you will."

NOTE:Do check out their home page...the little sample there is deeper than you'd think. The dropdown shows they can generate PNGs, JPGs, JPG HD, SVG, but also "EXE." Hm, download a random EXE from the internet? Yes please! ;) Take a risk and you'll get a nice self-contained EXE visualizer that not only renders the graph but lets you rotate it. You can download the ILView 3D viewer and play around, it's harmless - all the code for ILView is on GitHub! The best part is that it has a built in REPL so you can type your C# right there and see the results! It even runs on Linux and uses Mono. ;)

ILNumeric

Back to my goal. I want to use the library on a basic website and dynamically generate an SVG of this plot.

Here's the same plot, put inside an ASP.NET HttpHandler (which could also be made routable and used in ASP.NET MVC/Web Forms, etc.)

public void ProcessRequest(HttpContext context)
{
var scene = new ILScene {
new ILPlotCube(twoDMode: false) {
new ILSurface(ILSpecialData.sincf(40, 60, 2.5f)) {
}
}
};
scene.First<ILPlotCube>().Rotation = Matrix4.Rotation(
new Vector3(1f, 0.23f, 1), 0.7f);

var driver = new ILSVGDriver(context.Response.OutputStream, 1200, 800, scene, Color.White);
driver.Render();
}

Here I'm passing context.Response.OutputStream to their ILSVGDriver and saving the result not to a file, but directly out to the browser. I could certainly save it to cloud blob storage or a local file system for caching, reuse or email.

using (FileStream fs = new FileStream(@"test.svg", FileMode.Create)) {
new ILSVGDriver(fs, scene: whateveryoursceneis).Render();
}

While a SVG is preferable, one could also make a PNG.

var driver = new ILGDIDriver(1280, 800, whateveryoursceneis); 
driver.Render();
driver.BackBuffer.Bitmap.Save("whatever", System.Drawing.Imaging.ImageFormat.Png);

Their docs are excellent and many include a similar interactive viewer within the website itself.

It's so much more than a plot visualizer, though. It reminds me a little of D3.js, except more math focused and less live-data binding. It's almost as flexible though, with many kinds of visualizations beyond what you'd expect.

3D graph that looks like a mountainDonut graph

Three 3D graphs in one plotTopographical plot

Infinite TrianglesHalf a sphere intersected by a blue gear

Here's the code to show a green sphere that's composed of triangles, but has the top chopped off, as an example. This is just 10 lines of code, and could be made less.

var scene = new ILScene(); 
// create a new sphere
var sphere = new ILSphere();
// the sphere is a group containing the Fill (ILTriangles)
// and the Wireframe (ILLines) of the sphere. Both shapes
// share the same vertex positions buffer. Hence, we only
// need to alter one of them:
using (ILScope.Enter()) {
// take the vertex positions from the Fill.Positions buffer
ILArray<float> pos = sphere.Fill.Positions.Storage;
// set all vertices with a Y coordinate larger than 0.3 to 0.3
pos[1, pos[1, ":"] > 0.3f] = 0.3f;
// write all values back to the buffer
sphere.Fill.Positions.Update(pos);
}
// add the "sphere" to the scene
scene.Camera.Add(sphere);
// add another light (for niceness only)
scene.Add(new ILPointLight() {
Position = new Vector3(-0, 1, -2)
});
// move the camera upwards
scene.Camera.Position = new Vector3(0,3,-10);
// display the scene
scene;

And this gives you:

Half a green sphere

It's a really amazing project. ILNumerics is GPL3 and also uses OpenTK for OpenGL bindings, and Mono.CSharp for C# compiling and evaluation. ILView is under the MIT/X11 license.

You can get it via NuGet with just "Install-Package ILNumerics." Check it out and tell your friends, scientists, and friends of Edward Tufte.


Sponsor: Thanks to Red Gate for sponsoring the feed this week! Check out a simpler way to deploy with Red Gate’s Deployment Manager. It can deploy your .NET apps, services, and databases in a single, repeatable process. Get your free Starter edition now.



© 2013 Scott Hanselman. All rights reserved.
     

IE10 and IE11 and Windows 8.1 and __doPostBack

$
0
0

A while back there was a bug in the old browser definition files that shipped with .NET 2 and .NET 4. Fast forward to today and these older ASP.NET’s will mis-detect IE10 and IE11. If you have this, you'll see __doPostBack JavaScript errors in your sites when IE10 or IE11 hit them.

However, I'm still getting email from folks who are seeing this, which means they've got very unpatched installations.

Aside: If you don't have this two year old patch, be sure to check out what other updates your server is missing. Again, rollups like .NET 4.5 and "hotfix rollups" get you the latest in one swoop.

Here’s all the internal details for this fix across every combo of framework and OS if you can’t get .NET 4.5. You may want to run "aspnet_regbrowsers -i" after installing the fix if you're having trouble.

  • 2836939 .NET 4 - Win7SP1/Win2K3SP2/Win2K8R2SP1/Win2K8SP2/VistaSP2/WinXPSP3
  • 2836940 .NET 3.5 SP1 - Win2K3SP2/Win2K8SP2/VistaSP2/WinXPSP3
  • 2836941 .NET 2.0 SP2 - Win2K3SP2/WinXPSP3
  • 2836942 .NET 3.5 SP1 - Win7SP1/Win2K8R2SP1
  • 2836943 .NET 2.0 SP2 - Win7SP1/Win2K8R2SP1
  • 2836945 .NET 2.0 SP2 - Win2K8SP2/VistaSP2
  • 2836946 .NET 2.0 SP2 - Win8RTM/WinRTRTM/Win2K12RTM
  • 2836947 .NET 3.5 SP1 - Win8RTM/WinRTRTM/Win2K12RTM

You really shouldn’t be "sniffing" browsers, you should check for the existence of features in your browser. There have been a number "mobile browser" files, including one I used 4 years ago.

If you are using a custom browser definition file (and perhaps forgotten about it) you may STILL see a problem with IE10 or IE11 because you've got your own overriding custom browser sniffing regexes in there. Either remove the need for a browser definition file (ideal) or open up your custom file and remote the IE portion.

TL;DR Version

  • DO - Keep your Web Servers patched.
  • DO - Upgrade to ASP.NET 4.5 if you can.
  • DON'T - Use old Custom Browser Definition Files from years ago and expect them to work

Hope this helps.


Sponsor: Thanks to Red Gate for sponsoring the feed this week! Check out a simpler way to deploy with Red Gate’s Deployment Manager. It can deploy your .NET apps, services, and databases in a single, repeatable process. Get your free Starter edition now.



© 2013 Scott Hanselman. All rights reserved.
     

SCREENCASTS: What's New in Visual Studio 2013 - learn over lunch!

$
0
0

I could write a whole epic post about what's new in VS2013 for Web folks and front-end developers, but this time instead I did some videos. I'm proud of them and I think they really show some of the cool new features in a very clear way.

These are short, clear and to the point. I did them on my own and there's no marketing-speak, just "here's what we built." Here's the full release notes for ASP.NET and Web Tools for you to check out if you really like reading.

Otherwise, take about 30 minutes total, perhaps over lunch, and watch these short videos with live demos of what's new in Visual Studio for Web Developers and Front End Devs.

HTML5 in VS2013

CSS in VS2013

BrowserLink in VS2013

Page Inspector in VS2013

JavaScript in VS2013

Publishing in VS2013

If you've been paying attention over the last year, you may have seen some of these features. I realize that these may not ALL feel like "amazing new surprises." That's the price for being open, eh? If you'd prefer we hide out for a year and make stuff then appear and DROP it on you, let me now. Otherwise, we're sticking with a more Open Web.

Hope you enjoy the tools and the direction.



© 2013 Scott Hanselman. All rights reserved.
     

CollectionViewSource is crazy useful for binding to filtered Observable Collections on Windows Phone 8

$
0
0

I've been working on this Windows Phone 8 app on the side (it's a news app, but mark my words, it's gonna be huge). 

For the initial development I've been binding to a Pivot to a basic ObservableCollection of type "FeedItem," so basically my XAML was like this.

Really, the only thing you care about here is that FIRST line...ItemsSource=""

<phone:Pivot Title="MAGICAL FREAKING NEWS" x:Name="MainPivot" 
ItemsSource="{Binding Path=NewsData.Feeds}" >
<phone:Pivot.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=key}"/>
</DataTemplate>
</phone:Pivot.HeaderTemplate>

<phone:Pivot.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<TextBlock Text="{Binding Path=title}" Style="{StaticResource PhoneTextTitle2Style}" HorizontalAlignment="Center"/>
<TextBlock Text="{Binding Path=updated_at, StringFormat=F}" HorizontalAlignment="Center" TextWrapping="Wrap" />
<Button x:Name="PlayButton" Margin="0,40,0,0" HorizontalAlignment="Center" Style="{StaticResource PlayStyle}" Click="Play_Click">
<Button.RenderTransform>
<!-- Changes to .5 when in Landscape -->
<ScaleTransform x:Name="OrientationScale" ScaleX="1" ScaleY="1" CenterX="60" CenterY="0"/>
</Button.RenderTransform>
</Button>
</StackPanel>

...snip...you get the idea.

As an aside, I really like the idea of Design Time Data, meaning that I can layout my page in Visual Studio and it will actually LOOK like my app using static data that happens at Design Time. For this, I just add this at the PhoneApplicationPage level:

 d:DataContext="{d:DesignData Content/NewsDataSample.xaml}"

And that sample XAML file just looks like a "XAML-shaped" version of my Object Model, which is actually fed by JSON at runtime:

<vm:AppViewModel
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:vm="clr-namespace:toawesometolive_portable.Data;assembly=icantstandit-portable"
    OperationInProgress="True"
    >
    <vm:AppViewModel.NewsData Force="False">
        <vm:NewsData>
            <vm:NewsData.Feeds>
                <vm:Feed id="0" key="NPR" subtitle="National Public Radio"
...snip...

Fast forward some and requirements changed. Now I needed to be able to individually enable and disable new sources, as well as reorder sources on the fly.

image

That means, if a source is not enabled, it shouldn't be in the first page's pivot. The Sources page and the Main Pivot both bind to the same ObservableCollection, except I need a filter of some kind of the Pivot for "where enabled == true."

I tried lots of stuff things like other sub-collections, properties that returned filtered collections, IQueryable this and that, then discovered the (not really well documented) CollectionViewSource.

Turns out, though, that WPF folks have been using this for YEARS. Here's Beth Massi talking about CollectionViewSource in 2008, for crying out loud (as I discover it a half-decade later on the phone.)

You can have more than one CollectionViewSource on your page. You can use them with Master/Detail forms, for Pathing and for Filtering, which is what I'm interested in. It's also nice because any controls that you bind to the same CollectionViewSource will always have the same current item.

I put one in my Phone Page's Resources like this:

<phone:PhoneApplicationPage.Resources>
    <CollectionViewSource x:Key="src" Source="{Binding Path=NewsData.Feeds}"/>
</phone:PhoneApplicationPage.Resources>

Later, my Pivot binds to the CollectionViewSource by name:

ItemsSource="{Binding Source={StaticResource src}}"

I know folks love to do EVERYTHING in their XAML, but that's not how I roll. (Nor do I have any idea what I'm doing.)

In my page's code behind I set a filter:

collectionView.Source = App.ViewModel.NewsData.Feeds;
collectionView.View.Filter = item =>
{
Feed f = item as Feed;
if (f == null) return false;
if (!f.enabled) return false;
return true;
};

That's it. Now I can enable and disable my items in my source view and the Pivot updates nicely only showing those news sources that are enabled.

Ideally I would have been able to express this somehow in XAML with some kind of where clause as an attribute, but once I figured this solution out it worked famously. I suspect there's actually a LOT of depth to CollectionViewSource and I may end up using it in other parts of my app.



© 2013 Scott Hanselman. All rights reserved.
     

Make a Windows 8.1 Pinned Live Tile for YOUR website in minutes

$
0
0

imageI actually set this up on my site a few months back when Windows 8.1 preview showed up, but I didn't mention it. If you've got Windows 8.1, you've likely figured out that the most fun apps are ones that have active live tiles.

I'm a web guy and I like web sites, though. Certainly there's no reason or need for a "Hanselman" app anymore than there's a need for an app for, say, The Verge.com. We have perfectly lovely sites today and work just fine. We also have RSS feeds that contain our content and let folks know when a site has been updated.

You can add some HTML META markup to your site now and have a multi-size automatically updating Live Tile for Windows 8.1 in minutes. It's very cool.

Pin a Site to your Windows 8.1 Start Screen

  • Open Full Screen IE (that's the big blue IE from the Start Screen, not the one on your Desktop).
  • Visit the site you want to pin, like http://hanselman.com/blog.
  • Click the Star to Favorite the site, then the Pin to Pin it as a Live Tile
    • Before you finally pin the site, you can click the arrows left or right to pick the size of the Tile.
    • You can change the size whenever from your Start Screen by right clicking the Tile and clicking Resize.

Don't worry about my creepy eyes staring at you. My RSS feed will start coming in soon and the Live Tile will flip over.

Get a Large Live Tile for Your Site

The easiest way to make one of these is to visit http://buildmypinnedsite.com as they have a wizard that helps you make four file sizes and setup notifications from your RSS feed, as well as pick the background color for your Tile.

ASIDE: Back when IE9 came out, I added Site Pinning support to my site in a similar way. You can still do that for your Windows Taskbar, in fact, and get a nice right-click context menu with lots of quick access to my site, archives and podcasts. View Source or visit the link there for details.

There's a very detailed API on MSDN if you'd like to understand all the little details of Pinned SItes with IE9, 10 and 11. It's literally minutes of work on the low end, and maybe an hour if you go nuts with JavaScript.

You can put all your META tags in the HEAD and just have a pile of them if you want, which is fine:

<meta name="application-name" content="Scott Hanselman's Blog"/>
<meta name="msapplication-TileColor" content="#83382b"/>
<meta name="msapplication-square70x70logo" content="/tiny.png"/>
<meta name="msapplication-square150x150logo" content="/square.png"/>
<meta name="msapplication-wide310x150logo" content="/wide.png"/>
<meta name="msapplication-square310x310logo" content="/large.png"/>
<meta name="msapplication-notification" content="frequency=180;polling-uri=http://notifications.buildmypinnedsite.com/?feed=http://feeds.hanselman.com/ScottHanselman&amp;id=1;cycle=1"/>

More on that crazy notification one in a second.

Or, if you want a tidy META area, just move this stuff into a static XML file:

<!-- IE11 pinning and live tiles -->
<meta name="application-name" content="Scott Hanselman's Blog"/>
<meta name="msapplication-config" content="/browserconfig.xml" />

And that file, is predictably similar. Again, it's not needed, but you can either put the stuff in META tags, or in a file.

<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square70x70logo src="tiny.png"/>
<square150x150logo src="square.png"/>
<wide310x150logo src="wide.png"/>
<square310x310logo src="large.jpg"/>
<TileColor>#83382b</TileColor>
</tile>
<notification>
<polling-uri src="http://notifications.buildmypinnedsite.com/?feed=http://feeds.hanselman.com/ScottHanselman&amp;id=1"/>
<frequency>180</frequency>
<cycle>1</cycle>
</notification>
</msapplication>
</browserconfig>

Now, let's look at those notifications. The service above is speeding things up by making the little Tile Notifications XML file for me. This is similar to Facebook's open graph stuff or Twitter Cards, where you want an image (if available) plus the title of a post to show up as a "card" or in this case, a Tile.

ASIDE: You can do similar type things in other browsers with nice custom PNGs and Icons, like Opera's Speed Dial, or iPhone Home Screen icons. I've done all those for my site. There's a lot, but it's minutes each and then it's done.

You get some amount of control as to text and images that can appear in your live tile if you make the notification yourself. The BuildMyPinnedSite service, as you can see in the URL above, takes your RSS feed and makes it WAY smaller (mine is too large to poll, for example) and pulls out prominent images. I set my Frequency at a few hours, since I'm a blog, not a news site. No need to poll me every 30 minutes!

Here's a Wide title generated by a recent post:

image

Or a Large tile:

image

The site will generate those, but if you're a really high-traffic site you might just write a little handler to make these Notification Tile Files from your RSS feed.

<tile>
<visual lang="en-US" version="2">
<binding template="TileSquare150x150Text04" branding="logo" fallback="TileSquareImage">
<text id="1">CollectionViewSource is crazy useful for binding to filtered Observable Collections on Windows Phone 8</text>
</binding>
<binding template="TileWide310x150ImageAndText01" branding="logo" fallback="TileWideImage">
<image id="1" src="http://www.hanselman.com/blog/content/binary/Windows-Live-Writer/CollectionViewSource-is-crazy-useful-for_122F5/image_b5516dd4-31b0-422b-8742-9bc1fbfa5d12.png"/>
<text id="1">CollectionViewSource is crazy useful for binding to filtered Observable Collections on Windows Phone 8</text>
</binding>
<binding template="TileSquare310x310TextList02" branding="logo" contentId="http://www.hanselman.com/blog/PermaLink.aspx?guid=11a2bbd4-261b-4ba2-93cc-cdbdc3de6825">
<text id="1">CollectionViewSource is crazy useful for binding to filtered Observable Collections on Windows Phone 8</text>
<text id="2">SCREENCASTS: What's New in Visual Studio 2013 - learn over lunch!</text>
<text id="3">IE10 and IE11 and Windows 8.1 and __doPostBack</text>
</binding>
</visual>
</tile>

I wonder how hard it would be to write a WordPress, Drupal, Ghost, or MiniBlog plugin to make these notification files? Not hard I think.

UPDATE: Looks like Nick Halsey has already crated a Windows Pinned Sites Plugin for WordPress. Nice job, Nick!

UPDATE:Drupal has Pinned Sites also!

I'm looking forward to seeing tiles like this for sites I visit like LifeHacker, The Verge, CNN, etc. I'll be more likely to pin a site to the home screen if it also shows me updated headlines.



© 2013 Scott Hanselman. All rights reserved.
     

How to install the nodejs Ghost blogging software on Azure Websites

$
0
0
The Ghost Admin running in Azure

Like many folks, I watched the recent Kickstarter for the nodejs-based Ghost Blogging Platform with great interest. There are lots of folks, myself included, who believe that WordPress has jumped from blog to complete and complex CMS, and there's value in a simple platform for "just blogging."

SIDE NOTE: Every time a post something I get at least 4 emails from well-meaning readers about how my spelling and grammar sucks. And I appreciate you all. For a few posts, I'm trying an online service called Grammarly that promises to be 10x better than word processors in proofreading. 10x is like 9 x's more than 1 x and it's clearly a much more bigger number. We shall be seeing how it do. ;)
(Of course, Grammarly HATED this paragraph.)

Ghost is very minimal, evocative of Medium in style and essence. Ghost is basic and clean publishing, plus it's open source and being very actively developed on GitHub. As of the time of this writing, it's version 0.3.3, and I will do my best to keep this blog post up to date. Things are moving fast.

It'd be nice to get Ghost running on Azure, and since it's a reasonably complex node application, it's good exercise for everyone. Jeremiah Billmann and a number of others have been working on some of the small compatibility issues (like image uploads and pathing), and soon we'll be able to get Ghost up and running in just a few commands. Jeremiah has a great writeup here. He and I spent part of the afternoon Skyping and pairing and trying alternate ways to get Ghost running. My instructions are different and not meant to take away from his. There's more than one way to deploy a site.

I'll point out workarounds, and again, remove them (strike them out) as Ghost takes PRs. (BTW, the Ghost Team is SO NICE. So nice.)

Installing Ghost on Azure Web Sites

I'm using Windows, but these commands should also work on Macs.

IMPORTANT CHOICE:You canjust go download Ghost at https://ghost.org/download/ and everything comes pre-built.
If you download it, you can SKIP getting Grunt, Ruby, Sass, below. Just get node, and move to the Configuring Ghost before you Deploy section further down!
Otherwise, if you "git clone" like I did, you're doing stuff manually, certainly more than is needed, but perhaps learning more about node.
So, want it prebuilt and ready to go? Download Ghost.
Learning, hacking? git clone https://github.com/TryGhost/Ghost.git.

Prerequisites

To start, you'll want these things locally:

  • nodejs - Get 0.10 or above. Install from http://nodejs.org
    • Then get the node Azure command line
      • npm install azure-cli --g
  • Git - Get it from http://git-scm.com/downloads
  • Get Grunt
    • npm install grunt-cli --g
  • ruby - Get 2.0 or above. Install from https://www.ruby-lang.org
  • Bourbon and Sass. Bourbon brings in Sass.
    • gem install bourbon
  • Get an Azure Trial if you don't have one.
    • You get 10 websites free and can run whatever you want, node, php, ASP.NET, etc.

Setup the Azure Command Line

Connect the Azure CLI (command line interface) to your account like this:

  • azure account download
    • launches browser, sign in, get cert
  • azure account  import <filename>
  • [optional] azure account set "account name"

Getting Ghost

You can either download Ghost prebuilt or get the source and build it. Here's both ways. The Source is harder, but I learned some things.

Getting Ghost from Download

Download Ghost and unzip it into a folder.

> azure site create [Site Name] --location "West US" --git
# note that this line setups the "git remote add..." and you can confirm with "git remote show"
> azure site config add NODE_ENV=production
# sets an env var for node, up in azure
> npm install
# get all the modules locally, only needed if you are running locally
> copy con server.js
var GhostServer = require('./index');
CTRL-Z, ENTER
# Ghost uses index.js, not server.js. Make a server.js.

Now, skip over this to the Configuring section. The --git switch above set up your remote git repo in Azure.

Getting Ghost from Source

Now, run these commands from the command line. Read carefully, and think. You can change Site Name, Location. You can confirm the git remote. Things with # are my comments, don't type them. Note the copy con. Don't like it? Use a text editor.

> git clone https://github.com/TryGhost/Ghost.git
> azure site create [Site Name] --location "West US" --git
# note that this line setups the "git remote add..." and you can confirm with "git remote show"
> azure site config add NODE_ENV=production
# sets an env var for node, up in azure
> npm install
# get all the modules locally
> grunt init
> grunt prod
#preps your CSS and JS
> copy con server.js
var GhostServer = require('./index');
CTRL-Z, ENTER
# Ghost uses index.js, not server.js. Make a server.js.

At this point, you have a site running in Azure with nothing in it.

You currently have a local Git repo with a Git Remote pointing to Azure.

Configuring Ghost before you Deploy

Your cloned Ghost includes a config.example.js. I renamed it to config.js and made a few changes.

production: {
url: 'http://YOURSITE.azurewebsites.net/',
mail: {
transport: 'SMTP',
options: {
auth: {
user: 'poop',
pass: 'alsopoop'
}
}
},
database: {
client: 'sqlite3',
connection: {
filename: path.join(__dirname, '/content/data/ghost.db')
},
debug: false
},
server: {
host: '127.0.0.1',
port: process.env.PORT
}
}

Go to the production section, check your URL, your user/pass for mail (mine is invalid, I'll do it later), and check the port: section. Make it "process.env.PORT" which is what Azure uses to get the Port number.

Now open your .gitignore, comment out these lines. enabling you to check in these files and directories.

# /core/client/assets/css
# /core/built
# config.js

When you ran grunt prod earlier, it built files into /core/built, that's why we need that checked in.

NOTE: Of course, we are using Git for deployment. If you don't want to use Git, you can just FTP the files into Azure.

Deploy

Now, add, commit, push.

> git add .
> git commit -m "hope this works"
> git push azure master

Azure (specifically the Kudu subsystem) will run npm install, so this deployment may take a while. You can watch it live in the Azure Portal if you like.

There's my deployment in the Azure Portal

You can also look at deployments from the command line:

C:\Ghost>azure site deployment list hanselmanghost
info: Executing command site deployment list
+ Getting deployments
data: Time Commit id Status Author Message
data: ------------------- ---------- ------ --------------- ----------------
data: 2013-10-23 15:59:38 783746f6a1 Active Scott Hanselman adding server.js
info: site deployment list command OK

OK. It's deployed...except, today...there's a bug.

The Big Hack as of October 23rd...THIS HAS BEEN CLOSED AND MERGED!

Here's the hack/workaround. There's a node module called Express-HBS that is a handlebars template engine that supports partials. It has a caching bug, but there's been a Pull Request opened for express-hbs with the fix. As soon as that fix gets merged in, this whole workaround just goes away.

But, for now, you need to patch the express-hbs/lib/hbs.js with this version (link to RAW file)

How do you patch this in Azure? You can either FTP it, or use this super-secret Azure Kudu DebugConsole that is public but no one has noticed it yet.

Visit https://YOURSITEHERE.scm.azurewebsites.net/DebugConsole/ in your browser. The name and password are the same as your Git Deployment name and password.

Kudu DebugConsole

Navigate to site/wwwroot/node_modules/express-hbs/lib by clicking folders. Click the Edit button, which brings you to a live multiline textbox. Copy paste the patched hbs.js into the textbox, and click Save.

Once you've patched hbs.js, you're all good. Go hit http://YOURSITE.azurewebsites.net/ghost and sign in.

My ghost blog works

Where are the images for my posts stored? They are right there on the file system where Ghost put them. Here's me remoted into the Azure WebSite with the Kudu Debug Console. There's the images.

Images in Ghost in the Azure Kudu Debug Console

You might not want to scale this website out to more than once instance, as you'll have file contention, but you could certainly scale it up. Since it does so little, I don't see Ghost having much trouble scaling to the average blog's traffic.

Myself, Jeremiah, and lots of other folks are going to work on getting Ghost up and running even easier. Once that hack is gone, there's about 2 or 3 steps could be removed and this will be really quite streamlined. I've got some ideas about using Custom Azure Websites Deployment Scripts to move the Grunt build steps into Azure. They would happen after the push. We'll see!

Have fun, I am! Also, check out http://friday.azure.com, my new show where I learn Azure from the folks that built it...coming soon!



© 2013 Scott Hanselman. All rights reserved.
     

Using a Surface 2 (RT/ARM) to get actual work done + Remote Desktop + Visual Studio + Azure

$
0
0
Using Visual Studio in the Cloud running in Azure

I'm using just a Surface 2 today for work. Remember that the Surface 2 runs Office plus any apps in the Microsoft Store. It doesn't support installing desktop apps like Visual Studio or QuickBooks. It comes with Outlook, PowerPoint, Word, Excel, etc.

I didn't plan on this experiment this morning. In fact, I was supposed to go on a field trip with my son but the bus was full. Because I was going to be out all day I didn't bring my laptop. I had only my Surface 2 in the car, so when I wasn't able to go on the field trip, it was either go home and get a "real" computer or see what I could get done on the Surface.

NOTE: If I had my iPad and a Bluetooth keyboard and a stand, plus a remote desktop client for iOS I could do something similar.

I use it for Hulu, Netflix, Halo, email, Twitter, Facebook, Trello, Calendaring, etc and for that it's great. Split screen is cool, as I did email while watching a show on the plane yesterday. (What I really want is a full Surface 2 Pro but with the same exact size and weight of the Surface 2 proper.)

Surface remoted into Azure running Visual Studio

Anyway, I went to a bagel shop and figured I'd be limited to email today. I had my heart set on working on an project today (hacking on Project Kudu in Azure) and that was nagging at me. I also forgot my power adapter so I had only the battery life that I started with in order to get a day's work done.

I remembered that the Azure team recently added Visual Studio 2013 Virtual Machines to Azure accounts that are hooked up to MSDN. If you connect your Azure to your MSDN you get as much as US$150 in Azure Credits, and I never use all mine.

REMINDER: There are lots of Linux Virtual Machines (hundreds, in fact, if you include the VMDepot gallery of images) as well as a number of good SSH clients in the Windows Store that work on Surface. I use the "Remote Terminal" app. Here is a screenshot of me running htop on my Ubuntu machine where my mailing system runs in Azure. It's usually full screen, but I have the menus open here.
SSH'ed into my Linux Machine from my Surface RT

Here's some of the VMs to pick from. Soon the MSDN ones will move into an MSDN section on the left.

e Visual Studio in Azure

You can pick a VM from a small shared-core with less than a gig to a crazy 8 core 56 gig machine. I picked a "Medium" because it seemed similar to my laptop. It's got 2 dedicated cores and 3.5 gigs of RAM. There's also a 4 core 7 gig one, but since I'm not going to run Outlook or anything BUT Visual Studio (and some other small tools) I figured it would save money if I went a little small.

I named it "VSinTheSky" and noted that both PowerShell and RDP (Remote Desktop Protocol) ports were open in the firewall. I also put the new VM in a datacenter near me, so in the Western US region.

NOTE: Virtual Machines are billed when they are running, and you only pay for storage when they are shut down. Make sure to shut them down if you're not using them.

My friend Javier uses a Large VM for 10 hours a day and says it costs him about $3.60. I am cheap, so I'm using a Medium, so at 18 cents an hour, that will be $1.80 for the day if I work for 10 hours.

Remoting into Azure from a Surface 2 (RT/ARM)

There's a full-screen Remote Desktop client in the Windows Store that works nicely, but I like the sense of control I get from the "MSTSC.exe" desktop client, plus I can resize it a little more. You can run this on a Surface 2/RT with WindowsKey+R, then "mstsc" and enter. You can also save RDP files, as I have, on the desktop of my Surface 2. You can see in the screenshot at the top that there's a "Connect" button that lets you launch your Remote Desktop session directly from within the browser. It'll download and open the RDP there as well.

Optimizing the Azure VM for Performance

Azure Virtual Machines are allocated, I'm told, 500 IOPs (IO operations) per second, per disk. However, a great (and important) optimization is to add a data disk (or several) which gives you 500 more IOPS since each disk gets its own.

Make sure to get an empty disk for your Azure VM

In the Azure Portal, click Attach Empty Disk.

TIP: To save time, if you have a lot of files, a large data disk, or a large project, make a VHD locally on your machine, mount it as a disk (you DID know that was built into Windows since Windows 7, right?) and get it ready. Then upload it to a Storage Blob in Azure and attach it to your VM.

When asked how big you want the disk, pick a large size. Some size you wouldn't think you'd need. Why? Turns out that Azure VHDs are "sparse." You are only billed for actual usage. If you make a 1TB disk but it only has 5 gigs used up, you're only charged for 5 gigs. I made my data disk 64 gigs since I'm just putting code on it for building in Visual Studio.

Remote into your Azure VM now, log in, and hit WindowsKey+X. Click Disk Management and partition and format your new drive. It may end up being your F drive as C is the system and D is for temp space. That temp disk is where the Windows swapfile goes,etc. That disk may go away so don't put anything on Temporary Storage.

I added a DATA VHD in the Azure VM

I also moved my %TEMP% environment variable to D:\TEMP. I haven't measured if this was useful, but it feels more correct.

I moved TEMP to D:

Here's "My PC" on the remote machine now:

My optimized Azure VM drives

It came with Visual Studio installed, I also pinned IE to the Taskbar, installed Github for Windows, Chrome, and VS Web Essentials, as well as Windows Live Writer that I'm typing in right now.

Speed, both Local and Remote

The Surface 2 is just SO much faster than the original. At least twice as fast, to me. It has a 1920x1080 screen plus I was remoted into a VM running also at 1920x1080 and I often forgot which was the host and which was local. There's really no lag when connecting to this machine in Azure. Perhaps it's because I'm using the Windows 8.x Remote Desktop client to connect to a Windows 2012R2 Server? I don't know. It's fast and clear, and I'm doing this from a café. SpeedTest.net says this café has 16Mbs down measured running on the Surface. I get 7Mbs on my LTE device it was also fast, so this tells me that if the VM is near you (the one I made in Azure is just one state over from where I live) then you should see similar speeds.

I thought perhaps the Azure VM had slow internet. Um. No.

Azure VM reporting 381 Mbps down and 72 Mbps up

Not Just a Dumb Terminal

I didn't use the Surface 2 exclusively as a dumb-ish terminal. Since it has IE11 and Outlook, I also did email while builds happened in the Remote Session. In this screenshot I'm setting up the remote machine, and installing Chrome after installing GitHub for Windows. I've got Outlook running there, The Verge, plus Twitter docked to the right. The remote session is the window in the middle. It was also cool to run Music in the background tethered over bluetooth to my new headphones.

Surface2

imageImportant Productivity Tips for using Remote Desktop on a Surface 2 (RT/ARM)

There's a number of small but extremely useful things to remember when using RDP on a Surface.

  • You aren't limited to the Remote Desktop app that’s in the Microsoft Store.
    • Run mstsc.exe and you’ll get the full desktop version of the Remote Desktop Client.
    • This means you can use .RDP files and keep them on your desktop.
    • You can copy/paste files (like I have with the images in this blog post) between your remote session and your host session. For example, I took screenshots from "outside" and pasted them to the desktop of my remote session.
  • The Surface Type Cover has a row of Function keys that are also Charms keys. Invert their function to speed up your hotkey usage.
    • However, if you want to do something like ALT-F4, you're expected to FN+ALT+F4 which is unacceptable to a keyboard focused developer like myself. You can toggle (invert) FN usage with FN+CAPS on a Type Cover.
  • Know your basic hotkeys. Keep calm and use your keyboard.
    • Win+X is something you'll use a lot in both the Remote and Local sessions. You can run command prompts, check device manager, setup disks in disk management, launch apps, and much more. Use it.
  • Find a balance between your touchscreen and keyboard. If you haven’t brought an actual mouse, accept that you'll never be fast on the Surface Touchpad. It’s just too small and too felt-y. It's there for emergencies.
    • Move quickly between touching the screen and your keyboard. Most times – even over a remote desktop session – using touch to drag a file or click an icon will be faster than the touchpad. Touch isn’t a replacement for input, it's an augmentation for what you’re already using.
    • I have found that touch is the fastest way to get the text insert cursor (I-bar) pretty close to where I want it when editing text. I touch, then move one or two to the left or right. I've found this is WAY faster than using the mouse and WAY faster than cursor-ing around with the keyboard.
  • While I made it through the day without a mouse, I think having an Arc Mouse or some small bluetooth mouse would have made things nicer. That said, it wasn't a huge deal as I'm mostly a keyboard + touch person. YMMV.

All in all, I'm impressed. I'm going to keep this VM around. This isn't a setup I will use every day as I have an X1 Carbon Touch, but it's comforting to know that I can go 7+ hours with a Surface in a café if it comes to that.



© 2013 Scott Hanselman. All rights reserved.
     

How to sign into Windows 8 or 8.1 without a Microsoft account - make a local user

$
0
0

I was setting up Windows 8.1 on a machine and didn't want to use a Microsoft ID (Live ID) to sign into it. I didn't feel like linking this temporary machine to my existing Microsoft ID and just wanted a regular local login. Now, I realize that not using a Live ID would limit the things I could do and cause a lot more account popups when I visited apps like Music, Store, Video, and others, but still, I want the choice.

It wasn't immediately obvious to me how to create a local login, so I wrote it up here to help you, Oh Internet Person.

Step 1

When you get to settings, it doesn't matter if you click Use Express Settings or Customize. Pick what makes you happy.

2

Step 2

Setup will ask you to Sign into your Microsoft account. You can, but you don't have to. You can also click "Create a new account" at the bottom. You can click there to create a new online Microsoft account, sure, but this is also how you create a local account.

3

Step 3

At this point, it looks like you'll need to Create a Microsoft account, but you can also click "Sign in without a Microsoft account."

You should really know what you're doing here. Don't just do this because you don't like the idea of a Microsoft account. Be aware of the ramifications. That said, you can always add an account later. I found using a local local to be better for me when making a Virtual Machine.

4

Step 4

Here's where you actually make your local account. Put in a user name and password like you always do. This is a local account that has no ties to the online world.

5

Hope this helps someone.


Sponsor: Big thanks to Telerik Icenium for sponsoring the feed this week! Build and publish iOS & Android apps with Visual Studio using only HTML5 & JavaScript! Telerik Icenium now includes Visual Studio integration. Start a 30 day trial with support now!



© 2013 Scott Hanselman. All rights reserved.
     

PowerCfg - The hidden energy and battery tool for Windows you're not using

$
0
0

There's been a lot of talk about power and energy usage by PCs lately, especially ones on battery. I use an irresponsibly power hungry desktop at home, an Ivy Bridge Intel Lenovo X1 Carbon Touch for work, a Surface 2 (for email, remote desktop (RDP), videos, games and airplane stuff since I don't sweat its batter) and I'm also testing this prototype Haswell that Intel sent me. Whatever machine I get next to replace the X1 Carbon Touch (likely a Yoga 2 Pro) will be a Haswell, and ideally it will support "Connected Standby." Connected Standby is a low-power state that lasts for tens (or hundreds) of hours, but allows the PC to play music, refresh email, and receive VOIP calls. Haswell is amazing, to be clear, but it's all the components working together - chipset, wifi adapter, processor - that make for a truly compelling machine.

Recently I re-discovered the powercfg.exe command line tool that's built into Windows. You have this now. It's a funny little tool that, on the one hand, lets you make minute tweaks to how power is used on your computer, but on the other hand, creates the most elaborate reports on how your PC uses power.

You may have used powercfg.exe in low disk space situations to disable the hibernation file with

powercfg /hibernate off

It'll tell you lots of things about your system that you may not know, or that may help you better use power. For example powercfg /availablesleepstates will tell you the flavors of sleep and standy your PC supports.

How deep can your PC sleep?

Here's my fat desktop:

C:\>powercfg /a
The following sleep states are available on this system:
Standby (S3)
Hibernate
Fast Startup

The following sleep states are not available on this system:
Standby (S1)
The system firmware does not support this standby state.

Standby (S2)
The system firmware does not support this standby state.

This is useful to know. My desktop supports standby. Do I use it? We'll see a little later. Here's the same query on my 5 years-newer Surface:

C:\>powercfg /a
The following sleep states are available on this system:
Standby (Connected)

These S1,S2,S3,S4 numbers indicate how "deeply" your system can sleep. S1 is dozing, and S4 is hibernation. You might find that your machine supports a mode like S3 or something but then it's a device you've added that is preventing it from sleeping that deeply. You can diagnose sleep issues (which, for me, usually end up being cheap USB things I've added) with

powercfg /devicequery s1_supported

...for each state and compare the lists of devices.

The most powerful (today) sleep state for energy management is Connected Standby also known as ACPI S0. Regular Sleep/Standby on average Win7 and Win8 machines is S3.

Connected Standby lets you effectively turn your machine off, but still get email, VOIP calls, play music, etc. There's also rules and guidelines around connected standby that limit battery drain to less than 5% of capacity over a work day.

I ran powercfg.exe /a on the prototype Haswell I've been evaluating and it too supports connected standby, which is deeply cool. This explains the fantastic standby ("in the backpack") times I see with it. As more and more machines have Haswell and support Connected Standby, developers will need to support theses "always fresh" scenarios. It's just habit for me to open a laptop before getting on a plane, launch email, load up on RSS feeds, get my flight details. It'll be very cool to have a Haswell machine in "Connected Standby" that is always fresh, even though it may have been asleep all weekend.

Power Reporting

I recently blogged about how the Windows "High Performance" power profile differed from the "Balanced" profile on Servers' performance. Since I'm not on my desktop machine 24/7, I could save a lot of energy by making sure it's falling asleep at the appropriate time and that it's sleeping as deeply as possible.

The real magic switches buried in PowerCfg.exe are /energy and /batteryreport and, if your machine supports "Connected Standby" also /sleepstudy, and I recommend you run them now. I shall wait. ;)

I ran the Energy Report on my Desktop and it generated a nice HTML report. Here's some highlights (it's super long).

First, my desktop isn't configured to ever fall asleep! A fail on my part.

  • Power Policy:Power Plan Personality is High Performance (Plugged In)
  • The current power plan personality is High Performance when the system is plugged in.
  • Power Policy:Sleep timeout is disabled (Plugged In)
  • The computer is not configured to automatically sleep after a period of inactivity.

Second, my wifi adapter isn't set to use Low-Power. Didn't know that.

  • Power Policy:802.11 Radio Power Policy is Maximum Performance (Plugged In)
  • The current power policy for 802.11-compatible wireless network adapters is not configured to use low-power modes.

Finally, my Wacom Tablet may have the wrong drivers or not be able to sleep:

  • USB Suspend:USB Device not Entering Selective Suspend
  • This device did not enter the USB Selective Suspend state. Processor power management may be prevented when this USB device is not in the Selective Suspend state. Note that this issue will not prevent the system from sleeping.
  • Device Name - Wacom Tablet
  • Device ID - USB\VID_056A&PID_00D1

This was extremely useful information for me, so I'll take 5 minutes and make sure this big desktop goes into standby when I'm not around.

Battery and Power Reporting on a Laptop/Tablet

If you run powercfg /batteryreport on a laptop you get a WEALTH of information in an HTML report. Here's some highlights.

Details on Installed Batteries

Lots of details on the batteries in your machine

  • NAME - X864048BA
  • MANUFACTURER - ATL
  • SERIAL NUMBER - 12412
  • CHEMISTRY - L/ION
  • DESIGN CAPACITY - 31,297 mWh
  • FULL CHARGE CAPACITY - 31,646 mWh
  • CYCLE COUNT - 34

What the device was doing, when, the battery mWh and times:

image

You get awesome charts showing how you battery discharges, charges, and percentages.

image

As well as detailed usage history, percentage used and hours used.

image

Connected Standby machines get an even MORE amazing report with /sleepstudy

You can see what apps are using what about of battery and time, what devices are the "worst offenders" and then you can use this knowledge to decide what you keep running in the background.'

image

Here is one Connected Standby session:

image

I was a little surprised at the quantity of hard data collected and stored by Windows. Also, when blogs and reviewers do detailed tests on different machines showing battery life and stressed tests, are they running powercfg.exe to ensure all the drivers are working together and haven't been flagged as either power-hungry or energy-stupid?

I would love to see even more data on what Windows is doing around energy, and I'm nearly positive the system is keeping track of power-hungry apps. Why not give me a little "heat map" in the title bar so I can know what browser uses the most power, what app is working too hard, or what website is running JavaScript in a loop? Why not give us the option to put those tools front and center?


Sponsor: Big thanks to Telerik Icenium for sponsoring the feed this week! Build and publish iOS & Android apps with Visual Studio using only HTML5 & JavaScript! Telerik Icenium now includes Visual Studio integration. Start a 30 day trial with support now!



© 2013 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>