24 June 2009

Substituting Carriage Returns in text areas

  

 Here is a link

  .replace(/\r?\n/g, "-break tag-\n")
  

17 June 2009

System.Array.IndexOf to check if item exists without looping

public static string someMethod(parameterList ....., string[] filter)
{

foreach (DataRow item in dt.Rows)
{
if (
System.Array.IndexOf(filter, item["itemName"].ToString()) > -1)
collection.Add(item);
}

return collection;
}

05 June 2009

Cloning objects in js

I want to note that the .clone() method in jQuery only clones DOM elements - in order to clone JavaScript objects you would do:

// Shallow copy
var newObject = jQuery.extend({}, oldObject);

// Deep copy
var newObject = jQuery.extend(true, {}, oldObject);

More information can be found in the jQuery documentation.

I also want to note that the deep copy is actually much smarter than what is shown above - it's able to avoid many traps (trying to deep extend a DOM element, for example). It's used frequently in jQuery core and in plugins to great effect.

Link

04 June 2009

There are too many people accessing the web site at this time...

IIS server refuse to serve request complaining that there are too many users ??

Possible solution Link