View Windows Workflow Tracked Data Tools

For some reasons, it took me a few google search attempts to find the following tools:

 MSDN includes  Workflow Monitor Sample -Windows executable to view details of tracked workflows.

Jon Flanders put together the ASP.NET implementation of the Workflow Monitor SDK sample. 

 MSDN Tracking Samples mostly described how to store tracking data, but  ConsoleTrackingService Sample shows how to write the contents of tracked data to the console.

Enterprise Library Logging Application Block and Alternatives Links

 Overview of to Enterprise Library Logging Application Block and Alternatives  

  Loren Halvorson's comparision of the Enterprise Library Logging & Instrumentation Application Block and Log4Net 

 Comments on the EntLib/Log4Net feature and performance comparison

EntLib v4 has a few performance improvements in Logging Block.

Profiling Performance of ASP.NET Code Links

Below are a few links that  I found about Profiling Performance of ASP.NET Code

Code performance analysis in Visual Studio 2008 and Find Application Bottlenecks with Visual Studio Profiler

* Tool : VSProfiler - Analyze Performance of Managed Code

 How To: Use CLR Profiler and Transcript: Profiling Managed Code with the CLR Profiler are talking about CLR memory allocation profiler.

-

* Auto Performance Tuning in ASP.NET 2.0 process model (processModel) section of machine.config comes with default value of autoconfig="true".

and details in MSDN article Contention, poor performance, and deadlocks when you make Web service requests from ASP

 

Store custom objects configuration in separate custom configuration files using EntLib

We are going to have a windows service that will run a few workflow(WF) instances. I want to have configuration information to be stored in  separate config files for each WF instance.
I remembered that EntLib has helper classes to store custom objects configuration in separate custom configuration file, but finding good examples in Google wasn't easy(probably I didn't find good search keywords).

The links that I finally found(more relevant to the task first)

Tom Hollander 'post External configuration files in Enterprise Library for .NET Framework 2.0 mostly talks about EntLib provider config sections, but comments are talking about FileConfigurationSource  and custom sections.

Alois Kraus has good articles in his blog : Read/Write App.config with .NET 2.0/Enterprise Library  (and similar in  CodeProject) and Microsoft Enterprise Library for .NET 2.0: Configuration .

Using section handlers to group settings in the configuration file.  shows how to use sections of the types:

  • NameValueSectionHandler
  • DictionarySectionHandler
  • SingleTagSectionHandler 
  •  


    Example of separate custom config file Enterprise Library - Configuration Application Block - Patterns and Practices is obsolete(using EntLib 1.0). See Enterprise Library 2.0 - From Configuration Block to IConfigurationSource - SystemConfigurationSource - FileConfigurationSource

     

    reference: Microsoft.Practices.EnterpriseLibrary.Common.Configuration Namespace

    Alternative implementations from CodeProject without using EntLib are Custom app.config  and A custom configuration file AppSettings reader class

     

    If you want to add  EntLib Configuration Manager Design time support for editing you sections, look at 

    Enterprise Library Configuration (Part 1/2): Customized Appsettings and the EntLib Configuration Manager tool

    Enterprise Library Configuration (Part 2/2): Customizable configuration with framework extensions  

    Alex Homer: Adding Configuration Support for Custom Providers in Enterprise Library in ASP.NET 2.

    and Enterprise Library 2.0: Building Named Extensions in the Configuration Console

    Override ASP.NET Menu javascript functions to delay dynamic menus popup.

     We are using asp.net Menu control and wanted to have some delay before sub-menu popup to avoid annoying popup, if user just move mouse through menu area.

    After some search on Google I found the solution submitted by yupinggang on the thread delaying the menu control.
    I've slightly modified it( put in a separate JS file,call initMenuMouseHoverInterceptors just in the same file,added handling of the case if no menu on the page etc.)

     

    Another possible solution- override PreRender in derived from Menu control(mentioned in the same thread and in Menu Control - Use OnClick instead of OnMouseOver thread) requires more work and less elegant.

     FILE: Menu_HoverStaticDelay.js

     //    <!-- @BEGIN:: JavaScript to prevent the expanding of static menu when you quickly mouse over them -->

    //Example of usage: <script language="javascript" type="text/javascript" src="JS/TopNav/Menu_HoverStaticDelay.js"></script>

    //loaded from http://forums.asp.net/t/1156758.aspx

    //          <!-- A big thanks to hdierking for article Polymorphic Javascript -->

    //   <!-- Reference website: http://blogs.msdn.com/howard_dierking/archive/2007/04/23/polymorphic-javascript-well-kind-of.aspx -->  

                var constShowDelay=500;//ms- configurable

                var constDisappearDelay=800;//ms- configurable

                var myVar;

                var myTimeoutID;

                var myNode, myData;

                var ref_Menu_HoverStatic;

                var ref_Menu_Unhover;

                var ref_overrideMenu_HoverStatic;

               

               

                // This function is called in <body onload="...">

                function initMenuMouseHoverInterceptors()

                {

                      // *** Interceptors ***

                      // @:: Menu_Hover

                      //debugger;

                      //handle case if no menu on the page

                      if((typeof(Menu_HoverStatic)!='undefined'))

                      { 

                          ref_Menu_HoverStatic = Menu_HoverStatic;

                          Menu_HoverStatic = My_Menu_HoverStatic;

                           

                          // @:: Menu_Unhover

                          ref_Menu_Unhover = Menu_Unhover;

                          Menu_Unhover = My_Menu_Unhover;

                           

                          // @:: overrideMenu_HoverStatic

                    ref_overrideMenu_HoverStatic = Menu_HoverStatic;//corrected by skynyrd

                    Menu_HoverStatic = My_overrideMenu_HoverStatic;

                }

                }

               

                function My_Menu_HoverStatic(item)

                {    

                      My_overrideMenu_HoverStatic(item);

                }

               

                function My_overrideMenu_HoverStatic(item)

                {

                      var node = Menu_HoverRoot(item);

                    var data = Menu_GetData(item);

                      myNode=node;

                      myData=data;

                    if (!data) return; 

                     

                      myVar = item;                

                      myTimeoutID=setTimeout("My_DelayExpandMenu(myNode,myData)",constShowDelay);//COnfigurable

                }

         

                function My_DelayExpandMenu(node, data)

                {    

                    __disappearAfter = constDisappearDelay; //data.disappearAfter;

                    Menu_Expand(node, data.horizontalOffset, data.verticalOffset);

                }

         

                function My_Menu_Unhover(item)

                {          

                      clearTimeout(myTimeoutID);

                      ref_Menu_Unhover(item);

                }

               

    //Global call to initMenuMouseHoverInterceptors seems enough.

    //Alternatively call Page.ClientScript.RegisterStartupScript(Me.GetType, "MyFunction", "initMenuMouseHoverInterceptors();", True)

    //Alternatively consider to  call the function initMenuMouseHoverInterceptors() in <body> tag, <body onload="initInterceptors()" ..>)

    //If using ASP.NET AJAX documentation, call Sys.Application.add_Load or include in  pageLoad function( but only one per page is allowed)

    /*          function pageLoad()

                {initMenuMouseHoverInterceptors();

                }

    */

                initMenuMouseHoverInterceptors();

                              

    //   <!-- ~END:: JavaScript to prevent the expanding of static menu when you quickly mouse over them -->

         

     

    Helper String function to TrimLength

                /// <summary>
                /// If lenght of the string is greater than max allowed, remove the end
                /// </summary>
                /// <param name="str"></param>
                /// <param name="maxLength"></param>
                /// <returns></returns>
                public static string TrimLength(string str, int maxLength)
                {
                    if (str.Length > maxLength)
                    {
                        str = str.Remove(maxLength);
                    }
                    return str;
                }

    Helper function to Print Page using JScript(including inside frame)

                ///<summary>
                /// Helper function to Print Page using JScript(including inside frame) 
                ///</summary>
                ///<param name="page"></param>
                public static void PrintPage(Page page)
                {
                    //In case if page is in frameset, you need to call parent.window.print()
                    String script = @"
    if (parent!= self)
    { parent.window.print();
    }
    else
    {
        window.print();
    }
    ";
                    RegisterOnceStartupScript(page,TypeForClientScript(), MethodBase.GetCurrentMethod().Name,script,true);
                }
                public static bool RegisterOnceStartupScript(Page page, Type type,   string key, string script, bool addScriptTags)
                {
                    bool bRet=false;
                    if(false==page.ClientScript.IsStartupScriptRegistered(type,key))
                    {
                        page.ClientScript.RegisterStartupScript(type, key, script, addScriptTags);
                        bRet = true;
                    }
                    return bRet;
                }
     

    Make your web page more printer-friendly

    Below there are a few links describing how to Make your web page more printer-friendly

    Page dimensions : print :Maximum width = 560 pixels
     

    CSS Media Types Create Print-Friendly Pages - Save print.css in the same directory as the file, include the <link rel="stylesheet" type="text/css" href="print.css" media="print" />

    complete css guide - Printing

     CSS and Printing  describes Page Break  

    <STYLE TYPE="text/css">
         P.breakhere {page-break-before: always}
    </STYLE>

    This then will be the activator for the page break:

     <P CLASS="breakhere">

     css guide - Media

    MOM error- "BounceService: Service start of OnePoint failed. Error: 10"

    Today our MOM 2000  stopped working. Looking on MOM Esrver local eventlog we found that every few minutes OnePoint  starts , than we have message "BounceService: Service start of OnePoint failed. Error: 10" and it stops.

    Attempt to start OnePoint manually didn't succeeded.
    I was able to find workaround based on info from article http://www.huntland.co.uk/Downloads/MOM/ServiceBounceAsync.html

    To start OnePoint service I had to disable rule for "Agents Consolidators or Data Access Servers"
    (full path is Microsoft Operations Manager/Rules/Processing Rules Groups/Microsoft Operations Manager/Agents Consolidators or Data Access Servers/Performance Processing Rules/OnePoint service handle count > 10,000 (handle leak) - Bounce Service)
    and rule for "Consolidator"
    (full path is Microsoft Operations Manager/Rules/Processing Rules Groups/Microsoft Operations Manager/Consolidator/
    Threshold Process-Private Bytes-OnePointService Consolidator - Bounce Service)
     
    We will need to enabled them later and see what happened.

    Naming Guidelines: Names for embedded Enum and Property of the enum type

    Property Naming Guidelines recommends to consider creating a property with the same name as its underlying type. For example, if you declare a property named Color, the type of the property should likewise be Color.
    Enumeration Type Naming Guidelines recommends  do not use an Enum suffix on Enum type names.
     
    I found this recommendation conflicting if I want to declare Enum within class and have a property of the type of this enum.
    I've tried to create something like the following:.
     
    public class Control
    {
       public enum Color
      {
       // Insert code for Enum here.
      }

       public Color Color //confusing
       {
          get {// Insert code here.}
          set {// Insert code here.}

    }

    }

    This doesnt't work well, because compiler confused, do you refer to the Enum or Property. It probably will work if you will refer to enum with fully qualified namespace.
    It also will work, if enum Color will be declared outside the class(as in
    MSDN example), but I don't want to do it, because my enum is logically belongs to my class.

    The possible alternative is to ignore recommendation  do not use an Enum suffix

    public class Control
    {
       public enum ColorEnum // not recommended
      {
       // Insert code for Enum here.
      }

       public ColorEnum  Color 
       {
          get {// Insert code here.}
          set {// Insert code here.}

    }

    }

    The best way is to use the name of the property derivative but different to enum.
    If you have too many members in the class, consider to add an extra word as the suffix, not prefix- to help find the property in IntelliSence. For example,
    ColorSelected will be easier to find, than SelectedColor

    public class Control
    {

       public enum Color
      {
       // Insert code for Enum here.
      }

       public Color ColorCurrent //or ColorSelected or ColorMyFavorite
       {
          get {// Insert code here.}
          set {// Insert code here.}

    }

    }

    Is it possible to convert Workflow to Custom composite activity?

    I am reading about Windows Workflow and have a question:

    If I created a workflow with a few activities (While,If etc) and want to convert it to custom composite activity with ability to insert new activities inside blocks, how can I do it?
    Analogy in ASP.NET is strightforward- just a few steps(see How to: Convert Web Forms Pages into ASP.NET User Controls ) .

    Is something similar available for WF?

    Related links how to write Custom activities:
    Creating a Custom Composite Activity – Morgan Skinner's  article on MSDN

    MSDN documentation Concepts:  Creating Custom Composite Activities
    How to Write a Custom Workflow Activity  ,How to Write a Designer Component for Custom Workflow Activity

    A few links in OdeToCode blog: Windows Workflow Foundation and Domain Specific Languages

    RadioButton with Image instead of text

    I want to have RadioButton with Image instead of text, that clicking on image the check-box will be selected
     
    In the thread it is shown Radio button (without any text) and image on it's side.(but not inside radio-button)
    <asp:RadioButton ID="RadioButton2" runat="server" GroupName="A1"
    /><asp:image runat="server" id="Image2" /><br />
     
    Radiobuttonlist Image Setting thread  suggests to use code
    RadioButtonList1.Items.Add(New ListItem("<img src=""" + s + """/>", s))

    It will be useful (TODO) to create derided from RadioButton control- RadioButtonWithImage, similar to what I've done previously : ASP.NET custom control HyperLinkWithImage and ASP.NET custom control CheckBoxWithImage
     
    There is somehow related post and thread about creating custom control based on RadioButtonList.

    New posts of source code about old Asp.net custom controls

    I've found in my source code library a few custom ASP.NET controls that could be useful for someone.

    ASP.NET custom control TextFileViewerControl

     

     

     

     

     

    ASP.NET composite control FromToTextBoxes

     

     

     

     

     

    ASP.NET custom control CheckBoxWithImage

     

     

     

     

     

    My QueryStringHelper class.

     

     

     

     

     

    Function to Navigate To Named Anchor

    Below is  a helper function to insert javascript  to Navigate To Named Anchor

    Page should have anchor with the passed name

    <a name="anchorName"></a>

                // from http://www.webdeveloper.com/forum/showthread.php?threadid=112603
                public static void NavigateToNamedAnchor(Page page, string anchorName)
                {
                    String script = String.Format("window.location.hash = '{0}';", anchorName);
                    page.ClientScript.RegisterStartupScript(TypeForClientScript(), MethodBase.GetCurrentMethod().Name, script,true);
                    //return script;
                }

     

    Passing parameters in .Net Remoting

    It is well known, that in .Net value type parameters are passed by value, and reference type parameters are passed by reference(more detailed and strict description can be found here).
    I thought(even after a year working with application that extensively uses Remoting)  that .Net Remoting calls do the same. But I was wrong!
    Recently I found that a method with custom class parameter  doesn't have one of the properties updated after return, even if it is certainly updated inside the method.

    I've read a few reference articles.
    quickstart Remoting Overview is a little bit confusing:
    Object passing. All objects created remotely are returned by reference and have to derive from MarshalByRefObject. Objects passed as parameters to a remote method call can be forwarded by value or by reference. The default behavior is pass by value provided the object in question is marked by the custom attribute [Serializable]. Additionally, the object could implement the ISerializable interface, which provides flexibility in how the object should be serialized and deserialized. Objects that are not marshal by reference or marshal by value are not remotable.
     

    How to marshal an object to a remote server by value by using Visual C# is more clear:

    Because parameter ForwardMe does not inherit from MarshalByRefObject, it is passed by value to the server.

    And finally, article  Copying, Cloning, and Marshalling in .NET clarified it:

    By default, all objects in .NET (both value- and reference-types) are marshalled by value when sent across the "wire" to a remote AppDomain.To override this default MBV behavior, one can simply derive one's class from System.MarshalByRefObject .

    So the Rules for passing parameters in .Net Remoting are the following:

    1. Parameter should have attribute [Serializable] or derive from MarshalByRefObject.
    (It would be unusual for a class to be both marked with the serializable attribute and extend MarshalByRefObject.)

    2. If parameter is serializable, it is passed by value. Changes inside remote methods do not return to the client.

    3. If parameter  derive from MarshalByRefObject , it is passed by reference.

    4. I am not sure, what happens If you specify modifier ref  for serializable parameter. I hope that it is also passed by reference, but not sure.

    I did not have a chance to read, what are WCF rules for passing parameters.

    «July»
    SunMonTueWedThuFriSat
    293012345
    6789101112
    13141516171819
    20212223242526
    272829303112
    3456789