Using NHaml, from Source

The NHaml project is a super simple view engine that can be used with ASP.NET MVC. Unfortunately, like many young projects, it has changed so much in recent months, many articles on it are out of date. In fact, I don’t think I have seen any setup guides that still actually work. So, here is how to setup NHaml on SVN revision 98. Couple of prerequisites before you get started. I am assuming you have TortoiseSVN and ASP.NET MVC Here is the section outline so you can jump a head if you already have some of the steps done. »

About time, Amazon EC2 Console

Elasticfox was good while it lasted, but I definitely think Amazon took a step in the right direction with their console. Now almost anyone can play with EC2 without much of a commitment. »

Suppress .NET Compiler Warnings

Every now and again, the compiler will throw a warning message for a known issue. For example, some member variable may be set by reflection or an ORM tool like NHibernate. Using the pragma directive can easily solve these issues. public class PragmaExample { #pragma warning disable 0649 private int neverSetVariable; #pragma warning restore 0649 } To figure out what warning to disable, just right click on the warning. Then click on Show Error Help, which will bring up a dialog where you should select to view to show online help. »

2008 in review

2008 was an awesome year for me. Looking back on things, I can’t really believe what all has happened. Wrote my first automated test Setup my first continuous integration server Lead my first team through a few releases Adopted Scrum as agile process Learned a ton of coding best practices Joined the dark side as a manager Experienced an IPO from the inside Attended my first conference And a ton more If I had to sum up 2008, it was a foundational year. »

Brian Hartsock

Taking a break

The past week is probably the longest I have gone without booting up a computer. I was traveling, visiting friends and family, and celebrating Christmas. But I was also sitting on the couch watching TV doing nothing. One thing that I realized is breaks from work are a good thing, especially when you love what you do. I love software development, so I tend to do it at work, as well as at home. »

Brian Hartsock

Adapting and Changing

I wrote another post on the Mailtrust blog. Check it out. For anyone developing a web or desktop app, there are a lot of challenges in UI design. This post tried to show how the Control Panel team dealt with some of those challenges and are constantly evolving into a better application. »

Quick and Dirty SQL Server Slow Query Log

Optimizing SQL server can be a daunting task. There is a fairly large learning curve, and knowing where to start can be a problem. Over the weekend, I read over a great article on query optimization for SQL Server and found the greatest query ever. SELECT TOP 20 SUBSTRING(qt.text, (qs.statement_start_offset/2)+1, ((CASE qs.statement_end_offset WHEN -1 THEN DATALENGTH(qt.text) ELSE qs.statement_end_offset END - qs.statement_start_offset)/2)+1), qs.execution_count, qs.total_logical_reads, qs.last_logical_reads, qs.min_logical_reads, qs.max_logical_reads, qs.total_elapsed_time, qs.last_elapsed_time, qs.min_elapsed_time, qs.max_elapsed_time, qs.last_execution_time, qp.query_plan FROM sys.dm_exec_query_stats qs CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) qt CROSS APPLY sys.dm_exec_query_plan(qs.plan_handle) qp WHERE qt.encrypted=0 ORDER BY qs.total_logical_reads DESC This query will list the top 20 most read intensive queries. »

nvarchar vs. varchar in SQL Server, BEWARE

I discovered one of the scariest performance problems with SQL Server I have ever seen today. This problem is so easy to over look, yet extremely detrimental to database performance. Consider the following table. BEGIN TRANSACTION GO CREATE TABLE dbo.Users ( id int NOT NULL, username varchar(50) NOT NULL ) GO ALTER TABLE dbo.Users ADD CONSTRAINT PK_Users_id PRIMARY KEY CLUSTERED ( id ) GO CREATE UNIQUE NONCLUSTERED INDEX IX_Users_username ON dbo.Users ( username ) GO COMMIT Now look at the query plans of the following queries, that differ by a single character. »