Archive for the ‘Tech’ Category

Code to get SQL table and column schema from Entity Framework

  public static class Map { static Map() { var doc = new XmlDocument(); using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(“src.Admin.Entities.Model.msl”)) doc.Load(stream); //”urn:schemas-microsoft-com:windows:storage:mapping:CS” var nodes = doc.SelectNodes(“EntityTypeMapping”).Cast<XmlNode>(); LookupTableByType = nodes.ToDictionary( n => (NodeType)Enum.Parse(typeof(NodeType), n[“TypeName”].Value.Split(‘.’)[1], true), n => n.SelectSingleNode(@”MappingFragment/@StoreEntitySet’]”).Value ); Tables = nodes.ToDictionary( n => (NodeType)Enum.Parse(typeof(NodeType), n[“TypeName”].Value.Split(‘.’)[1], true), n => n.SelectNodes(“ScalarProperty”) .Cast<XmlNode>() .ToDictionary( s => s[“Name”].Value, s => […]

May 5, 2013 · admin · No Comments
Tags: , , ,  · Posted in: MSSQL, Tech

SQL to concatenate column values from multiple rows

  SELECT DISTINCT L2.Issue, substring( (SELECT ‘,’ + L1.Label AS [text()] FROM jira.label L1 WHERE L1.Issue = L2.Issue ORDER BY L1.Issue FOR XML PATH (”)) ,2 ,1000) [Labels]

March 27, 2013 · admin · No Comments
Posted in: MSSQL, Tech

SQL CTE to split a delimited string into a table

DECLARE @ListString varchar(8000) SET @ListString = ‘a,b,c,d’ DECLARE @List table (Item varchar(max)) ;with cte (item, list) as ( select cast(” as varchar(max)), @ListString union all select cast(left(list, charindex(‘,’,list+’,’)-1) as varchar(max)) item, stuff(list, 1, charindex(‘,’,list+’,’), ”) list from cte where list <> ” ) INSERT @List select item from cte where item <> ”

February 7, 2013 · admin · No Comments
Posted in: MSSQL, Tech

What’s next for free downloads after the fall of megaupload.com?

With megaupload.com being shut down, it is quite possible that more will follow. HotFile, FileSonic, UploadKing, UploadHere, FileServe, DepositFiles, xShare, wFiles not to mention a hundred others could all go any day now. So what’s next? Torrents! Torrents may be the only way left to host files on the internet without needing to have a […]

January 23, 2012 · admin · No Comments
Posted in: Free Software, Tech, Thoughs

C# Generic types

Code snippet: typeof(GenerticType<>).MakeGenericType(typeof(TParam1));

August 18, 2011 · admin · No Comments
Posted in: ASP.NET, Tech

ClearTrace – Free SQL Server trace analyser

Download: ClearTrace Site: http://www.scalesql.com/cleartrace/

August 18, 2011 · admin · No Comments
Posted in: MSSQL, Tech

Bypass OS version check for applications and installer

Download and install Microsoft Application Verifier tool. This tool is free and you can google for it. Run the tool, pick “Add Application” from the file menu and browse to the software setup executable program you are trying to install. Add it. Open the “Compatibility” node on the right and check HighVersionLie. Right click it […]

May 12, 2011 · admin · No Comments
Posted in: Free Software, Tech

Turn off windows zone security feature “unblock application”

In Windows Vista/7/2K8R2, Click Start. In the Search box, Run box or console window type: GPEDIT.MSC to bring up the Group Policy Object editor. Navigate to User Configuration > Administrative Templates > Windows Components > Attachment Manager. Here you will find a couple of policies related to this feature, but to disable it you’ll want […]

February 17, 2011 · admin · No Comments
Posted in: Tech

MSMQ Message Queuing Problems

The results of a recent MSMQ evaluation. Lets assume for use in an enterprise, where there will be a dedicated remote MSMQ cluster configured for high availability and reliability. Microsoft clustering is the only option, requiring Windows Server Enterprise licensing Microsoft clustering requires a shared SAN( or  iSCSI at a performance cost) Public queues require […]

December 13, 2010 · admin · No Comments
Posted in: Tech

MSSQL TODAY Function

DATEADD(dd, DATEDIFF(dd, 0, GETDATE()), 0) roughly twice as efficient as: CONVERT(DATETIME, CONVERT(varchar(10),@time, 120))

October 27, 2010 · admin · No Comments
Posted in: MSSQL