Wednesday, October 25, 2017

Scrum – Key terms



HashTable vs ListDictionary vs HybridDictionary

HashTable:
Hashtable is container which is recommended to work with large number of key value data objects. It’s deprecated because of dictionary class which is introduced in .Net 2.0. Because does not need to box or unbox data.  Dictionary is a generic type, Hashtable is not. That means you get type safety with Dictionary, because you can’t insert any random object into it, and you don’t have to cast the values you take out.
ListDictionary:
If, for example, you are dealing with a small number of items, you might not want to use a Hashtable since there are some noted inefficiencies in hasthtable. If you know the collection size is less than 10 items, recommended to use ListDictionray.
HybridDictionary:
HybridDictionary comes to optimize Hashtable.
If number of key value item storing in collection is less,  prefer ListDictionary. Some situation we are not sure about size we can go with Hybrid dictionary. HybridDictonary plays as ListDictionary while the item size is less if it grows the item  it will automatically switched from ListDictionary to Hashtable.
Many will ask the question “why not just use a HybridDictionary all the time?”
There is overhead associated with HybridDictonary because it has to constantly monitor the size while the size is increase/decrease need to convert between ListDictionary to Hashtable as needed.
Conclusion of the story is use
ListDictonary: if collection is small
HashTable : if collection is large
HybridDictonary: Is recommended while the number of elements is unknown


Jquery .end() Method

.end() Method in Jquery:

This method used to end the most recent filtering operations in the chain and return to the old original set of Selected DOM Element
JQUERY:
$(document).ready(function(){
$(‘p’).find(‘span’)             //find span elements inside the paragraphs
.css(‘color’,’red’)          //make span elements content red
.end()                             //move back to the paragraph elements
.css(‘font-weight’,’bold’);  //change font to bold for the paragraphs content
});
HTML:
<p id=”intro”>My name is <span>Prem.</span></p>
<p>I live in chennai.</p>
jquery-end

Saturday, March 2, 2013

Selecting value in dropdownlist:


Selecting value in dropdownlist:

   Dropdownlist.SelectedItem.Text = “two”;

To Select value in dropdownlist don’t use the above code snippet it will overwrite the existing item.

This is not good coding practice. Instead use Inbuilt function following

Consider dropdown binded by following value field and text field.

Valuefield          Textfield
    1                       One
    2                       two   
    3                       three
    4                       four

If u want “two” as selected text following is the way.

(i) Using textfield :

If(DropDownList.Items.FindByValue("two") != null)
{
      Dropdownlist.Items.FindByText (“two”).selected = true.
}

ii) Using valuefield:

If(DropDownList.Items.FindByValue("two") != null)
{
      Dropdownlist. Items.FindByValue (“2”).selected = true.
}