Wednesday, November 29, 2006

A few weeks ago I posted a way to use PowerShell to find in files. This is just an extension of that post to show how you might open the results of your find in a program.

Try this out:

dir -include *.vb -recurse | select-string "text to search for" | % { notepad $_.Path }

If you've got a lot of Visual Basic files that contain "text to search for", you may end up with a lot of instances of notepad open. At work, I use UltraEdit, so I typically would open my files using uedit32 so that all of the results get opened in tabs. You could do the same with Notepad++ or any other program.

I haven't really used PowerShell for much production work, but it has already made me for more productive than I used to be.

While I'm at it, I'll share another nice one-liner that Kerry shared with me to ngen all assemblies in a directory:

dir *.dll | % { C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ngen.exe $_.fullname}

posted on Wednesday, November 29, 2006 1:21:49 PM (Central Standard Time, UTC-06:00)  #    Comments [0]
 Tuesday, November 07, 2006

The web has been busy with news about .NET 3.0 going RTM, along with Office 2007, Vista, etc. But some other news that hasn't received quite as much publicity is news regarding Sysinternals at Microsoft. There were a couple of posts today that I thought were very interesting.

The first post is about the move from the original Sysinternals site over to Microsoft. I think the best part of the announcement is the focus on letting the "community demand help drive [their] priorities." A few of the comments have been negative regarding the decision to not post the source code to the tools, but that is the only negative thing that I can see in the post. Besides, if people want the source enough, maybe Microsoft will put it back out again. They listened when people complained about the Vista EULA didn't they?

The second post is even better news. In addition to some new releases of some great tools from Sysinternals (mostly to support Vista), a new tool has been released called Process Monitor! Process Monitor takes all of the functionality provided by RegMon and FileMon and combines them with even more information such as information about threads! If you're worried that it will put too much into one place because it was nice to focus only on registry or file access, don't because with the click of a button, you can tell it to only display registry changes, file changes, or thread changes. If you want to get straight to the main Process Monitor page, it is here.

Here's a screenshot of Process Monitor in action:

Unrelated to this post, but I used the Snipping Tool in Vista to get this screenshot. It works pretty well.

posted on Tuesday, November 07, 2006 6:58:17 PM (Central Standard Time, UTC-06:00)  #    Comments [0]
 Monday, November 06, 2006

I haven't posted anything on PowerShell in a while so here's something that's useful.

Get-ChildItem -Recurse -Include *.* | Select-String "text to search for"

Or, if you like things a little more abbreviated, try this:

dir -r -i *.* | Select-String "text to search for"

Select-String is a cmdlet that will search files or strings, sort of like grep in Unix or findstr in cmd.exe. If you use the Get-ChildItem cmdlet, you can specify the -Recurse switch to retrieve subdirectories and the -Include switch will only include the file types that you specify. Then you can pipe it over to Select-String.

Pretty nifty if you're wanting to do some quick file searches.

Check out this PowerShell in Action book excerpt. It gives a good overview on file manipulation from PowerShell and also introduced me to using the Get-ChildItem command and piping the output to Select-String.

Before I began using PowerShell, I had been using a small cmd file called ff.cmd that used the following:

findstr /p /s /i /c:%1 %2

Then I could type things like:

ff "text to search for" .\*.*

But PowerShell is so much cooler now :-)

posted on Monday, November 06, 2006 1:12:11 PM (Central Standard Time, UTC-06:00)  #    Comments [0]
 Tuesday, October 31, 2006

Colin has raved about the joys of middle clicking for a while now, but I was never able to enjoy it because clicking my mouse's middle button never seemed to do all of the cool things that his did. Mine brought up a really weird multi-directional arrow thing that was supposed to let me scroll in any direction I wanted - except that it rarely worked the way I wanted it to.

Well, I finally decided it was time to fix it once and for all so that I could enjoy middle clicking like the rest of the world.

The mouse in question that I'm using is the Logitech MX700 *.

Here's what my mouse settings dialog looked like when it didn't work:

Now that it does work, it looks like this:

The difference is subtle, but all I did was change the functionality for the middle button from "Universal Scroll" to "Middle Button." That was way too easy for me to have missed it for this long, but I'm glad I finally found it. If you're having a similar problem getting your MX700 (or other similar Logitech mouse) doing middle clicks the way you want, check out what your setting is.

* - The Logitech MX700 is a great mouse that has a recharging dock so you don't have to buy batteries all of time... I've been using mine for almost 3 years without any new batteries. I can also highly recommend the Logitech MX1000, which I use at home. I plan on sticking with Logitech mice unless Microsoft ever releases a wireless mouse with a rechargeable dock. That rechargeable dock makes all of the difference.

posted on Tuesday, October 31, 2006 1:13:17 PM (Central Standard Time, UTC-06:00)  #    Comments [0]
 Monday, October 30, 2006

I'm having my first 9 minutes of fame... ever!

Check it out here!

(from Jon Galloway)

posted on Monday, October 30, 2006 12:58:00 PM (Central Standard Time, UTC-06:00)  #    Comments [0]
 Tuesday, October 24, 2006

For those of you who don't subscribe to digg, check this out.

From the website:

"The Microsoft Internet Explorer Team sent us a cake for the upcoming release of Firefox 2!"

(via digg)

posted on Tuesday, October 24, 2006 6:30:04 PM (Central Standard Time, UTC-06:00)  #    Comments [0]

I guess this is really more of a link regarding ASP.NET AJAX and Full Trust.

Ken Cox points out that the new AJAX extensions install themselves into the GAC instead of a Bin subdirectory. I hadn't really thought about this until he notes how this affects those of us (me included) who have shared web hosting.

I've been putting a picture slideshow together for my sister's wedding and I've spent the past couple of nights working on a nice, AJAX-y website that would allow her to pick her own captions for the pictures and customize the slides without me having to email a huge PowerPoint file to her. It sounds like I'll have to look at another option for the time being, though, because I doubt I'll be able to convince my web host to install beta software to the GAC.

*sigh*

What fun it is being a beta junkie.

posted on Tuesday, October 24, 2006 7:42:30 AM (Central Standard Time, UTC-06:00)  #    Comments [3]
 Saturday, October 21, 2006

I recently installed GhostDoc 1.9.5 on Vista RC2 at home. At first, I received as error towards the end of installation so I searched around a little bit to see if anyone else had seen the error. Then, as with most issues I've had with Vista, I decided to see if elevating the install to admin would work which seems to have worked fine.

The easiest way I've found to run things that don't offer a "Run as admin" option on the click menu (like MSI files) is to run the Command Prompt as an admin and then start the program from there. You can pull up the start menu, type cmd and then CTRL+SHIFT+ENTER which will run the command as an admin (thanks to Kristan Kenney for that info). Quite a nifty shortcut key for running as an administrator.

posted on Saturday, October 21, 2006 1:30:29 PM (Central Standard Time, UTC-06:00)  #    Comments [0]