Thursday, December 27, 2012

Simple C# code to get Quarters

 public static DateTime GetQuarterStartDate()  
     {  
       DateTime date = DateTime.Today;  
       int quarterNumber = ((date.Month - 1) / 3) + 1;  
       return new DateTime(date.Year, (quarterNumber - 1) * 3 + 1, 1);  
     }  

Friday, November 16, 2012

svchost.exe process consume CPU memory with "winrscmde" description



If  you feel your computer is very slow.  Some time you get BLUE screen in your Windows 7 OS.
Please check following things:
1) hit Ctrl + Shift + Esc to open task manager.
2) Click "Processes" tab.
3) Sort by "Memory" > higher memory first
4) check if any services running with "svchost.exe" image & "winrscmde" as description
and conusming lots of CPU memory.


Solution:

download TDSKiller.exe from CNET > Install & Scan your computer


http://download.cnet.com/Kaspersky-TDSSKiller/3000-2239_4-75722087.html 


More details:

http://www.bleepingcomputer.com/forums/topic436219.html
http://forums.spybot.info/showthread.php?t=66455




thx

select column in PDF, Vertical test select in pdf



hold Alt key and then select PDF column it will select vertical.


Friday, November 9, 2012

Cannot add an entity with a key that is already in use, LINQ


-- When you get above error there are two possibility

1) you are trying to insert duplicate primary key.
2) when you have SQL column with data type = "Uniqueidentifier" and default set to 'NewID()'
    that means its auto-generated field.

   Make sure in you DBML file that tale > field > properties > "Auto Generated Value"  is set to true
   default is fault

Monday, October 15, 2012

Operand type clash: int is incompatible with uniqueidentifier



When you get above error please double check following

- you are inserting into table from view
- table has column with data type - uniqueidentifier  with allow null
- view is returning null for uniqueidentifier field
- you have to convert null to uniqueidentifier field in view 

for example ,convert(uniqueidentifier,null) as MyUniqueIdentifierField  

Tuesday, October 2, 2012

Autogenerate get and set class properties



1) use  notepad ++ to generate class private properties
2)
You can right-click on the field and go to Refactor > Encapsulate Field. That will generate a public Property. You still have to do each one at a time but it's a lot faster than the typing!