Posts

Showing posts from December, 2015

Using Underscore.js To Split an Array By Groups

Image
While working on a project today, I had to split an array of JSON objects into separate arrays based on one of the object's properties. Underscore.js makes this easy. In the example below, I'm splitting the sections  array into a new, multidimensional array called regions . var regions = _.toArray(_.groupBy(sections, function(section) {               return section.region;             })); Here's an example of the output logged to the browser's console:

Redirecting Assembly Versions in .NET

Image
As Kyle on South Park would say, "I learned something today." While working on one of our internal applications at work, I was getting the following exception: "System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Practices.ServiceLocation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) File name: 'Microsoft.Practices.ServiceLocation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'" But the funny thing was that all instances of this assembly in the solution were using version 1.3, and not  1.0 as the exception states. In fact, I could find no reference to version 1.0 anywhere in the config files. I enabled assembly bind failure logging (by setting the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1), and was given