Thursday, March 13, 2008

Type inference in .NET 3.0

One of the things I am having a hard time wrapping my head around is why one of the recommendations of Resharper 4.0 is to implicitly type all local variables. It goes against my anal retentive nature for clean, easy to read code.

The following article tries to explain the benefits of this practice, though I’m not sure they have me convinced though I have, at times, found myself annoyed with the redundant declarations of a new variable

i.e.


Dictionary<SearchCriteriaType, SearchCriteriaDisplay> criteriaDisplays = new Dictionary<SearchCriteriaType, SearchCriteriaDisplay>();


Can be shortened to


var criteriaDisplays = new Dictionary<SearchCriteriaType, SearchCriteriaDisplay>();


I guess that makes the code less cluttered. But is life really that much bad with the previous example that the Resharper folks found the need to suggest that it is now best practice?

http://www.programmersheaven.com/2/CSharp3-1

Wednesday, March 12, 2008

Visual Studio 2008 Error after upgrade

I needed some capabilities from VS2008 DB Edition to go with my VS2008 TA (Team Architect, not whatever other acronym starts with T&A), so I slapped a copy of that onto my machine this morning.

However, when I fired up VS2008, it started briefly, and then crashed. It did this a few times in a row, and I checked the event log.


.NET Runtime version 2.0.50727.1434 - Fatal Execution Engine Error (79FEC5F0) (80131506)


Ruh-Roh Shaggy. Time to reboot.

Try it again. Same problem.

We're in trouble now, Scoob.

After searching the web for a bit, I came across starting the app in SafeMode. with the/safemode switch. That worked. I let the app load up, then I closed it back down, removed the /safemode switch, and presto, back in business.

I think it has to do with my recent installation of Resharper 4.0 EAP, since the app was dying trying to load the toolbox items. We'll see if it happens again the next time I do an upgrade.

Tuesday, March 11, 2008

SQL Thief - Last Modified Stored Procs

I will admit that what I am about to put here, I stole from Pinal Dave's site. Nonetheless, I use these scripts quite frequently, but have a hard time finding them on line (you have to remember just the right search word, and I always forget to bookmark them). So for my quick reference

Here's how to get a list of all stored procedures modified in the last x days


SELECT name
FROM sys.objects
WHERE type = 'P'
AND DATEDIFF(D,modify_date, GETDATE()) < 7 --Change 7 to any other day value.



The following script will provide name of all the stored procedure which were created in last 7 days, they may or may not be modified after that.


SELECT name
FROM sys.objects
WHERE type = 'P'
AND DATEDIFF(D,create_date, GETDATE()) < 7 --Change 7 to any other day value

Monday, March 10, 2008

Dude, you're such a Tool

Yes, half the fun of blogging is coming up with good titles. This, post, as it so clear states, is about tools.

As a .NET developer, I take no shame in using as many tools as I can to make my day easier. Here are as many as I can think of. Most of them you will know, some you may have heard of, and some you'll think to yourself, why isn't he using xxxxx. Well, I want to know about xxxx, so if you don't see it listed here (and it pertains to something I would need at WORK, let me know.


  1. Visual Studio 2008 (of course, and 2005, and ack, sometimes 2003). LINQ in 2008 is quickly becoming my most important coding skill. Frankly, it had me at Hello, and I've been it's query biatch ever since

  2. SQL Server Management Studio - if you aren't working in SQL server these days, what, are you stuck in 1995?

  3. NUnit - Test driven development is getting a hold of me, and I like it!

  4. CruiseControl.NET - To know it is to be the only one in the office who cares, but it makes my life a lot easier in the long run

  5. NAnt - Part of my suite of build tools

  6. FireFTP - Mozilla add on for FTP. Great little tool

  7. FireBug - Mozilla add on for debugging web pages and css files

  8. Fiddler - Helps for debugging http traffic. Ethereal is another good tool to. I just haven't used it lately

  9. .NETReflector - Lost the source code for a .NET dll? Run it through Reflector to get it back. Want to compare two versions of a .NET dll to see what changed? Run it through Reflector

  10. ummm Visual Source Safe - better than nothing I guess. Slightly better.

  11. asp.net AJAX Toolkit 3.5. I've been really getting into AJAX this week, and it's pretty cool, though it does not seem very forgiving.



One of the tools I am going to try soon is called Resharper. I've heard really good things about it, and I'm pretty sure it will save me time, but it is quite expensive, and I just want to make sure I'm going to use it. Time to get the trial licence, and give it a whirl.

Anyway, that's pretty much what I sue on a day to day basis (that, plus google to help me find blogs that fix my bugs).

What am I missing?

Friday, March 7, 2008

Can I By a Val please Vanna

File this under gosh darn whacky wastes of time

If you have a web service written in VB.NET which has functions which are called by ASP.NET AJAX scripts, don't ever declare the values in the function declaration as ByRef. Use ByVal instead.

ASP.NET AJAX will show a Method 500 error and you'll spend much time trying to find out why that one call doesn't work.

Again, the side effects of relearning VB.NET

Oh joy.