Category Archives: CodeMinder

Force a SQL Restore

Really tired of having to google this and piece it together every time I want it, so I’m posting it here. .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, “Courier New”, courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } … Continue reading

Posted in CodeMinder, SQL | Leave a comment

Write MSMQ Messages from PowerShell

This PowerShell script sends a message to an MSMQ. I did it this particular way because NServiceBus can consume messages sent like this. [Reflection.Assembly]::LoadWithPartialName(“System.Messaging”); $queueName = ‘.\Private$\your.queue.name’; $queue = new-object System.Messaging.MessageQueue $queueName; $utf8 = new-object System.Text.UTF8Encoding; $tran = new-object System.Messaging.MessageQueueTransaction; … Continue reading

Posted in CodeMinder, MSMQ, PowerShell, Programming | 1 Comment

Read MSMQ Messages from PowerShell

This script dumps the contents of an MSMQ to the console. This one dumps the Journal contents of a private queue; of course you’ll have to adjust that line for your queue. [Reflection.Assembly]::LoadWithPartialName(“System.Messaging”) $queueName = ‘.\Private$\your.queue.name\Journal$’; $queue = new-object System.Messaging.MessageQueue … Continue reading

Posted in CodeMinder, MSMQ, PowerShell, Programming | Leave a comment

Update a SQL table’s XML value to insert a node

Sometimes a snippet of example code is all that’s needed: update MyTable set XmlColumn.modify(‘ insert <Description>This is a description</Description> as last into (/xpath/to/parent)[1] ‘) where SomeValue = ‘whatever’ .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, “Courier New”, … Continue reading

Posted in CodeMinder, Programming, SQL, XML | Leave a comment

Running Multiple AJAX Requests in Parallel

In some JavaScript I needed several independent items from the web server, and so I abstracted a solution for this into a jQuery plugin. After building the plugin I searched Stack Overflow and found a relevant question with some non-generalized … Continue reading

Posted in CodeMinder, Programming | Leave a comment

log4net Template for CodeRush

If you use log4net for logging in the traditional way you end up having a lot of classes with the following line: Private Shared mLog As log4net.ILog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType) This is the VB version of the recommendation from the log4net … Continue reading

Posted in CodeMinder, CodeRush | Leave a comment

Drop a SQL column default constraint that has been implicitly named

CodeMinder: to remind myself of stuff that I usually have to look up each time I do it. Notice the unnamed default in the following line: alter table test add col1 int not null default 1 This creates a default … Continue reading

Posted in CodeMinder, Programming, SQL | Leave a comment

Update a SQL table’s XML value to remove nodes

CodeMinder: to remind myself of stuff that I usually have to look up each time I do it. To delete all PersonAlternativeName nodes from XmlColumn of the People table: with xmlnamespaces( ‘http://mydomain.com/person/extension/0.1′ as px) update People set XmlColumn.modify(‘delete //px:PersonAlternateName’)

Posted in CodeMinder, Programming, SQL, XML | Leave a comment

Select multiple XML nodes out of each row in a SQL table

CodeMinder: to remind myself of stuff that I usually have to look up each time I do it. If a People table has a column named XML, and the XML column may specify multiple PersonAlternativeName entities, then to get all … Continue reading

Posted in CodeMinder, SQL, XML | Leave a comment