JCooney.NET

Joseph Cooney's Weblog

My Links

Blog Stats

News

I work for:


see also:
Dominic Cooney
Patrick Cooney

Archives

Image Galleries

My GotDotNet Samples

Tuesday, April 29, 2008

CodeCampOz 2008 slides - Silverlight 2.0 and WPF

Here are my slides from the talk I gave at CodeCampOz 2008 on “Silverlight 2.0 and WPF - what's the same and what's different”. Thanks to everyone who came along to my talk. I'll be doing the same talk in June at the QMSDNUG in Brisbane. I had to cancel on Mike for the May session because of ReMix, where I'll be talking about WPF 3.5 and the coming improvements to WPF.

slides as PDF [691K] (the WPF logo looks a little weird in the background...something strange with transparent PNGs and export to PDF from Powerpoint?)

 

posted @ 7:18 AM | Feedback (0)

Wednesday, April 23, 2008

A gentle reminder that interfaces aren't contracts

I received a gentle reminder this evening that interfaces aren't contracts. I was attempting to bend Silverlight 2 to my will, specifically the ResourceDictionary. I really wanted the keys, and was pleased to see that it implemented IDictionary<object,object>, which would give me a collection of keys (of object). I was dismayed to see the following implementation in reflector for the Keys and Values properties.

    ICollection<object> IDictionary<object, object>.Keys
    {
        get { throw new NotImplementedException(); }
    }

    ICollection<object> IDictionary<object, object>.Values
    {
        get { throw new NotImplementedException(); }
    }

This really brought home to me that Interfaces are nice and all, but really only tell us that a type will have methods with a certain name that take certain paramters - exactly the same thing the compiler tells us about lots of other things (that is if you're in a compiled world....the benefits of interfaces seem even more marginal in more dynamically typed duck typing* languages). It doesn't guarantee that the methods will actually DO what we think they'll do (or even that they'll do anything at all except throw an exception in your face). Don't get me wrong - I like and user interfaces, but they're not a contract, more of a gentleman's agreement or shared understanding. Now if you'll excuse me I have some nasty reflection hacks I need to brutally force on the Silverlight run-time.

* Aside: speaking of duck typing, I heard of another interesting turn of phrase for monkey patching - duck punching! If it walks like a duck and flaps like a duck but doesn't quite quack the way you want it to you just punch it [chewie].

 

posted @ 8:33 AM | Feedback (1)

Thursday, April 03, 2008

Ideas are worth next-to-nothing

I was reading through a discussion thread on a programming forum, where someone was proposing that a large software vendor should pay community members for ideas on how to enhance said software vendor's platform. This is an interesting idea, which files in the face of my own personal belief that ideas (with a few notable exceptions) are worth approximately nothing. It is the implementation/execution of the idea that is worth something. Lets look at some big software companies - Microsoft and Google. Operating systems were certainly not a new idea when Microsoft released MS-DOS, it was their implementation of the idea and the royalty stream they created through savvy licensing to IBM that made MS. The operating system they licensed to IBM wasn't even theirs, it was a CP/M clone they bought for $50K. Internet search and on-line advertising were not new ideas when google entered this market, but their dogged refinement of their search implementation built the brand/trust in the company, which in turn lead to extreme user buy-in and eventually a strong “network effect” between on-line content providers (AdSense) and advertisers (AdWords). Strong implementations of ideas are bought and sold every day (they're called companies, or the rights to products) whereas there is not currently an established market for ideas.

See also: No One Is Going To Steal Your Brilliant Idea

posted @ 11:59 AM | Feedback (1)

Tuesday, April 01, 2008

WPF MVP for another year

I was very happy to receive notification that I've been renewed as a WPF (technicall 'Visual Developer - Windows Client') MVP for another year. Thanks to Rose S. and the MVP team.

posted @ 12:56 PM | Feedback (2)

Wednesday, March 26, 2008

A Soul-ful Batman and Batgirl at Heroes Happen in Brisbane

Brisbane's own Dyanmic Duo Bronwyn and John showed up to the Heroes Happen event dressed as Batman and Batgirl. Respekt! They had previously emailed me trying to convince me to wear this superman outfit, but I had assumed it was a ruse and if I'd shown up in it there would have been much pointing and laughing. I work in an office environment where elaborate pranks featuring fake UPS tracking sites, trojaned laptops, host file entries, shelf companies, skype answering services attached to foreign numbers and faking your own death in the name of a good laff are not unheard of, so I assuemd this was just a pretty simple prank directed against me.

posted @ 3:12 AM | Feedback (1)

Tuesday, March 25, 2008

We can be "heroes" just for one day

Tomorrow I'll be attending the Visual Studio 2008, SQL Server 2008 and Windows Server 2008 "heroes happen here" launch event, manning a booth of some kind.

posted @ 3:43 AM | Feedback (1)

Thursday, March 13, 2008

Works on My Machine logo as ASCII Art - prefect for check-in/defect resolution/bug triage/investigation comments

Have you ever wanted to attach the ever-popular “works on my machine” logo to a check-in comment or “bug” report, but been thwarted by text-only fields? Well look no further friends (courtesy of glassgiant):

Small Version:

MMMMMMMMMMMMM=IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII=+???????IIIIII
MMMMMM~IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII~IIIIIII
MM:IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII+III
:IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII:I
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII ?II? III~,IIIIIIIIIIIII.~IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII=
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII= II. :II IIIIIIIIIIIIII.~IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII II . I~ II.   =II =  I.~I+ II=   IIIIIII    ?II +   IIIIIIIIIIIIIIIIIII
IIIIIIIIIIII   ?IIIIIIIIIIIIIIIIIII=  .IIIIIIIII =?.I I +I .III II +III.~ ,III..IIIIIIII ~III II III ,IIIIIIIIIIIIIIIIII
IIIIIIIIIIII I+                     I  IIIIIIIII? .II.~ II ,III II +III.~ .IIIII? +IIIII =III II III ,IIIIIIIIIIIIIIIIII
IIIIIIIIIIII I                      I  IIIIIIIIII  II? ?III ,?..II +III.~I? II.=? IIIIII? := :II III ,IIIIIIIIIIIIIIIIII
IIIIIIIIIIII I                      I  IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIII I                      I  IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIII I                      I  IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIII I                      I  IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIII I                      I  IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIII I                      I  IIIIIIIIIIIIIIIIIIIIIIIIIIIIII .        II, .II, IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIII I                      I  IIIIIIIIIIIIIIIIIIIIIIIIIIIIII ,II  II: III  I~ IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIII I                      I  IIIIIIIIIIIIIIIIIIIIIIIIIIIIII ,II  II: III, . .IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIII I                      I  IIIIIIIIIIIIIIIIIIIIIIIIIIIIII ,II  II: IIII  .IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIII I                      I  IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII: IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIII ?I                    ,I  IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII, ~IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIII                          ~IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIII                            +IIIIIIII. ~IIIIII  IIIIIIIIIIIIIIIII .IIIIII+ IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIII                              IIIIIIII., IIIII?  IIIIIIIIIIIIIIIII .IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIII                              IIIIIIII.,,.IIII I III    .III    .I .    III II .    III,    IIIIIIIIIIIIIIIIII
IIIIIIIIII                              IIIIIIII.,I III :I IIIIIII II ?IIIII  III =II II  III.:I~.III? IIIIIIIIIIIIIIIII
IIIIIIIIII,                             IIIIIIII.,I? I=.II III     II IIIIII .III ~II II .III.,I.      IIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII.,II.. III II :III II IIIIII .III ~II II .III.,I:.IIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII.,III +III II.   . III    ,I .III ~II II .III.,II.    =IIIIIIIIIIIIIIII=
,IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII,I
II:IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII=III
IIIIII:IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII:IIIIIII
IIIIIIIIIIIII=IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII=IIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIIIIIIII:~=+??IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII???=~:IIIIIIIIIIIIIIIIIIIIIIIIII
                                                                                                         GlassGiant.com

Large Version:
MMMMMMMMMMMMMMMMMMMMMMMMMMM,~=IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII+~,IIIIIIIIIIIIIIIIIIIIIIIIIIII
MMMMMMMMMMMMMMMMMMMM=IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII=:IIIIIIIIIIIIIIIIIIII
MMMMMMMMMMMM:?IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII?:IIIIIIIIIIIII
MMMMMMMM:IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII:IIIIIIIII
MMMM:IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII+IIIII
MM=IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII=III
+IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII+I
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII. IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII~
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII. IIIII   ?IIII..IIIIIIIIIIIIIIIIIIIIIII. IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII= ~III=   :III? +IIIIIIIIIIIIIIIIIIIIIII. IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII .III. ~ .III, IIIII:. .:IIIII: .I+..II. IIII. ,IIII~. ,+IIIIIIIIIIIII,. .~IIIII. :I?..,IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIIII,                                         +IIIIIIIIIIIIIIII  =II ,I  II? .III. =III~ ,III:   +IIII. II? .IIII~ .IIIIIIIIIIIIIII. ?III, ~III.   +II. =IIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIII                                            ~IIIIIIIIIIIIIII, .II +I, ?I, =II~ .IIIII. =II: .IIIIII. I~  IIIII, .IIIIIIIIIIIIII. ,IIIII  ?II. .IIII. ,IIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIII   +IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII,   IIIIIIIIIIIIIIII  +~.II? ,? .III. :IIIII, .II: .IIIIII.   ,IIIIIII+.   =IIIIIIIIII  +IIIII. ~II. :IIII. ,IIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIII  =I+                                   II   IIIIIIIIIIIIIIII, ,.:III.., ~III. ,IIIII. ,II: .IIIIII. I. .IIIIIIIII?  .IIIIIIIII  =IIIII  =II. :IIII. ,IIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIII  II                                    ,I+  IIIIIIIIIIIIIIII?   IIII=  .IIIII  IIIII .III: .IIIIII. III. =IIIIIIII= .IIIIIIIII+  IIII? .III. :IIII. ,IIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIII  II                                     II  IIIIIIIIIIIIIIIII.  IIIII  ~IIIIII.     .IIII: .IIIIII. IIII  ,II,     .?IIIIIIIIII?      ,IIII. :IIII. ,IIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIII  II                                     II  IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIII  II                                     II  IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIII  II                                     II  IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIII  II                                     II  IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIII  II                                     II  IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIII  II                                     II  IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIII  II                                     II  IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIII  II                                     II  IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII   II, .:III=. :IIII    IIIIII  .IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIII  II                                     II  IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII   +      ?      ?II~   :IIII+  ?IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIII  II                                     II  IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII    +I+    +II.  ,III.   IIII  ?IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIII  II                                     II  IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII   IIII   IIII:  ,III?   +II. :IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIII  II                                     II  IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII   IIII   IIII:  ,IIII,  .I=  IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIII  II                                     II  IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII   IIII   IIII:  ,IIIII.  ,  :IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIII  II                                     II  IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII   IIII   IIII:  ,IIIII+    .IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIII  II                                     II  IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII   IIII   IIII:  ,IIIIII,  .IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIII  II                                    ,I?  IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII+  +IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIII  II,                                   ?I:  IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII:  =IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIII   II:                                .+I=   IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII=  ,IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIII     +IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII?=    ,IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIII=                                          ,IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII, .IIIIIIIIIII. .IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIII+                                              .IIIIIIIIIIIIII+   ~IIIIIIIIII:   IIIIIIIIIIIIIIIIIIIIIIIIIIII, .IIIIIIIIIII. .IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIII=                                                 IIIIIIIIIIIII+    IIIIIIIIII .  IIIIIIIIIIIIIIIIIIIIIIIIIIII, .IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIII.                                                 IIIIIIIIIIIII+  : ~IIIIIIII: =  IIIIIIIIIIIIIIIIIIIIIIIIIIII, .IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIII                                                  IIIIIIIIIIIII+  I, +IIIIII~ ==  IIII:       ?IIIII.      .II, .      .IIII, .III~ ..      IIIII?       +IIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIII                                                  IIIIIIIIIIIII+  II .IIIII?  I=  IIII:?IIII? .III?  .IIIIIIII,  =IIII  ,III, .III~  ~IIII. .III+  =IIII. ?IIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIII,                                                 IIIIIIIIIIIII+  II: .IIII  +I=  IIIIIIIIIII  III  ~IIIIIIIII, .IIIII~ .III, .III~  IIIII+  III  ?IIIIII .IIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIII=                                                 IIIIIIIIIIIII+  III. ~II, ,II=  IIIII:       III  IIIIIIIIII, .IIIII~  III, .III~ .IIIII+  II+          .IIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIII=                                              ,IIIIIIIIIIIIII+  IIII  =: .III=  III:  IIIII  III  IIIIIIIIII, .IIIII~  III, .III~ .IIIII+  II+  IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII+  IIII= .  ?III=  III. :IIIII  III  :IIIIIIIII, .IIIII~  III, .III~ .IIIII+  III  ~IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII+  IIIII.  ~IIII=  III. .IIII.  III=  :IIIIIIII, .IIIII~  III, .III~ .IIIII+  III:  =IIIII,IIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII+  IIIIII.,IIIII=  IIII.     =  IIIII,      ,II, .IIIII~  III, .III~ .IIIII+  IIIII.      ,IIIIIIIIIIIIIIIIIIIIIIIIIIII~
+IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII+ 
II=IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII=.  
IIII:IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII=I?.  
IIIIIIII:IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII:IIIII?,  
IIIIIIIIIIII:+IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII+: ,?IIIIIII:  
IIIIIIIIIIIIIIIIIIII=IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII=:?,      :IIIIIIII=. 
IIIIIIIIIIIIIIIIIIIIIIIIIII:~=IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII+~,IIIIIIIII:     .~IIIIIIII+. 
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII,:~=++???IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII???++=~::+IIIIIIIIIIIIIIIIIIIIIII=.    .+IIIIIIII?. 
                                                                                                                                                                                         GlassGiant.com

posted @ 5:51 AM | Feedback (4)

Sunday, March 02, 2008

Abstract for my CodeCamp Oz Talk - Silverlight 2.0 and WPF, What's the Same and What's Different

I just emailed the abstract for my CodeCamp OZ 2008 talk to Mitch and Greg. Essentially I'd like to do a comparison between WPF and Silverlight 2.0, looking at the control set, the threading model, variations in the use of the Xaml dialect, deployment, data binding, styling and templating. Also I want to look at how you can re-use components, code and design elements between the two frameworks. I know this one will be fairly topical with the imminent release of Silverlight 2.0 beta1, but I'm sure there are also plenty of other folks with interesting ideas for talks. I hope my one gets up.

posted @ 2:54 AM | Feedback (2)

Wednesday, February 20, 2008

Visual Studio Extensibility - hard

This post from Victor Garcia Aprea (VGA...I wish MY parents had been more forward looking when they named me, although I could have ended up with a crappy acroname like JDBC or something) struck a chord with me. Extending some parts of Visual Studio is just much much harder than it should be. I've had some success in the past, but it was always extremely painful, and some cool things never saw the light of day because of it. if VGA calls this stuff hard (AFAIK he works with the PnP & VS SDK team and works for Clarius who made the  T4 editor, IronPythonStudio and a bunch of other VS-related things) then what hope do the rest of us have?

So far I know of two efforts to create a new developer shell - nautilus (only known shipping incarnation is Expression Blend), and now emacs.net. Considering the weight of history the current VS shell has I doubt the others will supplant the memory-lovin' COM beastie we know as Visual Studio.

posted @ 12:08 PM | Feedback (2)

Monday, February 04, 2008

I got a raptor

When I built my new rig last year I cheaped out on the hard-drive and got a 7200 RPM Samsung, and it showed in my Windows Experience Index Score too....my “weakest link” at 5.3. Recently I did some data recovery stuff for a member of my extended family, and as a thankyou present they bought me a 150GB WD Raptor. W00t. My WEI score is up to 5.5 now (the bottleneck has shifted to my 4GB of RAM) and the raptor scores a 5.9 for HDD perf which isn't surprising. The only small downside is I have to do a fresh install of windows to really reap the benefits. Oh well, at least I'll have a relatively clean machine for Vista SP1....due out in 48 hours or so.

posted @ 11:07 AM | Feedback (1)

Tuesday, January 29, 2008

Developer UI - the gathering

I know I've talked about developer UI before, but when I saw this today I couldn't resist. It's a GUI for robocopy from MSDN Magazine! and as you can see the translation from CLI to GUI has been fairly literal. Yes, you guessed it - every single one of those options corresponds to a command line parameter you can pass to robocopy. What does each one mean? Well - you'd better fire up a command prompt and type “robocopy /?“ to find out. The “filters“ and “logging“ tabs give you even more checkbox-array goodness.

What am I even _doing_ using a GUI for robocopy? I've always been an xcopy kind of guy, but now whenever I use it in vista it disses me about xcopy being deprecated, so today I finally bit the bullet and decided to figure out that robocopy stuff. A GUI that provided a way to enter things in a user-friendly manner and then show me the output script would be a positive boon. The reality was disappointing. It ended up being quicker muddling thru the plethora of command-line options in the CLI, and then grabbing a friendly infrastructure person to figure out some of the harder bits.

posted @ 3:12 AM | Feedback (0)

Friday, January 25, 2008

My most annoying Vista feature EVER

I've used Windows Vista as my primary OS on a number of machines since beta2, and am broadly supportive of it, however there are some things about it that annoy the heck out of me. This is probably the most annoying feature for me, where explorer will decide for some inexplicable reason that a particular folder should be treated “differently“. Let me clue you in here Vista - this isn't a directory of photos or video (I can't imagine what might have given you that impression), and I'm not about to start giving my different virtual machines “Ratings“. I want to see “Date Modified” and “Size“. Let's add “Type“ as a stretch goal in case I need to sort by that. Until you can get that right you can take your live previews of documents, funky “ultra ultra ultra large icon“ views of things, and weird non-standard menu that only shows up when I press the ALT key and de-scope it. Thankyou. If anyone can legitimately explain to me how I can never experience this problem again and a) still use vista b) still use explorer I will be extremely greatful, as changing things from the “Folder Options“ dialog has failed miserably thus far.

posted @ 5:47 AM | Feedback (6)

Wednesday, January 23, 2008

Prioritising doing over bloging

A few people have commented that I've “gone dark“ on my blog. This year I'm trying to prioritise doing over blogging. I have a number of interesting ideas I'd like to realize, and a finite amout of time to do it. If that means I only drop a few posts each year like the “SQL Server Management Studio Add-In Writing” one that haven't been covered much before, and don't post the thousandth echo chamber link to “wow, now I can single-step debug into the .NET framework” then the world will probably be a better place. We'll see how it all pans out.

posted @ 4:33 AM | Feedback (3)

Monday, December 03, 2007

Developers, Developers, Developers T-Shirt: Order Yours for Xmas

This Christmas re-live the passion all over again with the famous* “developers developers developers” shirt, the only garment to accurately encapsulate the energy, enthusiasm and profuse sweating of Microsoft CEO Steve Ballmer's famous speech to developers everywhere. As a special gift to YOU I've unleashed this zenith of word-art creativity and masterpiece of screen-grabbing for you to buy on CafePress for about $25 US (meaning that I'm making a whole $6 on EACH SHIRT!!!1). This is a little experiment of mine to see just how much more productive designing t-shirts is vs. developing advertising-sponsored software. If I sell a single shirt then this will be by FAR and away the most profitable. The t-shirt is available in 3 colors (pictured below) - “Sweaty Billionaire Blue” (my fave), “#6f6f6f” and “SteveJobsInvented Black”. So what are you waiting for? BUY BUY BUY!

Or if you're of more the DIY persuasion you can download the original image and print it out yourself and iron-on-transfer it on to a t-shirt.

posted @ 5:28 AM | Feedback (2)

Monday, November 26, 2007

The Black Art of Writing a SQL Server Management Studio 2005 Add-In

It all started with me writing this kind of T-SQL query over and over:
Select * from sysobjects where xtype = ‘U’ and name like ‘%foo%’
For the longest time I’ve wanted to write a SQL Server Management Studio (SSMS) add-in that would allow me to search for schema entities like tables and stored procedures by name non-modally to help me find things in “big” schemas. SSMS already has a schema entity search/filter feature built-in. You launch it by clicking the button with the funnel-shaped icon as shown in the screen-shot below. I wasn’t too enamoured with this since it launches a modal dialog, it only lets you search across one database, and only for one kind of thing at a time (table, stored procedure, view etc). Yes, I am that confused/lazy that I may not know which database I want to look at when I start.

SSMS Filter Functionality

Instead I imagined something where I could press a key to launch the “search” functionality, start typing and see anything that loosely matched what I had typed. Then when I found what I wanted I could click on it in the list of results and go to that item in the object explorer.

Downloads

Download the MSI here if you just want to use the add-in   

Download the code here if you want to modify the add-in or create your own

So Why Does This Qualify as a Black Art?
Writing add-ins for SSMS is something of a black art. It’s not supported, the APIs aren’t documented or designed for extensibility, and it’s really only possible by virtue of the fact that SSMS is built on top of the Visual Studio codebase. The only decent coverage I was able to find on the web was this article on ASP Alliance which doesn’t provide any code.  I’m hoping by writing this post and providing a working add-in I can start a revolution in SQL Server Management Studio add-in writing.

Why You Should Write a Cool Add-In
So I can use it. So other developers can use it. Writing stuff against supported, published, documented APIs is....well...quite frankly it’s passé. With intellisense and google and codeproject and the MSDN and blogs even infrastructure people can write code these days. So where’s the fun? It’s here my friends – all the pain of the Visual Studio object model combined with the added bonus of being unsupported and undocumented!

Starting a new Add-In Project
Creating a new SSMS add-in is very much like creating a new Visual Studio 2005 add-in. Expand the “Other Project Types” node on the left-hand side of the “New Project” dialog and select the “Extensibility” node. Then choose a Visual Studio Add-in.

Select New Addin Project Type

Step through the rest of the Visual Studio Add-in wizard, and examine the output. You should have a project that looks something like the following:

You can delete the .AddIn files – Visual Studio 2005 switched to a nicer, registry-free way of add-in registration using XML files, however SSMS does not seem to use these. Instead for SSMS to use your add-in you’ll need to add some information about it to the windows registry.

Add-In Registration
As a .NET developer you probably hardly ever have to look at the registry. For those of you young enough to have never done any Microsoft development before .NET you’ve probably NEVER had to look at the registry. That’s all about to change, because registering your SSMS add-in is ALL about the registry.
To register your add-in you’ll have to add the following keys and values to the registry:
Key Name Type Value
CommandLineSafe REG_DWORD [0=addin is not necessarily command-line safe and may display UI, 1=command-line safe]
LoadBehavior REG_DWORD [0=manually loaded, 1=loaded automatically]
ProductDescription REG_SZ [a textual description of your add-in]
ProductName REG_SZ [the name of your add-in]
SatelliteDllName REG_SZ [name of the dll your add-in lives in]
SatelliteDllPath REG_SZ [path on the file system to where your add-in will be installed]

All of this information should be contained in a registry key with the namespace of your add-in, and the type inside that namespace that implements IDTExtensibility2. If you created a new add-in via the wizard in Visual Studio this will be .Connect.
There are a few different places in the registry this registry key can live. One is Computer\HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\90\Tools\Shell\Addins\ (or Computer\HKLM\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\90\Tools\Shell\Addins\ for x64 based versions of windows).
Another is the equivalent registry hive for the current user: Computer\HKCU\SOFTWARE\Microsoft\Microsoft SQL Server\90\Tools\Shell\Addins\ - I think this is a better place to register your add-in because it isn’t x86/x64 specific, and can be written to without admin privileges. The downside is that it will only register the add-in for that user. Adding this registration information as part of the add-in deployment is handled by the Registry target in the setup project.
If some aspect of your add-in registration is incorrect or your add-in throws an exception on load you will see the following error message:

addin failed to register error message

Clicking “Yes” here will delete the registration information for the add-in in the registry, so don’t do that unless you like re-typing all that stuff. Once you get the registry stuff right you should probably export the key as a back-up in case you accidentally DO click yes one time, or if you want to develop on a different machine.
SSMS is based on the Visual Studio shell, which still uses COM extensively. For this reason the type in your add-in that implements IDTEExtensivility2 and handles the “plumbing” inside of SSMS needs to be COM-visible, and registered (hence the GUID attribute on the Connect class if you ran the Visual Studio add-in wizard). Visual Studio handles the registration when you build the add-in on your machine, but you’ll need to take care of that when you deploy your add-in to other users to get past the classic “but it works on my machine” problem.
You do this in your installer project by changing the Register property on the assembly from vsdraDoNotRegister to vsdraCOM as shown here

setting COM registration property in installer project

Add-In Debugging
To debug the add-in I set the “Debug” option to “Start external program” and provide a path to the SQL Server Management Studio executable as shown in the following screen shot.

Add-in debugging properties tab

For x86 systems this will typically be something like:
C:\Program Files\Microsoft SQL Server\90\Tools\binn\VSShell\Common7\IDE\SqlWb.exe
For x64 it might look something like this:
C:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\VSShell\Common7\IDE\SqlWb.exe

The SSMS Object Model
SQL Server Management Studio must have once been known as SqlWorkbench, based on the assembly and executable names. The foundation for understanding the managed code in SSMS is an assembly called SqlWorkbench.Interfaces.dll (typically located in the following location: C:\Program Files\Microsoft SQL Server\90\Tools\binn\VSShell\Common7\IDE\SqlWorkbench.Interfaces.dll – add an ‘ (x86)’ in after “Program Files” for an x64 machine)
This assembly contains 5 namespaces which in turn contain many classes and interfaces for interacting with SSMS. Since the purpose of this assembly seems to be a place to define common interfaces it is unsurprising that the majority of types in this assembly are interfaces. The namespaces are:

  • Microsoft.SqlServer.Management
  • Microsoft.SqlServer.Management.QueryExecution
  • Microsoft.SqlServer.Management.SqlMgmt
  • Microsoft.SqlServer.Management.UI.VSIntegration
  • Microsoft.SqlServer.Management.UI.VsIntegration.ObjectExplorer

The concrete classes that implement these interfaces (which you will be dealing with at run-time) seem to be located in separate assemblies of their own. For example the Object Explorer concrete classes are in the ObjectExplorer.dll assembly, which should be in the same directory as theSqlWorkbench.Interfaces.dll. The reflector class browser was invaluable (as always) when trying to find my way around the object model. I’d advise you to add every single managed dll in the same directory as SqlWorkbench.Interfaces.dll into reflector and use the search functionality (search is the new UI) in that tool to find your way around.

SSMS uses another API called Sql Management Objects (or SMO for short) for lots of things. Unlike the SSMS APIs SMO is a fully documented, supported piece of code developed by the SQL team for administering SQL Server. SMO is the logical successor to DMO, a COM API for administering SQL Server 2000.  SMO is fully managed and one of the best-designed APIs I’ve come across in recent times. If you want to script out SQL objects, enumerate through tables/views/columns or programmatically manipulate your SQL database this is the way to do it. In developing add-ins I would try to leverage SMO as much as possible since it integrates well with SSMS, and is much better documented and supported.

Since SSMS is built on Visual Studio knowledge of the Visual Studio object model is also quite helpful. Visual Studio makes extensive use of the “service provider“ design pattern, and the IServiceProvider interface. Many, many objects in the VS object model (and SSMS also) implement this interface, or inherit from other objects that implement this. This API is means you should always be able to “get“ the type you need, and presumably makes the object model smaller and less confusing. Unfortunately I find it hard to use, since there feels like less guarantees about if GetService will return you anything, and under what circumstances this might happen. Also the very high granularity of objects in the VS object model usually means it is hard to know which type to ask for, as there are often several likely-sounding candidates.

Adding Fuzzy Search
My original vision for searching for tables and stored procedures in the schema using T-SQL always involved a “%LIKE%” type search, and I wanted my add-in to continue in this tradition as much as possible. Fortunately I was able to find a commercial component called highlight express developed by a small ISV ShuffleText. They were keen for feedback, and the code changes required to use their stuff were so modest I decided to give it a go. I’ve been really happy – their stuff is all pure .NET code and runs quite fast. Now I keep thinking of other places a fuzzy text search would be useful – my messenger buddy list, Intellisense, active directory lookups, there are lots of places for non-exact-match searching could be used.

Add-Ins and Management Studio Express
Microsoft offer an express version of SSMS for administering SQL Server Express instances (or other SQL Server instances if necessary). Unfortuately I was unable to get my add-in to load and run inside the Express version. The SSMS tools pack (another free but not open-source) SSMS add-in say that they support SQL Server Management Studio Express. Other posts such as this one make it seem even less supported. SqlAssist (a pretty cool commercial product which to my knowledge is written as an add-in in the same manner I have described) states that the express version of SSMS does not allow add-ins.  

TODO Tasks and Excuses for my Lame Add-in Code
Q:
Does it work in SQL Server 2008 (Katmai)?
A: The add-in doesn’t work in the latest (NOV 2007 CTP) of SQL Server 2008 (Katmai). It loads and doesn’t crash, but doesn’t work either. Naturally I’d prefer if it did work.

Q: Why do you have a static “Current” property on the SearcherController? Don’t you know Singletons are evil?
A: I wanted to pass an instance of a SearcherController to the add-in UI ala dependency injection. I even created an interface IObjectSearcherUI which exists solely to allow the SearcherController to be injected. The CreateAddinWindow method of the SearcherController actually creates the VS toolwindow that hosts the add-in UI, however I was unable to find a way to get hold of an instance of the SearcherToolWindow in order to inject the dependency. I’ve left the interface in there in the hopes that I (or one of my clever readers) can show me how to get hold of the window instance, and get rid of the singleton forever!

Q: Why is the UI part factored out from the rest of the add-in? You’ve hard-coded which control you’re going to instanciate so what’s the point?
A: I thought about writing two UIs – one in WPF and one in WinForms. If WPF was present I was going to load that, and otherwise fall back to the legacy winforms, however I didn’t get around to implementing both.

Q: You only search on databases, tables, views and stored procedures – could you search on columns or user defined functions too?
A: Certainly. To do that you should enhance the BuildDBObjectDictionary method in the DatabaseObjectSearcher, the searchText_TextChanged event handler in the SearcherToolWindow and probably the ObjectExplorerManager to handle the correct “drill down” to the right level.The code inside the ObjectExplorerManager is probably the ugliest code in the whole solution.

Q: Why the ugly reflection hacks in the ObjectExplorerManager?
A: Those methods weren’t included in the interface that the ObjectExplorer exposed (IExplorerManager) but were necessary for me to “drill down” into the tree-view and select an item. I wish there had been another way.

Q: I tried to connect to a remote SQL Instance with a bazillion databases over a dial-up connection and your add-in didn’t seem to do anything. What’s going on?
A: When the add-in loads it builds a dictionary of all the things you might want to search on. If lots of data has to be retrieved from remote servers over slow networks then that is going to be slow. We lock the dictionary while we’re building it (to prevent people querying it while it is still being built), and also when we’re querying it (since WinForms applications are STA threaded there shouldn’t ever be more than 1 UI thread accessing the dictionary at a time anyway). In order to prevent the add-in locking up SSMS if the dictionary is still being built we wait for 1 second to see if we can acquire a lock on the dictionary. If we can’t we just return nothing from the search results. You’re welcome to look at the internals of the DatabaseObjectSearcher and the BuildObjectDictionary method to try and make this faster if you wish.

Please post any suggestions, bugs, anything I've overlooked, registration hacks, other tutorials I didn't find etc. as comments here 

posted @ 8:17 AM | Feedback (13)