web 2.0

Building Better MVC Code with T4MVC

If you are a ASP.NET web developer than chances are that you have heard of or dealt with problems related to “Magic Strings”. Magic strings are taboo because they introduce a degree of fragility in your code due to the fact that they are not strongly typed. The classic example, is referencing a View Name or Route in your controller action using a string value: public class HomeController : Controller { public ActionResult Index() { return RedirectToAction("Foo"); } public ActionResult Foo() { return View(); } } As you would expect, when the Index action is invoked the user gets redirected to “Foo”. Unfortunately, if I rename the “Foo” method to “Bar” my code will still compile but it will ultimately fail at runtime. This is all due to the fact that are RedirectToAction method is using the magic string “Foo” which is not strongly typed and therefore not caught by the compiler. As a workaround to this ... [More]

Error Handling in MVC with ELMAH

What is ELMAH? In case you have been living under a rock I will start this block post by giving you a basic introduction to ELMAH. If you already are familiar with ELMAH then just skip to the next section. The following description was taken verbatim from the ELMAH website… ELMAH (Error Logging Modules and Handlers) is an application-wide error logging facility that is completely pluggable. It can be dynamically added to a running ASP.NET web application, or even all ASP.NET web applications on a machine, without any need for re-compilation or re-deployment. Once ELMAH has been dropped into a running web application and configured appropriately, you get the following facilities without changing a single line of your code: Logging of nearly all unhandled exceptions. A web page to remotely view the entire log of recoded exceptions. A web page to remotely view the full details of any one logged exception. In many cases, you can review the original yellow screen of deat... [More]

New Job Equals New Toys

I recently renounced my role as Database Administrator and accepted a new job as Chief Web Developer. I am really excited about the opportunity because I get to write ASP.NET MVC apps on a full time basis. Not too many people get to do what they love for a living so I consider myself fortunate. As a result of switching careers and companies, I had to turn in my Blackberry Bold. Since the new job does not require after hours support I finally had the opportunity to buy the phone that I wanted instead of the phone that the company provided for me. Since I was in the market for a new phone, I spent a fair amount of time researching the various plans and phones that were available. Initially I was thinking about picking up an iPhone but I discovered a few key factors which pushed me towards getting a Android instead: 1. If you want to develop apps for the iPhone you need a Mac OS. In my humble opinion this is bullshit. 2. The iPhone's operating system is completely closed. It is being ... [More]