WinSnap

I had the need to capture some screen shots, and old Print Screen wasn’t cutting it. I was unable to capture the menus I needed for my documentation. A quick search found a tool so cool I just had to blog about it.

WinSnap, available at http://www.ntwind.com/software/winsnap.html has all sorts of features for doing screen captures. It will do rounded corners, allow you to capture in various color schemes, such as grayscale and sepia, and save in all the standard formats (jpg, gif, bmp, png, and tiff). You can also add watermarks, which is cool.

There are more options than I can cover here, most useful is the time delay feature. To capture an image you just click the new snapshot button. WinSnap hides itself, then after a user specified number of seconds it takes a screen capture. By default it is one second, you’ll probably want to bump it up so you have time to get your app like you want it. I’ve found five seconds to be a good default.

Rather than repeating what they already have on their site, I’ll just point you to the features page (http://www.ntwind.com/software/winsnap/feature-highlights.html).

Take a look, this tool will be valuable to anyone who has ever had to capture screen shots. And since it’s free, the price is perfect!

Arcane Searches

One of the things I really like about WordPress is that you can see the search engine terms that lead people to your site. In the lists I see some search terms that occur frequently. I thought it might be fun to take a guess at what the googlers were looking for, and take a stab at answering them.

exit full screen remote desktop

Move your mouse to the top, center of the display. A little yellow bar will scroll down, with the machine name. On the left is a push pin you can use to make it stick. On the right is the traditional Min / Max buttons you see on a window.

virtual pc exit full screen

Alt + Enter will exit full screen, but it has to be the Alt key on the right side of the keyboard. (This assumes you haven’t changed you hot key mappings).

command to close virtual pc

There’s several ways to close a virtual pc. The simplest, and best is to do a shutdown of what ever OS you are running. When the guest OS shuts down, the Virtual PC exits.

You can also select Action, Close on the menu, VPC will prompt you to see if you want to close and save state (sort of like Hibernate on a laptop) or exit and discard changes. If you are running a Windows OS, VPC will also give you the option to shut down. You can get the same prompt by clicking the X (cancel) button on the window your guest OS is running in.

eventtoaster

This is one that shows up a lot in my searches. Event toaster is part of the Visual Studio Enhancements Add-In from Microsoft. See my entry on November 15th (http://arcanecode.wordpress.com/2006/11/15/visual-studio-add-ins-ms-visual-studio-enhancements/ or http://shrinkster.com/kdt ) for more info.

virtual computer usb

Virtual PC does not support USB in either version 2004 or Server 2005. And, despite being the most asked for item in Virtual PC 2007, Microsoft still does not have any plans to include it in the next version.

VMWare, on the other hand does support USB. In the VMWare Server product, USB is not entered by default. You can add it, however by Editing the Virtual Machine Settings. In the dialog under Hardware click Add, and pick USB.

zone alarm remote desktop client

Another one that appears frequently, I’m guessing there’s a need to know how to get remote desktop to cooperate with Zone Alarm. Open the Zone Alarm settings panel, and click on Firewall. By default the Internet Zone Security is set to High. Drop this to Medium to get it to work with remote desktop. You will also need to go into Program Control and put checks for Remote Desktop Connection for all four columns.

defrag a single file

Use the SysInternals Contig tool. See http://arcanecode.wordpress.com/2006/11/06/sysinternals-contig/ for more info.

There’s a few of the top searches from my history, hopefully I’ve answered questions for a few of you out there!

Arcane Thoughts: The Zone

Over the Thanksgiving holidays I did a lot of traveling. Before I left I downloaded a lot of videos and podcasts from the internet to keep me busy during those slow times when everyone else had keeled over from too much turkey. One video that caught my eye was on the Channel 9 website. Channel 9 ( http://channel9.msdn.com/ ) , by the way, is the Microsoft sponsored site where the Channel 9 team goes out and videos other folks in Microsoft, talking about new technologies or interesting activities they are doing. This is the same place famous (or infamous) Rory Blyth ( http://www.neopoleon.com/home/default.aspx ), former co-host of DotNetRocks went to.

This particular video, http://channel9.msdn.com/Showpost.aspx?postid=226791 talked about the CodePlex team. CodePlex, by the way is the Microsoft site ( http://www.codeplex.com/Default.aspx ) for open source development projects. I rather like the way it’s laid out, easy to find and organize a project, however that’s beside the point of this post.

During the video they revealed the entire CodePlex team works in a single office. Not an office with nice cubicles, not a section of a building, no all 8 of them are crammed into a single small office. Each has a small workstation or laptop on a small table or desk. Apparently this is some take off on Agile Development. Their claim was that if one guy runs into an issue, it’s very easy to say “Help!” and get immediate help on a coding issue and not delay his work. My thought was, hey that’s really great. For that one guy.

For the rest of the team, it seems to me it would be incredibly disruptive to the creative process. As developers, we often get into what Tony Robbins ( http://www.anthonyrobbins.com/ ) refers to as “The Zone”, that creatvie point where the juices are flowing and we lose all track of time. You’re solving problems, creating code, really making your application flow well. You know you’re there when you reach over for that cup of coffee to find it’s ice cold.

Then boom, someone interrupts you. Doesn’t really matter if they were asking, all that matters is you are rudely jarred out of “The Zone” and back to reality. After dealing with the interruption, it can be difficult to get back into “The Zone”, I’ve seen some studies that suggest it can be as long as half an hour before your mental processes have returned to full focus on the issue.

There are some aspects to Agile that appeal to me, for example the short release schedules. But cramming a bunch of coders into a single room? No thanks. I prefer to hang out in “The Zone”.

But hey, that’s just my opinion. I could be wrong.

Visual Studio Add-Ins: SmartOutline

SmartOutline is a tool for creating regions in your code without having to use Region / EndRegion tags. Available at http://submain.com/default.aspx?nav=products.smartoutline, this tool took third place in the Microsoft Visual Studio Extensibility Contest packages category.

SmartOutline is a product that’s easier to show you how it works than describe, so let’s look at a few pictures. Let’s say I have a simple if statement. Highlighting it gives me a new pop up, as you can see below.

[SmartOutline 1]

Clicking on the Create new SmartOutline Region command brings up the following dialog, where you key in the name for your region.

[SmartOutline 2]

In this example I’ve keyed in “My If Statement” for the name. Assuming I then check the “Collapse region” box, my code will update as you see below.

[SmartOutine 3]

 

Clicking the + button will expand my region back to the original state, as you can see.

[SmartOutine 4]

SmartOutline is useful for hiding long lengths of code that add safety but not value. For example, you might have to do a lot of validation to input parameters, but they don’t add to the real purpose of the method. SmartOutline is a great way to hide that.

You might assume that SmartOutline is altering the source files using Region tags and intercepting them. Not so, as this command window dump of the source file proves:

[SmartOutine 5]

 

Some useful situations to use SmartOutine to hide code segments might include:

  • Lengthy error handlers
  • Long parameter checks
  • Long comments
  • Code that is commented out, perhaps something for a future version or older version that you’re not sure you want to delete
  • Using (or Imports) sections
  • Entire Methods

These are just a few ideas, feel free to post a comment with your own thoughts.


My one complaint / wish list item for enhancement is that SmartOutline left aligns the name you give to the smart region. This breaks up the visual flow of indents. You can add spaces yourself when you give the name, for example I could have keyed in six spaces then “
My If Statement”, but if I were to indent the code later SmartOutline doesn’t change to reflect this. You should also know this is a VS2005 tool only, sorry 2003 users.


Overall a useful tool for adding to the readability of your code, well worth the download, and like many of the other tools mentioned so far, it’s free.

Visual Studio Add-Ins: VSCmdShell

VSCmdShell is a handy add-in that places a Command window inside of Visual Studio. Available at http://www.codeplex.com/Wiki/View.aspx?ProjectName=VSCmdShell, after a simple install you can launch the command window from the View, Shell Window command. By default it launches as free floating, I chose to dock mine down at the bottom with the Command and Output windows.
[Picture of default VSCmdShell]

From here, you can issue your typical array of commands, such as getting a directory, but the cool thing I use it for is my deployment scripts. I have a cmd file (sort of the new version of a batch file) that compiles my web apps then deploys to the development server.

VSCmdShell has some nice customizations. It has the things you might expect, like being able to change the text and background colors, but you can also select the shell. For example, you could install the new Windows PowerShell, and use it as your default shell window.

To get to VSCmdShell’s options, click on Tools, Options. Scroll down to “Power Toys”. Note if you previously installed the Visual Studio Enhancements (which I blogged about at http://arcanecode.wordpress.com/2006/11/15/visual-studio-add-ins-ms-visual-studio-enhancements/) you’ll actually have two entries for power toys. The “PowerToys” (no space) is from the enhancements, the “Power Toys” (with a space) is from the VSCmdShell. Here’s a quick shot of the dialog:

[VSCmdShell Options Dialog]

As you can see, you can change the font and colors, the shell, and even set the initial directory for the command shell. Best of all, VSCmdWindow automatically sets up all the VS variables for you. If you ever have need of a command prompt, this free tool is well worth the download.

Visual Studio Add-Ins: Paste As…

If you are like most programmers, you tend to fiddle with your SQL in some tool where you can run, test, and optimize your SQL before you paste it into your app. Or perhaps you have some long static text info (such as instructions) that you need to display to the user. You type it all in, then you have to mess around with getting it onto a string. You break it into multiple lines, perhaps you are using a string builder to hold it. The whole time you’re thinking there’s got to be an easier way. Well, there is!

The great add on, Paste As… from

http://weblogs.asp.net/alex_papadimoulis/archive/2004/05/25/Smart-Paster-1.1-Add-In—StringBuilder-and-Better-C_2300_-Handling.aspx (or if you like shorter URLs, I’ve shrinksterized it, http://shrinkster.com/jut ).

This add-on takes whatever text you have in the buffer and pastes it into your code in one of four ways: as a comment, as a string, as a string builder, or as a region. Let’s take a fake SQL statement and render it the various ways. First, here is a SQL Statement that you’ve worked on inside your SQL tool (it’s fake, but you’ll get the idea.)

select FirstName, MiddleInit, LastName, Street, City, State, Zip, PayRate, HireDate from SomeEmployeeTable order by LastName, FirstName, MiddleInit

Here it is as a comment:

//select FirstName, MiddleInit, LastName, Street, City, State, Zip, PayRate,

//HireDate from SomeEmployeeTable order by LastName, FirstName, MiddleInit

Now here it is as a string:

@”select FirstName, MiddleInit, LastName, Street, City, State, Zip, PayRate, “ +

@”HireDate from SomeEmployeeTable order by LastName, FirstName, MiddleInit”

All you have to do is put “myString = “ on the front, and (if you are in C#) a ; at the end and you’re done. Now here it is as a StringBuilder. Note it will prompt you for the name of your StringBuilder variable, and how cool is it that it automatically calculates the size of the string for you (in this case 147).

StringBuilder myStringBuilder = new StringBuilder(147);

myStringBuilder.AppendFormat(@”select FirstName, MiddleInit, LastName, Street, City, State, Zip, PayRate, “);

myStringBuilder.AppendFormat(@”HireDate from SomeEmployeeTable order by LastName, FirstName, MiddleInit”);

 

The final option is Paste As Region. While you would not typically paste a single SQL statement as a region, let’s see how it looks anyway:

#region myRegion

select FirstName, MiddleInit, LastName, Street, City, State, Zip, PayRate, HireDate from SomeEmployeeTable order by LastName, FirstName, MiddleInit

#endregion

In the context we’ve presented above probably not something you’d do. Where this would come in handy is when you’ve copied a bunch of code to the clipboard, and want to paste it into a new region. Since it does no reformatting, this makes it an easy way to bring in new code to your application.

This tool works with both VS2003 and VS2005, and works in both C# and VB.Net. It has quickly reached the top of my “indespensible” list and is one of the first I install when setting up a new instance of VS. And it’s free! How cool is that.

Visual Studio Add-Ins: Copy Source as HTML

Our next tool is very handy for those of us who blog, or perhaps just want to share code snippets with friends using HTML enabled e-mail. Copy Source as HTML, available at http://www.jtleigh.com/people/colin/software/CopySourceAsHtml/ does just what it says. It takes the lines of source code you have highlighted in your Visual Studio editor and copies them to the clipboard as HTML.

For an example, I’ve pasted this simple HTML into my blog so you can see what it looks like. This is HTML text, not a picture:

 

    9 namespace WinTest1

   10 {

   11     public partial class Form1 : Form

   12     {

   13         public Form1()

   14         {

   15             InitializeComponent();

   16         }

   17     }

   18 }

 

 

There are several options, as you can see from the dialog below.

[Copy Source as HTML Options Dialog]

You can have line numbers (as I’ve done above), set the line number to start at, or omit them entirely. You can activate word wrap, over ride the default tab size, font and font size. If you’re a CSS guru there are even tabs for entering your own CSS for both the entire section (surrounded in DIV tags) or the individual line.

Another great free add-in, it has both 2005 and 2003 versions. If you ever need to convert your code to HTML this is a great, easy way to do it.

Follow

Get every new post delivered to your Inbox.

Join 104 other followers