Archive for the ‘ Uncategorized ’ Category

Usefulness of the Underscore.js functional library

I usually ignore new frameworks or libraries until I see it referenced more than a dozen times and Underscore has reached that threshold. Recently I needed some more powerful libraries for working with collections and due to time constraints I decided not to write additional functions but instead give this library a try. Many of the functions in Underscore are already present in modern browsers and when these functions are found the library will defer to the native implementation–this was a huge selling point for me.

To keep this post brief I’ll get to some samples of usage:

Some of the functions that I found useful recently were:

This function

_.pluck(_productCollection.Items, "Id"), function (Id) {
return Id === product.Id;

Transforms the Items[] from this object into

_productCollection = {
    CriteriaType: "Products",
    Items: {
        Facility: null,
        FacilityId: null,
        Name: "",
        Id: ""

An array of Id’s for additional processing


This was useful to me when I had to compare the values of Ids against a new value to see if it was already contained in the initial object.

!_.any(_.pluck(productCollection.Items, "Id"), function (Id) {
    return Id === product.Id;

Another useful area was removing an item in a collection with the following code:

productCollection.Items = _.reject(productCollection.Items, function (prod) {
    return prod.Id === productId;

This is definitely a useful library.


An email I received today.

I seriously just received this email from a dba at work today.


I’m sure that a lot of you know that reading one or more large dataset(s) returned from the SQL Server and generating HTML line-by-line to display the items on the web page is terribly slow. Several years ago, I developed a set of stored procedures which – to my knowledge – are still not in general use today… and that is a shame. Let me be clear: Calling the stored procedures I wrote to write HTML for you will speed up your web pages… in some cases (e.g. parsing thousands of lines to display on the web page) by a factor of 10 or more because generating the HTML on the SQL Server side results in *many* less rows being returned to the ASP on top of the fact that the ASP doesn’t have to cycle through those lines adding the tags (e.g. “” or “…“).

When displaying the page for Allina, for example, the result set being returned to the web page goes from 25339 rows of raw data that the ASP must process one line at a time down to 811 lines of pre-generated HTML code; this is a 97% reduction in the number of rows returned. PLUS – this is on top of the fact that the HTML has already been generated and all the ASP has to do is paste it into the page being displayed.

If you would like assistance converting your web pages over to using these stored procedures, or for more details, please contact me.

Adding additional Git remote for your rails code

In a previous example I showed how I was able to get my code easily deployed out to heroku. But the problem that remains is that this is the deployment destination of your web app, and not the actual source repository.

I took a look a github, but hated the fact that my code would be public unless I got into a paid plan. Normally, this wouldn’t matter, but the fact that this is a small app that I’d one day like to charge money for took github out of the running for me. so….i went back to my ole friend unfuddle.

I quickly setup a git repo with them and ran into several problems when trying to set my unfuddle repo as my remote for git. Then I found a link in unfuddle that under Repositories > [Name of my repository] that gave me a very specific 1 page tutorial on setting up my environment to work with unfuddle. Prior to this I copied my local ssh public key into my settings in unfuddle…and two minutes later I’m up and running.

(By the way, I’m using this spectacular book to learn about RoR, freely available here)


Learning Ruby on Rails from a .net developer perspective: Part I of N

I played with Ruby on Rails exactly one year ago and was very impressed with the thoughtful design, architecture and tooling that the platform provided.  I used to think that Mvc 2 would really hit the mark in filling in the gaps between mvc1 and RoR.  Well, I’ve been using Mvc2 on a project at work and I can truly say that it’s not as well thought out as it needs to be.  Couple this with my lack-luster experience that I’ve had in using bizspark and interacting with their team (found here and here) I decided to once again begin learning Ruby on Rails.

This is going to be an impromptu series that will just highlight little tidbits that I found useful and feel other .net developers may benefit from.  I guess you could say that this is a series highlighting my ignorance and will make a few of the ruby guys chuckle from time to time.