Why a PhD?

I’ve been working as a software engineer for more than 20 years, and when the opportunity came up for me to continue my education at the Ph.D. level I jumped at it. In September 2017 I started the Ph.D. Computer Science program at the University of South Carolina.

The things that motivate me now in this endeavor are the same aspects of my vocation that I have enjoyed throughout my career: research, teaching, and learning.

First, research: dig deep into the subject that I have dedicated my life too. I’ve always loved solving problems. The process of understanding the problem, studying the current state of the art, and extending my findings to create new solutions is probably what I enjoy most about what I do. It is my goal to do research that advances state of the art in computer science by being relevant, forward-thinking, and impactful.

Next, teaching: share my knowledge and experiences with others. I benefitted in my career by having great mentors who guided me to improve my understanding of any number of different topics. Through their sharing of not just the “nuts-and-bolts” of issues but their opinions and experiences, I have been able to take their teachings and expand my own understanding. My goal as a teacher is to be relevant and inspiring.

Finally, (lifelong) learning: continue to expand my understanding and experience with the theory and practice of computer science so that I can be a better practitioner, researcher, and teacher.

Why Blog?

Why do I blog? There can be many different reasons that people blog. Common reasons for blogging include: building audience, establishing authority, or differentiating oneself. I have three motivations for blogging.

First, I want to improve my writing skills and as there is no better way to get better at writing than by writing it makes sense to write more.

Second, over the course of my career, I’ve found that there is no better way to improve my understanding of a topic than to try to explain it to someone else. That explanation could be written or a presentation. Either way, the process of putting the explanation together forces me to make sure I understand the subject and organize my thoughts in such a way so I can communicate my understanding to someone else.

Finally, I would expect that the first tool many of us in the software development field reach for when faced with an interesting technical problem is what I like to call “the universal reference,” Google. By documenting issues and explaining the solutions that I’ve come across as a part of my work I can share this knowledge with others.

So it is my hope, dear reader that you can take away some benefit from my essays.

Refactoring Nerd Dinner – Adding Knockout JS

Ever wonder what Knockout JS is? Since it’s going to be a part of the default ASP.NET template in VS2012 I figured that I should take a look. AND what better project to try something new in than Nerd Dinner.

The Popular Dinners list in the Home/Index view is already using jQuery to get JSON data and dynamically building the list, this seems like the perfect candidate to refactor to use knockout.


The first step in adding Knockout to NuGet (assuming that you already have the latest Nerd Dinner source) is to get the package from NuGet


First, I need to add a script reference to knockout in the _Layout.cshtml


Next, the code in the Index.cshtml view needs to be changed from the empty container that gets dynamically populated to the use a knockout template. So I changed this line:


Similarly, in the NerdDinner.js file _renderDinners needs to be changed to use knockout model binding. After some code cleanup _renderDinners now looks like this:
NerdDinner._renderDinners = function (dinners) {
var viewModel = {
dinners: ko.observableArray(dinners)


$.each(dinners, function (i, dinner) {
var LL = new VELatLong(dinner.Latitude, dinner.Longitude, 0, null);

// Add Pin to Map
NerdDinner.LoadPin(LL, _getDinnerLinkHTML(dinner), _getDinnerDescriptionHTML(dinner), false);

// Display the event's pin-bubble on hover.
var dinnerPin = _getDinnerPin(dinner.DinnerID);
if (dinnerPin != null) {
function () { NerdDinner._map.ShowInfoBox(dinnerPin); },
function () { NerdDinner._map.HideInfoBox(dinnerPin); }

// Adjust zoom to display all the pins we just added.
if (NerdDinner._points.length > 1) {

Next, there were some custom binders that I needed to add. One for displaying the EventDate properly and another for showing the RSVP Message. They look like this at the end of the NerdDinner.js file:
ko.bindingHandlers.dateString = {
update: function (element, valueAccessor, allBindingsAccessor) {
var value = valueAccessor();
var allBindings = allBindingsAccessor();
var valueUnwrapped = ko.utils.unwrapObservable(value);
var pattern = allBindings.datePattern || 'MM/dd/yyyy';
var v1 = eval('new' + valueUnwrapped.replace(/\//g, ' '));
var v2 = v1.format(pattern);
ko.bindingHandlers.rsvpMessage = {
update: function (element, valueAccessor) {
var value = valueAccessor();
var rsvpMessage = " with " + value + " RSVP";
if (value > 1)
rsvpMessage += "s";

Finally, This sample has just barely scratched the surface of the interesting things that knockout allows you to do. If you’re interested in learning more go the Knockout JS site. Also, the Nerd Dinner source is on Codeplex. I’d encourage you to get it, fork it, and make it better!

Adding HTML5 Geolocation to Nerd Dinner with yepnope.js, and Modernizr

One of the new features of the recently updated Nerd Dinner project is the support for HTML5 Geolocation.

There are two JavaScript libraries that I used to accomplish this. The first is yepnope.js (http://yepnopejs.com/). Yepnope.js is an asynchronous resource loader. This means that you can load scripts based on the outcome of some condition. The second is Modernizr v1.7 (http://www.modernizr.com/). Modernizr detects a web browser’s ability to support various HTML5 and CSS3 features. Note: Modernizr v2 has yepnope.js built into the production version so you may want to consider using it in your project.

It’s important to remember that yepnope.js is an asynchronous resource loader. This means that the script you’re loading WON’T be available on page load or $(document).ready. What I did was create a common JavaScript function called getCurrentLocation in both javascript files and call that when the script load is completed.

The code in Nerd Dinner that kicks the Geolocation off is this:

So the whole thing works like this: First, the resource loader (yepnope.js) tests if the browser supports native geolocation by using Moderizr. If the browser does (yep) support geolocation natively, the geo.js gets loaded and the callback calls the geo.js version of getCurrentLocation.


function getCurrentLocation() {
    try {
        // do native HTML5 geolocation
        navigator.geolocation.getCurrentPosition(showCurrentLocation, errorHandler)
    catch (e) {
        // something happened, do it the old way

// callback from geolocation
function showCurrentLocation(position) {
    // go update the location box
    NerdDinner.getCurrentLocationByLatLong(position.coords.latitude, position.coords.longitude);

Otherwise (nope), Nerd Dinner uses geo-polyfill.js and the callback calls his version of getCurrentLocation, which uses the browser’s IP address to query a geolocation service for the location data.


function getCurrentLocation() {
    // this is how we used to do it by calling a geolocation service using the client IP address

Finally both methods use the location data they got to populate the Location box. This behavior is in both the regular (Views/Home/Index.cshtml) and mobile (Views/Home/Index.Mobile.cshtml) versions.

If you want to learn more, I’d encourage you to go checkout the source for Nerd Dinner on CodePlex at http://nerddinner.codeplex.com/.

Solving Facebook Programming Puzzles using Ruby

I really enjoy solving puzzles. That’s probably what drove me to become a software developer. So I was thrilled to learn that Facebook has a series of programming puzzles. Once you solve a puzzle, you email your code to Facebook and they email you back your results. What follows are the steps that I took to get my computer setup, solve my first puzzle, and submit it to Facebook for testing. It’s important to note that while I primarily work in the .NET world, the Facebook Puzzle bot doesn’t do .NET. This gave the opportunity choose a new language to learn from their list of supported languages (I chose Ruby).

General information about the Facebook Puzzles are at http://www.facebook.com/careers/puzzles.php

1) Download Ruby-1.8.6 from http://www.ruby-lang.org/en/downloads/

2) Next I picked the puzzle I was going to work on. For my first one I picked Hoppity http://www.facebook.com/careers/puzzles.php#!/careers/puzzles.php?puzzle_id=7

My solution looked like this:

1.upto(n) do |i|
    if i % 3 == 0 && i % 5 == 0
        print "Hop\n"
    elsif i % 3 == 0
        print "Hoppity\n"
    elsif i % 5 == 0
        print "Hophop\n"

3) Then I saved the solution to a file named the same as the keyword on the Facebook puzzles page. In this case, hoppity with no file extension. Source files from scripting languages shouldn’t have a file extension when they are submitted.

You can test the solution by creating a sample input file and calling Ruby from the Ruby command line like this:

David Eisenstat has some more information on his site http://www.davideisenstat.com/fbpfaq/. Including more information on how to submit solutions for compiled languages.

4) Finally, email the file to {0xFACEB00C>>2 in decimal}@fb.com (or 1051962371@fb.com). Once the puzzle engine processes your submission you’ll receive an email with the results.

I hope that you enjoy solving these puzzles as much as I do. And who knows, maybe you’ll even learn something. ;-)

Building a Facebook Graph API application using ASP.NET


Recently I needed to build a Facebook Share style application that gave me more control over the content that was posted on a users Facebook wall. Implementing this as a Facebook Application also allowed me to do some custom processing when the user completed the share process.

To do this I used Facebook’s Graph API. The Graph API is the core of Facebook’s system. It enables the developer to read and write Facebook data (provided the appropriate permisions exist). There’s a lot more information about the Graph API on the Facebook Developers Site

When the user clicks ‘Share’ they’re presented with the same Facebook style dialog that they’re used to, but where my application controls all of the data that they see

Finally, when the user completes the share process, the information shows up on their wall as it normally would, but I also get a callback letting me know that they completed the process which allows me to do any custom processing.

You’ll need to create a Facebook Application. You can do this at the Facebook Developers site. I’ve called the one that I use for this sample ‘My ASP.NET Application’. Once you have the application setup you’ll need to make note of the ‘App ID’ from Facebook as we’ll need this information later.

Using the Code

I like to create a ‘Controls’ folder in my ASP.NET Projects to contain any UserControls that I create/use in that project. To create my FacebookShare.ascx I right-clicked on my ‘Controls’ folder then selected ‘Add->New Item’ and finally chose ‘Web User Control’.

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="FacebookShare.ascx.cs" Inherits="FacebookApplication.Controls.FacebookShare" %>

facebook likeus Share with Facebook

The codebehind for the UserControl is defines the model for the data our control cares about.

namespace FacebookApplication.Controls
    public partial class FacebookShare : System.Web.UI.UserControl
        public string Message { get; set; }
        public string Prompt { get; set; }
        public string Name { get; set; }
        public string Caption { get; set; }
        public string Description { get; set; }
        public string Href { get; set; }
        public string Image { get; set; }
        public string ApplicationId { get; set; }

The code to use the Facebook Share control looks like this:

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="FacebookApplication._Default" %>

<%@ Register src="Controls/FacebookShare.ascx" tagname="FacebookShare" tagprefix="uc1" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
        A customizable Facebook Share button
        <uc1:FacebookShare ID="FacebookShare1" runat="server" ApplicationId="12345" Message="Message"
            Name="Name" Caption="Caption" Description="Description" Href="http://mourfield.com"
            Image="http://www.gravatar.com/avatar/41e139e92663400389c2c9d95a865820.png" /></p>
        You can also find <a href="http://developers.facebook.com/docs/"
            title="Facebook Developer Docs">documentation on Facebook at Facebook Developers</a>.

Hopefully, you’ll be able to use this as a starting place for your applications. There is much more that can be done using Facebook’s Graph API. This example barely scratches the surface of what is possible.

You can also find more information including documentation on Facebook at Facebook Developers.

Using jQuery Mobile with ASP.NET MVC


jQuery Mobile is a web UI framework from the same guys over at the jQuery Project. jQuery Mobile is built on top of the jQuery Core and jQuery UI projects with the intent of bringing a consistent UI framework to mobile platforms.

To get started using the jQuery Mobile framework you can either download the .js and .css files from http://jquerymobile.com/download/ or you can use the cdn-hosted versions as well.

The structure of a page that uses jQuery Mobile is pretty straightforward. First the page must start with an HTML5 ‘doctype’. Also, in the ‘head’, references to jQuery, jQuery Mobile and the mobile theme CSS are all required.

Next, the mobile page is defined inside the ‘body’ tag. Each ‘page’ is defined within a ‘div’ element with the data-role=”page” attribute. Inside the ‘page’ element, there are a set of child ‘divs’ with data-roles of “header”, “content”, and “footer”. Note, these are optional, but are typically used to provide a consistent look-and-feel. A very simple jQuery Mobile page would look like this:



Page Title


Page content goes here.


Page Footer


Incorporating with ASP.NET MVC

I like the idea of incorporating jQuery Mobile as an alternate mobile view in ASP.NET MVC because it allows us to use the same controllers and models as we would with our regular or desktop views while giving us the flexibility of delivering content that is mobile friendly.

To incorporate jQuery Mobile templates into an ASP.NET MVC site I like the approach that Scott Hanselman take with ‘A Better ASP.NET MVC Mobile Device Capabilities ViewEngine‘. Basically what Scott is doing is building a custom view engine for ASP.NET MVC that redirects the view to some relative route based on if the incoming request is coming from a mobile browser (or not).

So, to putting the whole thing together goes something like this: I’m starting with a new ASP.NET MVC 3 Project, but you should be able to follow these steps to start using jQuery Mobile in your existing ASP.NET MVC applications as well. The first step is to include the custom view engine and mobile helpers from Scott Hanselman’s article. I just created two new classes in a Helpers folder in my project. Looks like this:


Next, again from Scott’s article, you’ll need to ‘plug-in’ the CustomMobileViewEngine into MVC. To do this I added this code to my Application_Start().


protected void Application_Start()
    ViewEngines.Engines.Add(new RazorViewEngine());

The next step is to add either a mobile MasterPage or Layout page, depending on which view engine you’re using. In my case, I’m using the Razor view engine in ASP.NET MVC 3, but the basic techniques are the same with the WebForms view engine as well. To do this right-click on the Views\Shared directory in your project and select ‘Add->New Item’. Select the appropriate template type for your projects view engine; A View Master Page for ASPX or a Layout Page for Razor. And name the page appropriately. I’m calling mine ‘_LayoutMobile.cshtml’. My jQuery Mobile ready layout page looks like this:



My MVC Application





Page Footer



When it’s all said and done, my project’s view directory structure looks like this:

To create the Views for the Home controller I right-clicked on the Views\Home directory and added a new folder named ‘Mobile’. Next, I right-clicked on the newly created Mobile folder and selected ‘Add->View’. In the Add View dialog, I filled out the View name and made sure to select the appropriate layout or master page for the mobile templates that I created earlier.


The code for my Index view page looks like


    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_LayoutMobile.cshtml";
    • @Html.ActionLink(“Home”, “Index”, “Home”)


  • @Html.ActionLink(“About”, “About”, “Home”)





To learn more about ASP.NET MVC visit http://asp.net/mvc.

and my About view page looks like


    ViewBag.Title = "About";
    Layout = "~/Views/Shared/_LayoutMobile.cshtml";


Put content here.

Here’s what the views look like rendered on a mobile device:



Now what I’ve presented here is a very basic example, but hopefully, you can see the power of using a technique like this one to share the controllers and models, but change out the views based on the type of browser that is making the request.

I’d encourage you to head over and check out the documentation and demos for jQuery Mobile at http://jquerymobile.com/. This will help you get a better feel for how to accomplish your specific mobile UI tasks.

Custom Configuration Sections in .NET

Most .NET developers will need to store some application configuration information at some point. Most times developers choose to use the appSettings section in the configuration file for this purpose. Here’s an example of an appSettings configuration section:


Over time the number of configuration items tends to grow and managing them can become confusing. What you end up with is a seemingly endless list of key value pairs that are difficult to manage. Additionally the code required the access there values can start to get tedious.

using System;
using System.Configuration;

namespace Before
    class Program
        static void Main(string[] args)
            // Load Misc Settings
            decimal standardHandlingFee = Convert.ToDecimal(ConfigurationManager.AppSettings["StandardHandlingFee"]);
            int pageSize = Convert.ToInt32(ConfigurationManager.AppSettings["PageSize"]);

            // ... do work ...

.NET has the given developers the ability simplify this process by creating custom configuration sections. These custom configuration sections can help turn unstructured, untyped data into strongly-typed, straightforward elements. Basically, taking the almost meaningless key-value pairs and turning them into something more meaningful.


There are 3 pieces that makeup the custom configuration; a class that inherits from System.Configuration.ConfigurationSection; “registering” your configuration class in the configSections of your configuration file; and the XML configuration itself.

First is the class that handles how we access the configuration data.

using System;
using System.Configuration;

namespace After.Configuration
    public class TestAppConfigProviderSection : ConfigurationSection
        public static readonly TestAppConfigProviderSection Current = (TestAppConfigProviderSection)ConfigurationManager.GetSection("testAppConfigProvider");

        [ConfigurationProperty("StandardHandlingFee", DefaultValue = "4.95")]
        public decimal StandardHandlingFee
            get { return (decimal)base["StandardHandlingFee"]; }
            set { base["StandardHandlingFee"] = value; }

        [ConfigurationProperty("PageSize", DefaultValue = "10")]
        public int PageSize
            get { return (int)base["PageSize"]; }
            set { base["PageSize"] = value; }

This class is pretty straightforward, but there are some key things to take note of. First, the main ConfigurationSection class must derive from the System.Configuration.ConfigurationSection class.


Also, within the TestAppConfigProviderSection class I use a singleton style approach with the Current member. This helps make accessing the properties within the configuration section easy.

The configuration properties that the class is exposing should use the ConfigurationProperty attribute. The name that gets passed in this attribute should match the attribute name in the configuration file.

“Registering” our configuration section is done by adding a section the the configSections of the application’s .config file. The XML configuration is restructured to match how it is defined in our class. Here’s the new .config file after being refactored.


Here’s our example code again, but using the custom configuration sections.

using System;
using After.Configuration;

namespace After
    class Program
        static void Main(string[] args)
            // Load Misc Settings
            decimal standardHandlingFee = TestAppConfigProviderSection.Current.StandardHandlingFee;
            int pageSize = TestAppConfigProviderSection.Current.PageSize;

            // ... do work ...

It is also possible to load the custom configuration sections from an external file like so:


Where testApp.config looks like this:

One important note on using this method, you must make sure that you change the Copy to Output Directory property on the new .config file to either ‘Copy if newer’ or ‘Copy always’. Otherwise the file won’t get copied to the projects bin directory and the ConfigurationManager won’t be able to load the file.

The benefits of using a custom configuration section handler are significant. Using the handler code is pretty straightforward and gives you less clutter in the appSettings as well as strong typing of your configuration elements.