Thursday, October 23, 2014

How To retain aspajax:CalendarExtender selected value after postback




Try This below snippet to retain the CalendarExtender selected value after postback


if(isPostback)
{
           YourCalendarExtender.SelectedDate =
                    DateTime.ParseExact(YourTextBox.Text, YourCalendarExtender.Format, null);
}

Thursday, September 25, 2014

Command Prompt How to list all files in a folder as well as sub-folders in windows


Step 1 : Goto required folder in Command prompt.

Step 2: Type the following command    dir /b /s 

              /b - User bare format
              /s - Lists the files in the directory that you are in and all sub directories after that directory

              Step 2 will list all the files reside in the parent folder and it's sub folder.

Step 3: To get the specific file give the appropriate file extension. for example if we need sql file to be listed, give the following command dir /b /s *.sql | sort

Wednesday, April 9, 2014

ArrayList, List, HashTable, Dictionary, SortedList, SortedDictionary — Speed, memory, and when to use each?


Array - represents an old-school memory array - kind of like a alias for a normal type[] array. Can enumerate. Can't grow automatically. I would assume very fast insertion and retriv. speed.

ArrayList - automatically growing array. Adds more overhead. Can enum., probably slower than a normal array but still pretty fast. These are used a lot in .NET

List - one of my favs - can be used with generics, so you can have a strongly typed array, e.g. List. Other than that, acts very much like ArrayList.

Hashtable - plain old hashtable. O(1) to O(n) worst case. Can enumerate the value and keys properties, and do key/val pairs.

Dictionary - same as above only strongly typed via generics, such as Dictionary

but note Hashtable has less performance than Dictionary because of Boxing and Unboxing.

SortedList - a sorted generic list. Slowed on insertion since it has to figure out where to put things. Can enum., probably the same on retrieval since it doesn't have to resort, but deletion will be slower than a plain old list.

I tend to use List and Dictionary all the time - once you start using them strongly typed with generics, its really hard to go back to the standard non-generic ones.

There are lots of other data structures too - there's KeyValuePair which you can use to do some interesting things, there's a SortedDictionary which can be useful as well.




Courtesy - Stackoverflow


Wednesday, March 26, 2014

Access modifiers

public
The type or member can be accessed by any other code in the same assembly or another assembly that references it.
private
The type or member can only be accessed by code in the same class or struct.
protected
The type or member can only be accessed by code in the same class or struct, or in a derived class.
internal
The type or member can be accessed by any code in the same assembly, but not from another assembly.
protected internal
The type or member can be accessed by any code in the same assembly, or by any derived class in another assembly.

Friday, February 28, 2014

Entity framework in WCF Service - Network access for Distributed Transaction Manager (MSDTC) has been disabled. Please enable DTC for network access in the security configuration for MSDTC using the Component Services Administrative tool.



Incase if you getting the "Network access for Distributed Transaction Manager (MSDTC) has been disabled. Please enable DTC for network access in the security configuration for MSDTC using the Component Services Administrative tool." while using the Entity framework WCF service required MSDTC follow the below steps,
 

To find that,
1. go to start -> run -> type "c:\Windows\System32\comexp.msc" or comexp.msc
2. Click Component Services
3. Click Computers. Under this, click "My Computer"
4. Once you open "My Computer" you will see 4 folders.
5. Click on Distributed Transaction Coordinator. Underneath this, you will see "Local DTC'
6. Right click "Local DTC" and go to properties.
7. Select Security Tab.
8. Check mark "Network DTC Access" checkbox
9. Finally check mark "Allow Inbound" and "Allow Outbound" checkboxes.
10. Click Apply, Ok.
11. A message will pop up about restarting the service.
12. Click ok and That's all.