-
vs.net template
User' template location C:\Documents and Settings\[user_name]\My Documents\Visual Studio 2010\Templates\ItemTemplates C:\Documents and Settings\[user_name]\My Documents\Visual Studio 2010\Templates\ProjectTemplates
-
The "OnDelete" property of navigation in Entity Framework
This property affects the the behavior of entity framework when delete an entity. Here are two scenario.
[Fact] public void can_delete_order_with_lines_loaded() { TestEntities db = new TestEntities(); Order o1 = db.Orders.Include("OrderLines").First(); db.DeleteObject(o1); db.SaveChanges(); -
jQuery.globalEval
$.globalEval utility is a useful function, because it is preferred compare with eval in calling ajax script. What it does is adding script tag to document, then remove it later.
globalEval: function( data ) { if ( data && rnotwhite.test(data) ) { // Inspired by code by Andrea Giammarchi // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html var head = document.getElementsByTagName("head")[0] || document.documentElement, script = document.createElement("script"); -
jQuery event binding internal
The event binding in jQuery is very interesting. It is designed with several goals. 1. It should works consistently across browsers. 2. It should allows attaching more than one handler function to a event. The event registration information is saved in a jQuery.data(elem). In jQuery.cache actual data store for all these data. A piece of data in the cache can be assigned to the element. Below is some pesudo code to demonstrate the data structure
function fn(..){..} fn.guid = .. -
shadow copy in jQuery
We can use jQuery to copy(clone) an object to a new object, so the old object and the new object can evolved independently.
//shadow copy object var oldObj = { name: "fred" }; var newObj = jQuery.extend({}, oldObj); newObj.name = "jeff"; alert(oldObj.name); //fred
To do similar thing for array, we can use [].slice() method
//clone array var newArray = arr.slice(0);