Entries from September 1, 2012 - September 30, 2012

Wednesday
Sep262012

VisioPS now Requires PowerShell 3.0  

A recent change in VisioPS, my Visio PowerShell module, will result in a slight change for users.

The change is simple: VisioPS now requires Powershell 3.0.

You can download PowerShell 3.0 as part of the Windows Management Framework 3.0 –  which is available for download here: http://www.microsoft.com/en-us/download/details.aspx?id=34595

If you try using VisioPS with PowerShell 2.0, you will now get this error:

Could not load file or assembly 'System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Windows 8 users will not have to do anything special because Windows 8 comes with PowerShell 3.0 already installed.
Sunday
Sep162012

Bringing Back the Start Menu in Windows 8 with Classic Shell  

I've completely adapted to the new Windows 8 Start Screen, and for new Windows 8 users, I recommend giving it a month or two so that you can see for yourself what you like or dislike about it.

But for some of you, having something more like the old Start Menu is what you really want. So, having said that let's take a look at one popular and free solution: Classic Shell.

First, you can download Classic Shell from here.

Installation is very quick. After it installs on of the first things it will ask you do do is pick a style for the Start Menu

Snap00102

 

I selected the last option on the right “Windows Vista/Windows 7”.\

And now I have a Start Menu again.

Snap00101

 

Compare it to the screenshot below which shows the original Windows 7 Start Menu.

Snap00115

 

 

And it's very configurable. Below are the screenshots of all the settings. And notice that on the Windows 8 Settings tab you can also disable the active corners.

Snap00102

 

 

Snap00103

 

 

Snap00104

 

 

Snap00105

 

 

Snap00106

 

 

Snap00107

 

 

Snap00108

 

 

Snap00109

 

Snap00110

 

 

Snap00111

 

 

Snap00111

 

 

Snap00112

 

 

Snap00113

 

 

Snap00114

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Saturday
Sep082012

The Humor of ReSharper 7  

A always get a self-satisfied smile when I see this ReSharper 7 dialog appear when I launch Visual Studio 2012.

See the button highlighted in red. An appeal to my vanity works so much better than “Don't show this to me again” :-)

Snap00137

Friday
Sep072012

Exporting Windows Media Player Metadata to a CSV file  

I've written about this topic before except at that time dealing with IronPython and PowerShell. This post shows you show to accomplish the same thing in C#.

In order to use this code you'll need to:

 

  • Add a reference to WMPLib which is found at C:\Windows\System32\wmp.dll.
  • Add a NuGet reference to CsvHelper

 

 

using System.Collections.Generic;
using System.Linq;
// Add a Reference to WMPLib at c:\windows\system32\wmp.dll
// for VS2010 and VS2010 - make sure that for the WMPLib 
//    reference you set Embed Interop Types to FALSE
using System.IO;
using CsvHelper;
namespace ExportWMPMetdataToCSV
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                System.Console.WriteLine("Syntax: ExportWMPMetadataToCSV.exe  []");
                return;
            }
            int? top = null;
            if (args.Length >= 2)
            {
                top = int.Parse(args[1]);
            }
            string output_filename = args[0];
            var normalized_names = new Dictionary();
            foreach (var attr in all_attributes)
            {
                string name = attr.Replace("/", "_");
                normalized_names[attr] = name;
            }
            var wmp = new WMPLib.WindowsMediaPlayerClass();
            var item_collection = wmp.mediaCollection.getAll();
            using (var writer = File.CreateText(output_filename))
            using (var csv = new CsvWriter(writer))
            {
                // Write CSV Header
                for (int i = 0; i < all_attributes.Length; i++)
                {
                    string h = normalized_names[all_attributes[i]];
                    csv.WriteField(h);
                }
                csv.NextRecord();
                for (int i = 0; i < item_collection.count; i++)
                {
                    if (top.HasValue && i>= top.Value)
                    {
                        break;
                    }
                    // write a csv line for each item in the collection
                    var item = item_collection.Item[i];
                    for (int j = 0; j < all_attributes.Length; j++)
                    {
                        var attr_value = item.getItemInfo(all_attributes[j]) ?? "";
                        csv.WriteField(attr_value);
                    }
                    string sourceurl = item.getItemInfo("SourceURl") ?? "";
                    if (sourceurl.Length > 0)
                    {
                        if (sourceurl[1] == ':')
                        {
                            if (!System.IO.File.Exists(sourceurl))
                            {
                                System.Console.WriteLine("does not exist: {0} {1}", i+1,sourceurl);
                                wmp.mediaCollection.remove(item,false);
                            }
                        }
                    }
                    csv.NextRecord();
                }
            }
            System.Console.WriteLine("DONE");
        }
        private static string[] all_attributes = new string[]
                                               {
                                                   "AcquisitionTime",
                                                   "AlbumID",
                                                   "AlbumIDAlbumArtist",
                                                   "Author",
                                                   "AverageLevel",
                                                   "Bitrate",
                                                   "BuyNow",
                                                   "BuyTickets",
                                                   "Copyright",
                                                   "CurrentBitrate",
                                                   "Duration",
                                                   "FileSize",
                                                   "FileType",
                                                   "Is_Protected",
                                                   "IsVBR",
                                                   "MediaType",
                                                   "MoreInfo",
                                                   "PeakValue",
                                                   "ProviderLogoURL",
                                                   "ProviderURL",
                                                   "RecordingTime",
                                                   "ReleaseDate",
                                                   "RequestState",
                                                   "SourceURL",
                                                   "SyncState",
                                                   "Title",
                                                   "TrackingID",
                                                   "UserCustom1",
                                                   "UserCustom2",
                                                   "UserEffectiveRating",
                                                   "UserLastPlayedTime",
                                                   "UserPlayCount",
                                                   "UserPlaycountAfternoon",
                                                   "UserPlaycountEvening",
                                                   "UserPlaycountMorning",
                                                   "UserPlaycountNight",
                                                   "UserPlaycountWeekday",
                                                   "UserPlaycountWeekend",
                                                   "UserRating",
                                                   "UserServiceRating",
                                                   "WM/AlbumArtist",
                                                   "WM/AlbumTitle",
                                                   "WM/Category",
                                                   "WM/Composer",
                                                   "WM/Conductor",
                                                   "WM/ContentDistributor",
                                                   "WM/ContentGroupDescription",
                                                   "WM/EncodingTime",
                                                   "WM/Genre",
                                                   "WM/GenreID",
                                                   "WM/InitialKey",
                                                   "WM/Language",
                                                   "WM/Lyrics",
                                                   "WM/MCDI",
                                                   "WM/MediaClassPrimaryID",
                                                   "WM/MediaClassSecondaryID",
                                                   "WM/Mood",
                                                   "WM/ParentalRating",
                                                   "WM/Period",
                                                   "WM/ProtectionType",
                                                   "WM/Provider",
                                                   "WM/ProviderRating",
                                                   "WM/ProviderStyle",
                                                   "WM/Publisher",
                                                   "WM/SubscriptionContentID",
                                                   "WM/SubTitle",
                                                   "WM/TrackNumber",
                                                   "WM/UniqueFileIdentifier",
                                                   "WM/WMCollectionGroupID",
                                                   "WM/WMCollectionID",
                                                   "WM/WMContentID",
                                                   "WM/Writer"
                                               };
    }
}
Wednesday
Sep052012

An RGB Atlas of Colors - Just a page after page of sweet, glorious RGB  

(via designboom)

One of my obsessions is finding interesting color pickers in software. But I was unprepared for this beautiful set of 3 books by Tauba Auerbach –  each a cube of 8 x 8 x 8 inches.

 

http://www.designboom.com/weblog/cat/10/view/23357/tauba-auerbach-rgb-colorspace-atlas.html

Snap00126