Posts Tagged ‘Tip’

Formatting XML in ViM

September 11, 2012 Leave a comment

I love ViM. I use it for a lot of coding – especially non-project-based coding like creating or modifying PowerShell scripts. It’s also great for diagnosing log files or just a general purpose vanilla text editor/viewer with powerful regular expression search capabilities.

A common pattern of use is to open large minified XML files – like a Burn bundle manifest (which for Visual Studio 2012 is huge). Parsing all that information as a single line is a daunting task – one made more simple by formatting (indenting) the XML. I had a way that involved opening the file in another editor, formatting it, then saving it. But then I stumbled across another tip that inspired the following 2 commands that do all this in ViM:


This uses the default indentation ( :help c-indenting ) shipped with the main ViM distribution and works great for XML. It even provide progress by counting down the lines left to process.

Categories: Computers and Internet Tags: , ,

A faster way to output unique objects in PowerShell

August 15, 2012 Leave a comment

Many times – mainly when writing function cmdlets for other purposes – I find that I need to output all unique objects based on one or two properties but want all the objects’ properties returned. PowerShell’s built-in Select-Object doesn’t let me do that. Apart from enumerating and collecting all objects before outputing them to the pipeline, it only return the properties that you specified.

To let all the objects flow through the pipeline as they are enumerating, I added my own Select-Unique cmdlet to my $profile a couple of years ago but wanted to share it now as a Gist.

See the comments on the gist for more information.

How to split PST files in Outlook 2010

October 15, 2011 1 comment

For various reasons I’ve started splitting my archive folders into separate files separate by date. There is a fairly simple object model for Microsoft Outlook and utilizing built-in search in 2010 this would be even easier to write my own program, but being a pragmatic programmer I figured I’d see if anyone else has done this. There is many applications out there, but some were for-pay and none came from sites with which I was familiar.

Then I found buried in Outlook a way to archive even the archive folders with the ability to do so by date.

  1. Open Microsoft Outlook 2010 if not already open.
  2. Optional: Clean up archive folders to reduce size and decrease the time to process (see below).
  3. Click on File.
  4. Click on Cleanup Tools, then Archive….
  5. Scroll down and select “Archive Folders”.
  6. Set the date for which older items are moved into a new folder.
  7. Set the location for the new archive PST file.
  8. Click OK.

When complete, the archive PST is attached to your Outlook profile and will be indexed.

The optional step is clean up each folder before splitting your PST. I do this every month or so on my current folders as well before they are archived to reduce the active archive PST as well (too bad the Auto Archive settings don’t allow for this). While this is supposed to work on sub-folders, it has not seemed to work for me. So to clean up each folder,

  1. Select the folder to open it.
  2. Right click on that same folder and select Clean Up Folder.

Hopefully this tip helps you split PST files by date easily and freely.

Categories: Computers and Internet Tags: , ,