Emojis and String.Length

Are you using String.Length to compute the length of a string that might include emojis?

If you compute String.Length for such a string, you may not get back exactly what you expect:

This will write 12 to the screen. What were YOU expecting?

String.Length with emojis will not do what you expect

This happens because C# strings are UTF-16 by default and Unicode characters that fall outside of these 16-bit lengths are stored as surrogate pairs, or two chars that represent one 32-bit character.

However, you may be wanting the number of Unicode characters, not the actual length of the char array, in which case you should use System.Globalization.StringInfo to compute the length of your strings. Like so:

This will yield what you're looking for:

StringInfo will give you the actual number of characters in a string

Want more reading? Check out Joel Spolsky's very excellent article on strings and encoding. Remember, there is NO such thing as plain text!

VIDEO - Discussing React and Angular 2 with Adam Morgan

TL;DR: I've gotten really excited about React as a web framework since starting with Angular and then Angular 2. The combination of JSX + easy-to-understand component model have made React a winner to me.

I've been tweeting a lot recently about React recently. After doing a lot of Angular 2 work for the majority of 2016 including a successful workshop at a few conferences, I started learning React early this year and was instantly hooked. A friend of mine wanted me to show him what all the excitement was about, and, well:

...which caught the attention of a Twitter friend of mine, Adam Morgan. He asked to see a repo - I said, let's do one better and make a video, which you can find here:

In the video, I walk through the three things that really make React stand out to me over Angular 2, with questions and commentary from Adam. The long and the short of it:

  1. JSX is awesome. As Cory House wrote: "it’s more logical to enhance JavaScript to support markup than to enhance HTML to support logic." Plus, compile time checking of your views makes writing components a much easier process.
  2. It's just JavaScript. No need to learn any framework-specific DSLs like with Angular/Angular 2/Aurelia/etc. You only need to know JavaScript and HTML to write React apps.
  3. Low API surface and learning curve. Fewer moving parts means it's easier to understand and become productive with quickly.

Here are some of the resources I've used to get started.

Building Applications with React and Redux using ES6 - Pluralsight course by Cory House
Presentational vs Container components by Dan Abramov Getting Started with Redux - course by Dan Abramov, creator of Redux
React Slingshot - React starter kit by Cory House
ASP.NET Core SPA Generator/Starter Kits, which includes templates for React and React with Redux.

International speaker achievement unlocked + Quick note on NDC

It was a huge moment of pride in October when I received my Microsoft MVP award. It was as big a moment when I got my acceptance to NDC London to speak on RESTful APIs using ASP.NET ten days later.

I'm thrilled and grateful that another one of my talks was picked up for the 10th NDC Oslo - this time on a maintainable RESTful API architecture using ASP.NET Core. It's really the sequel to the talk I gave at NDC and several other conferences/user groups last year. I'm moving beyond the theoretical and diving into implementation of a API architecture that I think is maintainable for the life of your API.

I wanted to take a moment and thank NDC for giving me a chance to present at not only one but two conferences this year. As far as conferences go, NDC has the whole package - they have a content lineup that is unrivaled and go out of their way to make their attendees and speakers feel loved.

I'm told that NDC takes chances on newer speakers. For taking a chance on this new speaker from my little corner of the Midwest, I'm very grateful. You've created an eternally loyal speaker in me.

This is going to be an exciting year.

Cloud and web-based software consulting - announcing Aviron Software

Aviron Software logo

I'm so excited and pleased to announce the formation of my software consulting company, Aviron Software.

It sounds cliche, but this has been something I've dreamt of doing for a long time. I'm very grateful that the opportunity presented itself and I'm so proud and pleased to let this blog post be my ribbon-cutting.

Aviron is a French word meaning "rowing". The word is meaningful to us because it directly reflects Aviron's goal - to move our clients forward by providing best-in-class cloud- and web-based software solutions. Oars may or may not be involved. :)

As usual, there are many people to thank, but a couple of folks stand out. Above all, my wife Susan, who has supported this dream and is ready to step into the role of being spouse to a small business owner. And of course my good friend Jeff Strauss, who has provided critical direction and advice for the formation and maintenance of a fledgling software consultancy.

Interested? Get in touch: hello@avironsoftware.com

Road to my first Microsoft MVP Award

Today, the new Microsoft MVPs were announced. I am extremely grateful and humbled to be accepted into this prestigious group of individuals. My MVP award is for Visual Studio and Development technologies.

I started this blog on August 4th, 2014 (also my wedding anniversary) and opened with what remains my most popular post of all time - a post saying that Xamarin, then a paid product, should open up Visual Studio integration to those on its Indie subscription plan (oh how times have changed.) 10k hits on a blog's first day open is nothing to sneeze at. So I kept at it.

The turning point was a post I made about DevUp (then St. Louis Days of .NET) with some suggestions about how they could make their conference better. It caught the attention of the organizers and led to a lunch with Jeff Strauss and Scott Spradlin, two of the three on the board of DevUp, in early 2015.

I asked how I could help them and get involved. Scott said, well, we're always looking for speakers.

And so it began. I signed up to speak at a few small things around town - the Microsoft store (for an audience of 5 people!) and the user group. A couple months later, I was accepted to ThatConference 2015 speaking about Xamarin and SignalR. (I was told later to be an unknown and get into ThatConference is an accomplishment, so I have to thank my title and abstract for being so compelling. :) I was pleased to do the same talk at DevUp 2015 and spent the rest of the winter blogging here and there and doing some very minor open source work.

With the help and encouragement of my wife Susan, Jeff Strauss, and my company, I've kept submitting and getting accepted to different conferences, starting with Chicago Code Camp in April. This year, I've spoken to over 1,500 people around the country in various sessions, including three full-day workshops. By November, I'll have spoken at seven conferences and three user group meetings this year alone.

And now here we are - my very first Microsoft MVP award. I have a few individuals to thank for this award – they helped me tremendously in some way throughout this process.

My wife, Susan – none of this would be possible without your love, support, and encouragement. When I started this journey, I knew I was asking for a lot from you and you stepped up in a big way so that I could travel, speak, and blog. I can’t thank you enough for helping me achieve this. And of course thank you to my children Nick and Lucy for being great kids and tolerating my semi-frequent absences while going to conferences and user group meetings.

Jeff Strauss – you’ve been an incredible friend and mentor during my process to becoming a speaker and getting involved with the community. I can’t thank you enough for your advice, insights, and encouragement. No one has done more to make me feel welcome and help me grow as a speaker, community member, and software developer.

Tom Stemm, Nick Smarrelli and Joe Gadell – I told these guys when I was hired two years ago that I wanted to get involved with the community. They were right behind me, supporting me by sending me to conferences on Ryvit/GadellNet’s behalf. I couldn’t ask for three better guys to run our awesome companies and support their employees in achieving their goals.

Jonathan Mills – you’re a great friend and advisor who allowed me to speak at KCDC and connected me with other conferences around the country. Thanks for mentoring me throughout my speaking career.

Scott Spradlin – thanks for letting me speak and help with your awesome conference and user group. I hope I can help you continue to make an impact on the St. Louis .NET community.

Cory House – you’re the first speaker I saw at a conference where I thought, wow, that guy really knows what he’s doing. After ThatConference/DevUp 2015, I helped jump-start my speaking career via your speaker starter kit and haven’t looked back. You’ve given me great advice on how to be a better speaker and it’s been great to get to know you this year.

Adam Barney & Ken Versaw – even when I was still somewhat unknown, you took a chance on me for my first multi-day conference of 2016, Nebraska.Code(), even allowing me to do an 8-hour workshop that I had never done before. That was something special. I can’t wait to be part of more Amegala conferences in the future.

Gaines & Mary Kergosien – I'm so thankful to have been a part of Music City Code. Thanks for welcoming me in and being so hospitable. You really go out of your way to make the community feel like they’re part of something special.

Lisa Anderson - my MVP lead - thank you for selecting me for the MVP award. I'm looking forward to making even more contributions in 2017 and beyond!

Scott Hanselman – you were part of my inspiration to become a bigger part of the community. Your blog is a staple stop on my daily reading list. Your tools list has saved me hours of time. Thanks for everything you do.

Taiseer Joudeh - I read your blog post about becoming an MVP in 2015 and remember wanting to get more involved after reading it. Your posts on ASP.NET and Angular are top notch and I've learned a ton from you.