sharing about .NET and technology RSS 2.0
 Wednesday, November 01, 2006

I am currently building software factories and I needed a way to have a list of running Visual Studio instances and the corresponding EnvDTE._DTE object to manipulate the solution. Windows internally keeps a list of COM objects that are currently running, called the Running Object Table (ROT). VS .NET 2005 for example, register itself in the ROT as "!VisualStudio.DTE.8.0:pid" where 'pid' is the process id of the corresponding VS 2005 instance.

In .NET 1.1 you would use the the following UCOMIRunningObjectTable, UCOMIBindCtx for enumerating the ROT. In .NET 2.0 these interfaces are obsolete and are replaced by IRunningObjectTable and BIND_OPTS respectively. Note that the same code can be used for getting other instances like MS Word, IE, etc.

DTEHelper.cs - Copy Code
using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; using EnvDTE; public static class DTEHelper { const uint S_OK = 0; [DllImport("ole32.dll")] public static extern uint GetRunningObjectTable(uint reserved, out IRunningObjectTable ROT); [DllImport("ole32.dll")] public static extern uint CreateBindCtx(uint reserved, out IBindCtx ctx); static IDictionary<string, object> GetRunningObjectTable() { IDictionary<string, object> rotTable = new Dictionary<string, object>(); IRunningObjectTable runningObjectTable; IEnumMoniker monikerEnumerator; IMoniker[] monikers = new IMoniker[1]; GetRunningObjectTable(0, out runningObjectTable); runningObjectTable.EnumRunning(out monikerEnumerator); monikerEnumerator.Reset(); IntPtr numberFetched = IntPtr.Zero; while (monikerEnumerator.Next(1, monikers, numberFetched) == 0) { IBindCtx ctx; CreateBindCtx(0, out ctx); string runningObjectName; monikers[0].GetDisplayName(ctx, null, out runningObjectName); Marshal.ReleaseComObject(ctx); object runningObjectValue; runningObjectTable.GetObject(monikers[0], out runningObjectValue); if (!rotTable.ContainsKey(runningObjectName)) rotTable.Add(runningObjectName, runningObjectValue); } return rotTable; } public static IDictionary<string, _DTE> GetRunningVSIDETable() { IDictionary<string, object> runningObjects = GetRunningObjectTable(); IDictionary<string, _DTE> runningDTEObjects = new Dictionary<string, _DTE>(); foreach (string objectName in runningObjects.Keys) { if (!objectName.StartsWith("!VisualStudio.DTE")) continue; _DTE ide = runningObjects[objectName] as _DTE; if (ide == null) continue; runningDTEObjects.Add(objectName, ide); } return runningDTEObjects; } }
Wednesday, November 01, 2006 4:40:07 PM (Romance Standard Time, UTC+01:00)  #    Comments [0] -

The Microsoft Patterns & Practicess Team recently released a new version of the Web Client Software Factory that can be found on CodePlex. One of the things I noticed directly, is that they implemented a web version of the Composite UI based on the ObjectBuilder.

The goals of Web Client Software Factory are:

  • CAB for Web
    • Hiding complexity
    • Separation of infrastructure & biz logic
    • Biz logic reuse amongst different UI Technologies
    • Promoting consistent development practices
  • Navigation
  • UI Richness
  • UI Layout management
  • State management
  • Best use of technology available (Ajax, WinForms controls, ...)
  • Security
  • SaaS implications on application design

More information about the vision & scope can be found here.

Wednesday, November 01, 2006 2:37:11 PM (Romance Standard Time, UTC+01:00)  #    Comments [0] -

 Thursday, October 26, 2006

On IStaySharp.NET I created an article that shows you, how you can load a DSL file. This is necessary if you need to access your model from GAT, a Visual Studio AddIn, custom library, etc. The last couple of weeks I am digging into DSL and GAT for creating a set of software factories at Real Software that will be used as a baseline for building applications.

Learning two (DSL & GAT) simultaneously and combining them was not so trivial and there is some learning curve. For GAT there are some interesting resources:

The MSDN forums is a good resource when you have some issues and/or questions. DSL has also a specific forum. The capabilities of DSL are really impressive. Now you have finally the tools to write for example your own dataset designer with code generation!!!

Thursday, October 26, 2006 1:07:20 AM (Romance Standard Time, UTC+01:00)  #    Comments [0] -

 Monday, October 23, 2006

Version 0.22 of SyntaxColor4Writer is compiled against the new build release of Windows Live Writer 1.0 (Build 145). The issues around spell checking and FireFox will be fixed in the next release.

Monday, October 23, 2006 8:31:23 PM (Romance Standard Time, UTC+01:00)  #    Comments [0] -

 Wednesday, October 18, 2006

Last week I bought an external harddisk, Vantec Nexstar 3 (NST-360SU-BK), that can be connected through USB 2.0 and eSata. eSata is simply a new standard for connecting external SATA drives at full speed! I use the external harddisk to share data between my laptop (through USB 2.0) and my desktop PC (through eSata). I use extensively Virtual PC for development, and it's a good thing when developing on my desktop PC I can use the full speed of my HD. 

Wednesday, October 18, 2006 10:46:39 PM (Romance Standard Time, UTC+01:00)  #    Comments [1] -

 Thursday, October 12, 2006

Microsoft released the beta program for Virtual PC 2007. The new features are

  • Hardware-assisted virtualization
  • Support for Windows Vista as a guest and host operating system
  • Support for 64-bit host operating system

You can participate on the beta program through the Microsoft Connect web site.

Thursday, October 12, 2006 12:40:33 AM (Romance Standard Time, UTC+01:00)  #    Comments [0] -

 Friday, October 06, 2006

I've upgraded SyntaxColor4Writer with the new version of CodeHighlighter 4.0. It uses a new parsing model and it supports some additional language definitions, namely:

  • Assembly
  • Lua
  • MSIL
  • Pascal

For example:

HasChanges method of a DataSet in MSIL - Copy Code
1 .method public hidebysig instance bool HasChanges() cil managed 2 { 3 .maxstack 2 4 L_0000: ldarg.0 5 L_0001: ldc.i4.s 28 6 L_0003: call instance bool System.Data.DataSet::HasChanges(System.Data.DataRowState) 7 L_0008: ret 8 }

Any suggestions and/or feedback about SyntaxColor4Writer is welcome!

Friday, October 06, 2006 1:07:46 AM (Romance Standard Time, UTC+01:00)  #    Comments [5] -

 Thursday, October 05, 2006

A new version of CruiseControl.NET has been released. The release notes of version 1.1 can be found here. This is the defacto standard tool if you want to continuous integration together with unit testing, code metrics, code analysis, etc.

Thursday, October 05, 2006 12:48:25 PM (Romance Standard Time, UTC+01:00)  #    Comments [0] -

Recently I switched from RSSBandit to GreatNews as RSS reader (noticed by a post from Bert Jansen).

The speed for aggregating feeds using GreatNews is really fast! I think it was better called SpeedNews ;). Besides that, it has a nice user-interface and all config & feed data is kept in the installation folder. This means that no installation (MSI) is required, and that it can easily be deployed to other computers.

Thursday, October 05, 2006 2:31:16 AM (Romance Standard Time, UTC+01:00)  #    Comments [0] -
 | 
 Friday, September 29, 2006

Today I published a new version of SyntaxColor4Writer on IStaySharp.NET. It's compiled against the new beta version of Windows Live Writer with the following added features:

  • 'Copy Code' link (copies everything to the clipboard)
  • Caption text
  • Customize backcolor, including line numbering
  • Spaces in tabs
  • Font size

     

    Below you find some examples:

    1 <system.web> 2 <compilation defaultLanguage="VB" debug="true"/> 3 <customErrors mode="ReadOnly"/> 4 </system.web>

    C# code of the Main method class.

    Program.cs - Copy Code
    1 /// <summary> 2 /// The main entry point for the application. 3 /// </summary> 4 [STAThread] 5 static void Main() 6 { 7 Application.EnableVisualStyles(); 8 Application.SetCompatibleTextRenderingDefault(false); 9 Application.Run(new TestForm()); 10 }

  • Friday, September 29, 2006 1:12:38 AM (Romance Standard Time, UTC+01:00)  #    Comments [0] -

     Wednesday, September 27, 2006

    Cassini is a ASP.NET sample application that shows how to write a web server using .NET. This means that you can host ASP.NET using the ASP.NET hosting APIs (System.Web.Hosting). This is really an alternative to IIS. There is also a second project called UltiDev Cassini Web Server which is based on the Cassini source with the following additional features:

    • Comes ready for distribution with Visual Studio ASP.NET applications
    • Runs as a windows service
    • Hosts and runs multiple ASP.NET applications
    • Provides management UI and simple API for configuring web applications
    • Comes in two flavors: 2.0 version for ASP.NET 2.0 applications, and 1.1 for applications compiled for ASP.NET 1.1

    If you have the need for an offline version of your ASP.NET application, where easy deployment is required (without IIS), then this is a very good solution.

    Wednesday, September 27, 2006 12:16:18 AM (Romance Standard Time, UTC+01:00)  #    Comments [0] -

     Sunday, September 24, 2006

    Ubuntu is a free linux-based operating system. Ubuntu works very well on Virtual PC, and I didn't encounter any problems during installation. A detailed step-by-step explanation can be found on the documentation site of Ubuntu, How To - Configure Ubuntu for Microsoft Virtual PC 2004.

    Setting Ubuntu to the same screen resolution as the host in full-screen mode didn't worked for me. I tried the following post, but without any success.

    One of the reasons for installing Ubuntu, was to see if my blog site rendered correctly in Firefox. Only the line under the post title was not positioned correctly. I will update the 'business' theme soon.

    Sunday, September 24, 2006 5:32:17 PM (Romance Standard Time, UTC+01:00)  #    Comments [0] -

     Friday, September 22, 2006

    DasBlog 1.9 is released. It's a major update with a lot of extra features and fixes. I contributed to this release for improving DasBlog in a multi-user setup. The following features has been added (will update the documentation on dasblog.info):

    • Top Posters macro & Profile Combo control
    • Every admin/contributor can create/edit a personal profile page
    • A Contributor can be notified by mail for certain events and can be configured through the 'User Settings' screen
      • Notify when a new post has been added
      • Notify when comments has been added for ALL posts
      • Notify when comments has been added for OWN posts

    I also created a new theme called 'business', which is running on my weblog now. It's not yet included in this release, but it's available through the subversion repository. I am also planning to create a theme, based on 'business', for in a multi-user setup.

    Soon I will update RealDN (corporate blog of my company I am working for) to DasBlog 1.9.

    Friday, September 22, 2006 11:58:40 AM (Romance Standard Time, UTC+01:00)  #    Comments [2] -

     Friday, August 18, 2006

    Windows Live Writer is a desktop application that makes it easier to compose compelling blog posts using Windows Live Spaces or your current blog service. For Windows Live Writer I created a plugin called SyntaxColor4Writer that enables you to embed syntax highlighting in your blog posts. More details about SyntaxColor4Writer can be found here. This is how the plugin looks:

    This is an example of a xml fragment generated by SyntaxColor4Writer:

    <system.web> <compilation defaultLanguage="VB" debug="true" /> <customErrors mode="RemoteOnly" /> </system.web>

     

    Friday, August 18, 2006 2:17:50 AM (Romance Standard Time, UTC+01:00)  #    Comments [0] -
     |  | 
     Wednesday, August 16, 2006

    It has been quiet for some time on my blog, but that will change now. It was mainly due to the fact that we bought a new house in Hombeek, we didn't know that little village before :). Every weekend we spend time on painting and some chores. But the fact that we moved now, and that practically everything is done, I can again spend more time for programming and sharing with the community.

    Wednesday, August 16, 2006 7:49:35 PM (Romance Standard Time, UTC+01:00)  #    Comments [1] -

     Tuesday, May 23, 2006

    That's right, a public preview of Office 2007 Beta 2 is available. You can download the bits from here. Note that right now it is very difficult to connect to the server, due to high traffic.

    Tuesday, May 23, 2006 10:10:13 PM (Romance Standard Time, UTC+01:00)  #    Comments [0] -
     | 
     Monday, April 24, 2006

    BindingListView<T> is a project hosted on GotDotNet that gives you search, sorting and filtering capabilities to a plain BindingList. For example if you have the following Person entity:

    public class Person
    {
        string firstName = string
    .Empty;
        int age = 0;

        public string FirstName
        {
           
    get { return firstName; }
            set { firstName = value; }
        }

        public int Age
        {
           
    get { return age; }
           
    set { age = value; }
       
    }

        public Person(string firstName, int age)
       
    {
           
    this.firstName = firstName;
           
    this.age = age;
       
    }
    }

    And you want to have a collection of persons bind to a datagrid, you can simply write the following:

    BindingList<Person> persons = new BindingList<Person>();
    persons.Add(
    new Person("Bill", 45));
    persons.Add(
    new Person("Gert", 33));
    persons.Add(
    new Person("Johan", 12));
    persons.Add(
    new Person("An", 27));

    personsGrid.DataSource = persons;

    What if you need to do some filtering, or simply sorting on the datagrid? Therefore you would need to create a custom collection class that implements a bunch of interfaces for having sorting, filtering and searching capabilities.

    The BindingListView<T> class has all these functionalities built-in. You simply have to pass a list, and bind the BindingListView to the datagrid. The same way you would do with a DataSet and DataView. This means:

    BindingListView<Person> personsView = new BindingListView<Person>(persons);
    personsGrid.DataSource = personsView;

    Sorting on a BindingListView is done through the Sort property, the same as on a DataView. For example:

    personsView.Sort = "FirstName";

    Filtering is done through the Filter property and uses anonymous delegates. So for example to filter all persons that are less than 30, you can write:

    personsView.Filter = BindingListView<Person>.CreateItemFilter(new Predicate<Person>(
        delegate(Person
    person)
        {
           
    return
    (person.Age < 30);
        }
    ));

    You can also merge multiple sources to one view (functionality that the DataView doesn't support) through the AggregatedBindingListView<T>.

    Monday, April 24, 2006 11:42:21 PM (Romance Standard Time, UTC+01:00)  #    Comments [0] -

     Sunday, April 23, 2006

    One of the ways for extending the WebBrowser 2.0 control is to inherit from WebBrowserSiteBase. According to the documentation, you have to override the method CreateWebBrowserSiteBase and return your specific implementation of WebBrowserSiteBase.

    Everything is there to plug-in your implementation of WebBrowserSiteBase, but the problem is that the constructor of WebBrowserSiteBase is marked as internal, and so there is no way to inherit from. I am pretty sure that it was possible with the beta release of .NET 2.0, but for some reason they marked it as internal in the RTM version. This means that implementing some interfaces that are described here are not possible.

    I am planning to release a .NET 2005 version of my IStaySharp.WebBrowser project. More info coming soon.

    Sunday, April 23, 2006 7:43:56 PM (Romance Standard Time, UTC+01:00)  #    Comments [0] -
     | 
     Thursday, April 13, 2006

    The Service Factory is a cohesive collection of various forms of guidance that have been build with the primary goal of helping you build high quality connected solutions in a more consistent way with less effort.

    Check it out: http://practices.gotdotnet.com/projects/svcfactory

    Thursday, April 13, 2006 11:35:18 PM (Romance Standard Time, UTC+01:00)  #    Comments [0] -

    Finally I have updated my site, called IStaySharp to MediaWiki. MediaWiki is one of the best wiki based engines available and it's written in PHP and MySQL. Thankfully my hosting, webhost4life, has PHP & MySQL support.

    The intention of IStaySharp is to document and archive my code snippets, articles, components, projects, etc. that I am working on, and to share my experiences that I encounter during my .NET development. Visitors to the site can use the discussion page to give feedback, remarks, suggestions, etc. to the associated page.

    I didn't encounter much problems when installing MediaWiki on webhost4life, except the e-mailing didn't work directly. The problem was that MediaWiki uses the format: 'myname <myname@domain.com>' in the 'to' field of the mail function, and with the current settings and setup of webhost4life this resulted in an invalid address. Therefore I had to change the method 'toString()' of the 'MailAddress' class inside 'UserMailer.php' to

    function toString()
    {
         return $this->address;  
    }

    instead of

    function toString()
    {
      if( $this->name != '' ) {
       return wfQuotedPrintable( $this->name ) . " <" . $this->address . ">";
      } else {
       return $this->address;
      }
    }

    IStaySharp uses also the extension that I wrote for having syntax highlighting. Some other nice extensions are coming!

    Thursday, April 13, 2006 11:10:25 PM (Romance Standard Time, UTC+01:00)  #    Comments [0] -

    Navigation
    Archive
    <November 2006>
    SunMonTueWedThuFriSat
    2930311234
    567891011
    12131415161718
    19202122232425
    262728293012
    3456789
    About the author/Disclaimer

    Disclaimer
    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2009
    Christoph De Baene
    Sign In
    Statistics
    Total Posts: 154
    This Year: 0
    This Month: 0
    This Week: 0
    Comments: 166
    All Content © 2009, Christoph De Baene
    DasBlog theme 'Business' created by Christoph De Baene (delarou)