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
//Easy Background tasks in ASP.NET projects | |
//Inspiration from http://blog.stackoverflow.com/2008/07/easy-background-tasks-in-aspnet/ | |
//This code is added into the Global.asax file. In the Application_Start() method | |
private static CacheItemRemovedCallback OnCacheRemove = null; | |
protected void Application_start() | |
{ | |
//The register code that is put in here | |
//Here is where you add all the tasks you want to start on application start |
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 b.Id AS BusinessId, COALESCE(subCategoryImage.Id, parentCategoryImage.Id) AS ImageAssetId, COALESCE(subCategoryImage.CategoryId, parentCategoryImage.CategoryId) AS CategoryId, b.Name, COALESCE(subCategoryImage.FileName, parentCategoryImage.FileName) AS FileName | |
FROM Businesses b | |
OUTER APPLY ( | |
SELECT TOP 1 * | |
FROM ImageAssets | |
WHERE CategoryId = b.CategoryId | |
AND Deleted = 0 | |
ORDER BY CHECKSUM(NEWID(), b.id) & 2147483647 | |
) subCategoryImage | |
OUTER APPLY ( |
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 DISTINCT so.name FROM syscomments sc INNER JOIN sysobjects so on sc.id=so.id WHERE sc.text LIKE '%utility%' |
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 p.Name, substring | |
((SELECT ', ' + k.Number FROM dbo.Keys k | |
JOIN dbo.Keys_Assignments ka ON ka.KeyID = k.KeyID | |
WHERE ka.PersonID = p.PersonID | |
FOR XML PATH('')), 2, 1000) [Keys] | |
FROM dbo.People p | |
SELECT k.Number, SUBSTRING | |
((SELECT '; ' + p.Name FROM dbo.People p |
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
### Keybase proof | |
I hereby claim: | |
* I am andyconlisk on github. | |
* I am kingpancake (https://keybase.io/kingpancake) on keybase. | |
* I have a public key ASALMMqf4SM6CNyfc95F_w2_aYcKnvvdEA9bENXjbTLrlAo | |
To claim this, I am signing this object: |
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
Application.Core | |
This namespace should contain all functionality that is not expansive enough to be in its own project but are required by multiple consumers/projects | |
- Logging and other cross access functions | |
- Generic helper classes for logging. | |
- Non-domain specific, independent functionality, and Profiling. Such as .NET Extension methods. | |
Application.Domain | |
This namespace contains the domain objects. | |
- Domain Objects (POCO), Shared data transfer objects, Models, ViewModels, etc | |
- Business logic for Validators, Filters, Factories, Regular expressions | |
Application.Data |
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 databate table dbo.Test with columns Id, FirstName, LastName, TransactionNumber, LastUpdatedDate | |
-- Select rows that are duplicates without using LastUpdatedDate | |
-- If needed can insert into a backup/archive table | |
SELECT t.Id, t.FirstName, t.LastName, t.TransactionNumber, t.LastUpdatedDate | |
FROM dbo.Test t | |
LEFT OUTER JOIN ( | |
SELECT MIN(Id) as Id, | |
FirstName, LastName, TransactionNumber | |
FROM dbo.Test |
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
namespace ComplexEntityFramework | |
{ | |
using System.Collections.Generic; | |
using System.ComponentModel.DataAnnotations; | |
using System.Data.Entity; | |
public class Model1 : DbContext | |
{ | |
public Model1() | |
: base("name=Model1") |
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 generateUUID() { | |
var d = new Date().getTime(); | |
if (window.performance && typeof window.performance.now === "function") { | |
d += performance.now();; //use high-precision timer if available | |
} | |
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { | |
var r = (d + Math.random() * 16) % 16 | 0; | |
d = Math.floor(d / 16); | |
return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16); | |
}); |