Friday, October 23, 2009

A bit of creepiness for Halloween

I’ve got a new laptop with Windows 7.  Overall I’m pretty happy but it does seem to have some trouble staying connected to my home wireless network.  I went over to the Verizon website to see if there were any firmware upgrades for my modem/router and saw the following:

agent1

This is just creepy because it alternates between the above and this:

agent2

and then it blinks:

agent3

Creepy…

Thursday, June 25, 2009

Programmatically Changing Z-Order of DSL Shapes

If you want to programmatically change the Z-Order of a shape in a Visual Studio based DSL, don’t even bother trying to change the ZOrder property.  Rather, get the shape’s parent and change the order of the items in the NestedChildShapes collection.

This isn’t very well documented and a Google search using “zorder dsl change” doesn’t really pull up much useful information.  However (somewhat to my surprise) a Bing search using the same term turns up the answer as the first result.

Wednesday, June 10, 2009

How to Dynamically Customize the Property Window

The on-line help for the Microsoft Visual Studio Domain-Specific Language (DSL) tools explains how to prevent domain properties from appearing in the properties window:

You can prevent domain properties from appearing in the Properties window by setting the Is Browsable property to False. The Is Property Browsable property is available on domain roles.

However, this is a compile-time configuration.  This does not work if you need to optionally display a property based on some runtime state information.

Fortunately, a bit of digging with the most excellent Reflector tool shows that the Microsoft.VisualStudio.Modeling.Design.ElementTypeDescriptor has a virtual method, ShouldCreatePropertyDescriptor, that can be overridden.

Suppose you have a domain class Person with the properties IsMarried and WeddingDate.  You want the WeddingDate property to show in the property window only if the IsMarried property is true.

First, create a ElementTypeDescriptionProvider for the Person domain class:

class PersonTypeDescriptorProviderElementTypeDescriptorProvider    { }

Now, override the CreateTypeDescriptor() method to create a custom type descriptor named PersonTypeDescriptor:

class PersonTypeDescriptorProvider : ElementTypeDescriptionProvider

   {

   protected override ElementTypeDescriptor

        CreateTypeDescriptor(ICustomTypeDescriptor parent, ModelElement element)

     {return new PersonTypeDescriptor(parent, element);}

   }

 

Using the designer, select the Person domain class and a custom attribute of the type TypeDescriptionProvider passing the PersonTypeDescriptorProvider type to its constructor.

Now create the PersonTypeDescriptor class:

class PersonTypeDescriptor : ElementTypeDescriptor

{

    public PersonTypeDescriptor(

        ICustomTypeDescriptor parent,

        ModelElement element) :base(parent, element)

    {

    }

}

 

Finally, override ShouldCreatePropertyDescriptor method:

protected override bool ShouldCreatePropertyDescriptor(ModelElement requestor, DomainPropertyInfo domainProperty)

{

    if (domainProperty.Name == "WeddingDate")

        return ((Person)requestor).IsMarried;

    return base.ShouldCreatePropertyDescriptor(requestor, domainProperty);

}

 

It’s as simple as that.

Wednesday, May 6, 2009

A Remote Desktop Feature Request

Typically, I have several remote desktop sessions going at the same time on my desktop.  Within these remote sessions I might be running different applications or monitoring something.  I’d really like it if Remote Desktop supported a feature similar to VMWare’s Unity mode.   It would be really cool if I could point to an application window on a remote desktop and “unify” it with my main desktop.

Does anyone know of a 3rd party utility that makes this possible?  If so, answer here.

Wednesday, December 17, 2008

The Great Ice Storm of 2008

This is probably one of thousands of blogs noting that without the modern convenience of electricity life is a bit unusual.

We lost power last Thursday night and won't see it again until this coming Saturday at the earliest.  So far, it's five days without power and counting...

It's cold and snowy with major snow storms forecast for this coming Friday and Sunday.   This seems likely to add major delays to the power company estimates of when repairs will be complete.

However, I count my blessings for friends and neighbors willing to lend a hand.  We've had someplace warm to sleep every night, a borrowed wood stove to keep the pipes in the house from freezing and with any luck we'll have a generator up and running this evening.

Friday, October 17, 2008

Enabling disabled performance counters

Recently I wanted to use Performance Monitor to monitor the memory usage of a program while it was under stress.   However, when I opened up perfmon and attempted to add performance counters this is what I encountered:

snap

It appears that there are no performance counters available.

After a bit of searching I came up with this solution:

  1. Run regedit
  2. Go to this key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib
  3. Set the "Disable Performance Counters" REG_DWORD value to zero.

Thursday, September 25, 2008

Shrink the size of the VMWare guest desktop icons

I use VMWare on a daily basis to debug basis.   While my host OS is run with two monitors set at their highest resolution, I typically run the guest OS at 800x600.  This way, the guest OS only occupies part of one of the host monitors making it easy to drag and drop files from the host onto the guest desktop.

As a result of all this dragging and dropping from the host, the desktop of my guest OS is typically littered with icons for test applications, utilities etc.  Unfortunately, with a Windows Vista guest the icons can be rather large and rapidly fill the available area.

Recently, there was a post on The Old New Thing blog that provided a solution to my problem.    The post describes two ways to change the size of the desktop icons on Windows Vista:

  • Click on the desktop, then hold the Control key while rotating the mouse wheel.
  • Right-click on the desktop and choose an icon size from the View menu.

For Windows Vista guests, at least, I can just scroll down the size of the icons to a size appropriate to an 800x600 desktop.  Problem solved!