Wednesday, February 15, 2012

A Fundamental Law of the Universe

...the primary rule of IT support: whoever touched it last owns it.
Remy Porter for WTF!

Wednesday, January 11, 2012

How to write regexs matches that span multiple lines in Visual Studio search

Visual Studio has its own weird syntax for searching with regular expressions. Here's how to make a match across multiple lines. Given the sample XSL blocks below
<xsl:apply-templates select="Alph" mode="frobit"/>
<xsl:apply-templates select="Bob" mode="zap"/>
<xsl:apply-templates select="Cam"/>
I want to match the two statements with the mode="frobit", even though the first one has a carriage return in the middle. In VS, you'd use this regex statement to match just the first and last lines, skipping Bob with mode="zap":

select.*\n@.*mode="frobit"

The first bit, select.*\n, is standard Perlish for "match from the word select to the end of line character, \n."

The at sign @ is VS's way of asking "please can you find zero or more carriage returns, but only as few as needed." The alternative is the "greedy" match, using an asterisk *, which says "find as many lines as you can ending in carriage returns before you hit mode="frobit", so the match in this case would make one giant match, including all of the text from select="Alph" all the way to the last "frobit" on Cam, capturing poor Bob in the middle along the way.

Friday, January 6, 2012

How to clean up Windows Media Player

If you've relocated or removed a media directory but its contents are still showing up in WMP's libraries list, try deleting the contents of C:\Users\[username]\AppData\Local\Microsoft\Media Player. That should clear out phantoms!

Tuesday, January 3, 2012

How to restore TortoiseSVN icons in Windows Explorer

From the TortoiseSVN FAQ
With TortoiseSVN 1.3.0 and later, you can also rebuild the icon cache by calling TortoiseProc from the command line like this TortoiseProc.exe /command:rebuildiconcache

Thursday, December 1, 2011

Open Windows Explorer from the command line with a Folder tree

Did you ever have one of those "GARGHH!" moments when someone shows you how to do something sorta obvious but not really? Like opening Windows Explorer from the command line the way you want it to look? For example, I changed the default action for files of type "Folder" from "open" to "explore". That way, when I double-click a folder shortcut or "My Computer", the sidebar in the Explorer view shows the list of folders instead of the list of tasks, other places, etc.
The commands C:\>start foo or C:\>explorer /e, foo (notice the switch and comma!) opens Windows Explorer view the way I like it: 
Typing C:\>explorer foo produces a standard or default view:
This respect for the user's preferences seems to extend to things like the tool bars and status bar and type of view, e.g. tiles or details.  C:\>explorer foo seems to ignore all of your preferences.
Thanks to the mighty folks at How-To Geek for the awesome insights.

Wednesday, August 17, 2011

The Anti-Car Movement


Erik Curren writes in his review of Stop Signs: Cars and Capitalism on the Road to Economic, Social and Ecological Decay:
For my money, to get people to demand change on such a large scale, they’re going to need a pretty strong motivation. As any salesman can tell you, fear of loss is a much stronger motivator than hope of gain. And considering what’s at stake at this point — the survival of human civilization — a healthy sense of fear and urgency is also a more realistic reaction than warm-fuzzies about a higher quality of life.