Tuesday, December 23, 2008

PDC Video Stories - PT 2: Material

For anything that is done by the team ratings need to be recorded so that we can understand how well it is being received.

As the Mini PDC is different from normal, Herman as the man in charge, would need to produce a special evaluation form for it.

He is so good at delegating that when the task was assigned, Henk (our fearless leader) skipped Herman and assigned it to me directly to be done.

Moral of the story, if you are a good delegator other people do your work. If you are a great delegator like Herman other people do your delegating too!

Monday, December 22, 2008

The Delegator has left the building …

The Delegator is leaving (very) early today … after the team of delegatees has been really proactive. Sorry for the bad picture, but it kind-of shows the delegator, surrounded by his ‘delegatees’, including his son q;-)

image

Have a nice afternoon Mr. Delegator … we will hold the fort for another 5 minutes or so on your behalf.

Who is the Delegator?

The delegator is one of our senior developers, analysts, mentors, evangelists … to cut a long story short, he is one of our most competent professionals, is highly specialised in user interface design and development and “loves” delegation.

He also loves the series “Dr. Horibble's Sing-Along Blog”, which is why we believe the following footage showing our esteemed delegator is simply classic:

http://www.saarchitect.net/Publications/Events/Academia/Rhodes%202008%20Interoperability%20Roadshow/Silverlight%20Expert.wmv

… there is also a slightly longer version on SA Architect, which we have not been allowed to publish … but looking at the above url you may find the extended version q;-) … otherwise corner Herman at the next community or professional event.

Blue And White Robot Sitting And Looking At His Own Hands In Amazement Glossy Robot Inspecting Himself

The Carousel Silverlight Application … Awesome!

What did our esteemed delegator tried and did …

He tried to create a simple Fish Eye type menu where the icons are spaced evenly in degrees around a circle.

How did he do it?

First he needed to load the images into his Silverlight page. This was done by dynamically adding any number of images into an array and the setting the canvas top and left to the appropriate position. Easier said than done.

How do you get the X and Y coordinates on the outer edge of a circle? This is a question with which he tortured everyone in his team and in the true spirit of things, everyone vanished on a separate thread doing research for the delegator. 

The scene:

clip_image001

clip_image002                This is the point where he wants the X and Y coordinate.

clip_image003                This is the angle that we need to work with.

He used C# for the language…You need the following formulas to do this:

First, the Math .NET object, so that you can do the COSINE and SINE calculations.

The COSINE and SINE needs the radians to get the correct coordinates. To calculate the radian from an angle you need

  • Radian = ANGLE * Pi / 180

Then

  • X = Radius * COS(Radian)
  • Y = Radius * SIN(Radian)

Once he could calculate the x and y coordinates he was ready to rock and roll. Here is the method he used to add the animations to the images.

   1: private void addAnimation(Image image, double angle, double x, double y)
   2: {
   3:     TransformGroup tfGroup = new TransformGroup();
   4:  
   5:     //MouseOver animation for resizing
   6:     Storyboard sbMouseOver = new Storyboard();
   7:     ScaleTransform tfGrow = new ScaleTransform();
   8:     tfGrow.SetValue(NameProperty, "tfGrow_" + image.Name);
   9:     tfGrow.CenterX = 24;
  10:     tfGrow.CenterY = 24;
  11:     tfGrow.ScaleX = 1;
  12:     tfGrow.ScaleY = 1;
  13:     tfGroup.Children.Add(tfGrow);
  14:  
  15:     DoubleAnimation daGrowX = new DoubleAnimation();
  16:     daGrowX.SetValue(Storyboard.TargetNameProperty, tfGrow.GetValue(NameProperty));
  17:     daGrowX.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("(ScaleTransform.ScaleX)"));
  18:     daGrowX.To = 2;
  19:     daGrowX.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500));
  20:     daGrowX.AutoReverse = true;
  21:     sbMouseOver.Children.Add(daGrowX);
  22:  
  23:     DoubleAnimation daGrowY = new DoubleAnimation();
  24:     daGrowY.SetValue(Storyboard.TargetNameProperty, tfGrow.GetValue(NameProperty));
  25:     daGrowY.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("(ScaleTransform.ScaleY)"));
  26:     daGrowY.To = 2;
  27:     daGrowY.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500));
  28:     daGrowY.AutoReverse = true;
  29:     sbMouseOver.Children.Add(daGrowY);
  30:  
  31:     image.Resources.Add("sbMouseOver_" + image.Name, sbMouseOver);
  32:  
  33:     //Startup storyboard - Rotates the images in a circle
  34:     Storyboard sbStartLoading = new Storyboard();
  35:     TranslateTransform tfMove = new TranslateTransform();
  36:     tfMove.SetValue(NameProperty, "tfMove_" + image.Name);
  37:     tfMove.X = x+200;
  38:     tfMove.Y = y+200;
  39:     tfGroup.Children.Add(tfMove);
  40:  
  41:     DoubleAnimationUsingKeyFrames daMoveX = new DoubleAnimationUsingKeyFrames();
  42:     daMoveX.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("(TranslateTransform.X)"));
  43:     daMoveX.SetValue(Storyboard.TargetNameProperty, tfMove.GetValue(NameProperty));
  44:     DoubleAnimationUsingKeyFrames daMoveY = new DoubleAnimationUsingKeyFrames();
  45:     daMoveY.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("(TranslateTransform.Y)"));
  46:     daMoveY.SetValue(Storyboard.TargetNameProperty, tfMove.GetValue(NameProperty));
  47:     
  48:     TimeSpan nextTime = new TimeSpan(0, 0, 0, 0, 0);
  49:     LinearDoubleKeyFrame myFrameX = new LinearDoubleKeyFrame();
  50:  
  51:     LinearDoubleKeyFrame myFrameY = new LinearDoubleKeyFrame();
  52:  
  53:     for (int i = 0; i < 72; i++)
  54:     {
  55:         angle += 5;
  56:         if (angle > 360)
  57:         {
  58:             angle -= 360;
  59:         }
  60:         double aniAngle = (angle) * Math.PI / 180;
  61:  
  62:         double nuX = 150 * Math.Cos(aniAngle);
  63:         double nuY = 150 * Math.Sin(aniAngle);
  64:  
  65:         TimeSpan nuTime = nextTime.Add(new TimeSpan(0, 0, 0, 0, 100));
  66:  
  67:         //LinearDoubleKeyFrame 
  68:         myFrameX = new LinearDoubleKeyFrame();
  69:         myFrameX.KeyTime = KeyTime.FromTimeSpan(nuTime);
  70:         myFrameX.Value = nuX+200;
  71:         daMoveX.KeyFrames.Add(myFrameX);
  72:  
  73:         //LinearDoubleKeyFrame 
  74:         myFrameY = new LinearDoubleKeyFrame();
  75:         myFrameY.KeyTime = KeyTime.FromTimeSpan(nuTime);
  76:         myFrameY.Value = nuY+200;
  77:         daMoveY.KeyFrames.Add(myFrameY);
  78:  
  79:         nextTime = nuTime;
  80:     }
  81:  
  82:     daMoveX.Duration = new Duration(nextTime);
  83:     daMoveY.Duration = new Duration(nextTime);
  84:     sbStartLoading.Children.Add(daMoveX);
  85:     sbStartLoading.Children.Add(daMoveY);
  86:  
  87:     image.Resources.Add("sbStartLoad_" + image.Name, sbStartLoading);
  88:     image.RenderTransform = tfGroup;
  89: }


In the end he came up with a rotating circle of images which independently animate.

clip_image002

Well done Mr Delegator!

PDC Video Stories - PT 1: The name

Herman (the delegator) is currently running a mini-PDC here at BB&D, by showing some of the videos from it, and a few stories should be shared. First, and most importantly, is the origin of the delegator name.

Herman was assigned the task of working out the schedule for the mini-PDC. So he stood up, went to the white board, drew a 5 by 4 grid, put dates across the top and times down the side and wrote names in each block.

Next he sent out an email telling the team to find their blocks and fill in what videos they want to see at that time… thus delegating the scheduling to the entire team!

image

Friday, December 19, 2008

Done for the day

Herman has left the building! He is done for the day! In traditional delegator fashion, as he was walking out of the door, he delegated the entertainment of next week to me… namely I need to bring my XBox to work.

I am thinking the Boules may be a better choice, especially since last time we got some winning pictures like this:

PA240274_jpg

Welcome Herman "The Delegator" to your very own blog

Herman on behalf of your team we say WELCOME to your very own blog. We know your did not delegate this to be done but we felt it was about time. Thanks Robert "HAWTY"