Dallas TechFest 2010 – Call For Speakers

I’m thrilled to announce that Dallas TechFest 2010 has set a date of July 30th, 2010 and is currently engaged in a Call For Speakers looking for those in all sorts of technology areas who wish to speak.  If you’ve got expertise in .NET, Java, Ruby, PHP, ColdFusion, Python, Flex or anything else then send in an abstract and see if you can secure a speaking slot at Dallas TechFest 2010. Sometime in March we will be opening registration, but in the meantime mark the date on your calendar, and get ready for our registration drive.  Like in previous years, if you recommend people to register you will be entered to win a great prize.  What prize? Hmmm….  Well it’s got a touch screen, a 3G modem, and a huge app store.

Gravatars in ASP.NET MVC using HtmlHelper

I’m working on a side-project right now that is using Gravatars and found the wonderful article by Ryan Lanciaux on creating an HtmlHelper extension.  His extension was good, but did not use integrate with the FluentHtml model of MvcContrib, so I refactored his original into the following class, which does the same thing, but allows for fluent building of all the options.  Someone will undoubtedly point out that this could have used a couple of Enumerations, and their right, but I decided the API was static enough that I’d just create the methods. Anyway, I hope someone else gets some use out of this. using System.Collections.Generic; using System.Security.Cryptography; using System.Web.Mvc; using System.Web.Routing; using MvcContrib.FluentHtml.Elements; using System; using System.Web; public class Gravatar : Element { private string _email; private string _default; private string _rating; private int _size; private string _alt; public Gravatar(string email) : base("img") { _email = email; } public Gravatar DefaultToUrl(string url) { _default = url; return this; } public Gravatar DefaultToIdenticon() { _default = "identicon"; return this; } public Gravatar DefaultToMonsterId() { _default = "monsterid"; return this; } public Gravatar DefaultToWavatar() { _default = "wavatar"; return this; } public Gravatar DefaultTo404() { _default = "404"; return this; } public Gravatar Size(int size) { if (size < 1 || size > 512) throw new ArgumentException("Gravatars can only be between 1 and 512 in size.", "size"); _size = size; return this; } public Gravatar GRated() { _rating = "g"; return this; } public Gravatar PGRated() { _rating = "pg"; return this; } public Gravatar RRated() { _rating = "r"; return this; } public Gravatar XRated() { _rating = "x"; return this; } public Gravatar AlternateText(string alt) { _alt = alt; return this; } protected override TagRenderMode TagRenderMode { get { return TagRenderMode.SelfClosing; } } public override string ToString() { var src = string.Format("http://www.gravatar.com/avatar/{0}?", EncryptMD5(_email)); if (!String.IsNullOrEmpty(_rating)) src += string.Format("r={0}&", HttpUtility.UrlEncode(_rating)); if (_size != 0) src += string.Format("s={0}&", _size); if (!String.IsNullOrEmpty(_default)) src += string.Format("d={0}&", HttpUtility.UrlEncode(_default)); base.builder.MergeAttribute("src", src); base.Attr("alt", _alt ?? "Gravatar"); return base.ToString(); } private static string EncryptMD5(string Value) { using(var md5 = new MD5CryptoServiceProvider()) { byte[] valueArray = System.Text.Encoding.ASCII.GetBytes(Value); valueArray = md5.ComputeHash(valueArray); string encrypted = ""; for (int i = 0; i < valueArray.Length; i++) encrypted += valueArray[i].ToString("x2").ToLower(); return encrypted; } } } public static class GravatarHtmlHelper { public static Gravatar Gravatar(this HtmlHelper html, string email) { return new Gravatar(email); } }

I’m an MVP for 2009!

A couple of days late, but I’m thrilled to announce that Microsoft has recognized me as a Most Valuable Professional again for 2009.  I’m always immensely honored to be counted among this incredible group of technologists.  MVPs are known around the world as passionate experts in their field, and I can only hope to live up to that ongoing recognition. For those of you who follow my blog for technical reasons, you’ll be pleased to know I continue to be recognized as a Connected Systems Development MVP, and that you should see a lot of interesting content regarding Code Contracts, Windows Communication Foundation, and Windows Workflow Foundation all in .NET 4 in the coming weeks.