Tuesday, February 28, 2012

Group by Date SQL Query

From: http://goo.gl/LfvLO
The following queries group the result set by month:


select Year(CreatedOnUTC), Month(CreatedOnUTC), COUNT(1) cont
from ServiceLog
group by Year(CreatedOnUTC), Month(CreatedOnUTC)
order by Year(CreatedOnUTC) desc, Month(CreatedOnUTC) desc


select dateadd(month, datediff(month, 0, CreatedOnUTC),0), COUNT(1) cont
from ServiceLog
group by dateadd(month, datediff(month, 0, CreatedOnUTC),0)
order by dateadd(month, datediff(month, 0, CreatedOnUTC),0) desc

Monday, February 27, 2012

Log4net Exclude messages from log

In the config file add a StringMatchFilter with the string to discard/filter.

Example:


...










...

Monday, February 20, 2012

Undo TFS changes

Note: You must be an administrator in the repository where you want to perform the following commands.

1. Open a Visual Studio Command Prompt console.
2. Run tf undo {file path} /workspace:{workspace};{username} /server:{TFS name/IP}
Example:
tf undo $/Dorms/Develoment/src/Mein.Solution/Mein.Solution.vsmdi /workspace:"Jon's PC";jon.connor /server:maintfs-dev01

Note: The user and workstation info can be found by right-clicking on the file in the TFS' Source Control Explorer and then selecting Properties. A window will appear and the user and Workstation info will be listed under the Status tab.