I’ve been heavily working with generics over the past few weeks for the final re-factor of LiveFlex. Generics are fantastic but they do have some annoying limitations. You can’t, for instance, create a List<T> and add mixed types such as…Continue Reading →
I used to often find myself creating utility classes to process enums to create markup or carry out particular actions based on the enum value. Since extension methods have been introduced I have started using them to add processing methods…Continue Reading →
This is a simple function that hides an item when the mouse leaves. The object can be visible initially and will only dissapear once the mouse has entered AND left. $(‘div.mouse.LeaveHide’).on({ mouseover:function(e){ $(e.target).one({ mouseleave:function(e){ $(e.target).hide(); } }); } });
Here is a very simple asp.net .Closest() function like the jquery one. public static class ControlExtensions { public static Control Closest(this Control control, Type type ){ Control closest = null; Control parent = control.Parent; while(closest == null && parent != null){ if(parent.GetType().ToString() == type.ToString()){ return parent; } parent = parent.Parent; } return null; } }
To restore a sql.bak file you first need to find the name of the database files: RESTORE FILELISTONLY FROM DISK = ‘full path to your .bak file’ This will show you the names needed for extracting the original files to…Continue Reading →
I am trying to keep a list of the last 10 pages a user has been too. I tried to use Stack but it doesn’t support a fixed length so here is a dirty little class to only keep the…Continue Reading →