Did you know… how to open something in the binary editor – #109

for those of you following the tip of the day series, it’s time for something a little bit different.

The first time I saw this test case in the editor test bed, i thought, "whoa (yes, Keanu Reeves style)… i’ve opened this dialog box a 1000 times and have never seen this option before." 

File Open File dialog open with option

To use the binary editor…

  1. Go to File – Open File
  2. Click the drop down button on the Open button (or from keyboard, just press down arrow)
  3. Choose “Binary Editor” and press OK or Open (depending on your VS version)

Open With Dialog

Technorati tags: VS2005Tip, VS2008Tip

Did you know… How to share code snippets with your team? – #107

I like this tip because it isn’t really how to use features, but rather how to combine features to do new things.

  1. Put the snippets you want others to have access to out on a share.
  2. Go to Tools – Code Snippet Manager, press the Add button and give it the UNC share.
  3. Go to Tools – Import Export Settings, Export, and choose to export just the Code Snippet Locations to a file.
  4. Send out that .vssettings file to those on your team.  They can go to Tools – Import Export Settings, and choose Import.

Import Export Settings Code Snippet Locations

Technorati tags: VS2005Tip, VS2008Tip

Did you know… How to browse code snippets and add new ones – #106

All code snippets are found in the Code Snippet Manager.  It is found at Tools – Code Snippet Manager.  If you are using the default general settings, you can use Ctrl+K, Ctrl+B to bring up the dialog box. 

IMO, the most useful aspect of this dialog is to browse through your current snippets to learn what the "shortcuts" are to quickly insert the snippet into the editor (yesterday’s tip).

Additionally, this is where you add (a directory of snippets) and import (a single or multiple-selected snippets to a specified folder via the Import Code Snippet Dialog).

Code Snippet Manager display the C# "for" snippet

I circled the Language combo box to mention that you should always check there to see what type of snippets you are browsing.  The Code Snippet Manager Language combo box is a MRU, meaning that the last set of snippets you looked at (let’s say XML) will come up the next time you bring up the dialog.  For me as a tester, it was critical that i always confirmed where i was at before using the dialog.  So maybe I don’t need to give out this warning, but old habits die hard, even after a couple of years.

Technorati tags: VS2005Tip, VS2008Tip

Did you know… You can insert a code snippet via its shortcut keyword – #105

Update: thanks to Bill for catching that VB doesn’t show snippet shortcuts in the statement completion.  I’ve updated the VB picture below to better illustrate what is going on.  Also, check out Bill’s post, as he talks about using the ‘?’ to insert snippets. 

This is probably a much better tip than the previous two.  Code Snippets have the support to be given a "shortcut", usually an abbreviated version of the code snippet name that you can type into the editor and hit tab to insert.

To insert, simply type in the name of the snippet, e.g. "for", then hit tab.  Note that if statement completion is open, you’ll have to hit tab twice to insert the snippet.

In both Visual Studio 2005 and 2008, you will be able to see C# Code Snippet shortcuts in the Statement Completion window.  Below is the for snippet displayed within the Statement Completion window.  Note the snippet icon to the left.

For Snippet In StatementCompletion

In Visual Studio 2008, you won’t see VB snippets in the statement completion window, but you will see a note in the tooltip when you can hit tab twice to insert the corresponding snippet.

VB For keyword in statement completion

Technorati tags: VS2005Tip, VS2008Tip

DevTeach Open Source Panel recording now available on .NET Rocks!

Although I chose the wrong line at the border to reenter the US, adding an extra 45 minutes to the wait, I successfully completed my first solo trip into Canada to sit on the DevTeach open source panel.

You can find the recording as .NET Rocks! episode #296

And since this was in Canada, I can now say I’m an international speaker! (hey, it counts people. It counts.)

Special Thanks To…

Thanks to Richard Campbell for being an amazing host.  It was great chatting with him before the event, and i hope to chat with him again in the future.  Also thanks to Alan Griver for not allowing me to back out at the last second.  And special thanks to Beth Massi for giving me a thumbs-up whenever I, as a deer in headlights, looked at her in the audience for moral support.  lol.

What I was trying to say was…

I prefer to practice all of my talking points (usually for hours) prior to any speaking event, whether internal or external, to avoid panic (omg! i’m being recorded!) and brain freeze.  To me, I train for public speaking like I train for kata in karate – you practice over and over again until it is second nature.   Unfortunately, i didn’t get as much time to prepare as I would have liked, but I started to relax somewhere in the middle of the podcast, and actually started to have fun at the end.   Although some people are just naturals at public speaking, I am not one of them, but yet I love public speaking, so I keep trying, because one day, i’ll make it look easy.  =D

The first question regarding the "mixed model" is a perfect example of the "brain freeze" moment.  Wow.  I actually submitted a paper to OSCON 2007 that discussed this very topic, yet it never even crossed my mind at the time.  What should have crossed my mind was, "Absolutely. A popular development model is the platform play, where the core is open, but the add-ons are close / proprietary.  However, what we discovered with the power toys for visual studio is that you can actually reverse the platform play, where the core is closed, but the add-ons are open.  And looking in this space where the add-ons are open, could this form a developer ecosystem for traditional proprietary software applications? My theory says yes."  I described an instance of this theory, which unfortunately didn’t illustrate the higher-level  "reverse platform play" concept.  =(

Learning Eclipse, Teamprise, Subversion…

I should have stayed as long as it took on Thursday at the conference to have taken people up on their offers to teach me Eclipse, Teamprise, and Subversion.  I was so excited to see people coming up to the stage afterwards (and I liked the feeling of being tall – i’m 5’1) handing me biz cards, saying that they would find time during the conference to give me demos.  I’ll kick myself for a long time for not making the time.

Unfortunately, I was flying out that Sunday to go home for a month due to a medical family emergency, so I was greatly distracted wrt my time allocation.  My sincere thanks to Jonathan Wanagel and Jim Newkirk (my manager and manager’s manager) for their support for letting me work remotely from home during this time, and especially in their immediate response to my request.

I still need to contact everyone who handed me a card to brainstorm some creative ways to take them up on their offers to teach me this brave new world.  We will figure it out, even if it is becomes a phone call guided walkthrough. 

And thanks to everyone who has listened to the podcast and actually read this far!  And to repeat what I said all the time last … Towards a stronger open source ecosystem!!

Did you know… How to change default values and variables in a code snippet – #104

When you insert a code snippet, the editor highlights the fields (variables, values, etc) you can modify depending on how the code snippet was written.   The idea is you modify the contents of the field, then press tab to navigate to the next field.  When you press tab, that particular field is updated throughout the entire snippet.  You can also navigate outside the field via the arrow keys to invoke the update. 

For Loop C# Snippet

If you press enter, however, you will be committing both the current change (if any) and the entire snippet, meaning you can’t undo to get back to those highlighted fields.  You would have to use your favorite refactoring method to make any additional updates.  I call this out because I always press enter when i meant to hit tab.  No idea why this got hard-coded into my head, so just a heads-up.

For those of you who found this tip outside the tip of the day series, you can read more about code snippets on the VS Editor Team Blog.

Technorati tags: VS2005Tip, VS2008Tip

Tips Inspiring Tips

I’ve been inspired by the Silverlight Tip of the Day series (which was originally inspired by this VS Tip of the Day series) to include the tip # in the titles.  Isn’t community cool?!  Here’s the first Silverlight tip to check out.

When the New Orleans Saints play tonight (provided they don’t attempt another double-reverse game-losing fumble again), i’ll begin updating these tips to reflect their tip #, as I truly have no clue what tip # we’re on.  So in case you see updates in your RSS feed, this is what is going on.


Did you know… Ctrl+K, Ctrl+X inserts a code snippet – #103

In Visual Studio 2005, we introduced code snippets.  The VS Editor Team Blog has a nice write-up on code snippets, if you want to learn more instead of waiting for a tip here and there from me =)

So we’re going to start the code snippet tip series with how to actually insert a code snippet.  The keyboard shortcut is Ctrl+K, Ctrl+X.  It is bound to the command Edit.InsertSnippet, in case your mileage varies, depending on your configuration settings.

I’m going to use C# for today’s tip, but this applies to all languages that support code snippets.  When I invoke the Edit.InsertSnippet command, the code snippet insertion UI pops up.  Did you know… (the real tip here) that the snippet picker allows for type-ahead scrolling.  Note how I started typing "#re" on the line.  (oh, the fun i had testing this… but i digress…)

Code Snippet Insertion UI

Additional keystrokes:

  • You can hit tab to auto-complete the word.  If the word happens to be the code snippet (and not a folder), pressing tab will insert it.
  • You can also hit Shift+Tab to navigate back to the previous word (my contribution to the insertion UI)

Technorati tags: VS2005Tip, VS2008Tip

Did you know… How to keep tabs or to insert spaces? – #102

This tip and yesterday’s tip were my least favorite features to test.  It would just drive me crazy trying to keep up with when should a tab get inserted, when should the cursor move to the correct formatted position, etc.  Now, i will only use spaces in my code.  =)

Go to Tools – Options – Text Editor – <Language> – Tabs to switch between using tabs or to insert spaces instead.

Keep Tabs Or Insert Spaces options

Note that you can set this for all languages on the Text Editor – All Languages page, but usually this is something you may want to set for each individual language.

Additionally, check out an earlier tip on how to convert tabs to spaces and spaces to tabs.

Technorati tags: VS2005Tip, VS2008Tip