Friday, August 09, 2013

As I Grew Older


It was a long time ago.
I have almost forgotten my dream.
But it was there then,
In front of me,
Bright like a sun-

read full poem by Langston Hughes here...

Make linqpad show sql print statement in the console by doing this

Throw this baby on the top of your linqpad code and enjoy print goodness.

((System.Data.SqlClient.SqlConnection)this.Connection).InfoMessage += (object obj, SqlInfoMessageEventArgs e)=>{
    if (e.Message.Length < 200)  string.Format("    TSQL PRINT: {0}", e.Message).Dump();

};

Monday, July 29, 2013

Nice C# Helper Class for working with POST or GET web requests

You need the following namespaces:

System
System.Collections.Generic
System.IO
System.Linq
System.Net
System.Text

The code is here, shared as via LinqPad's instant share feature.

Saturday, July 20, 2013

Nice task management tool

I've been using Google Tasks for a long time but needed something better and am glad I stumbled across Trello. I wanted to use a kanban board style list and collaborate with other people.  Thanks Trello for a great product.

Monday, May 13, 2013

Examine sp_who2 with LinqPad

This script gets for you just the list of blockers and the list of blockees separately

Prerequisite: Make sure you check Include System Views and SPs in the SQL connection dialog.


var v= sys.sp_who2().Tables[0].AsEnumerable();//.Dump("SP_WHO2");

var blockers = v
 .Where(x=>x.Field("BlkBy") != "  .")
 .Select (x => x.Field("BlkBy")).Distinct();//.Dump("Blockers");  
  
var blockerDetails = v
 .Where (x =>blockers.Contains(x.Field("SPID")) ).Dump("Blockers");
 
var blockees = v.Where(x=> x.Field("BlkBy") != "  .").Dump("Blockees");