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
USE dbname; | |
SELECT s.name | |
FROM sys.schemas s | |
WHERE s.principal_id = USER_ID('username'); | |
ALTER AUTHORIZATION ON SCHEMA::db_owner TO dbo; | |
-- from http://blog.sqlauthority.com/2011/12/26/sql-server-fix-error-15138-the-database-principal-owns-a-schema-in-the-database-and-cannot-be-dropped/ |
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
static Type[] GetGenericArgumentsForBaseType(Type givenType, Type genericType) | |
{ | |
if (genericType.IsInterface) | |
{ | |
var interfaceTypes = givenType.GetInterfaces(); | |
foreach (var it in interfaceTypes) | |
{ | |
if (it.IsGenericType && it.GetGenericTypeDefinition() == genericType) | |
return it.GetGenericArguments(); | |
} |
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
find -iname "*.csproj" -exec grep -n "MyCompany.Assembly" /dev/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
public static class HtmlTruncator | |
{ | |
public static string LimitOnWordBoundary(string str, int maxLength, string ellipses = "...") | |
{ | |
XmlDocument doc = new XmlDocument(); | |
XmlParserContext context = new XmlParserContext(doc.NameTable, new XmlNamespaceManager(doc.NameTable), null, XmlSpace.Preserve); | |
XmlTextReader reader = new XmlTextReader("<xml>" + str + "</xml>", XmlNodeType.Document, context); | |
bool shouldWriteEllipses; |
NewerOlder