Friday, August 09, 2013

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");

Wednesday, October 10, 2012

Getting started with MassTransit - a .net message queueing system

The instruction on the mass transit project gets you started with how to setup mass transit within a single application publishing messages to itself. But this example shows you how to do messaging between applications.

http://www.codewrecks.com/blog/index.php/2012/08/03/quick-start-on-mass-transit-and-msmq-on-windows/