<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>What Was I Thinking?</title>
        <link>http://geekswithblogs.net/SoftwareDoneRight/Default.aspx</link>
        <description>Follies &amp; Foils of .NET Development</description>
        <language>en-US</language>
        <copyright>ChrisD</copyright>
        <managingEditor>chris@wtfsolutions.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <image>
            <title>What Was I Thinking?</title>
            <url>http://geekswithblogs.net/images/RSS2Image.gif</url>
            <link>http://geekswithblogs.net/SoftwareDoneRight/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <item>
            <title>A consolidated View of Broker Service Queues</title>
            <link>http://geekswithblogs.net/SoftwareDoneRight/archive/2013/01/22/a-consolidated-view-of-broker-service-queues.aspx</link>
            <description>&lt;p&gt;Originally posted on: &lt;a href='http://geekswithblogs.net/SoftwareDoneRight/archive/2013/01/22/a-consolidated-view-of-broker-service-queues.aspx'&gt;http://geekswithblogs.net/SoftwareDoneRight/archive/2013/01/22/a-consolidated-view-of-broker-service-queues.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;USE [CatalogWithMessageBroker]&lt;/p&gt;  &lt;p&gt;GO&lt;/p&gt;  &lt;p&gt;select q.name as QueueName, p.rows as MsgCount, case sq.is_receive_enabled when 0 then 'Disabled' else 'Enabled' end as QueueEnabled   &lt;br /&gt;from sys.objects as o    &lt;br /&gt;join sys.partitions as p on p.object_id = o.object_id    &lt;br /&gt;join sys.objects as q on o.parent_object_id = q.object_id    &lt;br /&gt;join sys.service_queues sq on sq.name = q.name    &lt;br /&gt;where p.index_id = 1    &lt;/p&gt; &lt;img src="http://geekswithblogs.net/SoftwareDoneRight/aggbug/151903.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ChrisD</dc:creator>
            <guid>http://geekswithblogs.net/SoftwareDoneRight/archive/2013/01/22/a-consolidated-view-of-broker-service-queues.aspx</guid>
            <pubDate>Tue, 22 Jan 2013 14:14:31 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/SoftwareDoneRight/comments/151903.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/SoftwareDoneRight/archive/2013/01/22/a-consolidated-view-of-broker-service-queues.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/SoftwareDoneRight/comments/commentRss/151903.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SoftwareDoneRight/services/trackbacks/151903.aspx</trackback:ping>
        </item>
        <item>
            <title>Troubleshooting Blocked Transaction in SQL Server</title>
            <category>SQL</category>
            <link>http://geekswithblogs.net/SoftwareDoneRight/archive/2012/12/07/troubleshooting-blocked-transaction-in-sql-server.aspx</link>
            <description>&lt;p&gt;Originally posted on: &lt;a href='http://geekswithblogs.net/SoftwareDoneRight/archive/2012/12/07/troubleshooting-blocked-transaction-in-sql-server.aspx'&gt;http://geekswithblogs.net/SoftwareDoneRight/archive/2012/12/07/troubleshooting-blocked-transaction-in-sql-server.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;While troubleshooting a blocked transaction issue recently, I found this code online.  My apologies in not citing its source, but its lost in my browse history some where. &lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;While the transaction is executing and blocked, open a connection to the database containing the transaction and run the following to return both the SQL statement blocked (the Victim), as well as the statement that’s causing the block (the Culprit)&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;--     &lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;prepare&lt;/span&gt; a &lt;span class="kwrd"&gt;table&lt;/span&gt; so that we can filter &lt;span class="kwrd"&gt;out&lt;/span&gt; sp_who2 results

&lt;span class="kwrd"&gt;DECLARE&lt;/span&gt; @who &lt;span class="kwrd"&gt;TABLE&lt;/span&gt;(BlockedId &lt;span class="kwrd"&gt;INT&lt;/span&gt;,

Status &lt;span class="kwrd"&gt;VARCHAR&lt;/span&gt;(&lt;span class="kwrd"&gt;MAX&lt;/span&gt;),

LOGIN &lt;span class="kwrd"&gt;VARCHAR&lt;/span&gt;(&lt;span class="kwrd"&gt;MAX&lt;/span&gt;),

                   HostName &lt;span class="kwrd"&gt;VARCHAR&lt;/span&gt;(&lt;span class="kwrd"&gt;MAX&lt;/span&gt;),

                   BlockedById &lt;span class="kwrd"&gt;VARCHAR&lt;/span&gt;(&lt;span class="kwrd"&gt;MAX&lt;/span&gt;),

                   DBName &lt;span class="kwrd"&gt;VARCHAR&lt;/span&gt;(&lt;span class="kwrd"&gt;MAX&lt;/span&gt;),

                   Command &lt;span class="kwrd"&gt;VARCHAR&lt;/span&gt;(&lt;span class="kwrd"&gt;MAX&lt;/span&gt;),

                   CPUTime &lt;span class="kwrd"&gt;INT&lt;/span&gt;,

                   DiskIO &lt;span class="kwrd"&gt;INT&lt;/span&gt;,

                   LastBatch &lt;span class="kwrd"&gt;VARCHAR&lt;/span&gt;(&lt;span class="kwrd"&gt;MAX&lt;/span&gt;),

                   ProgramName &lt;span class="kwrd"&gt;VARCHAR&lt;/span&gt;(&lt;span class="kwrd"&gt;MAX&lt;/span&gt;),

                   SPID_1 &lt;span class="kwrd"&gt;INT&lt;/span&gt;,

                   REQUESTID &lt;span class="kwrd"&gt;INT&lt;/span&gt;)

INSERT &lt;span class="kwrd"&gt;INTO&lt;/span&gt; @who &lt;span class="kwrd"&gt;EXEC&lt;/span&gt; sp_who2

--&lt;span class="kwrd"&gt;select&lt;/span&gt; the blocked &lt;span class="kwrd"&gt;and&lt;/span&gt; blocking queries (&lt;span class="kwrd"&gt;if&lt;/span&gt; &lt;span class="kwrd"&gt;any&lt;/span&gt;) &lt;span class="kwrd"&gt;as&lt;/span&gt; &lt;span class="kwrd"&gt;SQL&lt;/span&gt; text

&lt;span class="kwrd"&gt;SELECT&lt;/span&gt;

(

&lt;span class="kwrd"&gt;SELECT&lt;/span&gt; TEXT

&lt;span class="kwrd"&gt;FROM&lt;/span&gt; sys.dm_exec_sql_text(

(&lt;span class="kwrd"&gt;SELECT&lt;/span&gt; handle 

&lt;span class="kwrd"&gt;FROM&lt;/span&gt; (

&lt;span class="kwrd"&gt;SELECT&lt;/span&gt; &lt;span class="kwrd"&gt;CAST&lt;/span&gt;(sql_handle &lt;span class="kwrd"&gt;AS&lt;/span&gt; VARBINARY(128)) &lt;span class="kwrd"&gt;AS&lt;/span&gt; handle

&lt;span class="kwrd"&gt;FROM&lt;/span&gt; sys.sysprocesses &lt;span class="kwrd"&gt;WHERE&lt;/span&gt; spid = BlockedId

) query)

)

) &lt;span class="kwrd"&gt;AS&lt;/span&gt; &lt;span class="str"&gt;'Blocked Query (Victim)'&lt;/span&gt;,

(

&lt;span class="kwrd"&gt;SELECT&lt;/span&gt; TEXT

&lt;span class="kwrd"&gt;FROM&lt;/span&gt; sys.dm_exec_sql_text(

(&lt;span class="kwrd"&gt;SELECT&lt;/span&gt; handle 

&lt;span class="kwrd"&gt;FROM&lt;/span&gt; (

&lt;span class="kwrd"&gt;SELECT&lt;/span&gt; &lt;span class="kwrd"&gt;CAST&lt;/span&gt;(sql_handle &lt;span class="kwrd"&gt;AS&lt;/span&gt; VARBINARY(128)) &lt;span class="kwrd"&gt;AS&lt;/span&gt; handle

&lt;span class="kwrd"&gt;FROM&lt;/span&gt; sys.sysprocesses &lt;span class="kwrd"&gt;WHERE&lt;/span&gt; spid = BlockedById

) query)

)

) &lt;span class="kwrd"&gt;AS&lt;/span&gt; &lt;span class="str"&gt;'Blocking Query (Culprit)'&lt;/span&gt;

&lt;span class="kwrd"&gt;FROM&lt;/span&gt; @who 

&lt;span class="kwrd"&gt;WHERE&lt;/span&gt; BlockedById != &lt;span class="str"&gt;'  .'&lt;/span&gt;&lt;/pre&gt;
    &lt;style type="text/css"&gt;&lt;![CDATA[
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }]]&gt;&lt;/style&gt;&lt;/blockquote&gt; &lt;img src="http://geekswithblogs.net/SoftwareDoneRight/aggbug/151464.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ChrisD</dc:creator>
            <guid>http://geekswithblogs.net/SoftwareDoneRight/archive/2012/12/07/troubleshooting-blocked-transaction-in-sql-server.aspx</guid>
            <pubDate>Fri, 07 Dec 2012 21:45:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/SoftwareDoneRight/comments/151464.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/SoftwareDoneRight/archive/2012/12/07/troubleshooting-blocked-transaction-in-sql-server.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/SoftwareDoneRight/comments/commentRss/151464.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SoftwareDoneRight/services/trackbacks/151464.aspx</trackback:ping>
        </item>
        <item>
            <title>More useful Sql Server Serivce Broker Queries</title>
            <link>http://geekswithblogs.net/SoftwareDoneRight/archive/2012/12/03/more-useful-sql-server-serivce-broker-queries.aspx</link>
            <description>&lt;p&gt;Originally posted on: &lt;a href='http://geekswithblogs.net/SoftwareDoneRight/archive/2012/12/03/more-useful-sql-server-serivce-broker-queries.aspx'&gt;http://geekswithblogs.net/SoftwareDoneRight/archive/2012/12/03/more-useful-sql-server-serivce-broker-queries.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;SELECT 'Checking Broker Service Status...'   &lt;br /&gt;IF (select Top 1 is_broker_enabled from sys.databases where name = 'NWMESSAGE')=1     &lt;br /&gt;    SELECT ' Broker Service IS Enabled'  -- Should return a 1.    &lt;br /&gt;ELSE    &lt;br /&gt;    SELECT '** Broker Service IS DISABLED ***'    &lt;br /&gt;/* If Is_Broker_enabled returns 0, uncomment and run this code    &lt;br /&gt;ALTER DATABASE NWMESSAGE SET SINGLE_USER WITH ROLLBACK IMMEDIATE    &lt;br /&gt;GO    &lt;br /&gt;Alter Database NWMESSAGE Set enable_broker    &lt;br /&gt;GO    &lt;br /&gt;ALTER DATABASE NWDataChannel SET MULTI_USER    &lt;br /&gt;GO    &lt;br /&gt;*/&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;SELECT 'Checking For Disabled Queues....'    &lt;br /&gt;-- ensure the queues are enabled    &lt;br /&gt;--  0 indicates the queue is disabled.    &lt;br /&gt;Select '** Receive Queue Disabled: '+name from sys.service_queues where is_receive_enabled = 0    &lt;br /&gt;--select [name], is_receive_enabled from sys.service_queues; &lt;/p&gt;  &lt;p&gt;/*If the queue is disabled, to enable it   &lt;br /&gt;alter queue QUEUENAME with status=on; – replace QUEUENAME with the name of your queue    &lt;br /&gt;*/&lt;/p&gt;  &lt;p&gt;-- Get General information about the queues    &lt;br /&gt;--select * from sys.service_queues&lt;/p&gt;  &lt;p&gt;-- Get the message counts in each queue   &lt;br /&gt;SELECT 'Checking Message Count for each Queue...'    &lt;br /&gt;select q.name, p.rows    &lt;br /&gt;from sys.objects as o    &lt;br /&gt;join sys.partitions as p on p.object_id = o.object_id    &lt;br /&gt;join sys.objects as q on o.parent_object_id = q.object_id    &lt;br /&gt;join sys.service_queues sq on sq.name = q.name    &lt;br /&gt;where p.index_id = 1&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;-- Ensure all the queue activiation sprocs are present    &lt;br /&gt;SELECT 'Checking for Activation Stored Procedures....'    &lt;br /&gt;SELECT  '** Missing Procedure:  '+q.name  &lt;br /&gt;From sys.service_queues q     &lt;br /&gt;Where NOT Exists(Select * from sysobjects where xtype='p' and name='activation_'+q.name)    &lt;br /&gt;and q.activation_procedure is not null&lt;/p&gt;  &lt;p&gt;DECLARE @sprocs Table (Name Varchar(2000))   &lt;br /&gt;Insert into @sprocs Values ('Echo')    &lt;br /&gt;Insert into @sprocs Values ('HTTP_POST')    &lt;br /&gt;Insert into @sprocs Values ('InitializeRecipients')    &lt;br /&gt;Insert into @sprocs Values ('sp_EnableRecipient')    &lt;br /&gt;Insert into @sprocs Values ('sp_ProcessReceivedMessage')    &lt;br /&gt;Insert into @sprocs Values ('sp_SendXmlMessage')&lt;/p&gt;  &lt;p&gt;SELECT 'Checking for required stored procedures...'   &lt;br /&gt;SELECT  '** Missing Procedure:  '+s.name  &lt;br /&gt;From @sprocs s    &lt;br /&gt;Where NOT Exists(Select * from sysobjects where xtype='p' and name=s.name)    &lt;br /&gt;GO    &lt;br /&gt;-- Check the services    &lt;br /&gt;Select 'Checking Recipient Message Services...'    &lt;br /&gt;Select '** Missing Message Service:' + r.RecipientName +'MessageService'    &lt;br /&gt;From Recipient r    &lt;br /&gt;Where not exists (Select * from sys.services s where  s.name  COLLATE SQL_Latin1_General_CP1_CI_AS= r.RecipientName+'MessageService')&lt;/p&gt;  &lt;p&gt;DECLARE @svcs Table (Name Varchar(2000))   &lt;br /&gt;Insert into @svcs Values ('XmlMessageSendingService')&lt;/p&gt;  &lt;p&gt;SELECT  '** Missing Service:  '+s.name  &lt;br /&gt;From @svcs s    &lt;br /&gt;Where NOT Exists(Select * from sys.services where name=s.name COLLATE SQL_Latin1_General_CP1_CI_AS)    &lt;br /&gt;GO&lt;/p&gt;  &lt;p&gt;/*** To Test a message send Run:   &lt;br /&gt;sp_SendXmlMessage  'TSQLTEST', 'CommerceEngine','&amp;lt;Root&amp;gt;&amp;lt;Text&amp;gt;Test&amp;lt;/Text&amp;gt;&amp;lt;/Root&amp;gt;'    &lt;br /&gt;*/&lt;/p&gt;  &lt;p&gt;Select CAST(message_body as XML) as xml, * From XmlMessageSendingQueue&lt;/p&gt;  &lt;p&gt;/*** clean out all queues   &lt;br /&gt;declare @handle uniqueidentifier&lt;/p&gt;  &lt;p&gt;declare conv cursor for    &lt;br /&gt;  select conversation_handle from sys.conversation_endpoints&lt;/p&gt;  &lt;p&gt;open conv   &lt;br /&gt;fetch next from conv into @handle&lt;/p&gt;  &lt;p&gt;while @@FETCH_STATUS = 0   &lt;br /&gt; Begin    &lt;br /&gt;   END Conversation @handle with cleanup    &lt;br /&gt;   fetch next from conv into @handle    &lt;br /&gt; End&lt;/p&gt;  &lt;p&gt;close conv   &lt;br /&gt;deallocate conv&lt;/p&gt;  &lt;p&gt;***********************&lt;/p&gt; &lt;img src="http://geekswithblogs.net/SoftwareDoneRight/aggbug/151437.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ChrisD</dc:creator>
            <guid>http://geekswithblogs.net/SoftwareDoneRight/archive/2012/12/03/more-useful-sql-server-serivce-broker-queries.aspx</guid>
            <pubDate>Mon, 03 Dec 2012 21:50:46 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/SoftwareDoneRight/comments/151437.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/SoftwareDoneRight/archive/2012/12/03/more-useful-sql-server-serivce-broker-queries.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/SoftwareDoneRight/comments/commentRss/151437.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SoftwareDoneRight/services/trackbacks/151437.aspx</trackback:ping>
        </item>
        <item>
            <title>Convert VARCHAR() columns to NVARCHAR()</title>
            <category>SQL</category>
            <link>http://geekswithblogs.net/SoftwareDoneRight/archive/2012/09/26/convert-varchar-columns-to-nvarchar.aspx</link>
            <description>&lt;p&gt;Originally posted on: &lt;a href='http://geekswithblogs.net/SoftwareDoneRight/archive/2012/09/26/convert-varchar-columns-to-nvarchar.aspx'&gt;http://geekswithblogs.net/SoftwareDoneRight/archive/2012/09/26/convert-varchar-columns-to-nvarchar.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;We recently underwent an upgrade that required us to change our database columns from varchar to NVarchar, to support unicode characters. &lt;/p&gt;  &lt;p&gt;Digging through the internet, I found a base script which I modified to handle reserved word table names, and maintain the NULL/NotNull constraint of the columns. &lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;I Ran this script &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;use NWOperationalContent – Your Catalog Name here &lt;/p&gt;    &lt;p&gt;GO&lt;/p&gt;    &lt;p&gt;SELECT 'ALTER TABLE ' + isnull(schema_name(syo.id), 'dbo') + '.[' +  syo.name +'] '     &lt;br /&gt;    + ' ALTER COLUMN [' + syc.name + '] NVARCHAR(' + case syc.length when -1 then 'MAX'       &lt;br /&gt;        ELSE convert(nvarchar(10),syc.length) end + ') '+      &lt;br /&gt;        case  syc.isnullable when 1 then ' NULL' ELSE ' NOT NULL' END +';'      &lt;br /&gt;   FROM sysobjects syo      &lt;br /&gt;   JOIN syscolumns syc ON      &lt;br /&gt;     syc.id = syo.id      &lt;br /&gt;   JOIN systypes syt ON      &lt;br /&gt;     syt.xtype = syc.xtype      &lt;br /&gt;   WHERE       &lt;br /&gt;     syt.name = 'varchar'       &lt;br /&gt;    and syo.xtype='U'&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;which produced a series of ALTER statements which I could then execute the tables.  In some cases I had to drop indexes, alter the tables, and re-create the indexes.  There might have been a better way to do that, but manually dropping them got the job done. &lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;use NWMerchandisingContent     &lt;br /&gt;GO      &lt;br /&gt;ALTER TABLE Locale Drop Constraint PK_Locale      &lt;br /&gt;ALTER TABLE Country DROP CONSTRAINT PK_Country&lt;/p&gt;    &lt;p&gt;GO     &lt;br /&gt;ALTER TABLE dbo.[Campaign]  ALTER COLUMN [ActorKey] NVARCHAR(200)  NOT NULL;      &lt;br /&gt;ALTER TABLE dbo.[BundleLocalization]  ALTER COLUMN [Locale] NVARCHAR(8)  NOT NULL;      &lt;br /&gt;ALTER TABLE dbo.[BundleLocalization]  ALTER COLUMN [UnitOfmeasure] NVARCHAR(200)  NULL;      &lt;br /&gt;ALTER TABLE dbo.[BundleLocalization]  ALTER COLUMN [ActorKey] NVARCHAR(200)  NOT NULL;      &lt;br /&gt;ALTER TABLE dbo.[BundleComponentLocalization]  ALTER COLUMN [Locale] NVARCHAR(8)  NOT NULL;      &lt;br /&gt;ALTER TABLE dbo.[BundleComponentLocalization]  ALTER COLUMN [Imperative] NVARCHAR(MAX)  NULL;      &lt;br /&gt;ALTER TABLE dbo.[BundleComponentLocalization]  ALTER COLUMN [Instructions] NVARCHAR(MAX)  NULL;      &lt;br /&gt;ALTER TABLE dbo.[BundleComponentLocalization]  ALTER COLUMN [ActorKey] NVARCHAR(200)  NOT NULL;      &lt;br /&gt;ALTER TABLE dbo.[BundleComponent]  ALTER COLUMN [ActorKey] NVARCHAR(200)  NOT NULL;      &lt;br /&gt;ALTER TABLE dbo.[Bundle]  ALTER COLUMN [ActorKey] NVARCHAR(200)  NOT NULL;      &lt;br /&gt;ALTER TABLE dbo.[Banner]  ALTER COLUMN [ActorKey] NVARCHAR(200)  NOT NULL;      &lt;br /&gt;ALTER TABLE dbo.[Video]  ALTER COLUMN [Link] NVARCHAR(512)  NOT NULL;      &lt;br /&gt;ALTER TABLE dbo.[Video]  ALTER COLUMN [ActorKey] NVARCHAR(200)  NOT NULL;      &lt;br /&gt;ALTER TABLE dbo.[ProductUsage]  ALTER COLUMN [VideoLink] NVARCHAR(512)  NOT NULL;      &lt;br /&gt;ALTER TABLE dbo.[ProductUsage]  ALTER COLUMN [ActorKey] NVARCHAR(200)  NOT NULL;      &lt;br /&gt;ALTER TABLE dbo.[Thumbnail]  ALTER COLUMN [ActorKey] NVARCHAR(200)  NOT NULL;      &lt;br /&gt;ALTER TABLE dbo.[SkuLocalization]  ALTER COLUMN [Locale] NVARCHAR(8)  NOT NULL;      &lt;br /&gt;ALTER TABLE dbo.[SkuLocalization]  ALTER COLUMN [UnitOfMeasure] NVARCHAR(150)  NOT NULL;      &lt;br /&gt;ALTER TABLE dbo.[SkuLocalization]  ALTER COLUMN [SwatchColor] NVARCHAR(50)  NOT NULL;&lt;/p&gt;    &lt;p&gt;etc..&lt;/p&gt;    &lt;p&gt;GO     &lt;br /&gt;ALTER TABLE Locale ADD CONSTRAINT PK_Locale PRIMARY KEY (LocaleId)      &lt;br /&gt;ALTER TABLE Country ADD CONSTRAINT PK_Country PRIMARY KEY (CountryId)&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Note that this alter is non-destructive to the data.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;Hope this helps. &lt;/p&gt; &lt;img src="http://geekswithblogs.net/SoftwareDoneRight/aggbug/150815.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ChrisD</dc:creator>
            <guid>http://geekswithblogs.net/SoftwareDoneRight/archive/2012/09/26/convert-varchar-columns-to-nvarchar.aspx</guid>
            <pubDate>Wed, 26 Sep 2012 22:46:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/SoftwareDoneRight/comments/150815.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/SoftwareDoneRight/archive/2012/09/26/convert-varchar-columns-to-nvarchar.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/SoftwareDoneRight/comments/commentRss/150815.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SoftwareDoneRight/services/trackbacks/150815.aspx</trackback:ping>
        </item>
        <item>
            <title>Solved: Operation is not valid due to the current state of the object</title>
            <link>http://geekswithblogs.net/SoftwareDoneRight/archive/2012/09/06/solved-operation-is-not-valid-due-to-the-current-state.aspx</link>
            <description>&lt;p&gt;Originally posted on: &lt;a href='http://geekswithblogs.net/SoftwareDoneRight/archive/2012/09/06/solved-operation-is-not-valid-due-to-the-current-state.aspx'&gt;http://geekswithblogs.net/SoftwareDoneRight/archive/2012/09/06/solved-operation-is-not-valid-due-to-the-current-state.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;We use public static methods decorated with [WebMethod] to support our Ajax Postbacks. &lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;Recently, I received an error from a UI developing stating he was receiving the following error when attempting his post back:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;{      &lt;br /&gt;  "Message": "Operation is not valid due to the current state of the object.",       &lt;br /&gt;  "StackTrace": "   at System.Web.Script.Serialization.ObjectConverter.ConvertDictionaryToObject(IDictionary`2 dictionary, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object&amp;amp; convertedObject)\r\n   at System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeInternal(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object&amp;amp; convertedObject)\r\n   at System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeMain(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object&amp;amp; convertedObject)\r\n   at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInternal(Int32 depth)\r\n   at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeDictionary(Int32 depth)\r\n   at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInternal(Int32 depth)\r\n   at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeDictionary(Int32 depth)\r\n   at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInternal(Int32 depth)\r\n   at System.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize(String input, Int32 depthLimit, JavaScriptSerializer serializer)\r\n   at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit)\r\n   at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize[T](String input)\r\n   at System.Web.Script.Services.RestHandler.GetRawParamsFromPostRequest(HttpContext context, JavaScriptSerializer serializer)\r\n   at System.Web.Script.Services.RestHandler.GetRawParams(WebServiceMethodData methodData, HttpContext context)\r\n   at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)",       &lt;br /&gt;  "ExceptionType": "System.InvalidOperationException"       &lt;br /&gt;}&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;Goggling this error brought me little support.  All the results talked about increasing the &lt;code&gt;aspnet:MaxJsonDeserializerMembers value to handle larger payloads.  Since 1) I’m not using the asp.net ajax model and 2) the payload is very small, this clearly was not the cause of my issue. &lt;/code&gt;&lt;/p&gt;  &lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;  &lt;p&gt;&lt;code&gt;Here’s the payload the UI developer was sending to the endpoint:&lt;/code&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;{      &lt;br /&gt;  "FundingSource": {       &lt;br /&gt;    "__type": "XX.YY.Engine.Contract.Funding.EvidenceBasedFundingSource,  XX.YY.Engine.Contract",       &lt;br /&gt;    "MeansType": 13,       &lt;br /&gt;    "FundingMethodName": "LegalTender",       &lt;br /&gt;  },       &lt;br /&gt;  "AddToProfile": false,       &lt;br /&gt;  "ProfileNickName": "",       &lt;br /&gt;  "FundingAmount": 0       &lt;br /&gt;}&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;By tweaking the JSON I’ve found the culprit.&lt;/p&gt;  &lt;p&gt;Apparently the default JSS Serializer used doesn’t like the assembly name in the __type value.  Removing the assembly portion of the type name resolved my issue.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;{      &lt;br /&gt;"FundingSource": {       &lt;br /&gt;"__type": "XX.YY.Engine.Contract.Funding.EvidenceBasedFundingSource",       &lt;br /&gt;"MeansType": 13,       &lt;br /&gt;"FundingMethodName": "LegalTender",       &lt;br /&gt;},       &lt;br /&gt;"AddToProfile": false,       &lt;br /&gt;"ProfileNickName": "",       &lt;br /&gt;"FundingAmount": 0       &lt;br /&gt;}&lt;/p&gt;&lt;/blockquote&gt; &lt;img src="http://geekswithblogs.net/SoftwareDoneRight/aggbug/150634.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ChrisD</dc:creator>
            <guid>http://geekswithblogs.net/SoftwareDoneRight/archive/2012/09/06/solved-operation-is-not-valid-due-to-the-current-state.aspx</guid>
            <pubDate>Thu, 06 Sep 2012 18:05:19 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/SoftwareDoneRight/comments/150634.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/SoftwareDoneRight/archive/2012/09/06/solved-operation-is-not-valid-due-to-the-current-state.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/SoftwareDoneRight/comments/commentRss/150634.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SoftwareDoneRight/services/trackbacks/150634.aspx</trackback:ping>
        </item>
        <item>
            <title>Query SQL Server&amp;rsquo;s schema to find all tables containing a column named &amp;lsquo;x&amp;rsquo;</title>
            <category>SQL</category>
            <link>http://geekswithblogs.net/SoftwareDoneRight/archive/2012/04/26/query-sql-serverrsquos-schema-to-find-all-tables-containing-a.aspx</link>
            <description>&lt;p&gt;Originally posted on: &lt;a href='http://geekswithblogs.net/SoftwareDoneRight/archive/2012/04/26/query-sql-serverrsquos-schema-to-find-all-tables-containing-a.aspx'&gt;http://geekswithblogs.net/SoftwareDoneRight/archive/2012/04/26/query-sql-serverrsquos-schema-to-find-all-tables-containing-a.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;The following query will find all tables in my catalog with a column name like ‘city’&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;SELECT t.name AS table_name,     &lt;br /&gt;SCHEMA_NAME(schema_id) AS schema_name,      &lt;br /&gt;c.name AS column_name      &lt;br /&gt;FROM sys.tables AS t      &lt;br /&gt;INNER JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID      &lt;br /&gt;WHERE c.name LIKE '%City%'      &lt;br /&gt;ORDER BY schema_name, table_name; &lt;/p&gt;&lt;/blockquote&gt; &lt;img src="http://geekswithblogs.net/SoftwareDoneRight/aggbug/149468.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ChrisD</dc:creator>
            <guid>http://geekswithblogs.net/SoftwareDoneRight/archive/2012/04/26/query-sql-serverrsquos-schema-to-find-all-tables-containing-a.aspx</guid>
            <pubDate>Thu, 26 Apr 2012 14:59:06 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/SoftwareDoneRight/comments/149468.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/SoftwareDoneRight/archive/2012/04/26/query-sql-serverrsquos-schema-to-find-all-tables-containing-a.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/SoftwareDoneRight/comments/commentRss/149468.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SoftwareDoneRight/services/trackbacks/149468.aspx</trackback:ping>
        </item>
        <item>
            <title>Specifying DNS Servers at the command prompt</title>
            <category>General Geekiness</category>
            <link>http://geekswithblogs.net/SoftwareDoneRight/archive/2012/03/01/specifying-dns-servers-at-the-command-prompt.aspx</link>
            <description>&lt;p&gt;Originally posted on: &lt;a href='http://geekswithblogs.net/SoftwareDoneRight/archive/2012/03/01/specifying-dns-servers-at-the-command-prompt.aspx'&gt;http://geekswithblogs.net/SoftwareDoneRight/archive/2012/03/01/specifying-dns-servers-at-the-command-prompt.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Did you know you can set your DNS Servers from the command prompt using the NETSH command (available in win 2003 and later)?&lt;/p&gt;  &lt;p&gt;You can even specify the order in which the servers are registered in the DNS lookup&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;netsh interface ip set dns "Local Area Connection" static 8.8.8.8     &lt;br /&gt;netsh interface ip add dnsservers "Local Area Connection"  8.8.4.4 index=2      &lt;br /&gt;netsh interface ip add dnsservers "Local Area Connection" 10.0.8.100 index=3&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;If you want to configure DNS to use DHCP:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;netsh interface ip set dns “Local Area Connection” dhcp&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;if you want to clear the table entirely:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;netsh interface ip set dns “Local Area Connection” address=none&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;You’ll need to replace “Local Area Connection” with your LAN Connection name, should it differ. &lt;/p&gt; &lt;img src="http://geekswithblogs.net/SoftwareDoneRight/aggbug/148856.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ChrisD</dc:creator>
            <guid>http://geekswithblogs.net/SoftwareDoneRight/archive/2012/03/01/specifying-dns-servers-at-the-command-prompt.aspx</guid>
            <pubDate>Thu, 01 Mar 2012 21:02:30 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/SoftwareDoneRight/comments/148856.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/SoftwareDoneRight/archive/2012/03/01/specifying-dns-servers-at-the-command-prompt.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/SoftwareDoneRight/comments/commentRss/148856.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SoftwareDoneRight/services/trackbacks/148856.aspx</trackback:ping>
        </item>
        <item>
            <title>How to get a Product() (multiplication result) rather than a SUM() (addition result) using T-Sql</title>
            <category>SQL</category>
            <link>http://geekswithblogs.net/SoftwareDoneRight/archive/2012/02/29/how-to-get-a-product-multiplication-result-rather-than-a.aspx</link>
            <description>&lt;p&gt;Originally posted on: &lt;a href='http://geekswithblogs.net/SoftwareDoneRight/archive/2012/02/29/how-to-get-a-product-multiplication-result-rather-than-a.aspx'&gt;http://geekswithblogs.net/SoftwareDoneRight/archive/2012/02/29/how-to-get-a-product-multiplication-result-rather-than-a.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Get a summary aggregation of rows in T-Sql is easy thanks to the Sum operator:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Select Sum(Qty) From Table&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Why is there no Product() aggregation operation for T-Sql?  Sometimes I want the values multiplied, not added.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;Luckily, some one who is much smarter in math than I, observed:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;log(A * B) = log(A) + log(B)&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;So, summing the log, and converting back to its exponential value will yield its product. &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Select CAST(EXP(SUM(LOG(Qty))) as int) as ExtendedQTY&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Happy Calculating!&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt;UPDATE: &lt;/font&gt;&lt;/strong&gt; The above expression seems to calculate the wrong value when the value being multiplied is a large number.  For example:&lt;/p&gt;  &lt;p&gt;Select CAST(EXP(LOG(11111)) as int)  yields 11110, not 11111.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;Try this instead:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;  DECLARE @ExtendedQty FLOAT&lt;/p&gt;    &lt;p&gt; Select  @ExtendedQTY = COALESCE(@ExtendedQTY, 1) * Table.Qty From Table&lt;/p&gt;    &lt;p&gt; Select @ExtendedQty&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;As always, your feedback is welcome.&lt;/p&gt; &lt;img src="http://geekswithblogs.net/SoftwareDoneRight/aggbug/148843.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ChrisD</dc:creator>
            <guid>http://geekswithblogs.net/SoftwareDoneRight/archive/2012/02/29/how-to-get-a-product-multiplication-result-rather-than-a.aspx</guid>
            <pubDate>Wed, 29 Feb 2012 19:32:52 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/SoftwareDoneRight/comments/148843.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/SoftwareDoneRight/archive/2012/02/29/how-to-get-a-product-multiplication-result-rather-than-a.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/SoftwareDoneRight/comments/commentRss/148843.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SoftwareDoneRight/services/trackbacks/148843.aspx</trackback:ping>
        </item>
        <item>
            <title>Enabling Sql Server Broker Service Hangs</title>
            <category>SQL</category>
            <link>http://geekswithblogs.net/SoftwareDoneRight/archive/2012/01/28/enabling-sql-server-broker-service-hangs.aspx</link>
            <description>&lt;p&gt;Originally posted on: &lt;a href='http://geekswithblogs.net/SoftwareDoneRight/archive/2012/01/28/enabling-sql-server-broker-service-hangs.aspx'&gt;http://geekswithblogs.net/SoftwareDoneRight/archive/2012/01/28/enabling-sql-server-broker-service-hangs.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;If your connection hangs while attempting to start sql server broker service, its likely caused by the system trying to gain exclusive access to your database.   Some people recommend stopping and restarting the sql server instance.  I find that a little heavy-handed, like swatting a fly with a sledge hammer.  Instead switch the database into single user mode, enable the broker service, and restore the database to multi-user mode. &lt;/p&gt; &lt;p&gt; &lt;/p&gt; &lt;p&gt;1) Set the database to single user mode:&lt;/p&gt; &lt;p&gt;ALTER DATABASE [DBNAME] SET SINGLE_USER WITH ROLLBACK IMMEDIATE&lt;/p&gt; &lt;p&gt; &lt;/p&gt; &lt;p&gt;2) Enable Broker Service on the database &lt;/p&gt; &lt;p&gt;ALTER DATABASE [DBNAME] SET ENABLE_BROKER;&lt;/p&gt; &lt;p&gt; &lt;/p&gt; &lt;p&gt;3)Restore the database to multi-user mode&lt;/p&gt; &lt;p&gt;ALTER DATABASE [DBNAME] SET MULTI_USER&lt;/p&gt; &lt;p&gt;Of course you’ll need proper permissions, but enabling the service this way prevents interruption to any other databases running on your server.&lt;/p&gt; &lt;p&gt; &lt;/p&gt; &lt;p&gt;Also make sure Broker Service is enabled:&lt;/p&gt;&lt;pre&gt;SELECT is_broker_enabled FROM sys.databases WHERE name = ‘DBNAME’;It should return 1 if its enabled.&lt;/pre&gt;&lt;pre&gt;&lt;/pre&gt;&lt;pre&gt;-- Enable Service Broker:
ALTER DATABASE [DBNAME] SET ENABLE_BROKER;

-- Disable Service Broker:
ALTER DATABASE [DBNAME] SET DISABLE_BROKER;&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;More useful SSBS Queries&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;If your activation stored procured isn’t firing, it might be because the queue is disabled.  Check the status of the queues with:&lt;/p&gt;
&lt;p&gt;select [name], is_receive_enabled from sys.service_queues; – 0 indicates the queue is disabled. &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;To enable the queue:&lt;/p&gt;
&lt;p&gt;alter queue QUEUENAME with status=on; – replace QUEUENAME with the name of your queue&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Here’s a link to a great site with lots of useful broker service queries&lt;/p&gt;
&lt;p&gt;&lt;a title="http://myadventuresincoding.wordpress.com/2007/11/22/sql-server-service-broker-tips-and-tricks/" href="http://myadventuresincoding.wordpress.com/2007/11/22/sql-server-service-broker-tips-and-tricks/"&gt;http://myadventuresincoding.wordpress.com/2007/11/22/sql-server-service-broker-tips-and-tricks/&lt;/a&gt;&lt;/p&gt; &lt;img src="http://geekswithblogs.net/SoftwareDoneRight/aggbug/148512.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ChrisD</dc:creator>
            <guid>http://geekswithblogs.net/SoftwareDoneRight/archive/2012/01/28/enabling-sql-server-broker-service-hangs.aspx</guid>
            <pubDate>Sat, 28 Jan 2012 20:53:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/SoftwareDoneRight/comments/148512.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/SoftwareDoneRight/archive/2012/01/28/enabling-sql-server-broker-service-hangs.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/SoftwareDoneRight/comments/commentRss/148512.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SoftwareDoneRight/services/trackbacks/148512.aspx</trackback:ping>
        </item>
        <item>
            <title>Google&amp;rsquo;s Public DNS Servers</title>
            <category>General Geekiness</category>
            <link>http://geekswithblogs.net/SoftwareDoneRight/archive/2011/10/26/googlersquos-public-dns-servers.aspx</link>
            <description>&lt;p&gt;Originally posted on: &lt;a href='http://geekswithblogs.net/SoftwareDoneRight/archive/2011/10/26/googlersquos-public-dns-servers.aspx'&gt;http://geekswithblogs.net/SoftwareDoneRight/archive/2011/10/26/googlersquos-public-dns-servers.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Tired of ISP DNS service errors?  switch to use Google’s.  They are FAST and ALWAYS available. &lt;/p&gt;  &lt;p&gt;Primary: 8.8.8.8&lt;/p&gt;  &lt;p&gt;Secondary: 8.8.4.4&lt;/p&gt; &lt;img src="http://geekswithblogs.net/SoftwareDoneRight/aggbug/147460.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ChrisD</dc:creator>
            <guid>http://geekswithblogs.net/SoftwareDoneRight/archive/2011/10/26/googlersquos-public-dns-servers.aspx</guid>
            <pubDate>Wed, 26 Oct 2011 18:48:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/SoftwareDoneRight/comments/147460.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/SoftwareDoneRight/archive/2011/10/26/googlersquos-public-dns-servers.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/SoftwareDoneRight/comments/commentRss/147460.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SoftwareDoneRight/services/trackbacks/147460.aspx</trackback:ping>
        </item>
        <item>
            <title>Performing Case-Insensitive joins using EXCEPT operator in LINQ</title>
            <link>http://geekswithblogs.net/SoftwareDoneRight/archive/2011/10/26/performing-case--insensitive-joins-using-except-operator-in-linq.aspx</link>
            <description>&lt;p&gt;Originally posted on: &lt;a href='http://geekswithblogs.net/SoftwareDoneRight/archive/2011/10/26/performing-case--insensitive-joins-using-except-operator-in-linq.aspx'&gt;http://geekswithblogs.net/SoftwareDoneRight/archive/2011/10/26/performing-case--insensitive-joins-using-except-operator-in-linq.aspx&lt;/a&gt;&lt;/p&gt;&lt;div class="csharpcode"&gt;   &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt; var daysOfWeek = &lt;span class="kwrd"&gt;new&lt;/span&gt;[] { &lt;span class="str"&gt;"Sunday"&lt;/span&gt;, &lt;span class="str"&gt;"Monday"&lt;/span&gt;, &lt;span class="str"&gt;"Tuesday"&lt;/span&gt;, &lt;span class="str"&gt;"Wednesday"&lt;/span&gt;, &lt;span class="str"&gt;"Thursday"&lt;/span&gt;, &lt;span class="str"&gt;"Friday"&lt;/span&gt;, &lt;span class="str"&gt;"Saturday"&lt;/span&gt; };&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt; var workDays = daysOfWeek.Except( &lt;span class="kwrd"&gt;new&lt;/span&gt; []{ &lt;span class="str"&gt;"SUNDAY"&lt;/span&gt;, &lt;span class="str"&gt;"SaTURdaY"&lt;/span&gt;}); &lt;span class="rem"&gt;// Performs a case sensitive search and yields Sunday,Monday - Saturday. &lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;workDays = daysOfWeek.Except(&lt;span class="kwrd"&gt;new&lt;/span&gt;[] { &lt;span class="str"&gt;"SUNDAY"&lt;/span&gt;, &lt;span class="str"&gt;"SaTURdaY"&lt;/span&gt; },StringComparer.OrdinalIgnoreCase); &lt;span class="rem"&gt;// Performs a case insensitive search and yields Monday-Friday&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;&lt;![CDATA[
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }]]&gt;&lt;/style&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;The except operator takes a comparer that tells it how to evaluate the two lists.  Nice one!&lt;/p&gt; &lt;img src="http://geekswithblogs.net/SoftwareDoneRight/aggbug/147455.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ChrisD</dc:creator>
            <guid>http://geekswithblogs.net/SoftwareDoneRight/archive/2011/10/26/performing-case--insensitive-joins-using-except-operator-in-linq.aspx</guid>
            <pubDate>Wed, 26 Oct 2011 05:20:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/SoftwareDoneRight/comments/147455.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/SoftwareDoneRight/archive/2011/10/26/performing-case--insensitive-joins-using-except-operator-in-linq.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/SoftwareDoneRight/comments/commentRss/147455.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SoftwareDoneRight/services/trackbacks/147455.aspx</trackback:ping>
        </item>
        <item>
            <title>How can I include my derived class type name in the serialized JSON?</title>
            <category>Visual Studio</category>
            <link>http://geekswithblogs.net/SoftwareDoneRight/archive/2011/06/30/how-can-i-include-my-derived-class-type-name-in.aspx</link>
            <description>&lt;p&gt;Originally posted on: &lt;a href='http://geekswithblogs.net/SoftwareDoneRight/archive/2011/06/30/how-can-i-include-my-derived-class-type-name-in.aspx'&gt;http://geekswithblogs.net/SoftwareDoneRight/archive/2011/06/30/how-can-i-include-my-derived-class-type-name-in.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Sometimes working with the js Serializer is easy, sometimes its not.   When I attempt to serialize an object that is derived from a base, the serializer decided whether or not to include the type name. &lt;/p&gt;  &lt;p&gt;When its present, the type name is represented by a ___type attribute in the serialized json like this:&lt;/p&gt;  &lt;blockquote&gt;   &lt;pre&gt;&lt;code&gt;{"d":{"__type":"Commerce.Integration.Surfaces.OrderCreationRequest"&lt;/code&gt;&lt;code&gt;,"RepId":0}}&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt; The missing type name is a problem if I intend to ship the object back into a web method that needs to deserialize the object.   Without the Type name, serialization will fail and result in a ugly web exception.&lt;/p&gt;

&lt;p&gt;The solution, which feels more like a work-around, is to explicitly tell the serializer to ALWAYS generate the type name for each derived type.  You make this declaration by adding a [GenerateScriptType())] attribute for each derived type to the top of the web page declaration.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;For example, assuming I had 3 derivations of OrderCreationRequest; PersonalOrderCreationRequest, CompanyOrderCreationRequest, InternalOrderCreationRequestion, the code-behind for my web page would be decorated as follows:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;    [GenerateScriptType(&lt;span class="kwrd"&gt;typeof&lt;/span&gt;(PersonalOrderCreationRequest))]
    [GenerateScriptType(&lt;span class="kwrd"&gt;typeof&lt;/span&gt;(CompanyOrderCreationRequest))]
    [GenerateScriptType(&lt;span class="kwrd"&gt;typeof&lt;/span&gt;(InternalOrderCreationRequest))]
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;partial&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; OrderMethods : Page
{
...
}&lt;/pre&gt;

&lt;pre class="csharpcode"&gt;With the type names generated in the serialized JSON, the serializer can successfully deserialize instances of any of these types passed into a web method.&lt;/pre&gt;

&lt;pre class="csharpcode"&gt;Hope this helps you as much as it did me. &lt;/pre&gt;
&lt;style type="text/css"&gt;&lt;![CDATA[
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }]]&gt;&lt;/style&gt; &lt;img src="http://geekswithblogs.net/SoftwareDoneRight/aggbug/146043.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ChrisD</dc:creator>
            <guid>http://geekswithblogs.net/SoftwareDoneRight/archive/2011/06/30/how-can-i-include-my-derived-class-type-name-in.aspx</guid>
            <pubDate>Fri, 01 Jul 2011 00:35:34 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/SoftwareDoneRight/comments/146043.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/SoftwareDoneRight/archive/2011/06/30/how-can-i-include-my-derived-class-type-name-in.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/SoftwareDoneRight/comments/commentRss/146043.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SoftwareDoneRight/services/trackbacks/146043.aspx</trackback:ping>
        </item>
        <item>
            <title>QuickTip: Determine if Type implements IEnumerable&amp;lt;T&amp;gt;</title>
            <category>Visual Studio</category>
            <link>http://geekswithblogs.net/SoftwareDoneRight/archive/2011/04/28/quicktip--determine-if-type-implements-ienumerablelttgt.aspx</link>
            <description>&lt;p&gt;Originally posted on: &lt;a href='http://geekswithblogs.net/SoftwareDoneRight/archive/2011/04/28/quicktip--determine-if-type-implements-ienumerablelttgt.aspx'&gt;http://geekswithblogs.net/SoftwareDoneRight/archive/2011/04/28/quicktip--determine-if-type-implements-ienumerablelttgt.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;I was working on a project that required a determination if the type was an IEnumerable collection of some type.  &lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;Using a bit of reflection and the handy-dandy GetGenericTypeDefinition method, I arrive at this:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:a993c637-4913-4637-88b4-a087f572e36c" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Code Snippet&lt;/div&gt; &lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt; &lt;ol style="background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;bool&lt;/span&gt; IsIEnumerableOfT(&lt;span style="color:#2b91af"&gt;Type&lt;/span&gt; type)&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;      {&lt;/li&gt; &lt;li&gt;          &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; type.GetInterfaces().Any(t =&amp;gt; t.IsGenericType &amp;amp;&amp;amp; t.GetGenericTypeDefinition() == &lt;span style="color:#0000ff"&gt;typeof&lt;/span&gt; (&lt;span style="color:#2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&amp;gt;)) ;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;      }&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;Happy Coding!&lt;/p&gt; &lt;img src="http://geekswithblogs.net/SoftwareDoneRight/aggbug/145068.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ChrisD</dc:creator>
            <guid>http://geekswithblogs.net/SoftwareDoneRight/archive/2011/04/28/quicktip--determine-if-type-implements-ienumerablelttgt.aspx</guid>
            <pubDate>Thu, 28 Apr 2011 12:26:23 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/SoftwareDoneRight/comments/145068.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/SoftwareDoneRight/archive/2011/04/28/quicktip--determine-if-type-implements-ienumerablelttgt.aspx#feedback</comments>
            <slash:comments>9</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/SoftwareDoneRight/comments/commentRss/145068.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SoftwareDoneRight/services/trackbacks/145068.aspx</trackback:ping>
        </item>
        <item>
            <title>Reorder Your Accounts in Thunderbird</title>
            <category>General Geekiness</category>
            <link>http://geekswithblogs.net/SoftwareDoneRight/archive/2011/04/20/reorder-your-accounts-in-thunderbird.aspx</link>
            <description>&lt;p&gt;Originally posted on: &lt;a href='http://geekswithblogs.net/SoftwareDoneRight/archive/2011/04/20/reorder-your-accounts-in-thunderbird.aspx'&gt;http://geekswithblogs.net/SoftwareDoneRight/archive/2011/04/20/reorder-your-accounts-in-thunderbird.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Ever wanted to re-order your Thunderbird accounts?&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;You can either modify the prefs.js manually &lt;/p&gt;  &lt;p&gt;1. Exit Thunderbird if its running.&lt;/p&gt;  &lt;p&gt;2. Locate your prefs.js file (default location is c:\users\[your account]AppData\Thunderbird\Profiles&lt;/p&gt;  &lt;p&gt;3. create a backup , just in case. &lt;/p&gt;  &lt;p&gt;4. Open the prefs.js in any text editor and look for: user_pref("mail.accountmanager.accounts", "account1,account2,account3,account4…"); line&lt;/p&gt;  &lt;p&gt;5. Change the order of the accounts manually&lt;/p&gt;  &lt;p&gt;6. Restart Thunderbird&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;OR &lt;/p&gt;  &lt;p&gt;1. Download and install the FolderPane add-on.&lt;/p&gt;  &lt;p&gt;2. From Thunderbird, select Tools-&amp;gt;Add ons –&amp;gt; Folderpane and reorder the accounts using the “Move Up” and “Move Down” buttons. &lt;/p&gt;  &lt;p&gt;3. Close and restart Thunderbird. &lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;The choice is yours.&lt;/p&gt; &lt;img src="http://geekswithblogs.net/SoftwareDoneRight/aggbug/144974.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ChrisD</dc:creator>
            <guid>http://geekswithblogs.net/SoftwareDoneRight/archive/2011/04/20/reorder-your-accounts-in-thunderbird.aspx</guid>
            <pubDate>Wed, 20 Apr 2011 15:57:28 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/SoftwareDoneRight/comments/144974.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/SoftwareDoneRight/archive/2011/04/20/reorder-your-accounts-in-thunderbird.aspx#feedback</comments>
            <slash:comments>3</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/SoftwareDoneRight/comments/commentRss/144974.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SoftwareDoneRight/services/trackbacks/144974.aspx</trackback:ping>
        </item>
        <item>
            <title>QuickTip:  Selecting Children from a Parent Item in Linq</title>
            <category>Visual Studio</category>
            <link>http://geekswithblogs.net/SoftwareDoneRight/archive/2011/03/29/quicktip--selecting-children-from-a-parent-item-in-linq.aspx</link>
            <description>&lt;p&gt;Originally posted on: &lt;a href='http://geekswithblogs.net/SoftwareDoneRight/archive/2011/03/29/quicktip--selecting-children-from-a-parent-item-in-linq.aspx'&gt;http://geekswithblogs.net/SoftwareDoneRight/archive/2011/03/29/quicktip--selecting-children-from-a-parent-item-in-linq.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;I’m posting this here because I keep forgetting the syntax, and thought others might benefit as well.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;Given :&lt;/p&gt;  &lt;p&gt;public class ParentItem&lt;/p&gt;  &lt;p&gt;{&lt;/p&gt;  &lt;p&gt;   IEnumerable&amp;lt;ChildItem&amp;gt; Children&lt;/p&gt;  &lt;p&gt;}&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;Selecting all the childitem instances from an IEnumerable&amp;lt;ParentItem&amp;gt;:&lt;/p&gt;  &lt;p&gt;var allChildren = ParentItems.SelectMany(parent=&amp;gt;parent.Children);&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;Selecting matching childItem instances from an IEnumerable&amp;lt;ParentItem&amp;gt;:&lt;/p&gt;  &lt;p&gt;var selectedChildren = ParentItems.SelectMany(parent=&amp;gt;parent.Children).Where(child=&amp;gt;&amp;lt;boolean expression for filtering children&amp;gt;)&lt;/p&gt; &lt;img src="http://geekswithblogs.net/SoftwareDoneRight/aggbug/144573.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ChrisD</dc:creator>
            <guid>http://geekswithblogs.net/SoftwareDoneRight/archive/2011/03/29/quicktip--selecting-children-from-a-parent-item-in-linq.aspx</guid>
            <pubDate>Tue, 29 Mar 2011 19:47:27 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/SoftwareDoneRight/comments/144573.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/SoftwareDoneRight/archive/2011/03/29/quicktip--selecting-children-from-a-parent-item-in-linq.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/SoftwareDoneRight/comments/commentRss/144573.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SoftwareDoneRight/services/trackbacks/144573.aspx</trackback:ping>
        </item>
        <item>
            <title>Words of Wisdom</title>
            <link>http://geekswithblogs.net/SoftwareDoneRight/archive/2011/03/19/words-of-wisdom.aspx</link>
            <description>&lt;p&gt;Originally posted on: &lt;a href='http://geekswithblogs.net/SoftwareDoneRight/archive/2011/03/19/words-of-wisdom.aspx'&gt;http://geekswithblogs.net/SoftwareDoneRight/archive/2011/03/19/words-of-wisdom.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Culture beats Strategy every time.&lt;/p&gt; &lt;img src="http://geekswithblogs.net/SoftwareDoneRight/aggbug/144438.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ChrisD</dc:creator>
            <guid>http://geekswithblogs.net/SoftwareDoneRight/archive/2011/03/19/words-of-wisdom.aspx</guid>
            <pubDate>Sat, 19 Mar 2011 14:59:25 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/SoftwareDoneRight/comments/144438.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/SoftwareDoneRight/archive/2011/03/19/words-of-wisdom.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/SoftwareDoneRight/comments/commentRss/144438.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SoftwareDoneRight/services/trackbacks/144438.aspx</trackback:ping>
        </item>
        <item>
            <title>How to set x509 Certificate private key access rights for AppPoolIdentity</title>
            <link>http://geekswithblogs.net/SoftwareDoneRight/archive/2011/03/15/how-to-set-x509-certificate-private-key-access-rights-for.aspx</link>
            <description>&lt;p&gt;Originally posted on: &lt;a href='http://geekswithblogs.net/SoftwareDoneRight/archive/2011/03/15/how-to-set-x509-certificate-private-key-access-rights-for.aspx'&gt;http://geekswithblogs.net/SoftwareDoneRight/archive/2011/03/15/how-to-set-x509-certificate-private-key-access-rights-for.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;If your website uses the AppPoolIdentity and requires access to the private key of an x509Certficate, you’ll need to grant the read permissions to the iis application pool.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;To grant permissions to the AppPoolIdentity:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Run Certificates.MMC (or Start-&amp;gt;run-&amp;gt;mmc.exe, Add Certificate Snap-In for LocalMachine)&lt;/li&gt;    &lt;li&gt;Select the certificate (Personal node on the certificate tree) , right click and Manage Permissions.&lt;/li&gt;    &lt;li&gt;Add a new user to the permissions list. &lt;/li&gt;    &lt;li&gt;Enter "IIS AppPool\&lt;strong&gt;AppPoolName&lt;/strong&gt;" on the local machine". Replace "&lt;em&gt;&lt;strong&gt;AppPoolName&lt;/strong&gt;&lt;/em&gt;" with the name of your application pool.&lt;/li&gt; &lt;/ol&gt; &lt;img src="http://geekswithblogs.net/SoftwareDoneRight/aggbug/144378.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ChrisD</dc:creator>
            <guid>http://geekswithblogs.net/SoftwareDoneRight/archive/2011/03/15/how-to-set-x509-certificate-private-key-access-rights-for.aspx</guid>
            <pubDate>Tue, 15 Mar 2011 16:09:28 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/SoftwareDoneRight/comments/144378.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/SoftwareDoneRight/archive/2011/03/15/how-to-set-x509-certificate-private-key-access-rights-for.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/SoftwareDoneRight/comments/commentRss/144378.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SoftwareDoneRight/services/trackbacks/144378.aspx</trackback:ping>
        </item>
        <item>
            <title>Fixing LINQ Error: Sequence contains no elements</title>
            <category>Visual Studio</category>
            <link>http://geekswithblogs.net/SoftwareDoneRight/archive/2011/02/15/fixing-linq-error-sequence-contains-no-elements.aspx</link>
            <description>&lt;p&gt;Originally posted on: &lt;a href='http://geekswithblogs.net/SoftwareDoneRight/archive/2011/02/15/fixing-linq-error-sequence-contains-no-elements.aspx'&gt;http://geekswithblogs.net/SoftwareDoneRight/archive/2011/02/15/fixing-linq-error-sequence-contains-no-elements.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;I’ve read some posts regarding this error when using the First() or Single() command.   They suggest using FirstOrDefault() or SingleorDefault() instead.&lt;/p&gt;  &lt;p&gt;But I recently encountered it when using a Sum() command in conjunction with a Where():&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:7bac7082-2f36-4e70-858c-1f671356cb7c" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Code Snippet&lt;/div&gt; &lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt; &lt;ol style="background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;var&lt;/span&gt; effectiveFloor = policies.Where(p =&amp;gt; p.PricingStrategy == &lt;span style="color:#2b91af"&gt;PricingStrategy&lt;/span&gt;.EstablishFloor).Max(p =&amp;gt; p.Amount);&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;When the Where() function eliminated all the items in the policies collection, the Sum() command threw the “Sequence contains no elements” exception. &lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;Inserting the DefaultIfEmpty() command between the Where() and Sum(), prevents this error:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:0989abc7-d021-436a-a7db-9ab98d83ce2e" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Code Snippet&lt;/div&gt; &lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt; &lt;ol style="background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;var&lt;/span&gt; effectiveFloor = policies.Where(p =&amp;gt; p.PricingStrategy == &lt;span style="color:#2b91af"&gt;PricingStrategy&lt;/span&gt;.EstablishFloor).DefaultIfEmpty().Max(p =&amp;gt; p.Amount);&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;but now throws a Null Reference exception!&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;The Fix:&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Using a combination of DefaultIfEmpty() and a null check in the Sum() command solves this problem entirely:&lt;/p&gt;    &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:2b02ef6f-1e8d-4064-b162-ae1d52356494" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Code Snippet&lt;/div&gt; &lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt; &lt;ol style="background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;var&lt;/span&gt; effectiveFloor = policies.Where(p =&amp;gt; p.PricingStrategy == &lt;span style="color:#2b91af"&gt;PricingStrategy&lt;/span&gt;.EstablishFloor).DefaultIfEmpty().Max(p =&amp;gt;  p==&lt;span style="color:#0000ff"&gt;null&lt;/span&gt;?0 :p.Amount);&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;img src="http://geekswithblogs.net/SoftwareDoneRight/aggbug/143946.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ChrisD</dc:creator>
            <guid>http://geekswithblogs.net/SoftwareDoneRight/archive/2011/02/15/fixing-linq-error-sequence-contains-no-elements.aspx</guid>
            <pubDate>Tue, 15 Feb 2011 13:59:05 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/SoftwareDoneRight/comments/143946.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/SoftwareDoneRight/archive/2011/02/15/fixing-linq-error-sequence-contains-no-elements.aspx#feedback</comments>
            <slash:comments>7</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/SoftwareDoneRight/comments/commentRss/143946.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SoftwareDoneRight/services/trackbacks/143946.aspx</trackback:ping>
        </item>
        <item>
            <title>Making Cross-Domain / Cross-Protocol Ajax calls with flXHR, jQuery &amp;amp; ASP.NET</title>
            <category>Visual Studio</category>
            <link>http://geekswithblogs.net/SoftwareDoneRight/archive/2011/01/18/making-cross-domain--cross-protocol-ajax-calls-with-flxhr-jquery-amp.aspx</link>
            <description>&lt;p&gt;Originally posted on: &lt;a href='http://geekswithblogs.net/SoftwareDoneRight/archive/2011/01/18/making-cross-domain--cross-protocol-ajax-calls-with-flxhr-jquery-amp.aspx'&gt;http://geekswithblogs.net/SoftwareDoneRight/archive/2011/01/18/making-cross-domain--cross-protocol-ajax-calls-with-flxhr-jquery-amp.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;If you attempt to make an ajax call that cross domain or protocol boundaries, the default XHR (XmlHttpRequest) processor will fail.  The out-of-the-box implementation forbids crossing boundaries.&lt;/p&gt;  &lt;p&gt;Enter flXHR.  A flash-based proxy that implements (and extends) the XHR API.  That’s good news for JQuery developers.  It means you can use flXHR just like the native Jquery XHR.  There’s also a Jquery proxy plugin that makes it SIMPLE.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;You can download the sample &lt;a href="http://wtfsolutions.com/Documents/CrossDomainAjax%20(2).zip"&gt;here&lt;/a&gt;.  In my example, I’m hosting the website under IIS and have created an alias for localhost called CMDEV.  I’ve also configured the website for SSL.  This gives me 1 website with multiple domain names, and allows me to simulate cross-domain &amp;amp; cross-protocol calls.   The service code resides in the code behind page and is a static method decorated with the [WebMethod] attribute.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;About crossdomain.xml:  The file must reside in the website root (unless you specify its location with the PolicyURL setting)  and is VERY picky about the structure of the file.  My sample sets the security policy wide open and &lt;strong&gt;is not recommended&lt;/strong&gt; for production use.&lt;/p&gt;  &lt;p&gt;&amp;lt;?xml version="1.0"?&amp;gt;   &lt;br /&gt;&amp;lt;!DOCTYPE cross-domain-policy SYSTEM "&lt;a href="http://www.adobe.com/xml/dtds/cross-domain-policy.dtd&amp;quot;"&gt;http://www.adobe.com/xml/dtds/cross-domain-policy.dtd"&lt;/a&gt;&amp;gt;    &lt;br /&gt;&amp;lt;cross-domain-policy&amp;gt;    &lt;br /&gt;  &amp;lt;site-control permitted-cross-domain-policies="master-only" /&amp;gt;    &lt;br /&gt;  &amp;lt;allow-access-from domain="*" secure="false" /&amp;gt;    &lt;br /&gt;  &amp;lt;allow-http-request-headers-from domain="*" headers="*" secure="false" /&amp;gt;    &lt;br /&gt;&amp;lt;/cross-domain-policy&amp;gt;&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;If you wish to support cross-protocol calls (calling an HTTPS service from an HTTP page), you &lt;strong&gt;must&lt;/strong&gt; include the &lt;strong&gt;secure=false&lt;/strong&gt; attribute for both allow-access-from and allow-http-request-headers-from tags.  You’ll also need to specify the noCacheHeader:false setting when configuring the proxy.&lt;/p&gt;  &lt;p&gt;(from the Unsecured.aspx page in the sample)&lt;/p&gt;  &lt;p&gt;$.flXHRproxy.registerOptions(URL_SECURED + "/", { xmlResponseText: false, &lt;strong&gt;noCacheHeader: false&lt;/strong&gt; });&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;a final word, flXHR &lt;strong&gt;only works for asynchronous calls.&lt;/strong&gt;  If you attempt to make a syncrhonous ajax callback, the xhr proxy will select the default processor, and you’ll get a failure (“Access is denied”) message.&lt;/p&gt; &lt;img src="http://geekswithblogs.net/SoftwareDoneRight/aggbug/143526.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ChrisD</dc:creator>
            <guid>http://geekswithblogs.net/SoftwareDoneRight/archive/2011/01/18/making-cross-domain--cross-protocol-ajax-calls-with-flxhr-jquery-amp.aspx</guid>
            <pubDate>Tue, 18 Jan 2011 19:10:16 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/SoftwareDoneRight/comments/143526.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/SoftwareDoneRight/archive/2011/01/18/making-cross-domain--cross-protocol-ajax-calls-with-flxhr-jquery-amp.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/SoftwareDoneRight/comments/commentRss/143526.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SoftwareDoneRight/services/trackbacks/143526.aspx</trackback:ping>
        </item>
        <item>
            <title>Fixing &amp;ldquo;ResGen.exe&amp;quot; exited with code&amp;ndash;1073741701&amp;rdquo; in Visual Studio 2010</title>
            <category>Visual Studio</category>
            <link>http://geekswithblogs.net/SoftwareDoneRight/archive/2010/11/23/fixing-ldquoresgen.exequot-exited-with-codendash1073741701rdquo-in-visual-studio-2010.aspx</link>
            <description>&lt;p&gt;Originally posted on: &lt;a href='http://geekswithblogs.net/SoftwareDoneRight/archive/2010/11/23/fixing-ldquoresgen.exequot-exited-with-codendash1073741701rdquo-in-visual-studio-2010.aspx'&gt;http://geekswithblogs.net/SoftwareDoneRight/archive/2010/11/23/fixing-ldquoresgen.exequot-exited-with-codendash1073741701rdquo-in-visual-studio-2010.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;I found this fix online which appears to have resolve this issue, so I wanted to share it here.   I take no credit/responsibility for it, except to say that it has resolved the issue for me.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Set the 32-bit flag on resgen.exe&lt;/strong&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;a. Open a Visual Studio command-prompt as an administrator&lt;/p&gt;    &lt;p&gt;b. Navigate to the Microsoft SDKs\Windows\v7.0A\bin directory.&lt;/p&gt;    &lt;p&gt;c. ***SAVE A COPY*** of your original resgen.exe file.  This is very important if you want to be able to replace our tweak with the original file without having to repair your installation.     &lt;br /&gt;copy resgen.exe regen.exe.old&lt;/p&gt;    &lt;p&gt;d. Set the 32-bit flag to true using corflags.exe     &lt;br /&gt;corflags.exe resgen.exe /32BIT+ /Force&lt;/p&gt;    &lt;p&gt;e. Note the warning about strong name issues. On my machine the build now succeeds, without needing to do any additional work due to strong name issues. IF you have problems after trying this method, you can try the following to skip string name verification for that assembly-&lt;/p&gt;    &lt;p&gt;f. Register resgen.exe for strong name verification skipping using sn.exe     &lt;br /&gt;sn.exe –Vr resgen.exe      &lt;br /&gt;WARNING! This is a security risk. You are bypassing strongname verification for this assembly, making it possible for malicious code posing as resgen.exe to execute. To turn verification back on, use sn.exe –Vu resgen.exe&lt;/p&gt;&lt;/blockquote&gt; &lt;img src="http://geekswithblogs.net/SoftwareDoneRight/aggbug/142845.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ChrisD</dc:creator>
            <guid>http://geekswithblogs.net/SoftwareDoneRight/archive/2010/11/23/fixing-ldquoresgen.exequot-exited-with-codendash1073741701rdquo-in-visual-studio-2010.aspx</guid>
            <pubDate>Tue, 23 Nov 2010 16:59:47 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/SoftwareDoneRight/comments/142845.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/SoftwareDoneRight/archive/2010/11/23/fixing-ldquoresgen.exequot-exited-with-codendash1073741701rdquo-in-visual-studio-2010.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/SoftwareDoneRight/comments/commentRss/142845.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SoftwareDoneRight/services/trackbacks/142845.aspx</trackback:ping>
        </item>
        <item>
            <title>QuickTip: Don&amp;rsquo;t rely on HTTPPostedFile.FileName</title>
            <category>Visual Studio</category>
            <link>http://geekswithblogs.net/SoftwareDoneRight/archive/2010/11/05/quicktip-donrsquot-rely-on-httppostedfile.filename.aspx</link>
            <description>&lt;p&gt;Originally posted on: &lt;a href='http://geekswithblogs.net/SoftwareDoneRight/archive/2010/11/05/quicktip-donrsquot-rely-on-httppostedfile.filename.aspx'&gt;http://geekswithblogs.net/SoftwareDoneRight/archive/2010/11/05/quicktip-donrsquot-rely-on-httppostedfile.filename.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Supposedly, HTTPPostedFile.FileName is supposed to contain just the name of the uploaded file.  It should exclude the original filename path.  This doesn’t always appear to be the case, and seems to vary by the  browser doing an upload. &lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;To avoid the browser issue entirely, use a FileInfo(HttpPostedFile.FileName) to return just the file name (and extension) portion of the file. &lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;Change this:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:ed7e5ea0-50d1-4ca7-a751-ee149719bb11" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Code Snippet&lt;/div&gt; &lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt; &lt;ol style="background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;var&lt;/span&gt; saveFileName = &lt;span style="color:#2b91af"&gt;Path&lt;/span&gt;.Combine(UploadedFileServerPath, FilePackage.PostedFile.FileName);&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;to this:&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:5b54eeb3-44a4-4b6d-ae93-0cad59e31e79" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Code Snippet&lt;/div&gt; &lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt; &lt;ol style="background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;var&lt;/span&gt; saveFileName = &lt;span style="color:#2b91af"&gt;Path&lt;/span&gt;.Combine(UploadedFileServerPath, &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;FileInfo&lt;/span&gt;(FilePackage.PostedFile.FileName).Name);&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;img src="http://geekswithblogs.net/SoftwareDoneRight/aggbug/142612.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ChrisD</dc:creator>
            <guid>http://geekswithblogs.net/SoftwareDoneRight/archive/2010/11/05/quicktip-donrsquot-rely-on-httppostedfile.filename.aspx</guid>
            <pubDate>Sat, 06 Nov 2010 00:57:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/SoftwareDoneRight/comments/142612.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/SoftwareDoneRight/archive/2010/11/05/quicktip-donrsquot-rely-on-httppostedfile.filename.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/SoftwareDoneRight/comments/commentRss/142612.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SoftwareDoneRight/services/trackbacks/142612.aspx</trackback:ping>
        </item>
        <item>
            <title>Migrating SQL Server Broker Service (SSBS) Objects</title>
            <category>SQL</category>
            <link>http://geekswithblogs.net/SoftwareDoneRight/archive/2010/11/05/migrating-sql-server-broker-service-ssbs-objects.aspx</link>
            <description>&lt;p&gt;Originally posted on: &lt;a href='http://geekswithblogs.net/SoftwareDoneRight/archive/2010/11/05/migrating-sql-server-broker-service-ssbs-objects.aspx'&gt;http://geekswithblogs.net/SoftwareDoneRight/archive/2010/11/05/migrating-sql-server-broker-service-ssbs-objects.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;I recently migrated my dev environment to a new pc.  I moved over all the databases and reattached them.  Unfortunately, I soon discovered my SSBS services weren’t working. I was sending messages to my service, but nothing was showing up in the queue. I added logging and monitoring to the stored procs that act as an entry point to the services, and the stored procs I use for activation.   Still, nothing. &lt;/p&gt;  &lt;p&gt;When I ran the Broker Server Diagnostic tool (ssbdiagnose) (available in {Program files}\Microsoft Sql Server\100\tools\binn, it reported the following issues:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Service Broker Diagnostic Utility      &lt;br /&gt;The EXECUTE AS for the user dbo specified for activation on queue dbo.FulfillerQueue_Initiator_Mock cannot be impersonated due to an exception Cannot execute as the database principal because the principal "dbo" does not exist, this type of principal cannot be impersonated, or you do not have permission.&lt;/p&gt;    &lt;p&gt;     &lt;br /&gt;The EXECUTE AS for the user dbo specified for activation on queue dbo.FulfillerQueue_Target_Mock cannot be impersonated due to an exception Cannot execute as the database principal because the principal "dbo" does not exist, this type of principal cannot be impersonated, or you do not have permission.       &lt;br /&gt;&lt;/p&gt;    &lt;p&gt;Could not validate the SEND permission of user dbo on service FulfillerService_Target_Mock due to exception Cannot execute as the database principal because the principal "dbo" does not exist, this type of principal cannot be impersonated, or you do not have permission.      &lt;br /&gt;3 Errors, 0 Warnings&lt;/p&gt; &lt;/blockquote&gt; So what's going on here? I use integrated security on my dev machine, why is it complaining that the principal "dbo" doesn't exist?   &lt;p&gt;The problem is the result of moving my database from another server (my previous dev machine).  The underlying SID of the owner object is no longer valid in my new database.  Since the owner id of these objects don’t match the owner id of the currently executing user, SQL Server generated a permission exception.  &lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;The fix is pretty easy, I just needed to change the ownership of these objects back to the SA user:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;code&gt;ALTER&lt;/code&gt; &lt;code&gt;AUTHORIZATION&lt;/code&gt; &lt;code&gt;ON&lt;/code&gt; &lt;code&gt;DATABASE &lt;/code&gt;&lt;code&gt;[MYDATABASE] &lt;/code&gt;&lt;code&gt;TO&lt;/code&gt; &lt;code&gt;[SA]&lt;/code&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;  &lt;p&gt;&lt;code&gt;Running SSBDiagnose with the CONFIGURATION option generated happier results:&lt;/code&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;C:\Program Files\Microsoft SQL Server\100\Tools\Binn&amp;gt;ssbdiagnose.exe -d FulfillmentMessaging CONFIGURATION FROM SERVICE FulfillerService_Initiator_Mock TO SERVICE Fulfiller Service_Target_Mock ON CONTRACT FulfillerContract ENCRYPTION OFF      &lt;br /&gt;Microsoft SQL Server 10.0.2531.0       &lt;br /&gt;Service Broker Diagnostic Utility       &lt;br /&gt;&lt;strong&gt;0 Errors, 0 Warnings&lt;/strong&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;With my permissions errors resolved, my SSBS services were working once again.&lt;/p&gt; &lt;img src="http://geekswithblogs.net/SoftwareDoneRight/aggbug/142609.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ChrisD</dc:creator>
            <guid>http://geekswithblogs.net/SoftwareDoneRight/archive/2010/11/05/migrating-sql-server-broker-service-ssbs-objects.aspx</guid>
            <pubDate>Fri, 05 Nov 2010 20:58:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/SoftwareDoneRight/comments/142609.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/SoftwareDoneRight/archive/2010/11/05/migrating-sql-server-broker-service-ssbs-objects.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/SoftwareDoneRight/comments/commentRss/142609.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SoftwareDoneRight/services/trackbacks/142609.aspx</trackback:ping>
        </item>
        <item>
            <title>ASP.NET Data Binding from a Latebound IEnumerable&amp;lt;T&amp;gt;</title>
            <category>Visual Studio</category>
            <link>http://geekswithblogs.net/SoftwareDoneRight/archive/2010/10/08/asp.net-data-binding-from-a-latebound-ienumerablelttgt.aspx</link>
            <description>&lt;p&gt;Originally posted on: &lt;a href='http://geekswithblogs.net/SoftwareDoneRight/archive/2010/10/08/asp.net-data-binding-from-a-latebound-ienumerablelttgt.aspx'&gt;http://geekswithblogs.net/SoftwareDoneRight/archive/2010/10/08/asp.net-data-binding-from-a-latebound-ienumerablelttgt.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Many of the examples of databinding use datasource or objectsource controls.  I prefer to databind from the code-behind.  I feel I have finer control over how to data is prepared before I load it.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;The downside to doing this “late binding” of the data, and I can’t use the strongly typed names in my declarative markup.  The following code fails because the compiler can’t resolve the “Products”  reference. &lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:8fbf433c-a0af-4c2d-b6ff-d46592076b9a" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Code Snippet&lt;/div&gt; &lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt; &lt;ol style="background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;asp&lt;/span&gt;&lt;span style="color:#0000ff"&gt;:&lt;/span&gt;&lt;span style="color:#a31515"&gt;DataList&lt;/span&gt; &lt;span style="color:#ff0000"&gt;ID&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="DataList1"&lt;/span&gt; &lt;span style="color:#ff0000"&gt;runat&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="server"&lt;/span&gt; &lt;span style="color:#ff0000"&gt;RepeatColumns&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="1"&lt;/span&gt; &lt;span style="color:#ff0000"&gt;DataSource&lt;/span&gt;&lt;span style="color:#0000ff"&gt;='&lt;/span&gt;&lt;span style="background:#ffee62"&gt;&amp;lt;%&lt;/span&gt;#Products&lt;span style="background:#ffee62"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="color:#0000ff"&gt;'&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;instead, you must use the Eval() method of the Databinder to resolve the references.  The following works fine for any type of binding (late or early):&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:d18bcb38-c309-47cc-ad64-47bfbf5d71f9" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Code Snippet&lt;/div&gt; &lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt; &lt;ol style="background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;asp&lt;/span&gt;&lt;span style="color:#0000ff"&gt;:&lt;/span&gt;&lt;span style="color:#a31515"&gt;DataList&lt;/span&gt; &lt;span style="color:#ff0000"&gt;ID&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="DataList1"&lt;/span&gt; &lt;span style="color:#ff0000"&gt;runat&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="server"&lt;/span&gt; &lt;span style="color:#ff0000"&gt;RepeatColumns&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="1"&lt;/span&gt; &lt;span style="color:#ff0000"&gt;DataSource&lt;/span&gt;&lt;span style="color:#0000ff"&gt;='&lt;/span&gt;&lt;span style="background:#ffee62"&gt;&amp;lt;%&lt;/span&gt;#DataBinder.Eval(Container.DataItem,"Products")&lt;span style="background:#ffee62"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="color:#0000ff"&gt;'&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;Happy Coding!&lt;/p&gt; &lt;img src="http://geekswithblogs.net/SoftwareDoneRight/aggbug/142193.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ChrisD</dc:creator>
            <guid>http://geekswithblogs.net/SoftwareDoneRight/archive/2010/10/08/asp.net-data-binding-from-a-latebound-ienumerablelttgt.aspx</guid>
            <pubDate>Fri, 08 Oct 2010 14:17:50 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/SoftwareDoneRight/comments/142193.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/SoftwareDoneRight/archive/2010/10/08/asp.net-data-binding-from-a-latebound-ienumerablelttgt.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/SoftwareDoneRight/comments/commentRss/142193.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SoftwareDoneRight/services/trackbacks/142193.aspx</trackback:ping>
        </item>
        <item>
            <title>Using ThreadPoolHelper Syntax</title>
            <category>Visual Studio</category>
            <link>http://geekswithblogs.net/SoftwareDoneRight/archive/2010/09/28/using-threadpoolhelper-syntax.aspx</link>
            <description>&lt;p&gt;Originally posted on: &lt;a href='http://geekswithblogs.net/SoftwareDoneRight/archive/2010/09/28/using-threadpoolhelper-syntax.aspx'&gt;http://geekswithblogs.net/SoftwareDoneRight/archive/2010/09/28/using-threadpoolhelper-syntax.aspx&lt;/a&gt;&lt;/p&gt;&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:e8d2776a-8935-40a9-a739-341471212f3d" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Code Snippet&lt;/div&gt; &lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt; &lt;ol style="background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;"&gt; &lt;li&gt;ThreadPoolHelper.QueueUserWorkItem(arg1, arg2, arg3,&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                                          (localArg1, localArg2, localArg3) =&amp;gt;&lt;/li&gt; &lt;li&gt;                                          {&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                                              &lt;span style="color:#008000"&gt;/* code block */&lt;/span&gt;&lt;/li&gt; &lt;li&gt;                                          });&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;img src="http://geekswithblogs.net/SoftwareDoneRight/aggbug/142014.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ChrisD</dc:creator>
            <guid>http://geekswithblogs.net/SoftwareDoneRight/archive/2010/09/28/using-threadpoolhelper-syntax.aspx</guid>
            <pubDate>Tue, 28 Sep 2010 15:06:19 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/SoftwareDoneRight/comments/142014.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/SoftwareDoneRight/archive/2010/09/28/using-threadpoolhelper-syntax.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/SoftwareDoneRight/comments/commentRss/142014.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SoftwareDoneRight/services/trackbacks/142014.aspx</trackback:ping>
        </item>
        <item>
            <title>Evaluating Environment.SpecialFolders.Programs</title>
            <link>http://geekswithblogs.net/SoftwareDoneRight/archive/2010/09/27/evaluating-environment.specialfolders.programs.aspx</link>
            <description>&lt;p&gt;Originally posted on: &lt;a href='http://geekswithblogs.net/SoftwareDoneRight/archive/2010/09/27/evaluating-environment.specialfolders.programs.aspx'&gt;http://geekswithblogs.net/SoftwareDoneRight/archive/2010/09/27/evaluating-environment.specialfolders.programs.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;I’m posting this because I never seem to be able to recall this value when I need it.  Under Windows 7:&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;Environment.SpecialFolders.Programs resolves to: C:\Users\[username]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs&lt;/p&gt; &lt;img src="http://geekswithblogs.net/SoftwareDoneRight/aggbug/141999.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ChrisD</dc:creator>
            <guid>http://geekswithblogs.net/SoftwareDoneRight/archive/2010/09/27/evaluating-environment.specialfolders.programs.aspx</guid>
            <pubDate>Mon, 27 Sep 2010 20:45:53 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/SoftwareDoneRight/comments/141999.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/SoftwareDoneRight/archive/2010/09/27/evaluating-environment.specialfolders.programs.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/SoftwareDoneRight/comments/commentRss/141999.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/SoftwareDoneRight/services/trackbacks/141999.aspx</trackback:ping>
        </item>
    </channel>
</rss>