Monday, May 2, 2011

An ActivityDesigner for InvokeAction

Building off of An ActivityDesigner for InvokeAction

The only changes needed to make it work for InvokeAction was in the Xaml

< WrapPanel name="ArgumentWrapPanel">
and the OnModelItemChanged override:

 //set ETB expression type
            var generics = invokeActionObj.GetType().GetGenericArguments();
            if (generics.Length > 0)
            {
                this.ArgumentETB.ExpressionType = generics[0];
            }
            else
            {
                this.ArgumentETB.IsEnabled = false;
                this.ArgumentETB.Expression = null;
                this.ArgumentWrapPanel.Visibility = System.Windows.Visibility.Collapsed;

            }

Thursday, April 21, 2011

Command line shortcuts

for service starting stopping or even remote event viewing...shortcuts

I made a batch file that does this


set /p compname=Enter the computer name:
start mmc compmgmt.msc /computer:\\%compname%
set compname=

The original had c:\windows\system32\compmgmt.msc but on my system it doesn't appear to be needed
you can replace compmgmt.msc with services.msc or eventvwr.msc

Also to pipe into notepad:


set /p compname=Enter the computer name:
sc \\%compname% query type= service | find "SERVICE_" > %temp%\tmpsvc.txt
start notepad %temp%\tmpsvc.txt
ping -n 2 127.0.0.1
del %temp%\tmpsvc.txt
set compname=


the ping is there because the delete would fire much faster than the notepad starting up, so it's a sleep hack.

Monday, March 21, 2011

EF4 + ESQL for not supported options

So say you want to support wildcard searches against a SQL db. Yes this is probably horrible performance wise, but... useful or as an example how to do ESQL against an EF4 context.

Linqpad against my EF4 context:



  internal IEnumerable<IPlayerFull> SearchForPlayer(string playerNameLike, byte? universeId)
        {

var q= from p in q.Players.Where(p => p.UniverseId == universeId) 
.Where("it.Name like @Name"new ObjectParameter[] { new ObjectParameter("Name", playerNameLike) })
.Where(p => p.UniverseId == universeId)
       orderby p.Name
      select p;
 return q;
bizarre eh? EF4 note, not related to ESQL:

Monday, March 14, 2011

Class organization

I am putting together a theory of  class code readability organization with the assertions that


  • Classes consistently organized are easier to read and understand
  • Fields should be private
  • Consistent internal state is preferable to passing around invalid objects that can communicate they are invalid (immutability vs IDataErrorInfo)
This layout is my hypothesis of what a good consistent layout would be:

  1. private fields
  2. constructor(s)
  3. Initializers and wiring
    1. for example event wiring
  4. non-public properties
  5. public operations
  6. public properties
  7. explicit event plumbing
    1. For example designer auto-generated event handlers
  8. Other plumbing or utilities
As with any theory or concept, the main ways to learn from it are 

  • to communicate it out for feedback 
    • other people's viewpoints can help you find your blind spots
    • you can become aware of situations where the idea or solution doesn't fit and why
  • apply it
  • look at it with a critical eye for places or reasons that it works well and places it doesn't
    • keep an open mind that one size does not fit all
  • solicit feedback for applications of the idea
    • other people can better see past your blind spots
    • explaining it helps keep or find perspective
    • any critical thinking or discussion is likely to be beneficial to all involved parties

Monday, January 31, 2011

Long pages no more named anchors... link someone to a specific part?

I've wanted to do this so many times.... Link someone to a specific part or section of a long web page and had no idea it was possible. It's become a hidden feature since in the old days people used named anchors (< a href="#anchorname">Browser anchor link text. This was easy to right click and select copy location or copy shortcut, etc..

I don't think there's a UI based shorthand any longer but apparently:

example showing usage (with the source I found this information)

http://w3fools.com/#html_links