A cacophony of ramblings from my potpourri of notes
 Friday, January 23, 2009
Visual Studio Keyboard Shortcuts Wrap-up (MSDN Flash - Feb. 2, 2009)

In this edition, I am going to wrap up a few loose ends with a selection of miscellaneous keyboard shortcuts and links to a summary keyboard shortcut poster.

Debugging:

I realize that none of you would write bugs, but in case you meet someone that does or perhaps on occasion you need to debug some code in order to explain a complex algorithm, here are some invaluable debugging keyboard shortcuts.

  • F9 and CTRL+F9
    F9 creates or removes a breakpoint based on the cursor's current location. CTRL+F9 toggles whether a breakpoint is enabled or not.
  • F5, CTRL+F5 and SHIFT+F5
    CTRL+F5 launches the application or begins running the tests.  If there are multiple projects in the solution, which project is launched depends on the solution's configured startup project.  Using F5 will launch the application in debug mode.  After encountering a breakpoint, F5 will continue execution until the next break point.  SHIFT+F5 will stop the application from debugging all together.
  • F10, F11 and SHIFT+F11
    Executes the next statement one method at a time.  If not currently at a breakpoint, debugging will start at the first statement.  F10 will execute the method without following execution into the method.  In contrast, F11 will step into the method, allowing you to debug it line by line (assuming you have the source code).  SHIFT+F11 executes all remaining statements within the currently executing method, allowing you to jump out of a particular call rather than stepping over each line.
  • CTRL+ALT+I
    Displays the Immediate Window.  Used when debugging a method, this window allows you to write code (frequently with intellisense) and evaluate/evaluate the code line by line as though it was inline within the method you are debugging.  I find it extremely helpful when learning about a new .NET API.  After instantiating a particular type, I can examine various members on the type and learn more about their behavior.

Adding files to Project

  • SHIFT+ALT+C
    Displays the Add New Item dialog with the Class template selected.  Initially I wanted this to work without the dialog but I need to supply the class/file name and there are no additional keystrokes to placing it in the dialog.
  • SHIFT+ALT+A
    Displays the dialog for adding an existing item to the project.

Summary

As I wrote this series, I was amazed at how frequently I still found myself forgetting some of the new keyboard shortcuts I learned while writing (CTRL+Break to stop a build).  Fortunately, there are posters available with many of the top shortcuts listed.  I recommend using one as a mouse pad for a few months so that you can get them down.

This ends the series on Visual Studio Keyboard Shortcuts.  Next I plan to start a series on the Entity Framework.


Friday, January 23, 2009 7:23:22 AM (Pacific Standard Time, UTC-08:00)  #    Comments [7]  Computer Related | .Net | Headlines

 Friday, January 16, 2009
Guilty as Charged

image


Friday, January 16, 2009 10:05:35 PM (Pacific Standard Time, UTC-08:00)  #    Comments [1]  Computer Related

 Saturday, January 03, 2009
Visual Studio Keyboard Shortcuts for Editing (MSDN Flash -Jan. 19, 2009)

Knowing all the keyboard shortcuts for editing shows off our programming prowess, just like it would it did for programmers that could use VI.   Rather than describing the well known ones like CTRL+F and CTRL+H, I am going to review some that are more unique to Visual Studio Programming:

Find

  • CTRL+I/CTRL+Shift+I
    imageIncremental Search: Turns on incremental search so that characters typed next will be search for in sequence within the file.  Use CTRL+Shift+I to search up and ESC to cancel.
  • CTRL+Shift+F and Ctrl+Shift+H
  • Find in Files:  Displays the find dialog with Look in: set to Entire Solution, so that a search will look across all files in the solution and display the results in the Find Results window.  Using the up and down arrows, you can select which result to navigate to and then press ENTER to go there.  Similarly, Ctrl+Shift+H will perform a search and replace across files in the solution.
  • CTRL+K, CTRL+R
    Find All References: Takes into consideration the fact that you are navigating source code and, therefore, looks for all references for the item the cursor on.  F3 and Shift+F3 will navigate back and fourth between all the references found.

Editing

  • CTR+Shift+V
    Cycle Clipboard Ring:  Did you know that Visual Studio has a clipboard ring?  With this keyboard shortcut you copy different text areas, one after the other, without pasting the text in between.  After copying you can paste using CTRL+Shift+V - each time will cycle back through what you copied, allowing you to select what to paste, from the set of copied items you placed into the clipboard ring.
  • CTRL+Shift+L
    Delete the selected line.  CTRL+L cuts the selected line into the paste buffer. 
  • CTRL+Shift+T
    Transpose Words: Transpose the current word with the following word, pivoting on the operator separating them.  For example, given FirstName = firstName, the transpose keyboard shortcut on FirstName would switch the code to firstName = FirstName.  Similarly, Multiply(x,y) would switch to Multiply(y, x).

Outlining

  • CTRL+M, M
    Toggle outline expansion for the current context.

Ctrl M, M

  • CTRL+M, P
    Turn off outlining entirely.  Reopening the file will re-enable the outlining.

Coding

  • CTRL+. and CTRL+K, S
     image
    Whenever a smart tag appears (for example after renaming a method or variable), use CTRL+. to display the smart tag menu and then ENTER to select which menu to use.  (I can't imagine coding without rename anything significant without rename and this keyboard shortcut.)  Similarly, CTRL+K, S displays the surround with context menu, allowing you to surround the selected text with a region for example (C#).
  • CTRL+K, L and CTRL+K, P, also CTRL+K, I
    List Members: I frequently see other people (okay, I do this myself) deleting the period so that they can see the listing of IntelliSense options again.  CTRL+K, L is the keystroke to do this without deleting.  Similarly, rather than deleting the left parenthesis, use CTRL+K, P to display the parameter info for the function you are calling. CTRL+K, I will display the help tip for the method you are calling.
  • CTRL+K, C and CTRL+K, U
    Comments out the currently selected code.  These shortcuts are for end-of-line comments rather than block comments.  Use CTRL+K, U to un-comment the selected text. 
  • Shift+ALT+ENTER
    Full Screen: Toggles in and out of full screen mode.  Great for when you are heads down coding a method and want the most real estate you can get on a single screen.
  • CTRL+E, W
    Toggle Word Wrap:  If you frequently find lines within the code editor going beyond the screen you can toggle on word wrap so that lines wrap.  (Personally, I suggest a coding standard that encourages developers not to write 200 character lines).  In my books the limit is 72 (a little too small for comfort :)
  • CTRL+Shift+F12
    Next Error:  I should have mentioned this one last week.  After compiling, you can navigate between errors using CTRL+Shift+F12. 

Saturday, January 03, 2009 11:48:10 AM (Pacific Standard Time, UTC-08:00)  #    Comments [2]  Computer Related | .Net

 Friday, January 02, 2009
Starting out the Year with a Run and a (Polar Bear) Swim

This new year is the second one for me that I start out with a run and a swim in the morning.  There is nothing particularly special about either of these events except it has a kinda symbolism for starting out the year right.

New Year's Day was a little more challenging this year.  It started out with a weather advisory from the National Weather Service for Spokane, WA area:

HEAVY RAINFALL COUPLED WITH MELTING SNOW WILL RESULT IN FLOODING OF SOME CITY STREETS AS WELL AS SMALL STREAMS AND LOW LYING RURAL AREAS. SNOWFALL THIS MORNING WILL CHANGE TO RAIN THIS AFTERNOON AND CONTINUE OVERNIGHT. RAINFALL IS EXPECTED TO BE HEAVY WITH AROUND 1 INCH OF RAIN EXPECTED BY FRIDAY MORNING. CITY STORM DRAINS COVERED WITH SNOW AND ICE COULD QUICKLY RESULT IN STREET FLOODING.

Well... at least everywhere that I went, it wasn't rain but snow!  As has been the case for most days over the past two+ weeks, I start out by shoveling the drive way (I secretly still enjoy starting the day this way).  However, the result was that I was a little late picking up John Martinek.  Fortunately, he had paged me earlier suggesting that we cancel so he wasn't quite ready anyway.  Glad I didn't get that page or the day wouldn't nearly have been as fun since I probably wouldn't have left the house.  Along with John's wife, Kelly, we drove down to Coeur d'Alene for the Hangover Handicap.

Hangover Handicap

The Hangover Handicap run is put on by TESH, Inc, a non-profit rehabilitation organization helping those who are disabled and/or disadvantaged to reach their highest level of independence.  The course runs along lake Coeur d'Alene, ID, an exact match for a portion of the Coeur d'Alene Ironman run section. 

image

There was certainly nothing special about my time.  In fact, we arrived a few minutes late so we didn't even start until only the walkers could be seen in the distance.  I knew a a few folks from Itron in the race (Doug Dominey and Fran Johnson) so once I was able to catch them, I doubled back a few times to say, "Hi" and run with John some.  In total, I stats were as follows:

Distance (including doubling back): 5.24 miles
Time: 42:32
Pace: 8:07 min/mile

Nothing to write home about but we ran on snow the whole way, it was snowing heavily, and I can say I even enjoyed myself (not the usual poking yourself in the eye type of experience. :)  After grabbing an apple cider from a local restaurant, we headed down to the lake for a swim.

John and Mark

2009 Coeur d'Alene Polar Bear Swim

It seemed we were going to be just in time for the plunge but on the way there a truck (4X4) go stuck in front of us - I was driving a Honda Odyssey.  We of course stopped and once they got going we were stuck too.  Traffic started to line up quickly behind us.  Eventually, we got the line to reverse and we rolled back for a running start.  We got to the top of the hill and started sliding down the other site, narrowly missing a parked car on the way down.  I slowly rushed to the plunge area to join the other 1,000 or so "crazies."  Unfortunately, the bell went off just as we were entering the area.  Bummer.... I pushed through the watchers, raced down the beach, stripped, and dived in after everyone was already out.  (Heck, I had come all that way, I wasn't going to miss it now.)

Once I got out, John and Kelly came over to see if I was still alive.  John's doing the Ironman this year so he had no choice but to pressure him to go for a swim. He reluctantly agreed, and to ensure I wasn't asking him to do something I wouldn't do - I joined him for a my second swim of the day.  (I think that credits me for having done the polar bear swim 3 times in two years.)

CDAPress had a great description of the event in the newspaper the next day.  I say great because it does a good job of having absolutely no explanation of why people do this type of thing but that they do it anyway. :)

I highly recommend this experience.  Really, it sounds stupid (in fact, it is stupid) - however, having done it now, I can say it is actually pleasurable - really!  The coming up for a breath isn't great - you feel almost short of breath.  However, once you stand in the snow and soak up the experience - there is just something inside you that makes you want to yell... YEAHHH!!! 

(P.S.  Don't do it twice on the same day like I did, that isn't so great.)  


Friday, January 02, 2009 5:30:16 AM (Pacific Standard Time, UTC-08:00)  #    Comments [1]  Personal | My Sports