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 string EncodePassword(string pass, string salt) | |
{ | |
byte[] bytes = Encoding.Unicode.GetBytes(pass); | |
byte[] src = Convert.FromBase64String(salt); | |
byte[] dst = new byte[src.Length + bytes.Length]; | |
Buffer.BlockCopy(src, 0, dst, 0, src.Length); | |
Buffer.BlockCopy(bytes, 0, dst, src.Length, bytes.Length); | |
HashAlgorithm algorithm = HashAlgorithm.Create("SHA1"); | |
byte[] inArray = algorithm.ComputeHash(dst); | |
return Convert.ToBase64String(inArray); |
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 partial class HuntGroup : System.Web.UI.MasterPage | |
{ | |
private const string AntiXsrfTokenKey = "__AntiXsrfToken"; | |
private const string AntiXsrfUserNameKey = "__AntiXsrfUserName"; | |
private string _antiXsrfTokenValue; | |
protected void Page_Init(object sender, EventArgs e) | |
{ | |
// The code below helps to protect against XSRF attacks | |
var requestCookie = Request.Cookies[AntiXsrfTokenKey]; |
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 @TableName VARCHAR(MAX); | |
DECLARE @TableSchema VARCHAR(MAX); | |
DECLARE @result varchar(max); | |
SET @TableName = 'Contact'; -- your table name | |
SET @TableSchema = 'dbo'; -- your schema name | |
SET @result = ''; | |
SET @result = @result + 'using System;' + CHAR(13) + CHAR(13); |
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
SET QUOTED_IDENTIFIER OFF | |
GO | |
SET ANSI_NULLS OFF | |
GO | |
CREATE function A2ROMAN(@n int ) | |
--Converts an arabic numeral to roman, as a string. | |
returns VARCHAR(20) | |
as |
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 r.[RegistrationId], dc.[DigitalCodeId] | |
FROM | |
( | |
SELECT [RegistrationId], row_number() OVER (ORDER BY [RegistrationId]) AS row_num | |
FROM [dbo].[Registration] | |
WHERE [JobNumber] = 12897 AND [OrderNumber] = 5405 | |
) r | |
JOIN | |
( | |
SELECT [DigitalCodeId], row_number() OVER (ORDER BY [DigitalCodeId]) as row_num |
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
-- SQL Server string to date / datetime conversion - datetime string format sql server | |
-- MSSQL string to datetime conversion - convert char to date - convert varchar to date | |
-- Subtract 100 from style number (format) for yy instead yyyy (or ccyy with century) | |
SELECT convert(datetime, 'Oct 23 2012 11:01AM', 100) -- mon dd yyyy hh:mmAM (or PM) | |
SELECT convert(datetime, 'Oct 23 2012 11:01AM') -- 2012-10-23 11:01:00.000 | |
-- Without century (yy) string date conversion - convert string to datetime function | |
SELECT convert(datetime, 'Oct 23 12 11:01AM', 0) -- mon dd yy hh:mmAM (or PM) | |
SELECT convert(datetime, 'Oct 23 12 11:01AM') -- 2012-10-23 11:01:00.000 | |
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
-- ================================================================= | |
-- Create Stored Procedure Template for Windows Azure SQL Database | |
-- ================================================================= | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
-- ======================================================= | |
-- Author: Sinisa Petkovic | |
-- Create date: Nov 11, 2015 |
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 FirstName | |
, LastName | |
, Address1 | |
, Address2 | |
, City | |
, State | |
, PostalCode | |
, Country | |
, HomePhone |
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
INSERT INTO [TableName] | |
SELECT * | |
FROM OPENDATASOURCE | |
( | |
'SQLOLEDB','Data Source=XXX.XXX.XXX.XXX;User ID=USERNAME;Password=PASSWORD;' | |
).DATABASE_NAME.dbo.[TableName] | |
WHERE CouponId = @coupon_id; |
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
EXECUTE msdb.dbo.sysmail_add_account_sp | |
@account_name = 'DBMailAccount', | |
@email_address = 'test@test.com', | |
@replyto_address = 'noreply@test.com', | |
@display_name = 'SQL Server Agent Automated Mailer', | |
@mailserver_name = 'smtp.test.com', | |
@port = 587, | |
@username = 'user@test.com', | |
@password = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; | |
OlderNewer