Wednesday, November 27, 2013

Visual Studio 2012 comparison - F8 next difference keyboard shortcut

When comparing differences between 2 files in visual studio 2008 F8 will navigate to the next difference.

Windows Powershell Get-Content for monitoring log files similar to unix Tail

Windows Powershell Get-Content

Issue
For many developers testing or debugging often requires monitoring log files.
Closing and opening notepad gets tedious.
Soon, you have a bunch of notepads and you are note even sure what one is the current.

Power Shell to the rescue

1. Open windows powershell

2. enter this command
get-content logfile.log -Wait

3. You are now tailing your log file.



Tuesday, November 26, 2013

Grant Execute to all stored procs in a database

This script gives execute rights to all stored procs for the [USERNAME].  It uses a cursor, but it works well

DECLARE procs CURSOR FOR SELECT [name]
                         FROM sys.objects
                         WHERE type IN('p','AF','FN')
DECLARE @name AS VARCHAR(250)
DECLARE @stmt AS VARCHAR(1000)

OPEN procs

FETCH NEXT FROM procs INTO @name

WHILE @@FETCH_STATUS=0
BEGIN
    SET @stmt='GRANT EXECUTE ON '+@name+' TO [USERNAME]'
  
    EXEC(@stmt)
  
    PRINT @stmt
  
    FETCH NEXT FROM procs INTO @name
END

CLOSE procs

DEALLOCATE procs

Wednesday, November 20, 2013

Visual Studio 2012 TFS offline

Coding with TFS integration into your solution with a unreliable connection can be frustrating.

Frustration- Waiting for TFS timeout is a production Killer
  1. Start editing a file
  2. Visual studio tries to check out the file from TFS 
  3. You wait for the connection to timeout

Solution - Take Your Solution Offline
You can take your solution offline from source control.  Out of the box the only way for visual studio to go offline is to

  1. Close and re-open the solution.  
  2. hoping TFS is unavailable.  
To the rescue is a visual studio plugin that will let you go offline any time you wish.


Happy Coding!