Showing posts with label Timesavers. Show all posts
Showing posts with label Timesavers. Show all posts

PSR : Free Windows Screen Recording tool

An unsung hero in the MS Toolkit.
It has a weird name - Problem Steps Recorder that is not obvious as a search keyword. It doesn't create a video as the output, rather an HTML containing annotated images. (On the flip side, it doesn't eat up a lot of space and doesn't lose much information).

This one ships with Windows7. To invoke, Start > Run > psr 
This should pop the very intuitive UI. Here's a 3 min video walkthrough. I just learnt you can annotate issues as well. 

Brilliant!

Humanized's Enso Launcher : Jumpstart

Enso is a good example of the axiom that 'Search is faster than navigation'. Its one of the tools that I was introduced to by the book 'The productive programmer' by Neal Ford. It has been handy ever since.

The concept of the tool is pretty simple... it redefines the way in which you communicate with your machine. e.g. If I want to install or uninstall a program, I do not want to click through a number of windows and dig through menus (and lose my focus by the time I get there). My intention is 'open add or remove programs' so that I can install that new app. It may be a tiny boost but multiplied by the volume of instances / day, Enso can save you a lot of time. So lets get right to it...

First you need to install Humanized's Enso launcher (12 MB download)
Next it's easier if you are a keyboard person instead of a mouse person. You need some dexterity with your left pinky finger

Enso takes over your capslock key once installed. So keep capslock pressed down with your left pinky (you should see a green floating band at the top-left) and continue typing to issue commands....

Opening/Launching programs

With Vista and Windows7, this is not something to write home about. Both of them have a real-time search box when you invoke the Start Menu - where you can enter a substring/part of the app you want to invoke and the start menu narrows down your choices.

However if you're on WinXP, you're gonna love this. e.g I always had to go hunting for the add/remove programs applet inside the Start Menu. (or pick something else e.g. like a specific version of Visual Studio). Soon I'd be piling on quick launch icons ; and even that required you to reach for the mouse. (I like to be one with the keyboard as long as possible).

Now with enso, reach out your left pinky to the capslock key. Keep it pressed, while you continue to type a substring e.g 'open remove' or 'open 2008' in the green floating band that just popped up. You'll see a dynamically updating dropdown that you can use to select with the arrow keys. When you lift your finger off the capslock key. The selected program shall be opened. No kidding... try it. It's addictive ; No program is ever more than one open command away.
Useful: Absolutely

Associate a file/directory/url/shortcut with a command

Assume you have a directory that you frequently access e.g.
d:\mail\snail\wail\jail
Ensure that the above path is selected (either in the location bar of windows explorer or write it down in notepad and select it). Next use your pinky and type in
learn as open jail
Enso should get back with 'open jail is now a command'

Now try opening like before.
Caps + 'open jail'
and you should see a windows explorer window pointed at the right folder.

You just taught Enso a new command 'jail'.
You can verify this by looking in your MyDocuments folder. You should see a folder created by Enso with all your commands.
This also means that you can carry your enso commands with you across machine (e.g. in a USB storage device), dump it to the local MyDocuments folder and off you go.

Of course Enso just takes over your capslock key, to regain that function, Enso has 2 commands. Keep caps pressed and type
'capslock on' OR
'capslock off'.


You can make Enso unlearn a command by saying
Caps + 'unlearn open jail' Enso wipes its memory cells clean.
Useful: Usually. e.g. you could associate your MRU visual studio solution file with a command 'curproj'

Now try this on selected files/shortcuts.
e.g. Select any exe or shortcut in your file explorer.
Caps + learn as open someexe
Now you can the exe is at your fingertips with
'open somexe'
Works for shortcuts too. You can even create a "rooted view" e.g. create a shortcut for %windir%\explorer.exe /e, /root, D:\tarpit\theNextKillerApp
Select it and learn it as a command. Try it out
Useful: Sometimes

Works for urls as well. Enso would open up your a new instance/tab of your default browser pointed at the learned url.
e.g. select http://www.answers.com/topic/dexterity right here. Teach enso a new command
Caps + 'learn as open dex'
Now you can open this page at any time using
open dex

Useful: Occasionally - since browsers have generally better at this; bookmarks, tags and incremental search in the address bar.

Jump/Switch to an open window or tab in a browser

This one is nice.
Caps + 'go google'
or
go taskjump directly to an open window which has that substring in the window title.
Its works for browser tabs too - if you had a minimized or buried browser with a tab showing google's homepage, the right browser and child tab would be activated. Its a shame it doesn't work with Firefox3.. seems to be a bug that could be fixed. Works with IE8
Useful: Pretty much ; wish I could unlearn alt+tab-ing as easily as Enso.

Open with ...

This one is supereasy but hasn't become second nature to me yet. You can select any file (e.g. in a file explorer)
Caps + 'open with [name of app]'

and Enso does just that. e.g. 'open with notepad' will open up the selected file in notepad.
Useful: Yes. No more Shift+right click > Open with ... > hunt for the exe if !inList. Freedom!!

Close active window/tab

the command is close. I like dismissing windows with
Caps +'cl'
Enso can do minimize and maximise too.

For more inbuilt commands, Use Caps + 'command list' to have a look at inbuilt commands. I believe you can script custom commands too (e.g. 'mail' instead of 'open Outlook') if you know a bit of Python. However that's outside the scope of this post :)

That's all folks!

NUnit RowTest Extension : Running the same test with different inputs

Update 2010-03-10: The following extension has now been superseded by the TestCase attribute which is now a part of the NUnit core (v2.5 and later). (nunit.framework.dll)

For an equivalent code sample, see the end of the post.

End of Update

This extension allows you an elegant way of handing the scenario where you need to run with different sets of input values. Usually tests shouldn't take any inputs... (the test runner doesn't know what inputs to supply the test with).




[Test(Description="PlainVanilla")]
public void TestBasicMath()
{
Assert.AreEqual(1, 1, "Someone broke mathematics");
}


But then there are always 'exceptions to the rule'. For example I'm writing a class called the Tokenizer that reads tokens from an input string. So I give it "10 + 15", the first token returned by the class should be the number 10.
Now I need to exercise the test code block below with different inputs for sInput like "10", " 10 + 15"


Tokenizer t = new Tokenizer(sInput);
Assert.AreEqual( 2, t.GetNextToken() );



Now back in the old days, you'd need to write a test case for each possible data value. Now with Andreas Schlapsi's RowTest Extension which is bundled with NUnit, things are much simpler.
Prerequisites:
  • Needs NUnit 2.4.7 or later. I 'm using NUnit 2.4.8 for .Net 2.0. Get it here as always
  • Add a reference to the nunit.framework.extensions assembly (in addition to the usual nunit.framework to your test project



using NUnit.Framework;
using NUnit.Framework.Extensions;

namespace TestDynCalc
{
[TestFixture]
public class TestTokenizer
{

[RowTest]
[Row("10 + 15")]
[Row("10")]
[Row(" 10 +15", TestName = "WhiteSpaceBeforeFirstNumber")]
[Row("+10+15", Description = "Read number from +10+15", ExceptionMessage = "No number found at beginning of input stream!", ExpectedException = typeof(ArgumentException))]
public void ReadNumberFromInputString(string sInput)
{
Tokenizer t = new Tokenizer(sInput);
Assert.AreEqual( 2, t.GetNextToken() );
}

[Test(Description="PlainVanilla")]
public void TestBasicMath()
{
Assert.AreEqual(1, 1, "Someone broke mathematics");
}
}
}
Whoa! Let me step through all that. The using directives are self explanatory.
  1. The RowTest attribute (instead of Test) over a NUnit test method allows you to parameterize the test method and gets the ball rolling.
  2. Next for every unique set of inputs, you need to run this test with, you add a Row attribute and specify the inputs as constructor arguments. (The extension is vocal about any mismatch between number of test method parameters and the number of inputs you supply. )
  3. The Row Test also has some named parameters
  • TestName : Lets you specify a descriptive name for the specific 'sub-test'. See how the last child node of the RowTest has a different name in the the attached GUI Screenshot below.
  • Description: This seems to be broken. It's a NUnit feature.. allowing you to tag a test with some comments that will show up when you bring up Properties for the test case. (Right click > Properties)
  • ExpectedException, ExceptionMessage: Ideally I'd like this as a different test case. However you have the option to mark a set-of-inputs to indicate that 'this should cause this type of Exception with the following message'. See last Row attribute.
This is how the NUnit GUI renders a RowTest. Quite nice. (Of course, You should choose better names for your tests :) Each Row attribute is rendered as sub-node of the test with the relevant name and all the input params specified in brackets (comma seperated in case of multiple params).




Update

Moving from RowTest to TestCase: There are no big changes with using the new 2.5 TestCase attribute. You don't need an explicit RowTest attribute. Replace each Row attribute with a TestCase attribute.
The Exception properties have been renamed (inline with the 2.5 ExpectedException revamp. So check the docs on ExpectedException if you can't get something to work).. but easy to figure out via Intellisense.
Another improvement is an explicit Result property, which as you can guess would be used to verify the output of your test case. Before TestCase, you had to pass in another parameter in the RowTest named expectedOutput and take care to use it only for Asserting at the end of the test.



[TestCase("10 + 15")]
[TestCase("10")]
[TestCase(" 10 +15", TestName = "WhiteSpaceBeforeFirstNumber")]
[TestCase("+10+15", Description = "Read number from +10+15", ExpectedMessage = "No number found at beginning of input stream!", ExpectedException = typeof(ArgumentException))]
public void ReadNumberFromInputString(string sInput)
{
Tokenizer t = new Tokenizer(sInput);
Assert.AreEqual(2, t.GetNextToken());
}

IDE-Ninja Shortcuts with VS2008 and CodeRush Express

Just some nifty IDE tricks that I picked up from the PDC talk by Dustin Campbell at PDC2008
First off

Go to Definition is F12, Find all references is Shift+F12. Nothing new here.. but lets say you did F12 multiple times and lost your way in the jungle of code. Don’t fear.. Shift+Ctrl+8 backtracks through each step you took to take you back to the starting point. Shift+Ctrl+7 cycles forward again in case you want to get lost again :)
Useful : Sometimes

Lets say you have multiple files open in your IDE. Now you know you want to switch to an open file.. To do so like an IDE Ninja.. Press Ctrl+Alt+Down key-combo will bring to up the following popup



You can now start typing if you know the initial characters of the file name and press Enter to switch.
Useful : Quite

Next up, have you been trying to zoom in on those tiny squiggles, right click and choose a refactoring or some other action.



That tiny thing is called a Smart Tag and now you can activate it by doing the Ctrl+. (dot) combo to invoke the context menu when the cursor is under the word. You don't need to leave the keyboard to apply a refactoring or implement an interface ever again.
Useful : Very

CODERUSH : For the next set of moves, you need to install CodeRush Express which DevExpress + Microsoft have graciously partnered to give away to VS2008 users for free. 34 Meg download. Express Edition users.. tough luck!

Jump to File: Once you have CodeRush installed and a solution open. Use the uber Ctrl+Alt+F combo to bring up the following popup



Type in the filename, use arrow keys to select, press Enter and Voila! Insta-Teleport. And yes it does substring matches too.. you can type in part of the filename like 'Coffee'. Sweet!
Useful : Very

Can I do the same for jumping to methods? I remember I wrote a test for warmer plate status.. what was it called? Shift+Ctrl+Q for



I type in some characters and the results narrow down. Ah! there it is. Enter and teleport again. This shortcut is to Jump to Symbol.. so it works for member variables, properties, etc too.
Useful : Sometimes

Finally we have Put some GPS trackers on this variable. Ctrl+Alt+U



This will highlight all places where the symbol is used, you can then use tab to navigate between each reference. Esc to make these trackers disappear.
Useful : Rarely.. when you're in machete mode in someone else's code.

That's all folks!

Lookout! - Blazingly fast search for Outlook

Tired of trying to find the right incantation to find that elusive mail in Outlook ? Enter Lookout

If you have Outlook (period), you need to give this a try.
Lookout appears as a toolbar within outlook. You run the setup program, Restart Outlook, Lookout asks you to build an index. When this is done, you're off. (A Wizard takes you through the index process and simultaneous acts like a quick start)
You can type things like 'attachment:troubleshoot' in the Lookout search box to find mails that have an attachment which has the name troubleshooting in it.
You'll never go back to the old way again. It is just that good.

Story goes that Lookout was a small fish, which sparkled. Microsoft got wind of it, bought it, brought over the 'smart guy' behind it to the Outlook program team, squished out Lookout.. finally 'smart guy' quit. Couldn't align to the vision I guess.
PS: Seems Outlook2007 does a good job at this from some user reports.. but I don't have a copy and haven't tried it yet. So Outlook2007 might want to check before installing adding one more addin.


Update: If you have multiple pst files (Outlook archive or offline mail files), you'd need to tell Lookout to include them too while indexing. You need to click on the Options button on the Lookout toolbar and add the psts to the list. Then (re)create the index.


Update # 2: You can now use it on Outlook 2007 as well. You need to do a little sneaky trick to get it to install though.. rename a PIA assembly installed in the GAC. Unless you have some add-ins that depend on this, shouldn't cause any issues. So fire up a command prompt, issue these commands and restart outlook. You should now be able to install lookout. Awesome tip from Mike Belshe

cd %SYSTEMROOT%\assembly\GAC
rename Microsoft.Office.Interop.Outlook Microsoft.Office.Interop.Outlook.OLD

One password to rule them all...

Do you frequently find youself locked out of a site... coz you can't recollect the exact user name and password you used the last time for this site.. If yes, this is the post for you.

Problem: You go to a million sites, each one asks you to register and you end up with a zillion userid-pwd combinations to remember.
Now there are diff levels of security you need..

  1. e.g. if you use a online news service or email, you'd use one userid-pwd.. you dont care what it is as long as you get thru and you are able to retrieve your preferences and no one else can get at it.
  2. if you shop online you need a higher level of security coz they have your credit card number
  3. then there are sites that you dont know why they authenticate you.. but they do.

So now you can

  • have 3 diff pwds for these levels.. (or use a single pwd for everything... which is just asking for trouble.)
  • Or you can write everything down on a Post-it or a secret notepad file etc.. (a remote login or a login from another machine would break this scheme.. you need to carry that paper with you always.. For the record: writing down your password or persisting it somewhere is almost always a security risk.. bad idea)
  • Or you can create a lot of username-passwords and then do mental match the following each time you need to log in...

OR you can be smart and get to know PasswordMaker (passwordmaker.org)

Solution: What it does.. It takes the name of your website and a pwd from you. It then generates a hashed pwd using the above 2 inputs. So each time you visit the password, you just fire up the firefox addin (one of the forms in which the goodness is wrapped) and type in this key pwd, it will regenerate the exact same pwd for that site each time. Copy and paste it to the pwd box and Off you go!
No more waiting at the login box!

You can tweak the settings to generate the pwd.. but then you need to remember the exact settings each time you use passwordmaker.. e.g. if you decide to login via the online version of this tool from a new machine.

Pretty Nifty app this. Highly recommended.

Found about this from the podcasts from stackoverflow.com (It's a new site for people who don't have time to read and need good answers (rated by others) fast. Jeff Atwood (codinghorror.com) and Joel Spolsky (joelonsoftware.com) are behind this one.

Google spreadsheets + the new Form = Instant Online Poll

http://googledocs.blogspot.com/2008/02/stop-sharing-spreadsheets-start.html

Basically what you do with this:
1. Create a form ( a web page ) soliciting information from anyone out there.
2. All the data submitted via the form is stashed away on your online google spreadsheet (that you no longer HAVE to share - no risk of anyone messing up your spreadsheet design / formulas)
3. Next use your imagination to mine the data for information you want. e.g. I used the form method of collecting data + some excel formulas to count Yes/No votes + Google charts to publish the results of the poll. Google even goes as far as giving you an HTML Snippet that you can embed in your web-page...

You can choose to refresh the published results with every change to the underlying spreadsheet with a checkbox on the Publish tab.

The form design has most of the basic stuff covered. Lots of potential for this feature...
All in all... sweet stuff again from the guys at Google Docs. Double Thumbs up !

Tabbed console windows in Windows at your command... ala Linux's Konsole

Recently I was a bit annoyed with having to open multiple command shells or consoles to run different daemons/servers, which then just lay there and clutter up my task bar.

Enter Console on SourceForge.net ( from: Marko Bozikovic ).

'Don't make my brain get up' installation
  1. I downloaded the latest beta from the project's download page - Console-2.00b138-Beta.zip
  2. Extract to a folder.
  3. Double click on the Console.exe and we're up and running.
Some tweaks:
Console is quite customizable with keyboard shortcuts.. but then that is expected coz this is targeted for the shell users. Just some to get you started
  • Ctrl + T : New Tab (non-default. I set this to match my brain-associated keystroke for a new tab.)
  • Ctrl + W : Close current tab
  • Ctrl + 1, 2, 3 : Go to tab1, 2, 3, etc.
You can reassign any of the keyboard shortcuts via Main Menu > Settings... > Hotkeys.


'Pictures or it didnt happen' dept.

Here I have Console running with three tabs. Tab1 is running the Webrick server for my rails app. Tab2 just finished running my tests with rake. Tab3 is serving up the Fitnesse wiki pages.
And all this just takes one slot on my taskbar. No more manic alt-tabbing to find the right shell window...



Credits: While I was writing up the post on Aptana - the IDE for Rails, I came across another guy who had written up a similar post. And then I found a link on his blog... Credit where credit is due.
http://thenoobonrails.blogspot.com/2007/10/sexy-command-line-for-windows.html

Compare (and merge?) excel files with Beyond Compare

Another note to myself.

My main app - Beyond Compare, a file diff-merge utility from Scooter Software(and a really good one at that) has some spiffy rules that let you 'do the diff' on versions of an excel document.
You can compare (and it seems now you have merge as well) excel as well as word files. I haven't really compared word docs yet but xls diffs work ... well!

All you gotta do is download the rules (as a zip).
  • Unzip it to your Beyond Compare install Directory.. MSExcel folder for the xls diff rule.
  • Run Beyond Compare.
  • Main Menu > Tools > Import Rules. Select the rule file under the MSExcel folder.
  • Select the two xls files in Windows Explorer, right click and choose Compare! voila!
There are a lot of other goodies available here

Zipping up a set of files listed in a .txt file

Problem:
I have a selected set of files spanning across folders and subfolders that I would like to package into one zip e.g. list of modified files for a source control check-in operation.
I have the list of file paths in a .txt file.

I had an old version of PowerArchiver command line utility on my machine. After some tinkering with the console help... ta da!

>"PACOMP.EXE" -p -a [MyBatchzip.zip] @ListOfFiles.txt

-p : To store relative paths of zipped files.
-P : To store absolute paths of zipped files
ListOfFiles.txt : A text file with all the files you wanted to zip up
MyBatch.zip : Name of zip file to be created

The resulting zip had just those files that I wanted and the zip can be opened by any extraction utility like WinZip, etc.
Each filepath should be on a new line in the text file.

Noting down for my reference.

Update:
  • If you have some spaces or tabs at the beginning of the filepath, i think that file gets skipped.
  • Make sure of case uniformity in the List of files. It messes up with some files zipped with absolute path. To be safe, check relative paths by opening up the zip once.
    • d:\myfolder\..
    • D:\MyFolder\.. [No No.. use one of these throughout the list]

Neat Tip: Shortcut Keys VS.NET IDE

Jot it down. As the PP book said, it's important to know atleast one IDE very well.

  • Sometime back a 'fellow coder' asked me for a keyboard shortcut for moving to the next build error in the Visual Studio .NET 2003 IDE. Turns out it's as simple as F8. Now instead of moving to the task window and precision clicking on the next item in the list, Just press function key 8 and you are teleported to where you wanna be.
  • Another useful is one that takes you back and forth your function browse history. Lets say you click View definition from caller to be transported to callee. Now Press 'Ctrl & -' to simple waltz back to caller. (the reverse is 'Ctrl & Shift & -' ). No more remembering which file you come from and where you want to go.
For all the brickbats thrown, MS never ceases to amaze with some things of pure simplicity.

Enabling AutoComplete at Win2K Command Prompt

I just copied the steps from http://www.activewin.com/tips/win2000/1/2000_tips_44.shtml. Thank you Venkat Sankar, u great surfer on office time !!!! http://venkkats.blogspot.com

I don't know why this is not turned on by default. Who in their right minds would rather type out complete paths ?

• Type Regedit and OK,
• Find HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor,
• In the right pane of Regedit, double click the 'CompletionChar' DWORD value,
• Type 9 click OK,
• Close Regedit,