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"))
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")
 s => s["Name"].Value,
 s => s["ColumnName"].Value
 public static readonly Dictionary<NodeType, string> LookupTableByType;
 public static readonly Dictionary<NodeType, Dictionary<string, string>> Tables;

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
 ,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 <> ''
 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 FBI anti-piracy notice

With 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 fat internet connection and server.  Come sites are already doing it – take a look at ubuntu (a linux distro) for a non-warez download.  With ever more users becoming familiar with bittorrent and other torrent clients as warez/serials/cracks sites get shut down, it makes sense that the technology will be used for legal downloads as well. Plenty of usenet/newsreader users have already made the switch.

BitTorrent torrent download client

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

C# Generic types

Code snippet:


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

ClearTrace – Free SQL Server trace analyser

Download: 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 after checking it and pick properties. Fill in compatible OS properties to fool the setup program. Save. Run the setup program while the Microsoft Application Verifier still running.

Operating System Version Number Other Information
Windows 1.0 1.04 
Windows 2.0 2.11 
Windows 3.0 3 
Windows NT 3.1 3.10.528 
Windows for Workgroups 3.11 3.11 
Windows NT Workstation 3.5 3.5.807 
Windows NT Workstation 3.51 3.51.1057 
Windows 95 4.0.950 
Windows NT Workstation 4.0 4.0.1381 
Windows 98 4.1.1998 
Windows 98 Second Edition 4.1.2222 
Windows Me 4.90.3000 
Windows 2000 Professional 5.0.2195 
Windows XP 5.1.2600 Current SP3
Windows XP Professional x64 Edition 5.2.3790 
Windows Vista 6.0.6000 Current Version changed to 6.0.6002 with SP2
Windows 7 6.1.7600 RTM

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

How do I use my new HP printer without installing the HP Yahoo toolbar?

Oh wait, I can’t. All I wanted was a printer. A also notice I can’t install the printer without having internet – so their phoning home too. Oh, and did I mention the installer crashes if I choose “minimum install”?

Just my rant about another company that can’t make a buck the honest way anymore. How about those ink refill prices, hu?

February 20, 2011 · admin · No Comments
Posted in: Thoughs

Turn off windows zone security feature “unblock application”

  1. In Windows Vista/7/2K8R2, Click Start.
  2. In the Search box, Run box or console window type: GPEDIT.MSC to bring up the Group Policy Object editor.
  3. 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 to ENABLE the policy called “Do not preserve zone information in file attachments”.

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 Active Directory, and are listed in the AD catalog
  • Message routing is only supported with public queues
  • MSMQ must be installed on ALL clients sending messages
  • Clients can’t push directly to a remote queue – messages are queued locally
  • Once the journal is full, no more messages can be written to it
  • Messages can not be expired from the journal queue (but they can form regular queues)
  • Messages cannot be received transactionally from a remote queue (MS work-around)
  • Private queues cannot be created remotely
  • Remote private queues cant be enumerated
  • Performance counters are only available for queues that have active sessions (active queues)
  • There is no concept of publisher/subscriber
  • Message delivery expiry is global to a transaction (makes custom journaling tough)
  • Cannot backup an individual queue (but can backup and restore the entire MSMQ)
  • Cannot backup public queues

List of limitations form MSDN:

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