C# Destructors and IDisposable

This week I found myself somewhat confused on when to use destructor. Originally I assumed that anytime you implement IDisposable you should have a destructor that calls Dispose(). This is not the case though. The only time you really need a destructor is when a class directly contains unmanaged resources, like file handles. A good example of when not to use a destructor is a wrapper class. For instance, if you have a database connection class wrapped with some sort of adapter class, the adapter class doesn’t need a destructor. »

How to actually use trigonometry in web applications

Disclaimer: my teammate Dellanoce actually coded this, but is too cool to blog, so I am blogging for him. Mailtrust has many different customers, some of which like to have their own branded control panel or webmail interface. We allow them to customize many different facets of the user interface, including colors. This has some unintended consequences though. Sometimes, a user might select a white font color on top of a white background. »

CallContext isn't the greatest thing since sliced bread

In ASP.NET, it is quite common to need to store information in the context of a single web request. For example, a NHibernate session should usually exist for one web request. HttpContext is the tool for accomplishing this. But what happens when you have code embedded in business logic that might not always be running in an ASP.NET web application? HttpContext isn’t valid, so you can’t use it. Why not use CallContext, since HttpContext uses this anyways? »

Using NMS

NMS is the .NET client library for using ActiveMQ, as well as other messaging systems. Unfortunately, it is the only complete one that I found, so using it isn’t really a choice (although I recommend coding your own STOMP client). I encountered many problems using it, but after working through them, everything seems to work. Problem #1 - Downloading Almost all the links to NMS point to Sprint.NET’s NMS build. If you notice the date in the link, the last time it looks to have been built is March 20, 2007. »

Tried and True

Today I had the task of removing a few entries from a CSV file based on another CSV file. It was only about 300 rows that needed to be removed in a file of about 2000 rows, so I could have manually done it in about an hour. Since it is Saturday, I decided to have fun, write a Perl script to do it even if it took longer than doing it manually. »

Policy Inject Me

I just started using the Policy Injection Application Block from Microsoft’s Enterprise library. At first, I thought it was worthless and overly complex. I was wrong. It is a very powerful programming tool that allows me to develop a lot faster and cleaner. Policy Injection is similar to aspect-oriented programming in that it helps to break away cross-cutting concerns (authorization, logging) from the actual business logic. And yes, I basically copied that from the documentation. »

YSlow

I know I am probably the last person on the web to find this, but YSlow is a sweet Firefox/Firebug plugin for analyzing web site performance. It basically analyzes the best practices Yahoo laid out for speeding up websites. Nifty tool, go download it. Word to Bulman who never informed me of it. »

Clash of the Titans

Ten years ago, Java was the next big thing. It had portability and was purely object oriented, both of which were needed at the time. Today I found an article discussing Sun’s recent acquisition of two Python developers. Their main goal is making Python work on the JVM. This go me thinking, is Java trying to play catch-up to .NET? Don’t get my wrong, I know Java is a very widely used platform, but what has really changed in the past few years with Java? »

Thoughts on ASP.NET

Originally, I had planned on blogging about each major ASP.NET 2.0 feature independently. Themes, Membership, Roles, ADO.NET, Controls, and many more were already on my list, but I began to realize I had the same thoughts on most of them. Although I still plan to give a detailed review of each feature, I wanted to go ahead on voice my opinions on ASP.NET. The Bad ASP.NET, in my opinion, attempts to provide a RAD environment for developing new applications. »

.NET Slave Blog

While googling for some ASP.NET answers, I came across one of the best blogs I have ever seen. Any aspiring ASP.NET programmer should read every single article on his site. Mads Kristensen is the man. He truly uses his blog to share the wealth of knowledge he has accumulated. »