Dustin Horne

Developing for fun...

Implementing a Dictionary in TypeScript

Dictionaries are commonly used collections.  They provide the benefit of quickly looking up values based on a supplied Key and these lookups are extremely fast as they don't rely on iterating the collection to locate them.  In Typescript this is harder to achieve.  I have seen several implementations but many of them use separate backing arrays to hold the keys and the values and either iterate or use an indexOf call to locate the indexes.  This can be avoided if you're willing to make the sacrifice of limiting yourself to the string data type for your key.  Let's explore how this can be accomplished. More...

Factory Pattern and Lazy Initialization with AngularJS and Typescript

Recently, we've been migrating a large (and still in progress) Angular 1.x application from JavaScript to TypeScript.  This has allowed us to seriously clean up our code, enforce some more consistent patterns across teams, and provide compile time validation within our code.  As we migrated, we realized that some of our service classes had a large number of dependencies injected into them, from other logic services to validation services to data services.  Each of these services also may have many dependencies.  While Angular does create these as singletons and cache them, many of them may only be used for one or two logic methods so it made sense to use a factory and instantiate them lazily.  To accomplish this, I created a couple of helpers.  Here's how I did it.  More...

Many to Many Relationships in Entity Framework 7

In the coming days I'll be introducing a new series of posts about working with MVC 6 and WebAPI in ASP .NET 5.  This will include demonstrations using Entity Framework 7 as I dive into it.  In the meantime, though, I wanted to demonstrate something that functions differently in EF 7 than in previous iterations: Many-to-Many relationships. More...

Components With Shared Data in AngularJS

In this post I'm going to show you how to build and use re-usable components with shared data in Angular 1.x.  While there are similarities to the new component system build into Angular 2.0 Angular 1.5, my component is a completely separate entity and, in my opinion, more robust in most ways.  More...

Generic Attributes in C#

First I'd like to note a correction as this original post was unintentionally misleading.  The following works with Mono but will not work with the full fledged .NET Framework.

This afternoon while doing some related research I realized that I had been doing something for awhile that appears to be somewhat of a unicorn in the C# community:  using generic attributes.  Upon further research I saw a lot of information on creating generic attributes that ranged from "you can't" to "here's how you create a custom type descriptor and dynamically inject the attribute".  As I have been doing it for awhile a much easier way, I somehow was never aware that it was a problem for some, so here is how you do it.


December Charity Drive with JSON .NET for Unity


All proceeds from JSON .NET for Unity between December 1st and December 20th will be going to charity!  The awesome folks at the Unity Asset Store were very helpful in getting my product changes made so I could make this happen.

All proceeds will be going to the Siena / Francis House here in Omaha, NE.  They will help to provide Christmas toys for homeless and needy children.  They will also help to provide essentials such as hats, boots and gloves for these children and their families.  The response from the Unity community so far has been overwhelming with sales making a significant jump since announcing the charity drive yesterday.  At the time of writing of this article we have already raised $1,519, nearly $1,000 of which is within the last 24-hours alone.  I am thrilled that together we are able to make a difference this holiday season.

UPDATE:  Total donation was $3,000

If you've been looking for JSON .NET for Unity, now is the time to snag it.  If you'd like to help directly, you can visit the Siena/Francis donation page, or consider making a donation to your own local homeless shelter, even if it's old clothes, boots, hats, gloves, blankets, pillows, anything you can think of that they might need.  Or give them a call and they'll provide you with a list of their most critical needs.

You can find all of the relevant links below:

Siena/Francis House

JSON .NET for Unity on the Asset Store

Release Thread

Charity Announcement Thread



Json .NET for Unity Developers

I wanted to kick off my category on Unity (sometimes called Unity3D, though Unity is the proper name) by talking about Serialization, especially in conjunction with Json .NET (the Newtonsoft library) which I've ported to Unity 3.5+ and made to be compatible with iOS and the Web Player.  I'll give examples of serialization and deserialization with both Json and Bson (Binary Json).


Goodbye XNA, Hello Unity

Before writing about Unity, I wanted to provide clarification for my subscribers and let them know that I've moved away from XNA development and moved to Unity.  While XNA isn't entirely dead (there are still plenty of XNA developers around and still using XNA for desktop and XBLIG games), it is certainly fading away. 


DotNetNuke in the root on GoDaddy

The other day I was helping a friend setup a new website.  He wanted to use DNN for his content management and had settled on GoDaddy for hosting as this is where his domain was registered.  I had him setup his Windows Shared Hosting account and I set out to install DNN.  This is where the problems began.  I will show you how to get it working though.  More...

Windows Phone 8 (HTC 8X) First Impressions

On Thursday I headed down to a local Verizon Wireless store and picked up my HTC 8X.  I've been using and customizing it heavily for a couple of days now and I wanted to share my initial thoughts.  So far it's been a solid device and I absolutely love it.  I'll give you the lowdown from my purchase experience and use.  More...