Scott Hanselman

Replacing Start Run - The Quest Continues

August 04, 2006 Comment on this post [21] Posted in Reviews | Tools
Sponsored By

So many ways to launch programs. A good launcher doesn't just launch, it also auto-completes paths for you, starts your search engine or browser and generally saves you 15 minutes a day. No need to learn all the hotkeys like those Keyboard wonks who try to guilt you. Just learn ONE and make it do everything.

Given these offerings, if you open your Start Menu at all, at any point in the day, you're doing something wrong. Try them all, pick one, and save 15 min * 5 days * 52 weeks = 65 hours a year you'd have spent futzing around in your Start Menu*.

* These numbers came straight out of my butt.

  • Slickrun - still the sexy favorite, this little floating magic bar keeps me moving fast, launching programs, macros and explorer with it's shiny simplicity.
    Tell them I sent you. ;)
    Startrun1

 

  • SmartStartMenu - Shaun Harrington has created this elegant little application that lives in the task bar and automatically indexes the list of items in your Start Menu for quick access with the speed of AutoComplete.
    Startrun4
    It will take system commands, paths to launch explorer, even UNC paths. Launch anything on your system with less than 4 keystrokes. It also adds new context menus to Explorer like CopyPath and Open in DOS box to Explorer.

 

  • Startrun2Martin Plante, hot off his gig at Xceed has created slimKEYS, a "universal hotkey manager" with a simple .NET plugin architecture. If you've got ideas or thoughts, visit the slimCODE Forums.
    Have you ever wanted to bind something to Shift-Ctrl-Alt-Window-Q but didn't know how to grab a global hotkey?
    This will launch programs, watch folders, and find files. It has great potential as more and more plugins appear.
    The current version already comes with the following built-in plug-ins:
    • slimSIZE: Change the current window's position, size or monitor location to any area of your choice.
    • slimLAUNCH: Open applications, documents or folders by typing a few letters from their name. 
    • slimVOLUME: Display the volume level when you use your keyboard's volume control.

 

  • Colibri - The closest thing so far, IMHO, to Quicksilver on Windows, although this little gem has a slow startup time, it runs fast! It's being actively developed and promises integration with a dozen third party programs. It also formally supports "Portable Mode" for those of you who like to carry your apps around on a USB key.
    Startrun3

 

  • Launchy - Another do it all application, this one Open Source and written entirely in .NET, Launchy binds to Alt-Space by default. This app also has the potential to be Quicksilver like if it start including support for stringing together verb-noun combos. It's pretty as hell and totally skinnable (there's TWO Quicksilver skins included!)
    Startrun7

 

  • AppRocket -this little bar sits at the top of your screen, popping down an active list of Bookmarks, Programs, Music, Web Queries and more.  It's unclear if this tool is being enhanced for future versions as folks have reported not hearing from the company in a while.
    Startrun5

 

  • ActiveWords - Arguably the most minimal of these launchers (as it can have no UI at all if you like!), but the most configurable. ActiveWords watches everything you type, in every application, so anything you've just typed could potentially be used by you to launch a program, a macro, send email, or give you Auto-Correct in any application. Check out their screencast/demos and their scripting language. It also is the only launcher (I've seen) with explicit support for the Tablet PC and allows ink to trigger an "Active Word."
    Startrun6

 

  • Dave's Quick Search Bar - Written orignally in JavaScript and now written in magic and ensconced in voodoo, this little Toolbar sits in your Windows Task bar (or wherever you choose to drag it) and supports a huge community of macro writers who've enabled it as a Calculator, Web Searcher, People Finder, Currency Converter and literally hundreds of other tasks via simple to write plugins. Very actively developed and on the web for over 5 years (that's like 100 people years).Startrun8
    It even has a Search Wizard to create your own web searches by example.

UPDATE: I forgot a few that were totally worth mentioning. My bad.

  • Google Desktop - Startrun10Google Desktop has an option that let's you use it as a quick program launcher along with fantastic search abilities by tapping Ctrl-Ctrl.
    Startrun9

 

  • Find and Run Robot - Lightweight, small, quiet until you need it. This little application allows for tuneable heuristics to make it work like you think. Demo Screencast here.
    Startrun11

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

WhatIf Powershell

August 04, 2006 Comment on this post [0] Posted in PowerShell
Sponsored By

One of the best (little known?) features about Powershell is the -WhatIf switch. A script or cmdlet can have parameters, of course, like

param( [string] $foo )

but it can also have switches that are on or off like

param ( [switch] $verbose )

One of the mostly ubiquitous switches is -WhatIf for commands that could "do damage." For example:

PS> del foo.txt -whatif
What if: Performing operation "Remove File" on Target "C:\\foo.txt".
PS> get-process outlook | stop-process -WhatIf
What if: Performing operation "Stop-Process" on Target "OUTLOOK (2540)".

Drink in how useful this can be. Fabulous. Anyway, so we wanted to make our own scripts have this ability. Since our scripts are mostly strung together with built-in commands, we want to have a WhatIf switch be inherited by the sub-commands.

Switches are either present or not present so I tried a silly thing like this:

param ( [string] $file, [switch] $WhatIf)
if ($WhatIf.IsPresent) { $WhatIf = "-WhatIf" }
del $file $WhatIf

But was reminded by Keith Hill that this was cleaner:

"You can forward switch params to cmdlet parameters of type switch like so"

param([string]$file, [switch]$WhatIf=$false)
del $file -WhatIf:$whatif

"Bruce Payette and I had a newsgroup exchange on this a while back and he mentioned that they made sure you could still pass a "value" to a switch parameter for this very reason. I don't know of any other ways to make this better though."

Thanks Keith!

Technorati :
Del.icio.us :

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Hanselminutes Podcast 27 - Reflection

August 03, 2006 Comment on this post [3] Posted in Podcast
Sponsored By

My twenty-seventh Podcast is up. This episode is about Reflection. It was tough as I wanted to get really technical, but at the same time I wanted to discuss the basics. There's a lot of potential things to talk about, we'll need to do another show. 

We're listed in the iTunes Podcast Directory, so I encourage you to subscribe with a single click (two in Firefox) with the button below. For those of you on slower connections there are lo-fi and torrent-based versions as well.

This show was FULL of links, so here they are again. They are also always on the show site. Do also remember the archives are always up and they have PDF Transcripts, a little known feature.

Links from the Show

What is Reflection?
What's new in Reflection 2.0 (h1w)
MethodInfo Visualizer (h1x)
Dodge Common Performance Pitfalls to Craft Speedy Applications (h1k)
More on Reflection 2.0 (h20)
Deep Reflection (h1y)
Strongly Typed Reflection (h1q)
Fast PropertyAccessors (h25)
ReflectionOnly (h1z)
Dynamic Code Generation vs Reflection (h1r)
Reflection Demystified (h1u)
What is slow in Reflection (h23)
Programming C#: Chapter 18 (h1s)
Reflection vs. CodeDom
Calling Code Dynamically (h24)

Subscribe to my Podcast in iTunes

NEW COUPON CODE EXCLUSIVELY FOR HANSELMINUTES LISTENERS: The folks at XCeed are giving Hanselminutes listeners that is Coupon Code "hm-20-20." It'll work on their online shop or over the phone. This is an amazing deal, and I encourage you to check our their stuff. The coupon is good for 20% off any component or suite, with or without subscription, for 1 developer all the way up to a site license.

Our sponsors are XCeed, CodeSmith Tools, PeterBlum and the .NET Dev Journal. There's a $100 off CodeSmith coupon for Hanselminutes listeners - it's coupon code HM100. Spread the word, now's the time to buy.

As I've said before this show comes to you with the audio expertise and stewardship of Carl Franklin. The name comes from Travis Illig, but the goal of the show is simple. Avoid wasting the listener's time. (and make the commute less boring)

  • The basic MP3 feed is here, and the iPod friendly one is here. There's a number of other ways you can get it (streaming, straight download, etc) that are all up on the site just below the fold. I use iTunes, myself, to listen to most podcasts, but I also use FeedDemon and it's built in support.
  • Note that for now, because of bandwidth constraints, the feeds always have just the current show. If you want to get an old show (and because many Podcasting Clients aren't smart enough to not download the file more than once) you can always find them at http://www.hanselminutes.com.
  • I have, and will, also include the enclosures to this feed you're reading, so if you're already subscribed to ComputerZen and you're not interested in cluttering your life with another feed, you have the choice to get the 'cast as well.
  • If there's a topic you'd like to hear, perhaps one that is better spoken than presented on a blog, or a great tool you can't live without, contact me and I'll get it in the queue!

Enjoy. Who knows what'll happen in the next show?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Upcoming DasBlog 1.9

August 03, 2006 Comment on this post [13] Posted in ASP.NET | DasBlog
Sponsored By

Tagcloud ExampleSpeaking of DasBlog, one of the other things we're working on for the upcoming 1.9 release (remember, you can always get the latest source each day - many folks do like to live on the edge) is Tagcloud support, as seen in the image at right (the real thing is on the left, scroll down).

Here's a from memory list of cool new things (we'll do release notes soon):

  • Much better multi-user/blogger support including a Top Posters macro and total comments - from Christoph De Baene
  • TagCloud - from Scott
  • Huge (100x+) speedup in Macro execution - from Scott
  • Support for If-Not-Modified to speed up execution, improve RSS bandwidth and CPU cycles - from Scott
  • Direct Feedburner Support with 301 redirection for RSS and Atom feeds. Don't lose a single subscriber. We're the only blog with direct support for Feedburner and Feedflare I believe. - from Scott
  • Delete comments directly from your mail reader - from Omar
  • New themes out of the box, 18 at last count - from Many Folks
  • New XML-RPC support for newMediaObject - from Omar and Giuseppe Dipietro
  • New support for RSD so client software can autoconfigure itself - from Omar
  • Pluggable Rich Text Editor, choose from FreeTextBox or FCKEditor or write your own adapter - from Josh Flanagan
  • Support for CoComment - from Scott
  • Organized source, build, and packing for clarity - from Josh Flanagan
  • New Feed Icons - from Omar
  • Automatic disabling of Comments after a certain number of days. Also manual "close comments" support - from Omar
  • ContentLookAhead show future dated posts - from Josh Flanagan
  • Other misc fixes and suggestions from Tomas Restrepo, Jason Follas, Rene Lebherz and Steven Rockarts. Added entry CPU usage optimizatons from George V. Reilly.
  • Better strings and support for Portuegue, Turkish and Vietnamese from Ph?m Ð?c H?i.

One other thing...folks know that DasBlog is all file-based - no database - so doing mass operations like Category renames, re-categorization is non-trivial and non-performant. I'm working on that and currently have a number of Powershell scripts to make large-scale changes offline. In testing those scripts I took the opportunity to re-categorize my whole site over the last four years of content (some better than others) and in the process added a lot more categories to help folks find what they need.

Attention New Subscribers: I encourage you to peruse the Complete Archive with categorized links to every post ever as well as the Tag Cloud/Category Thing over on the in the left side. Also, for those temporally-minded view, check out the Calendar View (here's 2006) to find what you need.

The next mini-project is to tune a robots.txt file to make Google search a DasBlog site more intelligently, resulting in better search results.

Stay tuned.

Thanks folks.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Example: How to contribute a patch to an Open Source Project like DasBlog

August 02, 2006 Comment on this post [15] Posted in ASP.NET | DasBlog | Programming
Sponsored By

Lots of discussion going on around the death of NDoc and Open Source as a viable option for .NET projects. A lot of this harkens back to some of the things discussed in "Is Open Source a Crap Idea" from a a few months back.

  • I said Open Source is free like a Puppy. It requires care, feeding, and in the words of Pete Seale, if you beat it it will run away.
  • Phil says Open Source is free like a Flower. "I think of Open Source software as being like a nice set of flowers in a common space such as a courtyard. Nobody that lives around the common space owns the flowers, yet they all enjoy the presence of the flowers."
  • Jeff says Open Source is free as in Free. "The highest compliment you can pay any piece of open source software is to simply use it, because it's worth using."

From my point of view, just USING Open Source software doesn't fix bugs. Volunteers fix bugs, whether they are a member of the project or not. (Assuming you haven't got an Open Source Sugar Daddy or a company that supports your work.)

All that is required for Evil to succeed is that Good Men [and Women] do nothing.

If you have the power to fix a bug (or at least get the fix started), especially in software you're using, why not make THAT your contribution?

Jeff says:

Fine. Create a new blog entry. Walk us through, step by step, the process for contributing a fix to DasBlog. List EVERY step, starting with finding a bug.

If it's that easy, prove it.
Jeff Atwood on August 2, 2006 09:40 AM

Kind of a sassy tone that, Jeff ;) but here you go.

Note, the bug might be one line, a single char, or quite involved. It all depends. The point is, any help you can give an Open Source dev, no matter how little is a good thing. If you can give them a line number and an idea, that's contributing. Here's an ideal (and real) bug report that stops just short of including the fix. We'll fix it and submit the patch.

How to fix a bug in an Open Source Project
(Or at least one that uses Subversion or CVS and is hosted at SourceForge)

Get the Project

Install TortoiseSVN and/or TortoiseCVS, depending on which source control system the Open Source Project is using. They both work about the same, integrating into Explorer.

Make a new folder, right-click, select Checkout.

Opensource1

Enter the URL of the Source Repository and click OK. In this example, the project at Source Forge is called "dasblogce" and we are getting the "trunk" so the URL is https://svn.sourceforge.net/svnroot/dasblogce/trunk. This is how folks are getting the very latest "bleeding edge" versions of DasBlog, since we haven't released in a while.

Opensource2

Build the Project

Every project is a little different, but most have a build file, readme or some detail that says how to get started.

Assuming you have IIS installed, to build DasBlog, run the CreateDasBlogVdir.vbs file in the tools folder to make the IIS Virtual Directory for your local copy.

Open up DasBlog All.sln in Visual Studio 2003 and build. Your virtual directory is mapped to <projectdir>\newtelligence.DasBlog.Web and your binaries - since this is a web application - are in the <projectdir>\newtelligence.DasBlog.Web\bin folder.

Example: Find a Bug

So perhaps you've found a bug. Maybe you got the Yellow Screen of Death. You likely have a stack trace or a strange bit of behavior.

Most projects at SourceForge have a home page like http://sourceforge.net/projects/dasblogce. Visit ours and click the Bugs menu item. Pick one, or see if the bug you've found has already been reported.

For example, George V. Reilly reports in Bug 1397557 that our "content filter" feature for making words link as Google Searches doesn't work well. He writes:

[The Content Filter] $g(multiple words) should produce
<a href="
http://www.google.com/search?q=multiple+words">
multiple words</a>. In other words, the spaces should
be URL encoded as pluses in the URL.

I spent some time looking into a fix. It doesn't seem
to be possible with a regex. See the thread I started at
http://regexadvice.com/forums/14513/ShowPost.aspx

My suggested fix.
$g(expr) ->
<a href="
http://www.google.com/search?q=$h(${expr})">
${expr}</a>
where $h is a new kind of content filter, one that uses
a builtin function to URL encode the string.

Here he is kind enough to suggest the desired behavior. As you may have found the bug or undesirable behavior, you may have an opinion as to how to fix it.

Example: Fixing the Bug

So since this bug involves DasBlog's content filter feature, I'll search the project for "ContentFilter" using Ctrl-Shift-F (Find in Files).

Opensource4

Looking at my search, "ApplyContentFilters" looks promising in Utilities line 645.

As George points out in the bug report, we want to UrlEncoded the result, but we don't want to UrlEncode all results. Just some.

He also helpfully points me to a post on a RegularExpressions forum where he tried to get the bug fixed using pure Regex. It doesn't appear possible with just RegEx, so we'll use a System.Text.RegularExpressions.MatchEvalulator like the post suggested. He also recommends a new kind of Content Filter that would UrlEncode. In this case, it'll be necessary because we want to do this:

$g(The Quick Brown Fox)

into

<a href="http://www.google.com/search?q=The+Quick+Brown+Fox">The Quick Brown Fox</a>

Note that if we did a blanket UrlEncode on the first string, we'd get + signs in our linked text.

So, we'll take his suggestion. Here's the code for a new ApplyContentFilters function with our changes in red.

Remember, we will be submitting our changes as a DIFF file for the developers/commmiters/admins to check in, as we're assuming we don't have source 'commit' access.

private static string CustomUrlEncodingRegexReplacer(Match m)

{

    // Remove the $<char>() from around the string and encode the result.

    if (m.Value.Length < 4) throw new ArgumentOutOfRangeException("Match",m.Value,"UrlEncoded Content Filters should be in the format $u() where 'u' is any single character. Match strings must be at least 4 characters long.");

    string trimmed = m.Value.Substring(3,m.Value.Length-4);

    return HttpUtility.UrlEncode(trimmed);

}

 

public static string ApplyContentFilters( SiteConfig siteConfig, string content )

{

    if ( content == null ){return String.Empty;}

 

    foreach ( ContentFilter filter in siteConfig.ContentFilters )

    {

        if ( filter.IsRegEx )

        {

            try

            {

                if(filter.UrlEncode)

                {

                    content = Regex.Replace(content, filter.Expression, new MatchEvaluator(CustomUrlEncodingRegexReplacer), RegexOptions.Singleline);

                }

                content = Regex.Replace(content, filter.Expression,filter.MapTo,RegexOptions.Singleline);

            }

            catch

            {

            }

        }

        else

        {

            content = content.Replace( filter.Expression, filter.MapTo );

        }

    }

    return content;

}

And we'll add our new Content Filter as George suggested to the XML settings file. (Note: we don't need to edit the XML directly, we'll change the editor page in a moment)

Again, changes in red.

  <ContentFilters>
    <ContentFilter find="\$g\((?&lt;expr&gt;[\w\s\d]+)\)" replace="&lt;a href=&quot;http://www.google.com/search?q=$u(${expr})&quot;&gt;${expr}&lt;/a&gt;" isregex="true"/>
    <ContentFilter find="\$u\((?&lt;expr&gt;[\w\s\d]+)\)" replace="${expr}" isregex="true" urlencode="true"/>
...snip other filters...
  </ContentFilters>

So now after our Google filter (or dictionary filter, or any of the dozens of filters that folks use) runs, we'll be able to UrlEncode arbitrary parts of the result.

Now we'll add UrlEncode as an option to the ContentFilters object. We'll make false the default so we don't break our public interface as we don't want to break existing code or change existing behavior.

Opensource4

Content Filters don't have to be edited in the XML file directly, they are managed by a rich UI. We'll want to extend the UI quickly.

On the EditContentFilters page, I'll add a new column to allow us to edit this new option in "EditContentFilters" by copy-pasting from another column.

Opensource5

I also do copy paste of the code to update the config file by using the existing "IsRegEx" example. It's a true/false checkbox-style option, just like the new one we're adding.

Here's a test of the results. Note the + in the URL in the Status Bar.

Opensource6

Making the Patch

Now that we think the bug is fixed, we want to make a patch/diff file that will allow the developer(s) to apply easily so they can consider our patch for committing to the project. We don't want to email them a zip of our project directory. That would mean they'd have to manually diff each file and that's a hassle. Remember the goal here is easy on everyone's part. We don't want to bust our asses sending in the patch and we don't want to stress them out by sending 4 megs of code when we only changed 10 lines.

Now I'll right click in the main folder of my project in Explorer and click Create Patch.

Opensource7

From the Create Patch window I will select the files I changed:

Opensource8

In this example, it was only four files. I'll save the unified diff/patch as "contentfilterchange.patch"

Opensource9

If I look inside the patch file with Notepad2 (with it's lovely diff/patch syntax highlighting) I'll see just my few changes with deletes and adds highlighted.

Opensource10

Now, we'll log back into SourceForge and upload and attach our patch to the bug.

Opensource11

Conclusion

We've just downloaded source to an Open Source application, built it, found a bug, fixed the bug, and submitted a patch to an Open Source Project that we were not committing members of. 

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.