Wednesday, October 28, 2009

Google, My Friend

It's astonishing to me how well Google distinguishes itself in anticipating its customers' needs. I couldn't remember the file name for the Task Manager program. I only knew that it was some abbreviation of TaskManager.

I tried doing a search on "task manager command line" or something like that receiving nothing but frustration. But then remembering Google's "Did you mean . . .?" feature. I typed "cmd tskmngr" into Google's search box. There it was.

Did you mean: cmd taskmgr

Simple. Effortless.

How Again Do You Get Data Out of a Refcursor in Sql Developer?

There appears to be no way for me to memorize how to run a stored procedure in Sql Developer that uses a refcursor. So I'm putting an example here. That way I can refer to it any time I want.


variable CV_1 REFCURSOR;
declare V_INTUSERID number;
BEGIN
V_INTUSERID := 1;
spProc1(V_INTUSERID,:CV_1);
END;
PRINT CV_1;

Wednesday, October 7, 2009

Visual Studio Shortcut for Using Directives

My current vote for top Visual Studio shortcut goes to "Shift-Alt-F10."  This little beauty will bring up the "Options to help bind the selected item" dialog which will allow you to command the UI to inject the appropriate "Using" directive at the top of a class. Trying to bring up this dialog with the mouse is tricky and time-consuming. Save those precious brain cells for something else.




"Add Reference" Dialog Delays

Today I decided to reduce the impact of an annoying problem with Visual Studio--the length of time it takes to initially bring up the "Add Reference" dialog. It can take a minute! I run into this delay constantly because I seem to almost always need to add a reference to System.Configuration to every project. My approach was to create a custom project template with the reference already included. Here are the steps I took:
  • Navigate to "C:\program files\microsoft visual studio 9.0\common7\IDE\ProjectTemplates\CSharp\Windows\1033"
  • Copied the template ConsoleApplication.zip
  • Navigate to My Documents\Visual Studio 2008\Templates\ProjectTemplates\Visual C#
  • Pasted ConsoleApplication.zip
  • Opened up the zip with "Open with > Compressed (zipped) folders" and dragged "consoleapplication.csproj" onto the desktop
  • At line 45 added
  •     <Reference Include="System.Configuration" />
  • Saved the proj file
  • Opened up the zip with Winzip (or use 7zip) and dragged in the new version of "consoleapplication.csproj"
  • Closed winzip (or 7zip)
The new project template is ready to use!

The official documentation from Microsoft is here.

Tuesday, October 6, 2009

Executing Console Commands with PowerShell

I'm just starting to master PowerShell . . and I emphasize the word "starting".  Frankly, I'm disappointed with the learning curve required. PowerShell doesn't seem to be optimized, yet, for quick learning, despite that it piggy-backs off of .NET.

Here's a tip. Don't throw away those useful scraps of "DOS" commands you've been carrying around for many years.  You can reuse them inside of PowerShell. Here's an example:

 cmd /c  <PathToCommand> arg0 arg1 argEtc

Getting Started with the 7Zip Command Line

7Zip's command line tool has umpty-um options. Many of them are very useful. But if you are looking only for a command line version of the Windows' "Send to > Compressed (zipped) Folder" command, then you can get by with merely the following:

 7z a -tzip <ZippedFileName>.zip <FolderName>

Thursday, October 1, 2009

Using C Sample Code in MSDN

Here's a simple tip for Windows C (and C++) programmers. There's a wealth of C code samples in MSDN. Unfortunately, many of those I've seen and used suffer from the same deficiency: they not unicode friendly and therefore not compatible with recent versions of Visual Studio. It's relatively easy to fix, however. Substitute the _tmain function for main and for _tmain's second parameter use "_TCHAR* argv[]" instead of "char *argv[]."