Software Engineering : This category relates to interesting computer related stuff that I am researching or reading about. Most of it is in the area of .NET technologies which is the focus of most of my computer related time at the moment.
Updated: 9/21/2004; 3:38:40 PM.

 



My Software Development





Subscribe to "Software Engineering" 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

 
 

Saturday, September 11, 2004

Applications: Running 32-Bit Applications with Windows Running on AMD Opteron and AMD Athlon 64 Systems
Google Search It

I came across this title in the release notes for the beta version of Windows 2003 for 64 bit AMD with SP1.  It seems innocuous enough at first.  The problem is in the details which I quote below:

 Generally, you can run 32-bit applications on Windows Server 2003, Standard Edition; Windows Server 2003, Enterprise Edition; and Windows XP 64-Bit Edition without making any changes. Applications that meet the following criteria, however, are not compatible with Windows products running on AMD Opteron and Athlon 64 systems:

  • Applications with 16-bit installers
  • Applications that install 32-bit kernel-mode drivers
  • Applications with dependencies on any version of Microsoft .NET Framework

We recommend that you contact your software vendors to verify whether one of these exceptions applies to your software.

Hmmmmm... I think that could be a problem for me.  Uggghhhhhhh!!!!!!  Besides, wasn't the .NET Framework supposed to deal explicitly with this problem?


11:08:54 PM   []    comment []

Friday, September 10, 2004

System.Diagnostics.Stopwatch in .NET 2.0
Google Search It

A picture named System.Diagnostics.Stopwatch.jpgOne omission from .NET 1.0 that would have been extremely useful is a Stopwatch that can report accurate time (presumably using the high performance counter APIs).  It is needed especially for doing any type of small scale testing.  Unfortunately, there is no such class in .NET 1.0.  However, 2.0 does have such a class in the System.Diagnostics namespace called Stopwatch.

If you are stuck in the 1.0 world still then Daniel Strigl has defined a class on CodeProject called HiPerfTimer that could easily be converted to look like the Stopwatch class in 2.0. 


10:24:59 AM   []    comment []

Thursday, June 03, 2004

In the past I have been a big fan of NewsGator and pretty much used it exclusively.  However, one particularly irritating feature of some blogs is that they only supply the title, posting URL, and date in the RSS feed, forcing one to go to the website to view the body.  intraVnews deals with this issue displaying the posting URL content below the blog content.  This is a fantastic feature that allows one to still follow blogs that don't provide a body.  (This begs the question that perhaps blogs that don't provide a body should continue to be boycotted regardless of the tools to overcome the problem.)

I am currently giving intraVnews a try and so far I am reasonably pleased.  In fact, I have NewsGator and intraVnews installed simultaneously without problem.  My two negative comments on intraVnews relate to

  1. Moving blog folders -  The UI for this is rather cumbersome and time consuming if there are lots of blogs.
  2. The scheduler to download doesn't appear to autostart (presumably a setting I haven't found yet.) 

One of the key items I need to investigate soon relates to exporting the settings of the RSS reader and then importing them once I re-install the OS.


12:34:50 AM   []    comment []

Wednesday, June 02, 2004

Here is an interesting device especially if you already own a Windows Media PC and want to add cassette capabilities.  The PlusDeck 2 is an internal cassette deck for your computer that can help convert cassettes to their WMA/MP3 equivalent.  I have lots of cassettes, especially talks from Willow Creek, that I would love to convert just so they can be digitally organized.  I would then listen to the MP3s on my not-yet-existent mini Smart Phone with built in MP3 player (and Bluetooth of course).


10:59:23 PM   []    comment []

When .NET was first released I was disappointed by the fact that they had not provided a definition for the term "component."  The term was common in the COM days but it was never clearly defined as referring to a particular COM object or the DLL in which the COM object was implemented.

Under .NET the definitions remain ambiguous and at this point too many leading engineers have placed a stake in the ground one side or the other so it is unlikely to get resolved any time soon.  Some, like Juval Lowy, firmly believe it corresponds to a class.  Other sway more toward it referring to an entire assemble. 

I share Michael Platt's amazement that these terms remain ambiguous given the length of time they have been pervasive in the industry.  Furthermore, the frequent need to create designs that include classes as well as the containers of the class definitions would lead one to expect that their definitions were firmly established.  Perhaps what makes this even worse is that "module" now has a definite meaning in the .NET space.  Therefore, it cannot be used as the generic term for a container of compiled code.

Personally, I prefer the component to mean assembly (or container of compiled code) as I don't believe there is any need to provide another word for object or class as these have firm O.O. definitions.  Furthermore, there is not really any generic term for the files (or streams) that contain a series of bytes implementing a feature (or class etc.)  Component seems like a great term to fill this hole.  Recently I read Michael Platt's discussion of the terms Object, Component, Model, and Service and was pleased to hear I am not alone in my leanings.

Thoughts?


5:10:32 PM   []    comment []

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 []

Sunday, May 23, 2004

TechEd Webcasts
Google Search It

For those of you who were not able to make it to Tech Ed 2004 this year, here are several of the developer related talks that will be broadcast over the web (in date order):

1.   
5/24/2004 12:15 PM
2.   
5/25/2004 12:15 PM
3.   
5/26/2004 11:00 AM
4.   
5/27/2004 11:00 AM
5.   
5/27/2004 11:45 AM
7.   
5/28/2004 12:15 PM

I am not sure why these are the only ones showing up on the Microsoft Event Search pages so if you come across others please let me know.
10:05:05 PM   []    comment []

Thursday, May 13, 2004

My primary responsibility at work over the past year has been to be lead a team of developers that is responsible for building a Framework on top of the .NET Framework that fills in all the holes the Microsoft left and defines best patterns and practices for my companies .NET development.  I admit that unfortunately sometimes we don't always get everything completed perfectly due to various constraints and then we have to go back in a later release and "fix" the problems we introduced.  The Making AP Is Obsolete practices documented here provide good guidelines on how to make changes to APIs in future releases.  Note that to depricate an API one decorates it with the ObsoleteAttribute attribute.


9:05:43 PM   []    comment []

Wednesday, May 12, 2004

For the Inductive Bible program (previously called eBible) I am working we are currently using MSDE (assuming no SQL Server available).  Unfortunately, MSDE doesn't come with any management or query tools.  However, there are some free solutions out there that fulfill the purpose and are worth checking out. 

MSDE Manager
Includes both a .NET and an unmanaged version.  This is free for personal use.  The big plus of this tool over the others is that it includes database administration not just query capabilities so it is more than simply a replacement for query manager, offering more like the functional equivalent of Enterprise Manager.  The company, White Bear Consulting, also provides versions as controls that can be bundled into you applications for a reasonable fee.

MSDE Query
The first tool I tried.  It works much like SQL Server's query manager, allowing you to select the database and then execute queries against the database.  It has an MDI interface so each query can be in its own window.  Results are reported either as text, the default, or into a grid.  Overall I would say this is a fully functional replacement for SQL Server's query manager.  The same company also has a program similar to Enterprise Manager at minimal cost that is worth checking out if you need such a tool.

MSDE GUI
Based on the screen shots this looks like another viable option that includes source code so you could perhaps include it into your own application.  Certainly worth checking out if you need to bundle something in your application.

There are a couple issues with our choice for MSDE.  Firstly, I don't expect users of the software to have the most cutting edge computers or connections.  MSDE is a 45 MB download which would certainly be a hitch to telephone modem users especially given that they are also going to have to download the .NET Framework redistributable.  Secondly, it is not exactly clear whether we should install even when there is already a SQL Server installation in order to protect the copyrighted material that we include.  Given our own MSDE instance we can control the security on the database but this would mean duplicate binary installs as well.

(Updated 5/14/2004 by adding reference to MSDE Manager which is currently my favorite because of the database administration functionality.)


11:33:30 AM   []    comment []

Sunday, April 25, 2004

Beware of Inequalities with Floating Point Types
Google Search It

I have been playing around with the inaccuracies of floats and decided to share some of the simplest comparisons that might surprise folks that use the equality comparisons of floats indiscriminately.

The following code listing pretty much captures the issues:

using System.Diagnostics;
...
decimal decimalNumber = 4.2M;
double doubleNumber1 = 0.1F * 42F;
double doubleNumber2 = 0.1D * 42D;
float floatNumber = 0.1F * 42F;

Trace.Assert(decimalNumber != (decimal)doubleNumber1);
// Displays: 4.2 != 4.20000006258488
System.Console.WriteLine("{0} != {1}", decimalNumber, (decimal)doubleNumber1);

Trace.Assert((double)decimalNumber != doubleNumber1);
// Displays: 4.2 != 4.20000006258488
System.Console.WriteLine("{0} != {1}", (double)decimalNumber, doubleNumber1);

Trace.Assert((float)decimalNumber != floatNumber);
// Displays: 4.2 != 4.2
System.Console.WriteLine("{0} != {1}", (float)decimalNumber, floatNumber);

Trace.Assert(doubleNumber1 != (double)floatNumber);
// Displays: 4.20000006258488 != 4.20000028610229
System.Console.WriteLine("{0} != {1}", doubleNumber1, (double)floatNumber);

Trace.Assert(doubleNumber1 != doubleNumber2);
// Displays: 4.20000006258488 != 4.2
System.Console.WriteLine("{0} != {1}", doubleNumber1, doubleNumber2);

Trace.Assert(floatNumber != doubleNumber2);
// Displays: 4.2 != 4.2
System.Console.WriteLine("{0} != {1}", floatNumber, doubleNumber2);

Trace.Assert((double)4.2F != 4.2D);
// Display: 4.19999980926514 != 4.2
System.Console.WriteLine("{0} != {1}", (double)4.2F, 4.2D);

Trace.Assert(4.2F != 4.2D);
// Display: 4.2 != 4.2
System.Console.WriteLine("{0} != {1}", 4.2F, 4.2D);

I find the results notable in several regards:

  1. You can use a double to expose the inaccuracy of a float.
  2. Comparing decimalNumber and floatNumber reveals they are not equal even though printing the values out to 20 decimal places indicates they are equivalent.
  3. doubleNumber1 and floatNumber are not equivalent even though they are both assigned the exact same calculated value in the code.  (In fact, the IL reveals the values are different.)
  4. This is not just an issue of calculation as the last two assertions reveal.

The obvious question at this point is why?

  1. float is only accurate to 7 digits so if you cast it to a data type that can hold more than that you will inevitable expose the "insignificant" portion such that it becomes significant.  (This is why (double)4.2F does not equal 4.2D.)
  2. decimal, float and double get initialized with different calculated values because they require different levels of accuracy.  The decompiled IL code is as follows:

decimal decimalNumber = 4.2;
double doubleNumber1 = 4.200000062584877;
double doubleNumber2 = 4.2000000000000002;
float floatNumber = 4.2000003;


In response to and appreciation of Julian's post here I took the time to correct my post.  Thanks Julian!

I should perhaps delete the entire post but I think my carelessness requires a correction.  The primary modifications are as follows:

  1. I updated the IL code.  Converting the hex values displayed by ILDasm.
  2. Deleted the  "Trace.Assert((decimal)4.2F != 4.2M);."  "Trace.Assert(!4.2M.Equals(4.2F));" was what I should have posted. 
  3. I updated the variable names to be slightly better.
  4. Deleted: "Even though floatNumber and doubleNumber2 are assigned the same values in IL they still don't evaluate as equal."  This was incorrect.  They are not assigned the same value in IL, only in C#.
  5. Delete: "Any time you compare one <of these> types against another the Equals(object value) method is called and it returns false if the data type is not the same. "  It didn't really fit as I didn't use the Equals() method in any of my code and generally the Equals() method is overloaded with a parameter that takes the class type.
  6. Deleted: "If you remove the calculations and simply assign 4.2F ...."  This was just incorrect (see colophon).

Colophon: 
The root cause of all the errors was the fact that I was using csc.exe for compiling and not VS.NET.  As a result, I forgot the /D:TRACE switch so assertions were ignored.  I am amazed that only one of the assertions in the end was invalid but regardless I should have been more careful.


8:07:40 PM   []    comment []

Friday, April 23, 2004

Outlook's "I'm sorry.... MapiExcption..." Dialog
Google Search It

I unexpectedly received the following dialog from Microsoft Outlook 2003 after dialing in to my VPN.

A picture named I'mSorryMapiException.jpg

Perhaps what puzzles me most is exactly who "I'm" is referring to.  I was not aware that my computer had feelings of remorse -- or any feelings for that matter.


10:51:41 PM   []    comment []

News Readers for Microsoft Outlook
Google Search It

I came across two NNTP news reader add-ins for Microsoft Outlook recently.  The first is NewsLook and the second is from MAPILab's. It appears none of the have the fast efficient newsgroup reading support that comes with Agent Newsreader but still, the idea of integrating email, newsgroups and RSS (via NewsGator) is intriguing.

By the way, why doesn't Outlook support the efficiencies of Agent?  I can go through hundreds of messages in Agent in short order and Outlook is an order of magnitude slower.  Perhaps the key differentiating factor is the single key accelerator keys (R versus CTRL+R for example) but I think there is more than that.

Note that there is a host of Outlook tools from MAPILab's including a Redirector, Mailing List Service, Duplicate Email Remover and more that I would really like to try.


4:45:10 AM   []    comment []

This article contains a good introduction into the NAS and SAN storage options. 

I recently received a quote for a custom built half-terabyte computer with hot swappable hard drives and an ATA serial controller.  The price was over $2,500, however, and this seemed higher than necessary.  You can by off the shelf NAS devices for less than that.  The unexpected costs were in the case (SuperMicro SC742T-550 for $600) and the AMD mother board (TYAN AMD-8000 Chipset Model: Tomcat K8S for $295).

I am interested to learn more about the Microsoft storage solutions that are coming out but the OEM hardware I have seen so far is similarly priced to the custom system.


4:31:08 AM   []    comment []

There is little that can be added to Chris Anderson's post on writing a book.  As an author of several, I think he hits the mark quite well.  However, I must agree with Mike's comment that, "Writing is a great way to learn something."  This is perhaps the greatest motivator for me.
4:19:54 AM   []    comment []

This story is noteworthy just because it puts Spokane on the map in a technology rag which is a pretty rare occurrence.  I confess, however, I have never connected to the "city-wide" wireless network as I rarely go downtown (although it is only 20 minutes drive from my house) and when I do it is usually for recreational purposes and my laptop doesn't accompany me.

As it turns out, I am more likely to use the wireless networks in Chicago's airports than the ones in Spokane as I travel there and through relatively frequently and I really like to connect when I travel.


4:15:38 AM   []    comment []

Today I updated the Source Safe FAQ with information about the RSS Feed for Source Safe that Greg Reinacker posted.
4:01:29 AM   []    comment []

KB article 555025 and 829361 describe a way to decrease the shutdown time of Windows 2003 Server with Exchange 2003.  What amazes me is that there is no way to configure the dependency between services so that this happens automagically (they seem to be configured already but the delay still exists.)  Neither does there appear to be any Windows support for auto-starting a process at Shutdown time (to automatically do as the KB article suggests.)  By the way, Exchange 5.0/5.5 appear to have the same problem as described here.

I was also frustrated again by the fact that the dependency tree between services is read-only in the Services dialog.  However, as the JSI FAQ TIP 0069 indicates, you can modify the dependency tree from registry key HKEY_LOCAL_MACHINESystemCurrentControlSetServices and modifying the DependsOnService key of the particular service you want to modify.


2:29:31 AM   []    comment []

This article provided some interesting insight into the power of the Windows XP FOR command that I appreciated as I was trying to do some renaming to a name that included the file date myself.


2:22:09 AM   []    comment []

Friday, April 02, 2004

Some time ago now I commented on my need for synchronizing folders between computers and the fact that I was unable to find the ideal solution.  Ted Kekatos pointed me to Second Copy which look promising.
5:36:22 AM   []    comment []

I have been wanting a portable access point for some time now and I happened to run across this one while browsing the ASUS site.  The description is as follows:

As small as a deck of cards, the Pocket Wireless AP WL-330 is not only a wireless access point (AP) but also a wireless bridge/ repeater and wireless Ethernet adapter.

Seems just about perfect except that it still requires the AC Adapter rather than charging off of USB.  Now that would be ideal.


5:27:33 AM   []    comment []

Thursday, March 04, 2004

The SharePoint customization site seems like a useful resource if you are looking to do that type of thing.  The key tool is FrontPage 2003.  The site includes a bunch of How-To articles and Code Samples (Next time I am board I will switch the VSS FAQ to use this code).  I am intrigued by the XML/XSLT editor that can be done on live data as my team previously had trouble with accessing data except via web services.
8:16:37 AM   []    comment []

Informative article on developing against new Outlook 2003 features.


6:37:46 AM   []    comment []

Wednesday, March 03, 2004

Ted Kekatos (founder of sysadminday.com) pointed out to me some of the not-so-well known features of Google such as the calculator, dictionary, search by number (support VIN, package tracking, area codes, etc), and more.  Also, if you wish to modify your Google search preferences such as number of items returned and default language go here.


9:27:28 PM   [