On this page.... RSS 2.0 | Atom 1.0 | CDF
# Thursday, March 31, 2005
Looks like Server 2003 SP1 went to RTM status recently (like yesterday).  As you can see in the list of Top 10 Reasons to install it, you really should seriously consider getting it ASAP for your 2003 servers.  There are some great security features they're adding. 
Thursday, March 31, 2005 10:01:09 AM (Eastern Standard Time, UTC-05:00)  #    Disclaimer  |  Comments [0]  | 
# Wednesday, March 30, 2005

I just had a strange bug pop up in this framework I've built.  It uses a number of custom attributes.  I have a base attribute and a corresponding collection.  On my collection, there's an Add method that checks to ensure the attribute hasn't already been added before adding, since ArrayList's default implementation is to allow duplicates and nulls.

I declared a type and applied a few of these attributes to different properties on the type, and yet, when I went to add them to my collection, I found that it was only adding the first attribute of a particular attribute type. 

So I looked up the docs on ArrayList.Contains to find out it uses Object.Equals in order to determine if the object is in the list.  So, on a hunch, I looked up System.Attribute, and sure enough, they override Object.Equals.  Here's a link to the help on that.  As you can see, it isn't very helpful.  It doesn't describe how it is changing the semantics of Object.Equals in any way.

So then it was time to pull out my trusty friend Reflector.  Looking at what Attribute.Equals is doing wasn't particularly helpful either because it keeps making external calls, but from what I can gather, it attempts to compare the values of all the fields on the two instances in question.  So you'd think, hey, this is a fair way to determine equality, right?

Wrong.  It doesn't work.  The two attributes I was having problems with had several differing values in their fields, yet this Equals method did not catch that.  Needless to say, this is obviously a bug.  I'd love to hear, in any case, the reasoning why Attribute overrides Equals and, in addition, why the help docs don't explain it one bit.

In the meantime, life goes on, and I had to figure out a separate implementation of Equals that'd work for my needs.  Unfortunately, as far as I can tell, there's no way to call the default Object.Equals method because, as you can see in Reflector, it will simply use objA == objB, which will only redirect you to the most overridden implementation. 

So since I couldn't compare references themselves, which is what I would prefer, I decided to just use two of my properties that were sufficient to meaningfully give the attributes separate identities. 

"Sure," you might say, "you should always do this."  But most of the time I don't see the point; it is often more confusing to do so because, apart from System.String, developers expect reference types to compare equality based on references not values, especially when dealing with custom domain types. 

So I'd say it's generally a bad idea to override Equals unless you really need to because, once you do that, you should also override GetHashCode and, at that point, you may as well just toss the computer out the window and give all your money to charity.  It's just a lot of (usually) unnecessary work that can actually cause confusion and introduce unexpected bugs into your apps.

Anyways, to bring this to a close, if anyone can explain the rationale behind what Attribute is doing, I'd appreciate it.  And if any MS BCL or corlib guys read this, please update the docs on Attribute.Equals to be more meaningful.

Wednesday, March 30, 2005 3:35:39 PM (Eastern Standard Time, UTC-05:00)  #    Disclaimer  |  Comments [0]  | 
# Tuesday, March 29, 2005


To summarize, I'm being told that having the component designer break every time you double-click on a class that inherits from an abstract class is okay.  The absurdity of it is overwhelming.  Just show me the code! :)

Tuesday, March 29, 2005 9:24:51 PM (Eastern Standard Time, UTC-05:00)  #    Disclaimer  |  Comments [0]  | 
# Thursday, March 17, 2005

It's nice when a patently Catholic holiday makes it into most secular calendars, even if it's just so that the retailers can sell green stuff and Guiness can make a few extra $$.  As fun as this day can be, let's not forget about the origination of this feast.

Here's a great article on St. Patrick. To sum up, St. Patrick was an early, perhaps the first, Catholic missionary to Ireland, circa 500 AD.  There have been many legends that have grown up around him, but suffice it to say that he took the route that made the most sense in societies in the early middle ages, i.e., to convert the political leaders, because, in those days, religion was a matter of state; if you convert the leaders, you convert the society. 

St. Patrick was successful in this, so he is credited with converting Ireland to Catholicism and has so been named the apostle and patron of Ireland.  For a variety of reasons, Ireland and the Irish, have retained a very strong Catholic identity despite (or perhaps because of) the several attempts by the English to convert and suppress them to one or other flavor of Protestantism.

The Irish brought the holiday of their primary saint and their distinct Catholic cultural identity with them over to the U.S. and the rest, as they say, is history.  So wear some green, go out and have a pint, and think about St. Patrick and how amazing it is that one person can have such a great impact on humanity.

Thursday, March 17, 2005 7:34:56 AM (Eastern Standard Time, UTC-05:00)  #    Disclaimer  |  Comments [0]  | 

In a previous blog, I discussed the difficulties I had in getting activity tracking to work for dasBlog, which ultimately boiled down to the fact that threads in the ThreadPool (which dasBlog uses for logging activity) do not share the impersonated identity of a web application. 

The easy solution, if your hoster will allow it, is to call them up and say, "hey, give ASP.NET's default process identity Modify permissions on the logs directory."  However, if your hosting provider won't do that or if you prefer not to do that yourself, you have another option.

This article, on ASPAlliance.com, describes the steps you can take to get ThreadPool threads to use your impersonated identity.  It describes how to set up application-wide impersonation like your hoster might do it and then shows how to deal with it.  I included a helper class for use with this scenario that can be found as a download on the last page.

If you have any comments or suggestions to make it better, feel free to share!

(Omar has agreed to include this in a future build of dasBlog if I work it into the project for him, so if you'd like this feature let me know.)

Thursday, March 17, 2005 7:11:05 AM (Eastern Standard Time, UTC-05:00)  #    Disclaimer  |  Comments [2]  | 
# Thursday, March 10, 2005

I've been asked numerous times what “dotNetTemplar” is and/or do I know the history of the Knights Templar.  The answer to the latter is yes, probably a little better than most, as it falls within one of my areas of expertise.  And I did, in fact, choose dotNetTemplar with the Knights Templar in mind, as the Latin motto and icon on this site might suggest.

For those of you who don't know, the Knights Templar were the first military order, founded during the time of the Crusades.  For a brief overview, you can read this article.  The primary reason the order appeals to me is that they were the first group to successfully blend a patently secular occupation (soldiering) with a religious vocation.  Their motto, “not to us, Lord, not to us, but to your name give glory,” is what I think all of us who strive for excellence in this world should have as our motto.

So I adopted their motto as my own.  I, too, work in a secular occupation, and I try to do my best at it.  Yet I am a man of faith and believe that all the good that we have--our talents, belongings, intelligence, strength, etc.--is a gift from God.  I believe that without God, the source of all being, I would be and do nothing, so everything good that I am and do is thanks to God; therefore, he deserves to be honored for it.

Hence I try in my life (though I'm not by any stretch of the imagination perfect at it) to blend my faith into my secular activities, whether it be through keeping reminders of my faith near me, sharing my faith with others as seems appropriate, or simply doing what's right as much as I can by, for example, not pirating software, not lying, not cheating, giving to the homeless guy on the street who asks for money regardless of what I think he'll do with it, etc.  And by working towards this blend, I hope to in some ways--ways that I truly hope are not ostentatious--glorify God in my everyday life.

Non nobis, Domine, non nobis, sed nomini Tuo da gloriam.


Thursday, March 10, 2005 9:27:36 PM (Eastern Standard Time, UTC-05:00)  #    Disclaimer  |  Comments [3]  | 

I was just talking (writing, actually) to some buddies about why we can't have multiple inheritance.  James Avery pointed me to this blog by Wesner Moise, discussing the complications and potential perf hits we could take with MI.  He says that Eiffel's done it using the compiler so that you can have default implementations for interface methods that get emitted where (I presume) you don't implement it yourself.

Truly, I don't care what we call it.  I just would like the convenience of being able to have default implementations of methods that can be shared among multiple types and can be overridden.  If you want to call it default implementations for interface, multiple inheritance, mix-ins, or whatever, I really could care less as long as I don't have to copy and paste the same code over and over (or maintain all those copies) or write calls to helper methods (and write the corresponding helper types and methods).

I also don't particularly care if it is two or three levels of indirection to make the call.  That's really getting a bit overly concerned with performance; developer time, my time, is far more important than a few clicks on the processor, even multiplied a novemdecillion times.  We can upgrade and scale out relatively cheaply, but we only have so much quality developer time.

Thursday, March 10, 2005 3:32:52 PM (Eastern Standard Time, UTC-05:00)  #    Disclaimer  |  Comments [0]  | 

Thanks to Server Intellect!  Ever since I put dotNetTemplar.Net up, I've just kind of tolerated that my activity tracking doesn't work.  It was one of those things where you just don't feel like hassling with figuring it out.  dasBlog was sooo easy to set up, I wasn't about to complain or spend much time messing with it, especially since activity tracking is not too terribly important to me--it's just a nice to have.

Fast forward a few months.  I keep getting told by Cindy that she's getting referrals from me, so I finally get fed up and decide to figure it out.  First of all, I upgraded to the latest version of dasBlog, thinking maybe there was a fix in the upgrade.  Not so, but I did get some nice perf enhancements and a CAPTCHA comment spam blocker (and yes, I know these aren't perfect, but they're better than nothing).  And I'm now getting emails for referrals as well.

So my next step, as any good developer will tell you, was Google.  Searching on "tracking not working dasblog" didn't turn up much.  I tried a few variations and found some blogs by folks talking about dasBlog and/or tracking, but nothing along the lines of what I was looking for.

Then I decided to log into the kickin' control panel for my Server Intellect hosting, thinking it might be some setting (probably permissions) that I could change.  Well, I found out I can't do everything in the control panel (i.e., change permissions on directories), but I did find out that the logs directory only had files from 11/21/2004-11/26/2004.  Bringing up those dates in my activity tracker actually showed data (wow!), so I then was almost sure it was a permissions thing. 

Since I can't change/check that myself, I emailed Server Intellect at 6:11am, asking them to check the permissions.  The response, which I received just about an hour later (I guess for once I'm up earlier than someone), was that dasBlog does logging under ThreadPool threads and that my site runs under impersonation.  The configured site impersonated identity has the requisite permissions to write to the logs directory (and the SiteConfig and content--hence most of dasBlog works); however, the ThreadPool doesn't inherit the identity of the impersonated user, so the logging threads couldn't write to the logs directory.  They granted the ThreadPool's identity those perms on the logging directory, and voila, I'm actually seeing activity tracking data again!

Of course, now knowing the problem, a Google search on "ThreadPool thread doesn't inherit the impersonation settings" brings up a blog by Omar Shahine that shows this isn't the first time Server Intellect (formerly EAServe) has run into this problem.  I guess they need to add a "are you running dasBlog" checkbox to their signup form so they know to enable this or perhaps add it to their KB.  I'm not complaining, though--as soon as I reported the problem, it was fixed. 

So thanks again, Server Intellect!  Now maybe I can figure out a way to get the ThreadPool to inherit the identity of the queuing thread without having to know the logon info for that identity...

Thursday, March 10, 2005 7:55:08 AM (Eastern Standard Time, UTC-05:00)  #    Disclaimer  |  Comments [0]  | 
# Tuesday, March 8, 2005
It's official: I'll be presenting Introduction to Object-Relational Mapping in .NET on March 23, 2005 at the Tampa DNUG.  If you're interested, please sign up to come at: http://www.fladotnet.com/reg.aspx?EventID=164.
Tuesday, March 8, 2005 10:01:02 PM (Eastern Standard Time, UTC-05:00)  #    Disclaimer  |  Comments [0]  | 
# Monday, March 7, 2005

It's a beautiful problem to have--trying to decide how to organize your code into namespaces (and even classes) meaningfully.  But it can also be paralyzing.  I think I could sit here for hours debating the merits of one way of organization over another until I come up with the perfect approach.  But then, I'd be wasting a lot of time.

So in order to avoid namespace paralysis and not waste time, here is one approach you can use to get past it and move on and yet leave it open to relatively easy change later.  Group related code into one namespace and then use using (Import in VB) statements in the consuming code to use that namespace.  Then if at a later time you find that perfect name for your space, you can change it and only need to update the using/Import statements.  Of course, you run the risk of naming conflicts at that time, but this isn't the best of all possible worlds either.  Deal with it. 

Don't know if anyone else runs into this problem, but I'm in it now and need to move on, so here's my pep talk. Hope it helps some other overly analytical types like myself. :)

Monday, March 7, 2005 2:08:14 PM (Eastern Standard Time, UTC-05:00)  #    Disclaimer  |  Comments [2]  | 
# Saturday, March 5, 2005

After a few weeks of moving, moving the data center at GTE FCU (note the new HQ in the top graphic), moving to a new job, and moving to a new house--we're finally pretty much settled in.  The move of the data center, while a long and hectic week (especially for the infrastructure guys), went off quite well with little notable down time for the systems, and I just got my first paycheck from ASPSOFT this week.  We just finished hanging most of our wall hangings at home, and I'm writing this from my new study (yay! I've got a study! with a nice view!), hanging out with my five-month-old son.  It was a crazy few weeks, but I think it's over and I can find a good groove again.

Apparently, though, I don't have much on Jim Blizzard, who just moved down from the Northwest to join us Tampa nerds.  Welcome to Tampa, Jim!  Any friend of Joe's is a friend of mine. :)  Looking forward to meeting you at the upcoming Tampa Nerd Dinner!

Saturday, March 5, 2005 2:16:47 PM (Eastern Standard Time, UTC-05:00)  #    Disclaimer  |  Comments [1]  | 

The opinions expressed herein are solely my own personal opinions, founded or unfounded, rational or not, and you can quote me on that.

Thanks to the good folks at dasBlog!

Copyright © 2020 J. Ambrose Little