March 21, 2007

Visual Studio.Net tool I didn't know about

One of those things I have long believed is there is potential for really cool things to be hidden in the Visual Studio.Net IDE and I wont know about them.

I found out it was very true last week. Someone introduced me to "Code Definition Window" (shortcut Ctrl-\, Ctrl-d).

You probably already know about the right-click option Go to Definition. This does that one better. It is a tool window that displays the definition of whatever your cursor is on in a read only window.

It is kind of like the second code window you always wanted.

Selenium and IIS7

We had a minor victory this morning. We finally got Selenium working under IIS7.

Apparently Selenium doesn't like IIS7's new managed pipeline. Neither does Reporting Services 2005 -- but that is another story.

So the fix: Open up the IIS Manager (InetMgr.exe), open up "Application Pools", you should see DefaultAppPool. Double-click it. The last option on the dialog should be "Managed pipeline mode", select classic (it should be Integrated by default).

You can read about what changed in the March 2007 issue of MSDN Magazine article: Explore The Web Server For Windows Vista And Beyond (http://msdn.microsoft.com/msdnmag/issues/07/03/IIS7/)

Skip down to ASP.NET Integration so see how the pipeline has changed.

The real nice thing is that with IIS7, yes they made a number of changes that seem to break a number of web application, but they did give us a way back.

Vistual Studio.NET shortcuts of the day

I got this neat handout from Microsoft the other day with a "complete" list of Visual Studio.NET shortcut commands. And I am all in favor of not having to reach for the mouse.

So here are my two favorite Refactoring shortcuts:
First a note of warning, these command are chords. Meaning, you hit the first command, and then the second command to get it to work. This is actually kind of nice, all of the refactoring commands are grouped under a Ctrl-r. So to do a Refactor.Rename, you hit Ctrl-r, then Ctrl-r again.

Anyway, here is the list:

Ctrl-r, Ctrl-r: Rename

Ctrl-r, Ctrl-e: Encapsulate Field (turn a private variable into a public property)

Ctrl-r, Ctrl-i: Create an interface for the current class

Ctrl-r, Ctrl-m: Extract Method

Four is enough for one blog post I think. Any more than that and I would overwhelm you with them. So, learn these and I will post more later.

March 11, 2007

Off to the MVP summit

The good: I get to go to Microsoft's MVP Summit and I leave tomorrow.
The Bad: I probably wont be able to talk about it because I'll be under NDA.
The Ugly: Well, I'm not expecting a lot of pretty faces at an event like this.

Anyway, it should be a fun time, and I'm hoping to see some people I've only "met" in blogs. And yes, there is a difference.

As for imagery, think of a hobbit trying to rub shoulders with a giant. And I'm not a giant. :)

February 27, 2007

Open Command Prompt Here in Vista

One of the small items I have been missing (until now) is Open Command Prompt Here in Vista.

In WinXP it was a Power Toy you could download from Microsoft. But that is not supported in Vista.

Turns out that "Open Command Prompt Here" is built into Vista -- I just didn't know it.

So here is how you get it. In windows explorer (WIN-e or what ever other method you use), right click in the files area on the right -- but not on a file, but you can click on a folder.

Then there it is: Open Command Prompt Here.

One of my coworkers just told me about this, you can find more information on this site:
http://blogs.msdn.com/tims/archive/2006/09/18/windows-vista-secret-1-open-command-prompt-here.aspx

February 23, 2007

Playing with Generics

I've been meaning to play with Generics more for a long time now. I finally have the chance.

As part of a new project we are working on we are using the Generic List class all over the place.

A common usage is to store a Contact class. It has the standard stuff: first name, last name, address, bank account, gun locations, caliber of gun, etc.

Now we want to sort them by by weird criteria like amount of money in house, number of guns, and caliber. (note to self: I should also save amount of ammo) Or see if a contact exists with no guns at all. Very standard stuff.

So, in the List class there are now Predicates for both the Find and Exists methods. Using Predicates and anonymous delegates you can pass custom code into the Find method. Essencially telling the Find method how to find something.

So it would look like this:

Contact found = currContacts.Find(
delegate(Contact c)
{
// has no guns and more than 5 dollars
if ((c.Gun.Count == 0) && (c.NetWorth > 5.0)
return true;
else
return false;
});

But for something more likely, and powerful. Say you are moving new items to list of existing items. Say I have a list of new contacts, but first I have to figure out if the contact doesn't already exist. To do this you have to find contacts with the same first name and last name.

List currContacts = GetAllContacts();

foreach(Contact newContact in contactList)
{
Contact found = currContacts.Find(
delegate(Contact c)
{
if ((c.FirstName == newContact.FirstName)
&& (c.LastName == newContact.LastName)
return true;
else
return false;
});

if (found != null)
{
currContact.Add(newContact);
}
}


Finally, I've been looking into Generic methods. You can have a single method in a class that uses generics, without making any changes to any other part of the class. Very cool! Here is an example:

public T MaxValue(T currentValue, T newValue)
{
if ((currentValue > newValue)
return currentValue ;
else
return newValue;
}

This is making much of my life much simpler.

February 21, 2007

Install issues with SQL Server 2005 on Vista

OK, first off, SQL Server 2005 does run just fine on Vista (as far as I can tell right now at this particular time)

But...at work we all just got new Dell laptops with Vista Business Edition installed (from what I hear you can't even order a laptop with WinXP on it anymore).

Anyway, we went out to install our standard set of software: Visual Studio.NET 2005, SQL Server 2005, etc; and SQL Server 2005 will NOT install.

The culprit: Microsoft Office Web Components 2003. You need to uninstall the Web Components to be able to install SQL Server 2005. Don't worry if you need them, SQL Server 2005's install reinstalls them.

BTW: if you do need the Office Web Components, you need to stop. Microsoft is dropping support for them. Eventually.

Snow?

Figures. 4 days ago (Saturday) it was sunny and 70 degrees. This morning (Wednesday) I wake up to 2 inches of snow.

This will make for a fun commute.

Well, it is February.

February 13, 2007

Boise Code Camp 2.0: Post Mortem

It is finished. Now I don't expect a tearing of the cloth, but I do believe I hear angels singing. With a sign of relief I can now say Boise Code Camp 2.0 is over. Long live Boise Code Camp 3.0.

Overall, it went really well. At least I thought so.

* 215 people showed up. Not bad for a city the size of Boise.
* We had enough room for everyone -- thank you many times over Boise State University.
* We had enough pizza for everyone without a lot of left overs.
* Pizza was catered by the university, so they brought it in, set it up, and took it away. Nuf said.
* Plenty of sessions. We had 38 at last count. Pretty good for a one day event.
* All of the speakers had working laptops.
* Dinner was a little late...but not too bad.
* The sponsors were very happy with the turn out.
* I got to play RoboRally at the dinner.

Problems:
* We had one problem room where lights and projects all got poltergeist for a few sessions at the end (sorry to everyone at Martin Danner's presentation on VSTS Unit testing session -- we are going to try to do that again at a NetDug). But it was really funny when the lights would spontaneously turn off every time Doug Seven talked during the Software Quality panel.
* We still had a few scheduling problems. They did not go unnoticed. I believe all of the security sessions were at the end of the day.
* When doing the final raffle my dyslexia finally kicked in and I read a number backwards (I said 201 when it was 102). But all was well in the end, 201 was called for one of the grand prizes.

And my one session when well. Beginning MDX (an SQL like language for OLAP). I talked right to the end without going over, so that was good. But I didn't leave much time for questions at the end either.

Things I would like to change for next time:
* Get the wives involved earlier. Especially David Star's wife Eleanor. Lets just say she stepped in just in time. There is something about geek (or just men in general) that had organizing things. We would rather play with toys and talk. We need her, and Dawn McKeeth, again to pull this off well, and the sooner the better.

* Have it in March. We moved everything up to February this year. That was a minor mistake. But basically, nobody took it seriously until after New Year (actually, second week of January). And another month would have saved me a bit of stress.

* The web site. I'm going to burn the old one. We were better off with WordPress from last year. Problem was, while everyone was asking me for help with the web site, I couldn't do anything about it. For example, you had to be logged onto the machine to get a count of people who signed up. And WAY too many people put in tracks when the meant to put in a session.

* More non-Microsoft specific sessions. I'm not trying to knock Microsoft here (I've make my living off of Microsoft since 1997), but there are alternatives out there that have good market share and are worth learning. For example: Java, Ruby, Python, PHP, ColdFusion, Perl, Delphi,... All good technologies.

* Lastly, to give at least one non-Business Intelligence related talk. People are beginning to think that is all I do.