Scott Hanselman

iPhone tethering personal hotspot shows up a as a new network each time (plus the smart quote is silly)

March 16, '12 Comments [25] Posted in Musings
Sponsored By

I often use my iPhone as a Personal Hotspot. I'm not sure what's changed in iOS5 but one problem still exists and the other has gotten worse. First, the 802.11 wireless specification doesn't say anything about the character encoding of the SSID (Service Set Identifier - the think that names your access point). Most APs and Operating Systems assume that the string will be straight ASCII and code page 1252. However, Apple iOS devices default to yourname's iPhone where the quote ' is a smart quote like this ’, so Scott’s iPhone. Just as I mentioned in my post on "Why the #AskObama Tweet was Garbled on Screen: Know your UTF-8, Unicode, ASCII and ANSI Decoding Mr. President" even smart folks can mess this up. Since the iPhone is assuming that the encoding is UTF-8 while the rest of folks are assuming ASCII, we end up with "Scott’s iPhone."

Scott's iPhone is trying to use Smart Quotes, and failing

It's harmless, but it's irritating. I've filed a feature request with Windows (it's not a bug per se, but rather what appears to be an ambiguous spec that makes everyone look bad, IMHO).

If if bugs you too, you can Right Click on the network icon near your click and "open Network and Sharing Center" then click on the ICON that represents your network. That will get you this dialog (that you've likely never seen before because clicking on the icon isn't intuitive).

Set Network Properties Dialog

In that dialog you can change the name and the icon of the connection. Fancy.

image

If you really really want to fix it, then change the name of your phone to include a ' rather than a ’ by going to Settings | About | Name.

Changing a quote to a smart quote - before Changing a quote to a smart quote - after

However, since the iOS 5.1 update last month every time I tether my iPhone I get a new Wireless Network. I'm currently on Scott's iPhone 12 and it keeps going up. I'm not sure what changed in this update but it's clearly changed because everyone is seeing this behavior.

I like my things tidy, so I wanted to merge or delete all these superfluous networks. Remember that dialog above that we got to my clicking on the icon in Network and Sharing Center? Well, at the bottom it has another button that you've never seen before. I know I hadn't.

Merge or delete network locations

Click on Merge and you will be shocked to see the last six billion networks that you've connected to. You're very wirelessly promiscuous, aren't you?

Merge or Delete Network Locations List

From here you can select and merge together all your duplicate networks, as well as delete ones you don't want to have Windows remember.

Hope this helps! I hope that this is fixed in both iOS, the specification AND in Windows. Specification ambiguity hurts everyone.

About Scott

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

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

On Pie Chart Diversity at Technical Conferences

March 15, '12 Comments [17] Posted in Musings
Sponsored By
A large panel of 12 apparently white men at SXSW - Photo via Jay Smooth from http://jsmooth995.lightbox.com/

This last week at the SXSW (South by Southwest) conference I appeared on a panel that discussed "What can technology conferences do about diversity?" (the audio is up at that link also)

The picture at right is NOT that panel.

I speak at or attend between 12 and 20 conferences a year. Too often panels and speakers at conferences consist only of white males between the ages of 25 and 35. This year at SXSW we hosted a frank conversation attempting to answer some questions like "what is diversity (hint, it's not just color)", "how can we make technology conferences more inclusive," and "why should we value diversity at all?"

Our panel consisted of

It was expertly moderated by Latoya Peterson, Racialicious.com. Our panel was also mentioned in an article at Salon.com, although perhaps not for the reasons we would have liked.

A number of interesting and compelling points were made during this panel.

Pie Chart Diversity in Cartoons - How did I not see this before?Anjuan brought up the issue of the "pipeline" of potential technology workers and conferences attendees. We need to continue to make sure that everyone has the opportunity to access technology and express interest in technology. This starts with making sure schools put adequate focus on STEM (Science, Technology, Engineering, and Math) programs.

Anjuan also spoke about the pressure for minorities to be stewards for their respective groups. As a white male if I'm late for a meeting that reflects poorly on me, but if Anjuan is the only black male in a meeting and is late he feels that may reflect poorly not only on him, but any prospective future hires. While it's not the same, I relate somewhat as a Type 1 diabetic on a pump. I am aware that if I am unable to travel, am sick often, or am in some way unable to do my job effectively that may reflect poorly (and has in the past in my experience) on other diabetics. This could then make the company reticent to hire folks that follow in my footsteps.

When I travel overseas and meet new people I am an American representative, and it's on me to be a good one. When I travel in the rural areas of Zimbabwe I want to leave a good impression of white Americans. We are all stewards of our respective groups, and PoC (People of Color) certainly feel that pressure more than others.

Benneton Ad - Fair Use

I offered my perspective as the only white panelist. I feel that many people say "I don't see color," but that's like saying "I don't see you. I don't see your experience." We are the sum of our experiences, our abilities and disabilities, our languages, our color, our place of birth and a thousand other characteristics. While color is an easy categorization, so is height, weight, gender, number of extremities and a bunch of other physical characteristics.

We need to resist the temptation to move from all white panels and apply "pie-chart diversity" to our groups. Pie Chart Diversity is my term for when you have one Black man, an Asian girl, a blonde white person and a brunette, and perhaps a Latino in a arbitrary group. You see this pattern in sitcoms and cartoons time and time again. It might make for a nice Benetton ad but it doesn't make for a good tech conference.

Don't assemble colorful panels, assemble diverse panels.

Value lies in diverse perspectives, not aesthetically pleasing color swatches. An all white panel can  be a diverse panel if it includes a variety of ages, genders, languages, education levels, countries of origin and more. Don't ask yourself questions like "Why is this panel only white men" but rather ask yourself "where are qualified women and people of color for this panel?"

My point to the audience was that awareness is the key. If you are assembling a panel or conference it's OK if you are a white person to ask yourself "do we have a diverse and representative group of perspectives in this talk?" If you are participating in a talk, it's OK to ask the organizers or suggest friends who might bring an interesting perspective.

Corvida brought up the importance of tapping your own network. If she is the only PoC at a conference, perhaps she needs to reach out to her own network and let them know that the conference even exists! Lots of people have never heard of CodeMash, SXSW, or OSCON. Spread the word and encourage folks to submit. There's also BarCamps and CodeCamps as a way of starting small.

Our Diversity Panel at SXSW - Photo by Josette Rigsby

Thanks to Adria for organizing the Panel, to Latoya for excellent moderation, and to Anjuan and Corvida for their unique perspectives! To those that attended, I hope you enjoyed it as much as we did. There should be video and audio of the event soon. I'll update this post when it's available.

Recommended Links

About Scott

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

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

How to access NuGet when NuGet.org is down (or you're on a plane)

March 9, '12 Comments [29] Posted in NuGet | Open Source
Sponsored By

I was in Dallas today speaking at the Dallas Day of .NET. During my keynote presentation - it included lots of NuGet demos - and for some reason the NuGet.org site was down at that exact moment. I ended up coming up in the middle somewhere. I'm not in Redmond so I don't know what happened and I won't speak for the team. However, my initial reaction was "I'm screwed" and the crowd was interested in how I was going to continue. We all depend on NuGet (the system) and NuGet.org (the server). I know that the team is aiming for "5 nines" availability with the NuGet.org site and that it runs in Azure now. I assume they'll put an explanation of the issue up on the site soon.

Regardless, you might think I was stuck. Well, remember that NuGet caches the packages it downloads on your local hard drive. My cache was located at C:\Users\scottha\AppData\Local\NuGet\Cache.

The Local NuGet Package Cache

You can add that cache folder as a NuGet Source by going to Options | Package Manager | Package Sources. You can see I added it in my dialog below.

The NuGet Package Source Options dialog

Then later, when I'm using NuGet offline I can select my cache if need be. Again, I should never need to, but you get the idea:

The NuGet Cache selected as an option in the Package Manager Console 

If you're concerned about external dependencies on a company-wide scale, you might want to have a network share (perhaps on a shared builder server) within your organization that contains the NuGet packages that you rely on. This is a useful thing if you are in a low-bandwidth situation as an organization.

If you think a feature that makes offline a more formal state is useful, please go vote up this "offline" issue on NuGet's CodePlex site and join the conversation with ideas on how you think "NuGet on an airplane" or "low/no bandwidth NuGet" should work. For example, should it automatically fall back? Should there be a timeout? Should there by an -offline explicit option? Should the existing Offline Cache be added automatically?

About Scott

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

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

Dark Matter Developers: The Unseen 99%

March 7, '12 Comments [101] Posted in Musings
Sponsored By

In astronomy and cosmology, dark matter is a currently-undetermined type of matter hypothesized to account for a large part of the mass of the universe, but which neither emits nor scatters light or other electromagnetic radiation, and so cannot be directly seen with telescopes. - Wikipedia on Dark Matter

You can't see dark matter, but we're pretty sure it's there. Not only is it there, but it's MOST of what's there. We know it and we can't see it. It never shows up.

My coworker Damian Edwards and I hypothesize that there is another kind of developer than the ones we meet all the time. We call them Dark Matter Developers. They don't read a lot of blogs, they never write blogs, they don't go to user groups, they don't tweet or facebook, and you don't often see them at large conferences. Where are these dark matter developers online?

Part of this is the web's fault. The web insists on moving things forward at an rate that makes people feel unable to keep up. I mean, Google Chrome has upped two version numbers just in the last 3 paragraphs of this blog post. Microsoft probably created a new API and deprecated an old one just while I was typing this sentence.

Lots of technologies don't iterate at this speed, nor should they. Embedded developers are still doing their thing in C and C++. Both are deeply mature and well understood languages that don't require a lot of churn or panic on the social networks.

Where are the dark matter developers? Probably getting work done. Maybe using ASP.NET 1.1 at a local municipality or small office. Maybe working at a bottling plant in Mexico in VB6. Perhaps they are writing PHP calendar applications at a large chip manufacturer.*

Personally, as one of the loud-online-pushing-things-forward 1%, I might think I need to find these Dark Matter Developers and explain to them how they need to get online! Join the community! Get a blog, start changing stuff, mix it up! But, as my friend Brad Wilson points out, those dark matter 99% have a lot to teach us about GETTING STUFF DONE.

They use mature products that are well-known, well-tested and well-understood. They aren't chasing the latest beta or pushing any limits, they are just producing. (Or they are just totally chilling and punching out at 5:01pm, but I like to think they are producing.) Point is, we need to find a balance between those of us online yelling and tweeting and pushing towards the Next Big Thing and those that are unseen and patient and focused on the business problem at hand.

I like working on new stuff and trying to new ways to solve old (and new) problems but one of the reasons I do like working on the web is that it's coming to a place of maturity, believe it or not. I feel like I can count on angle brackets and curly braces. I can count on IL and bytecode. These are the reliable and open building blocks that we will use to build on the web for the next decade or three.

While some days I create new things with cutting edge technology and revel in the latest Beta or Daily Build and push the limits with an untested specification, other days I take to remember the Dark Matter Developers. I remind my team of them. They are out there, they are quiet, but they are using our stuff to get work done. No amount of Twitter Polls or Facebook Likes or even Page Views will adequately speak for them.

The Dark Matter Developer will never read this blog post because they are getting work done using tech from ten years ago and that's totally OK. I know they are there and I will continue to support them in their work.

* These people and companies all exist, I've met them and spoken to them at length.

UPDATE: I found a blog post from John Cook that mentioned Kate Gregory who also used this term "Dark Matter" to refer to programmers. It seems it's an apt analogy!

About Scott

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

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

On the nightmare that is JSON Dates. Plus, JSON.NET and ASP.NET Web API

March 6, '12 Comments [69] Posted in ASP.NET | Javascript | Open Source
Sponsored By

Ints are easy. Strings are mostly easy. Dates? A nightmare. They always will be. There's different calendars, different formats. Did you know it's 2004 in the Ethiopian Calendar? Yakatit 26, 2004, in fact. I spoke to a German friend once about how much 9/11 affected me and he said, "yes, November 9th was an amazing day in Germany, also."

Dates are hard.

If I take a simple model:

public class Post
{
public int ID { get; set; }

[StringLength(60)][Required]
public string Title { get; set; }

[StringLength(500)]
[DataType(DataType.MultilineText)]
[AllowHtml]
public string Text { get; set; }

public DateTime PublishedAt { get; set; }
}

And I make a quick ASP.NET Web API controller from VS11 Beta (snipped some stuff for simplicity):

public class PostAPIController : ApiController
{
private BlogContext db = new BlogContext();

// GET /api/post
public IEnumerable<Post> Get()
{
return db.Posts.ToList();
}

// GET /api/post/5
public Post Get(int id)
{
return db.Posts.Where(p => p.ID == id).Single();
}
...snip...
}

And hit /api/post with this Knockout View Model and jQuery.

$(function () {
$("#getPosts").click(function () {
// We're using a Knockout model. This clears out the existing posts.
viewModel.posts([]);

$.get('/api/PostAPI', function (data) {
// Update the Knockout model (and thus the UI)
// with the posts received back
// from the Web API call.
viewModel.posts(data);
});
});

viewModel = {
posts: ko.observableArray([])
};

ko.applyBindings(viewModel);
});

And this super basic template:

<li class="comment">
<header>
<div class="info">
<strong><span data-bind="text: Title"></span></strong>
</div>
</header>
<div class="body">
<p data-bind="date: PublishedAt"></p>
<p data-bind="text: Text"></p>
</div>
</li>

I am saddened as the date binding doesn't work, because the date was serialized by default like this. Here's the JSON on the wire.

[{
"ID": 1,
"PublishedAt": "\/Date(1330848000000-0800)\/",
"Text": "Best blog post ever",
"Title": "Magical Title"
}, {
"ID": 2,
"PublishedAt": "\/Date(1320825600000-0800)\/",
"Text": "No, really",
"Title": "You rock"
}]

Eek! My eyes! That's milliseconds since the beginning of the Unix Epoch WITH a TimeZone. So, converting in PowerShell looks like:

PS C:\> (new-object DateTime(1970,1,1,0,0,0,0)).AddMilliseconds(1330848000000).AddHours(-8)

Sunday, March 04, 2012 12:00:00 AM

Yuck. Regardless,  it doesn't bind with KnockoutJS either. I could add a bindingHandler for dates like this:

ko.bindingHandlers.date = {
init: function (element, valueAccessor, allBindingsAccessor, viewModel) {
var jsonDate = valueAccessor();
var value = new Date(parseInt(jsonDate.substr(6)));
var ret = value.getMonth() + 1 + "/" + value.getDate() + "/" + value.getFullYear();
element.innerHTML = ret;
},
update: function (element, valueAccessor, allBindingsAccessor, viewModel) {
}
};

That works, but it's horrible and I hate myself. It's lousy parsing and it doesn't even take the TimeZone into consideration. This is a silly format for a date to be in on the wire.

Example of Knockout binding

I was talking to some folks on Twitter in the last few days and said that all this is silly and JSON dates should be ISO 8601, and we should all move on. James Newton-King the author of JSON.NET answered by making ISO 8601 the default in his library. We on the web team will be including JSON.NET as the default JSON Serializer in Web API when it releases, so that'll be nice.

I mentioned this to Raffi from Twitter a few weeks back and he agreeds. He tweeted back to me

He also added "please don't do what the @twitterAPI does (ruby strings)." What does that look like? Well, see for yourself: https://www.twitter.com/statuses/public_timeline.json in a random public timeline tweet...snipped out the boring stuff...

{
"id_str": "176815815037952000",
"user": {
"id": 455349633,
...snip...
"time_zone": null
},
"id": 176815815037952000,
"created_at": "Mon Mar 05 23:45:50 +0000 2012"
}

Yes, so DON'T do it that way. Let's just do it the JavaScript 1.8.5/ECMASCript 5th way and stop talking about it. Here's Firefox, Chrome and IE.

All the browsers support toJSON()

We're going to do this by default in ASP.NET Web API when it releases. (We aren't doing this now in Beta) You can see how to swap out the serializer to JSON.NET on Henrik's blog. You can also check out the Thinktecture.Web.Http convenience methods that bundles some useful methods for ASP.NET Web API.

Today with the Beta, I just need to update my global.asax and swap out the JSON Formatter like this (see Henrik's blog for the full code):

// Create Json.Net formatter serializing DateTime using the ISO 8601 format
JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
serializerSettings.Converters.Add(new IsoDateTimeConverter());
GlobalConfiguration.Configuration.Formatters[0] = new JsonNetFormatter(serializerSettings);

When we ship, none of this will be needed as it should be the default which is much nicer. JSON.NET will be the default serializer AND Web API will use ISO 8601 on the wire as the default date format for JSON APIs.

ISO Dates in Fiddler

Hope this helps.


Sponsor: Big thanks to DevExpress for sponsoring this last week's feed. There is no better time to discover DevExpress. Visual Studio 11 beta is here and DevExpress tools are ready! Experience next generation tools, today.

About Scott

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

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

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