I'm sure this is posted in a 100 different spots but I just learned about it before I went on vacation and wanted to share it. It has never really bothered me at guessing which w3wp.exe process to use for debugging SharePoint code but when I was working with Joe (new guy) he saw what I was doing and he told me there was a lot easier way of identifying the w3wp process. He said just open a command prompt and type in "iisapp" and it will list all the Application Pool processes with the process ids. I took his advice and sure enough it gave me everything I needed to choose the correct process from the Visual Studio "Attach to Process" screen. If you don't really know what I'm talking about then below is details on how to do it.
For me there are times when I'm developing with InfoPath or SharePoint and I need to create some code (Workflows, Web parts, ...) that runs part of the w3wp process and running it in debug mode from Visual Studio is not possible and you will have to deploy the code and then attach the Visual Studio project to the w3wp process that its deployed for stepping through the code. For example, recently I had to create a new SPD Workflow Action to send out emails with a "From Address" that can be specified and to use the SharePoint SMTP property that's set in Central Admin. To do this I had to create a new Workflow Activity Library project and this project type can't be run in debug mode from Visual Studio (if I'm wrong about this please correct me). To debug the code in this project you have deploy it first and then attach your Visual Studio project to the w3wp process that it runs in and then do something from SharePoint or InfoPath that will execute the deployed code. To attach the Visual Studio project to w3wp process you can either click "Debug->Attach to Process" or "Tools->Attach to Process" menu combination and then the "Attach to Process" screen will appear.

Then you will need to select the w3wp process that your code is running in. If you develop on a SharePoint server then you will almost always have more than one w3wp process to choose from. This is where the "iisapp" command helps out. If you open a command prompt and type "iisapp" then it will list all w3wp process (Application Pools) running with some details.

This list should give you enough information to choose the correct w3wp process from the "Attach to Process" screen. Click the entry you want and then click to the "Attach" button to attach to it. Now set your break point and then do something from SharePoint or InfoPath that will execute the code.
I'm sure this was a big repost for most people and I'm sorry for that but I just wanted to share what I learned that way it may help someone starting out with SharePoint, Workflow or InfoPath development.
Cheers