dasBlog 1.8 up and running#
What a way to spend a Friday evening, upgrading to dasBlog 1.8  But seriously it was very simple and straight forward, so go and upgrade if you have not already.
Saturday, January 28, 2006 2:29:51 PM (GMT Standard Time, UTC+00:00) #    Comments [0]  | 

 

nulls, nulls everywhere#

I just can’t stand seeing nulls everywhere in code especially when the null object pattern could be used.  Maybe I’m just a fanatic but I really dread the null reference exception and if you are returning and assigning nulls everywhere the probability of this exception happening is increased.

Saturday, January 28, 2006 1:49:21 AM (GMT Standard Time, UTC+00:00) #    Comments [0]  | 

 

Cloning a XmlNode #

After reading Bob Brumfield’s post about his issue with selecting a node from a cloned node it got me interested.  At first it seemed trivial but then I started getting frustrated with it.  The cloned node had a OwnerDocument so why was it not working.

Well the OwnerDocument is only half the story.  You need a ParentNode to successfully do a query on the cloned node.  The ParentNode is nulled when a clone is made.  Thus the answer is put the cloned node in another document.  So if  you want to clone a node and use it you will need to do something like below.

  private XmlNode Clone(XmlNode node, bool deep)
  {
      XmlNode clone = node.CloneNode(deep);
      XmlDocument cloneDoc = new XmlDocument();
      XmlNode importNode = cloneDoc.ImportNode(clone, true);
      cloneDoc.AppendChild(importNode);

      return importNode;
  }

Now Bob’s real issue is when he serializes/deserializes an element he can’t select a node (The clone issue seemed to mimic the same problem).  I suspect what I described above is what he is seeing.  The node is serialized and deserialized with no XmlDocument or ParentNode so you will always get null when querying for a node.

Friday, January 27, 2006 4:50:01 AM (GMT Standard Time, UTC+00:00) #    Comments [0]  | 

 

Performance Comparison: Remoting vs. WebService#
Yesterday I spent some time doing some performance test between remoting and web services.  In the end the performance was nearly identical.  Using remoting showed a slight speed increase; slight being a .24 millisecond faster.  The percent error that was in my test is easily .24 milliseconds, so at this point I say choose your poison based on your usage and take the performance discussion out of it all together.
Thursday, January 26, 2006 8:06:51 PM (GMT Standard Time, UTC+00:00) #    Comments [0]  | 

 

Great Time at Sambuca#
Last night the wife and I went to Sambuca and listened to some great Jazz and had a wonderful meal.  If you are in the Denver area I highly recommend it.
Thursday, January 26, 2006 7:57:58 PM (GMT Standard Time, UTC+00:00) #    Comments [0]  | 

 

Why TDD is important#

Last week I was thinking of a way to explain to my team why TDD is so important.  Here is the list I came up with.

  • Code Design:  Developing code for testing in isolation leads to more decoupled designs.
  • Unit Tests is one thing that is used to help determine code quality.
  • Code Confidence
  • Code does what it is intended to do
  • Tends to be less YAGNI using TDD
  • Devs have a better understanding of what the code is supposed to do
  • If you can only write integration test it may be a sign of a highly coupled design
  • The refactoring step is usually skipped when not using a TDD approach
  • Unit test live with the code; integration tests live with the project and tester (usually after a project goes live the integration tests get our of date and are useless)  
Wednesday, January 25, 2006 3:56:22 AM (GMT Standard Time, UTC+00:00) #    Comments [0]  | 

 

Windows Workflow Beta2 and Events#

One change I just noticed in WF Beta2 is that services you want to add need to be added to a ExternalDataExchangeService.  The ExternalDataExchangeService needs to be added to the runtime then any custom service need to be added to it.  The reason lies with Reflector  The AddService method calls IntercepService which wires up the event handlers for the service that has the ExternalDataExchangeAttribute and in the end adds it to the workflow runtime.

So the ExternalDataExchangeService responsibility is to wire/unwire events and add/ remove [ExternalDataExchange] equipped services.  This is not the most intuitive and I don’t really like have a service to track other services events.  I would of been happy if it was called ExternalDataExchangeCatalog instead of ExternalDataExchangeService; but there is an easy fix for that.  Derive from ExternalDataExchangeService and name it ExternalDataExchangeCatalog and add it to the runtime

Wednesday, January 25, 2006 3:44:37 AM (GMT Standard Time, UTC+00:00) #    Comments [0]  | 

 

Goodbye Rhapsody!#
I finally got rid of Rhapsody and switched to XM radio.  No more DRM install issues and I get to listen to the music at home, in the car and on the net with XM.  Awesome!
Tuesday, January 24, 2006 3:30:45 AM (GMT Standard Time, UTC+00:00) #    Comments [0]  | 

 

Awesome OneNote feature#
I just came across the Screen Clipping feature in OneNote.  This thing is great, just try hitting WinKey + S.  The screen will go white, select an area with your mouse and BAM that clipping goes right into OneNote.  In OneNote this feature is under Insert->Screen Clipping.  Very cool!
Friday, January 20, 2006 3:52:28 PM (GMT Standard Time, UTC+00:00) #    Comments [0]  | 

 

Entertains Children and Opens Beer#
GumbyBottle
Monday, January 16, 2006 12:51:53 AM (GMT Standard Time, UTC+00:00) #    Comments [0]  | 

 

CAB: How to tell when a window is Closed?#

The simplest answer is add a SmartPartClosed event.  The SmartPartClosing event is nice but since all the workspaces in CAB do not dispose the smartpart when closed you may want to listed to when a smartpart is closed and decide what to do, such as dispose it.  So to add the SmartPartClosed event I went one by one through the workspaces and wrote unit tests for it.  I then added the SmartPartClosed event to IWorkspace and added RaiseSmartPartClosed(WorkspaceEventArgs e) to the IComposableWorkspace.  Well after adding these to the interfaces all the workspaces and mock workspaces in the test have to be updated.  This is not a hard task but takes about ten minutes.

You can download the source for the workspaces from here

Sunday, January 15, 2006 7:24:23 PM (GMT Standard Time, UTC+00:00) #    Comments [0]  | 

 

CAB: Closing a Window in a WindowWorkspace#

As some of you may have already figured out depending on how you close a window in a window workspace you will get two different results.  If you call Close(smartpart) on the workspace the smart gets removed from the form before it is disposed (this happens in the OnClose method).  If you just click the “X” on the form the view is allowed to be disposed.  To correct this I had the private method WindowFormClosed call the OnClose by changing to read the below:

  private void WindowFormClosed(object sender, WorkspaceEventArgs e)
  {
   Control smartPart = e.SmartPart as Control;

   if (smartPart != null)
    OnClose(smartPart);
  }

And then changed the OnClose to read:

 /// <summary>
  /// Closes the form where the smart part is being shown.
  /// </summary>
  protected override void OnClose(Control smartPart)
  {
   Form form = windowDictionary[smartPart];
   smartPart.Disposed -= ControlDisposed;

   // Remove the smartPart from the form to avoid disposing it.
   form.Controls.Remove(smartPart);

   form.Close();
   windowDictionary.Remove(smartPart);
   base.InnerSmartParts.Remove(smartPart);

   base.RaiseSmartPartClosed(smartPart);
  }

 

Sunday, January 15, 2006 6:43:25 PM (GMT Standard Time, UTC+00:00) #    Comments [0]  | 

 

CAB: Adding FormStartPosition to the WindowWorkspace#

I have been using the window workspace quite a bit lately by passing in an owner form.  The owner form is most of the time the shell form.  So the first obvious thing I wanted was to have a form start position.  So I wrote a unit test then added a FormStartPosition to the WindowSmartPartInfo.

  [TestMethod]
  public void FormSetsStartPosition()
  {
   TestableRootWorkItem workItem = new TestableRootWorkItem();
   WindowWorkspace workspace = workItem.Workspaces.AddNew<WindowWorkspace>();
   MockSmartPart smartPart = workItem.SmartParts.AddNew<MockSmartPart>();
   WindowSmartPartInfo info = new WindowSmartPartInfo();
   info.StartPosition = FormStartPosition.CenterParent;

   workspace.Show(smartPart, info);

   Assert.AreEqual(workspace.Windows[smartPart].StartPosition, FormStartPosition.CenterParent);
  }

Added Code:

  /// <summary>
  /// Sets the location information for the given form.
  /// </summary>
  protected void SetWindowLocation(Form form, WindowSmartPartInfo info)
  {
     form.Location = info.Location;

   form.StartPosition = info.StartPosition;
  }

The test passed and it seemed to work fine until I really tried to use it in an app.  When I checked the FormStartPosition of the new window it was correct but it still did not show in the right place.  After furthur investigaton the issue was  the location was always being set to 0,0.  To fix this I initialized the location to Point.Empty in the WindowSmartPartInfo and added a check in SetWindowLocation.

  /// <summary>
  /// Sets the location information for the given form.
  /// </summary>
  protected void SetWindowLocation(Form form, WindowSmartPartInfo info)
  {
   if (info.Location != Point.Empty)
    form.Location = info.Location;

   form.StartPosition = info.StartPosition;
  }

More to come on tweaking the window workspace

Sunday, January 15, 2006 6:25:54 PM (GMT Standard Time, UTC+00:00) #    Comments [0]  | 

 

Polar S725 with NightRider light#

Lately I have been riding in the dark and using my NiteRider light that mounts to my handler bar.  Well the frequency my light supplies power at interferes with the wireless setup for my polar watch so all heart rate, speed and cadence functions do not work.   I wondering if some kind of shielding will help with this?

Sunday, January 15, 2006 6:09:22 PM (GMT Standard Time, UTC+00:00) #    Comments [0]  | 

 

Vote For Monkey Bean!#

Vote for the Monkey Bean on AOL City Guide for best of for 2006.  If you have not been to the Bean you need to haul your ass down there.

Thursday, January 05, 2006 1:06:11 AM (GMT Standard Time, UTC+00:00) #    Comments [0]  | 

 

All content © 2008, John Luif
On this page
This site
Calendar
<November 2008>
SunMonTueWedThuFriSat
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456
Archives
Sitemap
Blogroll OPML
Disclaimer

Powered by: newtelligence dasBlog 2.1.8102.813

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Send mail to the author(s) E-mail

Theme design by Jelle Druyts