Monthly Archives: November 2008

GetSubDomain

private static string GetSubDomain(Uri url){ if (url.HostNameType == UriHostNameType.Dns) { string host = url.Host; if (host.Split('.').Length > 2) { int lastIndex = host.LastIndexOf("."); int index = host.LastIndexOf(".", lastIndex – 1); return host.Substring(0, index); } } return null;} From: http://www.webpronews.com/expertarticles/2006/11/30/retrieve-subdomain-from-a-url-in-c Advertisements

Posted in ASP.NET | Leave a comment

script to shink log

First switch to that database,then run this: ================================== DECLARE @DB varchar(100) SET @DB = DB_NAME() BACKUP LOG @DB WITH TRUNCATE_ONLY DBCC SHRINKDATABASE (@DB, TRUNCATEONLY ) ================================== It worked very well for me in SQL 2005, but not for 2008 any … Continue reading

Posted in SQL | Leave a comment