Mark Michaelis' Weblog :
Updated: 9/1/2004; 7:08:51 AM.

 








Subscribe to "Mark Michaelis' Weblog" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.

Subscribe To
Mark's Weblog

 
 

Tuesday, June 01, 2004

Creating a Toggle Anchor Lock macro for images in word
Google Search It

I recently wanted a button or keystroke that could automatically toggle the Lock Anchor state for shapes in Microsoft Word.  Unfortunately, there didn't seem to be a built-in Word action for doing this.  Using a tip from Cindy Meister I created the following macro that does the trick nicely:

Sub ToggleShapeAnchor()
    Dim newlockAnchorSetting As Boolean
    If Selection.Type = wdSelectionShape Then
        If (Selection.ShapeRange.Count >= 1) Then
            newlockAnchorSetting = Not Selection.ShapeRange(1).LockAnchor
        End If
        For Each Shape In Selection.ShapeRange
            Shape.LockAnchor = newlockAnchorSetting
        Next
    End If
End Sub

I also had a problem with trying to make fine adjustments of the shapes.  Each adjustment caused the shape to jump a couple inches up the page.  Further adjustment caused it to jump again.  Cindy informed me that this was generally indicative of damage in the binary structures of the control page layout and advised I tried round tripping the file to RTF, WordML, or HTML.  I also found that turning on and off the anchor sometimes seemed to get particular images positioning correctly again.


9:40:54 PM   []    comment []

VS.NET external help didn't work for me until Michael Stokesbary recommended this post from Rob Caron.


9:24:24 PM   []    comment []

The current C# 2.0 specification includes the following quote:

"A comparison operator (==, !=, <, >, <=, >=) has a lifted form when the operand types are both non-nullable value types and the result type is bool. The lifted form of a comparison operator  is formed by adding a ? modifier to each operand type (but not to the result type). Lifted forms of the == and != operators consider two null values equal, and a null value unequal to a non-null value. Lifted forms of the <, >, <=, and >= operators return false if one or both operands are null."

What does this mean?

Perhaps the most significant concept in this paragraphs is at the end where it declares that the operators <= and <= versus the operator == behave differently for Nullable<T> types when that have the value null.  As a result, even though == may return true, the >= operator and the <= operator will sometimes return false.  Let's consider an example.

int? x, y;   // Declares two variables of type Nullable<int>
x = null;
y = null;

Assert.IsTrue(x == y);
Assert.IsFalse(x <= y);

When null is involved with a nullable type, therefore, the >= operator would not be equivalent to the combination of the > and == operators.  In other words,  the expression x>=y would not be equivalent to the combination of x>y || x==y.  Perhaps what is most unusual about this is generally they operator >= is called greater-then-or-equal but in the case of both operands being null, the result of the >= operator would be not equal even though the == operator indicates they are equal.

Furthermore if you were to sort a list of Nullable<T> types using the > operator for ascending order and the < operator for descending order then regardless, all items with the value null would sort to the same location regardless of which operator (< or >) was used (null items would always sort to the top or the bottom regardless of which operator is used.)

Note that currently the May 2005 Visual Studio.NET Tech. Preview does not support the >= and <= operators.  Also, the == operator is marked as obsolete.

I would be curious to know what folks think about this implementation?

(This topic is also being discussed at on the GotDotNet C# Language Message board here.)


4:21:35 PM   []    comment []

Accident Recovery
Google Search It

It has now been one month since my bicycle accident.  I would like to say everything is back to normal but there are a few hitches.

Mental state

I will let you draw your on conclusions based on interactions with me and the following additional data points:

  • Pushed the undock button when leaving work but I ended up forgetting my laptop at work for one night last week.  Normally an allergic reaction starts when I get to far from the laptop and I didn't even realize the mistake until I got home.
  • I left my wallet on the bus (my means of commuting while I can't ride a bicycle) last week and didn't realize it was missing until half way through the day.  (Fortunately, this is Spokane and not <enter city name here> because I picked it up intact with all cash and cards 2 days later at lost and found.)
  • I asked my son to put his used paper napkins into the dishwasher 3 times one evening.  Fortunately, my beautiful wife was there to point out my nonsensicalness.
  • Today I took a bus from work to the transit station.  I then moved to another bus and waited for it to leave.  Five minutes into the journey I realized that the bus I boarded at the transit station was taking me back to work rather than home.  I disembarked soon enough to be in walking distance from home and this was the first time taking this particular route but still, it wasn't particularly bright of me.

Physical state

On Friday I had a tilt table test in the morning, an appointment with an orthopedic surgeon for my AC separation in the early after noon, followed by a stress (treadmill) test and meeting with the cardiologist toward the end of the day.  Earlier that week I also had a CAT scan of my heart.  The orthopedic went so far as to say that I should come and see him in six months if I still have a problem but that it should heal on its own (I responded that is wasn't personal but I hoped I wouldn't need to see him again either.)  At the very end of the tilt table test I went pale and sweaty but I didn't faint (the goal if it was to be a positive test).  In the end the cardiologist concluded that all the tests were negative except for the tilt table test which was abnormal but inconclusive.  Therefore, he recommended that I go for a Catheter Ablation.  He also cleared me for driving but not exercise.

Emotional state

Looking forward to this all being over.  Frustrated by my lack of productivity both at work and with writing.  Perhaps this is normal but I am blaming it on my accident regardless.  :)

Summary

  • I am uncomfortable with doing the Catheter Ablation and I don't think there is enough evidence to warrant putting a tube into my heart.
  • They have also not been able to show any exercise related syncope and it frustrates me that they are still asking me not to do any exercise, especially when my two syncope related incidents immediately following my accident have more in common with driving than exercise.

11:09:13 AM   []    comment []

© Copyright 2004 Mark Michaelis.



 


June 2004
Sun Mon Tue Wed Thu Fri Sat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30      
May   Aug


Recent Posts