.net

Template Toolkit for .NET

Friday, June 12th, 2009 | Software | Comments Off

A while back I got the urge the waste time on yet another project. This time, it’s a version of Template Toolkit for .NET. As usual, you can find the project on GitHub.

Not knowing anything about what it takes to convert a template language to .NET I started from ground up learning how to use ANTLR to create a lexer/parser automatically from a grammar definition. As if that wasn’t enough, my parser output is an Abstract Syntax Tree, which I then use another grammar to template it into C# code using StringTemplate templates, which ANTLR supports natively.

It’s slow going, but I’m learning a lot along the way. At some point I’m going to output VB.NET and it still needs a lot of work for compilation, dll caching and such. The code is in a pre beta state, but it does support basic GET/SET/DEFAULT/IF statements and I’m slowly adding more as I get more comfortable with ANTLR.

Tags: , , , , , ,

Always Set Application Name In SqlClient Connection Strings

Friday, February 13th, 2009 | Manifesto | Comments Off

If you’re using connection strings on the web, set Application Name to the domain name. If you’re using connection strings with an executable, set Application Name to the executable name. If you have to use SQL Profiler to diagnose performance issues, it will be easier to filter out a specific application or web site.

<connectionStrings>
  <add name="LocalSqlServer" connectionString="... Application Name=mywebsite.com;" />
  <add name="LocalSqlServer" connectionString="... Application Name=myapp.exe" />
</connectionStrings>

Tags: , , ,

ConfigurationElementCollection Gotcha

Saturday, November 1st, 2008 | Software | Comments Off

Here’s a fun way to waste 2 hours of your life. I was writing a custom config section, and trying to figure out why this wasn’t throwing a duplicate key error:
› Continue reading

Tags: , ,

Links

Meta

Search