This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @current_tracefilename VARCHAR(500); | |
DECLARE @0_tracefilename VARCHAR(500); | |
DECLARE @indx INT; | |
SELECT @current_tracefilename = path | |
FROM sys.traces | |
WHERE is_default = 1; | |
SET @current_tracefilename = REVERSE(@current_tracefilename); | |
SELECT @indx = PATINDEX('%\%', @current_tracefilename); | |
SET @current_tracefilename = REVERSE(@current_tracefilename); | |
SET @0_tracefilename = LEFT(@current_tracefilename, LEN(@current_tracefilename) - @indx) + '\log.trc'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT SUM(p.rows) as [cnt] | |
FROM sys.partitions AS p | |
INNER JOIN sys.tables AS t ON p.[object_id] = t.[object_id] | |
WHERE p.index_id = 1 /* clustered index */ | |
AND t.name = N'tablename'AND t.schema_id = schema_id('dbo'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Add-WebAppIPRestrictions { | |
Param( | |
[Parameter(Position = 0, Mandatory = $true, HelpMessage = "WebApp name", ValueFromPipeline = $false)] | |
$WebApp, | |
[Parameter(Position = 1, Mandatory = $true, HelpMessage = "Resource group name", ValueFromPipeline = $false)] | |
$ResourceGroupName, | |
[Parameter(Position = 2, Mandatory = $true, HelpMessage = "Restricted IP address: 1.1.1.1/1 (including mask)", ValueFromPipeline = $false)] | |
$IPAddress, | |
[Parameter(Position = 4, Mandatory = $true, HelpMessage = "Restricted IP Priority", ValueFromPipeline = $false)] | |
$Priority, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[BuildActivity(HostEnvironmentOption.All)] | |
public sealed class ParseResharperCLI : CodeActivity | |
{ | |
// Define an activity input argument of type string | |
public InArgument<string> PathToXml { get; set; } | |
public OutArgument<string[]> Warnings { get; set; } | |
public OutArgument<string[]> Errors { get; set; } | |
// If your activity returns a value, derive from CodeActivity<TResult> | |
// and return the value from the Execute method. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IEnumerable<T> TraverseTree<T>(this T parent, Func<T, IEnumerable<T>> getChildren) | |
{ | |
yield return parent; | |
foreach (var child in getChildren(parent)) | |
{ | |
foreach (var item in child.TraverseTree(getChildren)) | |
{ | |
yield return item; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected string GetPropertyName<T>(Expression<Func<T>> propertyExpression) | |
{ | |
if (propertyExpression == null) | |
{ | |
throw new ArgumentNullException("propertyExpression"); | |
} | |
var body = propertyExpression.Body as MemberExpression; | |
if (body == null) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT C.TABLE_CATALOG [PKTABLE_QUALIFIER], | |
C.TABLE_SCHEMA [PKTABLE_OWNER], | |
C.TABLE_NAME [PKTABLE_NAME], | |
KCU.COLUMN_NAME [PKCOLUMN_NAME], | |
C2.TABLE_CATALOG [FKTABLE_QUALIFIER], | |
C2.TABLE_SCHEMA [FKTABLE_OWNER], | |
C2.TABLE_NAME [FKTABLE_NAME], | |
KCU2.COLUMN_NAME [FKCOLUMN_NAME], | |
RC.UPDATE_RULE, | |
RC.DELETE_RULE, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public delegate void UseServiceDelegate<T>(T proxy); | |
public interface IService<T> | |
{ | |
void Use(UseServiceDelegate<T> codeBlock); | |
} | |
public class Service<T> : IService<T> | |
{ | |
private readonly ChannelFactory<T> _channelFactory; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public sealed class RightTapped | |
{ | |
#region Properties | |
#region Command | |
/// | |
/// GetCommand | |
/// | |
/// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class DateTimeExtensions | |
{ | |
public static bool IsToday(this DateTime currentDate) | |
{ | |
return (currentDate >= DateTime.Today && currentDate < DateTime.Today.AddHours(24)); | |
} | |
} |