Monday, July 07, 2008

image So a couple days ago we covered how to display line numbers:

31 Days of Visual Studio Tips & Tricks – Day 4: Display Line Numbers”.

So now how can we take this one step further. How about an easy way to go to a specific line of code? Think about how often as a developer you need to find a line in a large file of code. Sometimes you find out there is an error on a certain line of code and instead of scrolling down to this line manually you could use a special keyboard shortcut.

Go to Line

Ctrl + G

Definitely one of my favorite keyboard shortcuts for Visual Studio.

Note: The image to the right will take you to a full size image if you want to see this in more detail.

Feedback:

If you have a favorite Visual Studio Tip or Trick be sure to share it in the comments. I’ll compile a list and post it for everyone once there are enough.

PowerPoint: 31 Days of Visual Studio 2008 Tips & Tricks.pptx (Note: PowerPoint is updated daily to include new items.)


Monday, July 07, 2008 4:59:00 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  |  Trackback
Sunday, July 06, 2008

image Many times developers will find themselves working with an object, and wanting to know more information about how it is defined and designed.

For example, you are working with a Customer object and you want to look at the Customer.cs file and find out what the Customer object has to offer. What methods, properties, and events does it have for you to work with?

There are several ways for learn more about our Customer class. One you could use the Solution Explorer and manually locate the wanted Customer.cs file. This is a slow process and requires you to already know name and location of the class you want to review. Sometimes it may not be as simple as added a .cs extension the object.

Another approach would be to right click on Customer object and choose Go to Definition. This will take you there automatically, so it is much quicker. But there is an even faster way, and this is the way you wan to use:

Go to Definition
F12

This keyboard shortcut is so important that it is assigned to a function key. This requires only one key press.

Note: The image to the right will take you to a full size image if you want to see this in more detail.

Feedback:

If you have a favorite Visual Studio Tip or Trick be sure to share it in the comments. I’ll compile a list and post it for everyone once there are enough.

PowerPoint: 31 Days of Visual Studio 2008 Tips & Tricks.pptx (Note: PowerPoint is updated daily to include new items.)


Sunday, July 06, 2008 1:51:00 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  |  Trackback
Saturday, July 05, 2008

image If you have used many Microsoft Office products you are probably familiar with the Clipboard Ring concept. Basically it allows the clipboard to contain multiple items, and when you use the keyboard shortcut you cycle back through previous items.

The Clipboard Ring is to a developer’s code what a Painter’s Palette is to the painter’s paint. It is a any easy way to access recently used items. This is a common need when writing code for any application. There are lots of times you are juggling two or three key pieces of code, and it is very nice to have quick access to them. It’s almost like having real-time IntelliSense.

Cycle Clipboard Ring

Cltr – Shift - V

Note: The image to the right will take you to a full size image if you want to see this in more detail.

Feedback:

Alright, we’ve a lot of new reader submitted tips! Thanks guys. I quite a bit behind in score now. I’ll have to come up with a way to weight the scores to give me a chance now.

PowerPoint: 31 Days of Visual Studio 2008 Tips & Tricks.pptx (Note: PowerPoint is updated daily to include new items.)


Saturday, July 05, 2008 3:00:00 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  |  Trackback
Friday, July 04, 2008

It is Independence Day today in the US, and we’re in Washington, D.C. imageto see us some awesome fireworks!

Since today is July, 4th, and we are on Day 4 I figured it would be good to do a VSTT that dealt with numbers. The best one I know is how to display line numbers in Visual Studio:

Display Line Numbers:

Go to the Tools menu, then click on the Options… menu item. Find the Text Editor item in the list on the left. Then I recommend choosing All Languages. Next find and check the Line Numbers checkbox in the Display section on the right.

The image to the right will take you to a full size image if you want to see this in more detail.

Feedback:

Alright, we’ve more reader submitted tips.  Thanks guys. Yeah, we are now tied. score: Me 4 / Readers 4.

PowerPoint: 31 Days of Visual Studio 2008 Tips & Tricks.pptx (Note: PowerPoint is updated daily to include new items.)


Friday, July 04, 2008 10:18:00 AM (Eastern Standard Time, UTC-05:00)  #    Comments [2]  |  Trackback
Thursday, July 03, 2008

imageOne of the best features most Internet browsers have is the ability to navigate backwards, and forwards, through your history of Web site pages you have visited. Don’t you wish you had this feature in Visual Studio? Well, you do. Here’s how you do it.

One option is to go to Visual Studio’s View menu and choose either Navigate Forward or Navigate Backward. An even more handy method is to use the following keyboard shortcuts:

Ctrl + – and Ctrl + Shift + –.

One cool thing about the way Visual Studio does this is that it will navigate backwards through different parts of Visual Studio, everything from forms you’ve open to code you’ve worked, and more.

Feedback:

Alright, we’ve had one reader submitted tip.  Thanks D1eg0. So far I still have the lead. score: Me 3 / Readers 1.

PowerPoint: 31 Days of Visual Studio 2008 Tips & Tricks.pptx (Note: PowerPoint is updated daily to include new items.)


Thursday, July 03, 2008 3:34:00 PM (Eastern Standard Time, UTC-05:00)  #    Comments [4]  |  Trackback

Oh, the humanity! How I hate it when I get “The terminal server has exceeded the maximum number of allowed connections.”

image

Page Brooks and I were just talking about how it only happens to you when you are in a bit of a hurry, and need to get something done ASAP. You are allowed two remote terminal sessions.

The problem usually isn’t that there are too many people logged in. The problem is almost always that people disconnected from their without ending their session or logging out. So terminal services thinks the connection is still active, but just idle.

One option is to use the Computer Management Console, and choose Action, Connect to another computer…, Services and Applications, and then go to Terminal Services Manager and log off or disconnect the sessions.

I found out about a more powerful command line version that was able to work for me. I think the above didn’t work because our servers are virtualized.

  1. run the following from a command prompt: query session /server:servername
  2. Next run the following: reset session [ID] /server:servername

Ah, it just works. So much better now. Me and our servers are friends again.


Thursday, July 03, 2008 2:22:00 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  |  Trackback

imageIt happens all the time. You’re working in Visual Studio, and you need to work with an object that is in a namespace you haven’t declared yet. For example, you need to create a WebRequest in the System.Net namespace.

You have a few choices, some easy and some hard: You could add a using or import statement at the top of the class file as in “using System.NET”. You could fully qualify the object as in “System.Net.WebRequest”. You could try to click that tiny, tiny little red rectangle that will open the Smart Tag. You could type “CTRL + SHIFT + F10”. Or you could take the easy road and simply enter “Ctrl + .”.

“Ctrl + .” Rocks! Try it, you’ll love it!

 

Feedback:

What is your favorite Visual Studio 2008 tip or trick? Tell us all about it in the comments section. I’m keeping score: Me 2 / Readers 0.

 

PowerPoint: 31 Days of Visual Studio 2008 Tips & Tricks.pptx (Note: PowerPoint is updated daily to include new items.)


Thursday, July 03, 2008 1:59:00 AM (Eastern Standard Time, UTC-05:00)  #    Comments [1]  |  Trackback
Tuesday, July 01, 2008

image

With most things there are two ways to learn them: the easy way, and the hard way. Visual Studio 2008 is know exception. One option, the hard way, is to spend all of your precious time learning and memorizing hundreds of Visual Studio shortcut key combinations.

Quick, what is the shortcut to perform an incremental search, or to convert selected text to lower case, or to comment a selection of code? Everyone one of these has a handy shortcut key combination. Do you know them all? If not, did you know Visual Studio has a feature you can enable so that it will show you, or maybe I should say teach you, the shortcut keys for most commonly accessed menu and toolbar items?

It is called “Show shortcut keys in Screen Tips”. You have to enable “Show Screen Tips on toolbars” for this feature to work. Both items are located on the same screen for easy access.

Here’s what you need to do:

  • In Visual Studio go to Tools, and then Customize….
  • This will open the Customize dialog where you will now need to check both the “Show shortcut keys in Screen Tips” and “Show Screen Tips on toolbars” checkboxes.

From now on when you use Visual Studio it will display shortcut key combinations on menus and toolbar tooltips whenever you use them.

If you’ll click on the included image, you will see a larger more detailed screenshot of the areas discussed.

 

Feedback:

Do you have a favorite Visual Studio 2008 tip or trick? Then tell us all about it in the comments section. I’m keeping score: Me 1 / Readers 0. Don’t let your teammates down. :D

 

PowerPoint: 31 Days of Visual Studio 2008 Tips & Tricks.pptx (Note: PowerPoint is updated daily to include new items.)


Tuesday, July 01, 2008 10:42:00 PM (Eastern Standard Time, UTC-05:00)  #    Comments [1]  |  Trackback

imageI’ve committed myself to taking the knowledge I have learned, over the years, and sharing it more with others. Last month I did 30 Days of .NET Windows Mobile Applications, and this month I intend to do 31 Days of Visual Studio 2008 Tips & Tricks.

The material will come from a presentation I have given many times at different code camps and user groups. One of the goals of the series is to start a “conversation” with my readers. I want to share some of my best tips and tricks for Visual Studio, and in return I hope you’ll share some of yours with us as well.

Another goal I have is for the information to be quick and easy to “digest” and as worthwhile as possible. Give me a few minutes every day this month, and I bet I’ll make a difference in how productive you are every day.

 

Here’s the introduction from my Visual Studio 2008 Tips & Tricks presentation to set the stage:

“Visual Studio .NET is filled with hundreds of features that make our lives as developers more efficient. The number of features that Visual Studio .NET contains is immense. The Visual Studio .NET Tips and Tricks presentation is a compilation of my favorite, and most popular, tips and tricks for this great IDE. Developers who are unaware of these timesaving features miss out on opportunities to increase their programming productivity and effectiveness. This Visual Studio .NET Tips and Tricks presentation is meant to explain how to use Visual Studio .NET more effectively.”


Tuesday, July 01, 2008 10:40:00 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  |  Trackback
Monday, June 30, 2008

image And there you have it: 30 .NET Windows Mobile Applications in 30 Days!

I really liked yesterday’s application, Community Megaphone Reader. I think it was because it was a Windows Mobile mashup application. And we can look forward to many more of these types of applications to come our way.

 

image

Trippr

You’ve probably already figured out what this application does. That’s right it takes your current GPS position and pulls back pictures that are geotagged for the area you are in. So while you are riding down the road you can flickrscan for photos taken near you, possibly as close as the block you are on.

Really cool idea I think. I’ll probably hook this up to the dashboard of my car and just let it run while I drive around. It should be lots of fun to just see what I see.

The UI is basic sterile white, but I wanted the photos to be the star of the show so I went with the one uber true neutral color.

Control are very simple: Update, Menu, GPS, GPS Start, GPS Stop, About, and Exit. Update is the main feature. Any time it is pressed new photos are downloaded.

Again for this project we looked to the GPS Intermediate Driver Reference, it has served us well these 30 days and I really highly recommend it. If you need to do a Windows Mobile GPS application use this and you are almost done.

Another great API I found is the Flickr.Net API. If you need to connect to Flickr in .NET or .NET Compact Framework this is great. It does all the heavy lifting for you! I was up and running in minutes!

“The Flickr.Net API is a .Net Library for accessing the Flickr API. Written entirely in C# it can be accessed from with any .Net language in .Net Framework 1.1, .Net Framework 2.0, .Net Compact Framework 2.0 and Mono.”

Update Method

   1: if (gpsPosition == null || !gpsPosition.LatitudeValid || !gpsPosition.LongitudeValid)
   2:      return;
   3:  
   4:  double minimumLongitude = gpsPosition.Longitude - 1;
   5:  double minimumLatitude = gpsPosition.Latitude - 1;
   6:  double maximumLongitude = gpsPosition.Longitude + 1;
   7:  double maximumLatitude = gpsPosition.Latitude + 1;
   8:  
   9:  string apikey = "get_your_own_flickr_key";
  10:  Flickr flickr = new Flickr(apikey);
  11:  
  12:  PhotoSearchOptions options = new PhotoSearchOptions();
  13:  options.BoundaryBox = new BoundaryBox(minimumLongitude, minimumLatitude, maximumLongitude, maximumLatitude);
  14:  options.Extras |= PhotoSearchExtras.Geo;
  15:  options.PerPage = 10;
  16:  options.SortOrder = PhotoSearchSortOrder.InterestingnessAsc;
  17:  
  18:  Photos photos = flickr.PhotosSearch(options); 
  19:  StringBuilder stringBuilder = new StringBuilder();
  20:  
  21:  foreach(Photo photo in photos.PhotoCollection)
  22:      stringBuilder.AppendFormat(@"<img src=""{0}"" style=""border: 1px black solid; padding: 0px; margin: 1px"" />", photo.ThumbnailUrl);
  23:  
  24:  webBrowser.DocumentText = stringBuilder.ToString();

Possibilities:

Obviously this needs an auto-update feature and settings for those of use who will use it on the road. If I click on a picture I’d love to see a larger view of it as well. and a details listing telling me more about the photo would be great.

Download executable: trippr.cab

Download Source Code: trippr.zip

Thank You:

I appreciate everyone’s encouragement and feedback. This project would not have been a success without all of you. Keep an out there’s more to come in the future. Wink


Monday, June 30, 2008 10:24:00 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  |  Trackback

imageWe only have one more day left in our 30 days of .NET [Windows Mobile Applications]. Where do we go from here?

I’m really happy with the 30 Days of .NET so I do think I will continue that in one format or another for some time. It’s been a blast. And everyone knows my passion for Windows Mobile programming so we keep finding way to work that in there as well.

I haven’t quite decided what I’ll do for next month but I’m sure it’ll only get better as we move forward.

There have been a lot of request for applications that haven’t made it on deck yet, and obviously they aren’t all going to get done tomorrow. But I think I’ll be able to throw in some Bonus Day of .NET or Return of Day of .NET and knock some of them out over time.

My goal is to take all the existing content and clean it up some and make more through and detailed learning materials to really help beginners take off with Windows Mobile.

Hope you’ll join me on the road ahead…


Monday, June 30, 2008 1:10:00 AM (Eastern Standard Time, UTC-05:00)  #    Comments [1]  |  Trackback

Wow, it’s hard to believe the month is almost over already. So far we have 29 applications done in 29 days! Thank you for all your encouragement.

If you missed the week one recap here it is: 30 Days of .NET [Windows Mobile Applications] - Week One.

If you missed the week two recap here it is: 30 Days of .NET [Windows Mobile Applications] - Week Two.

If you missed the week three recap here it is: 30 Days of .NET [Windows Mobile Applications] - Week Three.

What’s your favorite?

image image  image image
GPS Clock MobileInfo Mobile Flashlight SmartDial

Let see we have a time utility, and device information, call blocker, and lots more!

image image image image_thumb15[4]
GeoCash Repeatr CallBlocker What will be next?

Feedback:

Got an idea? Got some feedback? Share it? Thanks!


Monday, June 30, 2008 12:06:00 AM (Eastern Standard Time, UTC-05:00)  #    Comments [1]  |  Trackback

 imageA friend, a coworker, and an all-around great guy, Page Brooks, has created a contest for building controls for Silverlight.

Here’s the highlights:

"Welcome to the Silverlight Control Builder Contest! With this contest, we hope to incite the development of many open and free Silverlight Controls that all developers can use in their applications, and what better way to do this than through a friendly contest! This contest is your chance to demonstrate your control building skills to the Silverlight community and win some pretty cool prizes at the same time!"

Check out the prizes:

1st Place

  • 1-Year MSDN Premium Subscription (Not for Resale)
  • Your choice of one book from the entire O'Reilly catalog

2nd Place

  • Microsoft Visual Studio 2008 Standard Edition
  • Your choice of one book from the entire O'Reilly catalog

3rd Place

  • Essential Silverlight 2 Up-to-Date from O'Reilly
  • Your choice of one book from the entire O'Reilly catalog

Great opportunity to build a little fame and win some great prizes. Find out more after the jump: http://gosilverlight.org/


Sunday, June 29, 2008 11:52:00 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  |  Trackback

Only One Day Left…

Not too long ago Page Brooks and myself made the three and a half hour drive from Florence, SC to Greensboro, NC to attend the Ineta Carolina Community Leadership Summit '08. This was a great event and there we meet a lot of the local Ineta user group leaders. We also meet Andrew Duthie, aka DEvHammer. One issue that rose to the top of things we wanted to work on improving at the leadership summit was awareness of events that are occurring in the local regional area. That’s when Andrew told everyone about the project he has been working on: Community Megaphone.

I love have information at my fingertips, so I decided to write a tie-in application:

image

image

Community Megaphone Reader

Basically, this application connects to the Community Megaphone RSS feed and pulls down event data. Then it takes your current GPS position and calculates your distance from each event. Finally, it takes all the events and sorts then so you can find the event that is the closest to you. This is a great application for the traveling .NET geek. Where ever you are you can find great .NET events to attend.

The UI is paying homage to Andrew’s Community Megaphone site. I tried to match the basic colors to keep it familiar. The hyperlinks are active and will take you the event’s page on Community Megaphone. The menu only has a few options: Refresh, About, and Exit.

An application like this is really exciting, because it is tying the world of mobile together with the world wide web.

These types of mashup applications will contitue to take of for years.

LoadRss Method

   1: public static DataSet LoadRss(string requestUriString)
   2: {
   3:     HttpWebRequest feed = HttpWebRequest.Create(requestUriString) as HttpWebRequest;
   4:     StreamReader streamReader = new StreamReader(feed.GetResponse().GetResponseStream());
   5:  
   6:     string rssXml = streamReader.ReadToEnd();
   7:     rssXml = rssXml.Replace(@"<?xml version=""1.0"" encoding=""utf-8""?>", string.Empty);
   8:  
   9:     StringReader stringReader = new StringReader(rssXml);
  10:  
  11:     DataSet dataSet = new DataSet();
  12:     dataSet.ReadXml(stringReader);
  13:  
  14:     return dataSet;
  15: }

 

GetEvents Method

   1: public static List<Item> GetEvents(DataSet dataSet, GpsPosition gpsPosition)
   2: {
   3:     List<Item> items = new List<Item>();
   4:  
   5:     foreach (DataRow dataRow in dataSet.Tables["item"].Rows)
   6:     {
   7:         Item item = new Item();
   8:         item.Title = (string)dataRow["title"];
   9:         item.Description = (string)dataRow["description"];
  10:         item.Link = (string)dataRow["link"];
  11:         item.PublishDate = DateTime.Parse((string)dataRow["pubDate"]);
  12:         item.Latitude = Double.Parse((string)dataRow["lat"]);
  13:         item.Longitude = Double.Parse((string)dataRow["long"]);
  14:  
  15:         if(gpsPosition.LatitudeValid && gpsPosition.LongitudeValid)
  16:             item.Distance = GeoCodeCalc.CalcDistance(gpsPosition.Latitude, gpsPosition.Longitude, item.Latitude, item.Longitude);
  17:  
  18:         items.Add(item);
  19:     }
  20:  
  21:     items.Sort(delegate(Item item1, Item item2)
  22:     {
  23:         return item1.Distance.CompareTo(item2.Distance);
  24:     });
  25:  
  26:     return items;
  27: }

Display Events Method

   1: public static string DisplayEvents(List<Item> events)
   2: {
   3:     StringBuilder stringBuilder = new StringBuilder();
   4:  
   5:     foreach (Item item in events)
   6:     {
   7:         stringBuilder.Append(@"<span style=""color: #FFFFFF;font-weight:bold;"">");
   8:         stringBuilder.AppendFormat(@"<a href=""{0}"" style=""color: #DBB94F;"">{1}</a><br/><br/>", item.Link, item.Title);
   9:         stringBuilder.AppendFormat(@"{0}<br/><br/>", item.Description);
  10:         stringBuilder.AppendFormat(@"<b>Distance: <span style=""color: #DBB94F;"">{0} miles</span></b><br/>", item.Distance.ToString("0.00"));
  11:         // stringBuilder.AppendFormat(@"<b>{0}</b><br/>", item.PublishDate);
  12:         // stringBuilder.AppendFormat(@"{0}<br/>", item.Latitude);
  13:         // stringBuilder.AppendFormat(@"{0}<br/>", item.Longitude);
  14:         stringBuilder.AppendFormat(@"<br/><br/>");
  15:         stringBuilder.Append(@"</span>");
  16:     }
  17:  
  18:     return stringBuilder.ToString();
  19: }

Possibilities:

Andrew recently added iCalendar file support to Community Megaphone. This would be a great feature to add to a Windows Mobile application, and it is totally doable. The HTML could be a little more fancy maybe even use a few 16x16 fonts for a little personality.

Download executable: communityMegaphoneReader.cab

Download Source Code: communityMegaphoneReader.zip

Feedback:

Want more? What else would you like to see? Time’s running out only one more day. Be sure to get your ideas in soon!


Sunday, June 29, 2008 11:31:00 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  |  Trackback

Theme design by Jelle Druyts

Pick a theme: