Check out my new blog at https://shibumiware.blogspot.com

Monday, August 01, 2011

Vacation

Aside from going to Seattle once a year and an occasional weekend outting, I haven’t taken a vacation since 2005.  I am taking one this week! 

Not sure what I am going to do with my self, but I am sure the kids will have fun.

Tuesday, July 26, 2011

New Component Available: Task Bar Docker

 
Taking a breather for a moment and since I decided to take up blogging again, here is a little piece about a component I wrote last night.  I am working on yet another tool and this one lives in the system tray.  I wanted the main window to dock to the task bar. I looked around these here interwebs and found a lot of half-way-there implementations but I couldn’t find one that handled multiple monitors,  changing the primary monitor, moving multiple monitors around, etc.  Most of them ended up with incorrect window coordinates.  So I slapped one together.  You can download it from here.

I have a dual monitor system.  Here is how I have them setup:

image 

The docker has to support multiple monitors, switching main monitors, and handle redocking correctly if the task bar moves.  Here goes…

First, the sample app (which ships with the component) shown undocked on my monitor space:

image

Notice the whitespace.  That is because my monitors are at different resolutions and I have them lined up so swing the mouse to and from monitors crosses the barrier between the two monitors correctly.

Dock Scenario #1 = Taskbar docked, bottom, main monitor

image

Passed!

Dock Scenario #2 = Taskbar docked, right, main monitor

image

Passed!

Dock Scenario #3 = Taskbar docked, top, main monitor

image

Passed

Dock Scenario #4 = Taskbar docked, left, main monitor

image

Passed!

Dock Scenario #5 = Taskbar docked, bottom, secondary monitor

image

Dock Scenario #6 = Taskbar docked, right, secondary monitor

image

Passed!

…Okay so you probably don’t need to see all the scenarios and you get the idea.  Here is the math:

   1: private void PostionLeft()
   2: {
   3:     Point taskBarLocation = TaskBar.GetTaskBarLocation();
   4:     Screen taskBarScreen = Screen.FromHandle(TaskBar.GetHandle());
   5:     Size size = TaskBar.GetTaskBarSize();
   6:  
   7:     _Form.Left = taskBarScreen.Bounds.X + size.Width - (_BorderSize * 2);
   8:     _Form.Top = (taskBarScreen.WorkingArea.Height + taskBarLocation.Y + (_BorderSize * 2)) - _Form.Height;
   9: }
  10:  
  11: private void PostionTop()
  12: {
  13:     Point taskBarLocation = TaskBar.GetTaskBarLocation();
  14:     Screen taskBarScreen = Screen.FromHandle(TaskBar.GetHandle());
  15:  
  16:     _Form.Top = taskBarScreen.WorkingArea.Y + _BorderSize;
  17:  
  18:     _Form.Left = (taskBarScreen.Bounds.Width + taskBarLocation.X) - (_Form.Width - (_BorderSize * 2));
  19: }
  20:  
  21: private void PostionRight()
  22: {
  23:     Point taskBarLocation = TaskBar.GetTaskBarLocation();
  24:     Screen taskBarScreen = Screen.FromHandle(TaskBar.GetHandle());
  25:  
  26:     _Form.Left = (taskBarLocation.X) - (_Form.Width - (_BorderSize * 2));
  27:     _Form.Top = (taskBarLocation.Y + taskBarScreen.Bounds.Height + (_BorderSize * 2)) - _Form.Height;
  28: }
  29:  
  30: private void PostionBottom()
  31: {
  32:     Point taskBarLocation = TaskBar.GetTaskBarLocation();
  33:     Screen taskBarScreen = Screen.FromHandle(TaskBar.GetHandle());
  34:  
  35:     _Form.Left = (taskBarScreen.Bounds.Width + taskBarLocation.X) - (_Form.Width - (_BorderSize * 2));
  36:  
  37:     _Form.Top = taskBarLocation.Y - (_Form.Height + _BorderSize);
  38: }

Enjoy!

Colby

Saturday, July 23, 2011

Update

Gosh time flies.  I haven’t written much for a very long time.  Back in early 2007 I was writing almost every day.  Not so much these days.  I have been working on a new product, which will be announced later this year.. Our company, forProject Technologies, has been pushing very hard on it for almost 2.5 years.  It will be a big deal, for me anyway, when we launch.  

That work consumes the bulk of work time, the rest of my time is spent with my family except for a small sliver of hobby time.  Over the past three years I have managed to create a few tools, some of which I am the only user while others are used internally by my company and by some friends.  By the end of the summer, I hope to have these tools released on a new website I am working on, which will be announced soon as well.  I think some of them may be available on my company’s site as well, but we haven’t worked that out yet.

The new website is another hobby project that is important to me not because I think the site is going to draw much traffic, but because I really need to learn some of the newest web development technologies.  I spend most of my time working on backend services and Windows applications.  So, the new website is where I am learning advanced java script techniques, compliant HTML/CSS (I use Expression Web, which is pretty nice), and ajax using Microsoft's ajax client library with ajax-enabled WCF web services.  Pretty fun really, event if java script drives me a little bonkers sometimes.

Okay, so what I am going to do in this post is explain what each of these tools do and why I created them.  First, my development environment is Visual Studio 2010 SP1 in C#,  Expression 4.0, IIS 7.0 (hosted by these very cool folks), Team Foundation Server 2011 (also hosted by these very cool folks), SQL Server 2008 (hosted by…you guessed it), and TopStyle.  TopStyle, by the way, has the best CSS editing environment I have encountered.  And, as I was getting ready to do some screenshots for this blog, I found Sizer, which is kind of handy.

I haven’t moved to .NET 4.0 yet because some of my stuff has dependencies on SharePoint, which is not .NET 4.0 ready yet.

Tools

In no particular order… Let’s start with Queue and Performance Monitor for Project Server:

Queue and Performance Monitor for Project Server 2007/2010

I have been working with Microsoft Project since 1996, including building quite a few products around it. In fact, that is my work currently. One of the things I did recently was build a stress/performance suite for Project Server. It involves a lot of queue operations, obviously, and the SharePoint queue viewer isn’t sufficient. So…I wrote my own.

image

image

It also supports ULS log viewing, including tracking a failed queue job’s ULS records:

image

Performance monitoring:

image

Including export of performance information:

image

Set thresholds and events:

image

Export chart to various formats:

image

And plenty of options:

image

image

image

image

image

Service Manager

The Windows server MMC snapin for service management is okay but not great.  I wanted a tool that would give me more advanced information about services, plus the ability to create a “profile” of services that I could stop and start in bulk.  Why is this useful?  Well, there a great many services that are configured to run that aren’t really necessary much of the time.  So, by being able to turn these off I can get a little more performance out of my machines when writing some of my server applications.

image

You can see the basic features in the screen shot above:

  • A list of all installed services on the local machine or a remote machine with basic information in the grid
  • A more comprehensive list of properties about the service
  • A list of all services the service depends upon
  • A list of all dependent services
  • And the list of required privileges the server requires to run

So I got to dig deeper into the service control API and even deeper into NT Services in general because some of these properties are not exposed through the BCL. But, the real fun came when I started working on the service profile feature.  Here is s screenshot of the ribbon page for this feature:

image 

The gallery on the left is just a list of all of the profiles defined. A profile is simply a set of services that I either want to start, stop, or a combination of the two in a single operation:  Here is an example where I am turning off all services not required to run the OS, SharePoint, and Project Server:

image

When I click the Apply button, all of the selected services are put into the required state.  When I apply a service profile, I have the option of creating a “restore point”, which is a record of all the services running before I applied the service profile.  I can restore to that state by clicking the Restore button.

Pretty handy, with more services stuff to come later.

A Note on All New Tools

As I was writing about Service Manager it occurred to me that there are several characteristics and feature of all the tools I have written recently (Event Viewer/Service Manager – the rest I will retrofit to this paradigm):

  • They all employ the ribbon user interface, including the “backstage” concept.
  • They all have automatic update capability
  • They all have a feedback mechanism
  • And a shared “About” framework

Here are some screens

image

Launching Feedback:

image

Launching Info:

image

And you can check for updates as well:

image

Okay, back to the tools…

Event Viewer

The Windows event viewer MMC snapin is pretty great, but I wanted it is lacking a few features.  On particular, I would like to be able to search for key words (or multiple key words) across multiple log files… So, here is Event Viewer:

image

Here are the features:

  • A list of all the available logs on the local machine or a remote machine
  • The ability to open a saved or exported log
  • Color coded event types
  • Ability to copy to the clipboard
  • Advanced and basic search (more on this in a minute)

None of the first four features are particularly interesting but needed just to hit the bare minimum feature set.  The real useful features are search.

image

Along the left is a checkable tree control.  I check the logs I want to search, put in my keywords (separated by a ‘,’) and click search.  The engine looks through all of the checked logs and presents you the search results. In the message pane at the bottom there is also a search box, which supports incremental search (like F3 in Visual Studio). 

Pretty handy!

One last feature is the engine looks at each message when you click it to see if it is HTML (a lot of our events are formatted for display in a forum other than the event viewer).  If HTML is detected, the engine will render the HTML:

image

QuickPatch

QuickPatch is a software servicing system I started writing back in 2007.  First you define your patch, which can include replacing files, updating SharePoint solutions, running database scripts, plus a more advanced file placement feature that I will discuss elsewhere:

image

Configure various options, including using a “registry hint” that tells the patch application where to start looking for files to update:

image

Then you build the patch:

image

You end up with two files:

image

Setup is the bootstrapper and package.exe is the patch.  When run, the patch applying application looks like this:

 

image

Pretty sweet!

Debug View

After years of using Mark Russinovich’s debug viewer, I decided I wanted to build my own with a few more features plus do it all in .NET. Fortunately, Microsoft provides a managed debug API, which you can download here.  This was started before I moved to the ribbon UI. Eventually I will return to this and update it.

image

Key features:

  • In 1.0, intercept .NET debug stream (in a subsequent release I will enable native as well)
  • Include and exclude filters
  • Highlighting
  • Buffer tracking (I have left Mark’s Debug Viewer up on a server and drained all memory because the number of messages was like 1.5 million)
  • Message recording
    • This allows you to turn on an engine that will record all of the debug messages to a file
    • You can either replay the session or export it

image

  • An advanced capture/highlighter (not done yet)

image

Sfx Creator (Self-extracting executable generator)

There are quite a few self-extracting executable tools out there but I wanted my own so I wrote one:

image

Here are the features:

  • Create a self-extracting executable engine in pure .NET
  • All for the user to define an “Sfx” project, which includes all of the files, prompt, options, whatever so it can be used again later.
  • All for both plain text and HTML in the prompt.
  • All the user to specify an executable to run after extraction
  • All of the user to (optionally) allow for a target directory to be selected by the user at extraction (if not, it is extracted to a temp directory, the after-extraction executable is run, then everything gets clean up)

If isn’t a silent, extract, run type of project, the user sees this (with sample HTML prompt content):

image

And then the files are extracted…

Registry Viewer

Not trying to reinvent the wheel here but I must say that some of the system tools from Microsoft are seriously Soviet looking and I prefer nicer look-and-feel so… Here is my Registry Viewer:

image

The best thing is the search feature:

image

C# Header Designer

This tool allows you to define a header for your C# source files and apply it to individual files, directories of files, or you can simply select a Visual Studio solution or project and the tool figures out what files to apply it to.  Here is the user guide for more information.

image

Project settings page:

image

Friday, May 27, 2011

Memorial Day Weekend Hobby Project Preview–Limited Time Only

Limited to this weekend only, I am making 64 bit preview editions of the following tools available:

  • SfxCreator - A simple self-extracting executable generator

  • DebugViewer - An update to Mark Russinovich's DebugView, fully implemented in .NET using Microsoft's MDbg stack

  • Queue & Performance Monitoring Suite for Project Server - A set of utilities for monitoring Project Server's queue system, plus SharePoint’s Universal Logging System, and performance counters (including charting!).

All of these tools are very BETA at this point, and I make no guarantee about them whatsoever, and neither does my employer.  My employer, by the way, keeps me plenty busy so if you want changes or additions, it may take some time.  Source code is NOT available for these tools at this time. 

.NET 3.5 SP1 is required before you can unpack the setup MSIs let alone run the tools.

If you have questions, please contact me through comments.  If you encounter bugs, which you will, use the Help\Send Feedback feature in each tool to tell me about any problems.

Download is here (27 mb): www.mpfx.org/downloads/AllTools64bit.exe

Enjoy…

Happy Memorial Day Weekend!

Wednesday, May 18, 2011

New Debug Viewer Tool

This is coming out after I get the Project Server Queue Monitor out.  I haven’t had much time. Pretty busy at my real job right now…

image

If you are going to use the MDbg library in your app…

…REMEMBER TO SET THIS ON YOUR ENTRY PROC:

[MTAThread] // MDbg is MTA threaded
static void Main() { … };

I did this when I first started working on my debug viewer tool, but moved some types around and forgot to re-add it and spent an HOUR staring at my screen trying to figure out why everything stopped working…

Friday, April 08, 2011

Wednesday, March 09, 2011

Visual Studio 2010 Performance Tips

First, just released yesterday, is the Visual Studio 2010 Service Pack I, described here. As of yesterday, it was only available to MSDN subscribers but will be broadly available on March 10th.

Since upgrading all of our projects to VS2010 this past week, I have been struggling with performance and usability issues.  The most vexing problem was my mouse would simply stop working except when clicking into the solution explorer.  All of the code editor windows and the main toolbar\menu would not accept mouse clicks whatsoever until the IDE was restarted.   One of my colleagues recommended locating a new device drive for my mouse.  I did that (and at the same time updated 18 other drivers via this wonderful little tool).  I have quite a few add-ins and extensions so I started disabling them one-by-one.  No luck.  I was in that state this morning and I happened to move the IDE from my secondary monitor onto my primary monitor and whamo, the IDE started accepting mouse clicks.  So, Tip #1, if the IDE stops accepting mouse clicks, try moving it to your primary monitor.

As you probably know, VS2010’s IDE is implemented on WPF, which brings the managed stack into the mix on a scale unlike VS2008.  Many have complained that the use of WPF is a major performance hit in VS2010.  I have read otherwise, but I did notice a gradual degradation of performance over time, especially with many code editor windows open.   Tip # 2 is to learn the shortcut key to force VS2010 to do a garbage collection:

http://blogs.msdn.com/b/camerons/archive/2010/12/15/force-vs-to-garbage-collect.aspx

You can marginally decrease startup time and increase performance by creating a shortcut with specific command line arguments as well.  Create a shortcut with these parameters:

C:\Windows\System32\cmd.exe /c start "runhigh" /high "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" /nosplash

http://weblogs.asp.net/kodali/archive/2011/01/24/visual-studio-2010-running-very-slow.aspx

There is also a performance diagnostic tool available here, but I have not been able to get it working after installing SP1

Finally, there is a good discussion of hardware requirements and other items on Stack Overflow

Disclaimer

Content on this site is provided "AS IS" with no warranties and confers no rights. Additionally, all content on this site is my own personal opinion and does not represent my employer's view in any way.