The blog of flying mind

March 24, 2008

Startup, Shutdown and related matters

Filed under: Software

Also see: Single source code base for Silverlight and WPF solutions

Usually
I write blog articles on topics that people request via email or comments on
other blogs.  Well, nobody has ever
asked me to write anything about shutdown.

size=2>

But then
I look at all the problems that occur during process shutdown in the unmanaged
world.  These problems occur because
many people don’t understand the rules, or they don’t follow the rules, or the
rules couldn’t possibly work anyway.

size=2>

We’ve
taken a somewhat different approach for managed applications.  But I don’t think we’ve ever explained
in detail what that approach is, or how we expect well-written applications to
survive an orderly shutdown. 
Furthermore, managed applications still execute within an unmanaged OS
process, so they are still subject to the OS rules.  And in V1 and V1.1 of the CLR we’ve
horribly violated some of those OS rules related to startup and shutdown.  We’re trying to improve our behavior
here, and I’ll discuss that too.

(more…)

ReflectionTypeLoadException

Filed under: Software

Also see: My Presidential Endorsement:

Also see: Memory Model

Also see: Brad Abrams’ pixel8 Interview Podcast posted

If a type can’t be loaded for some reason during a call to Module.GetTypes(), ReflectionTypeLoadException will be thrown. Assembly.GetTypes() also throws this because it calls Module.GetTypes().

The Message for this exception is “One or more exceptions have been thrown while loading the types” or “Unable to load one or more of the types in the assembly”, which doesn’t seem very descriptive. But, the exception actually provides more info that that. Just get the LoaderExceptions property of the ReflectionTypeLoadException instance. That will give an array of the exceptions caught while loading all of the types from the module. If the exceptions are due to an assembly loading problem, see my general debugging advice.


http://blogs.msdn.com/suzcook/archive/2003/08/11/57236.aspx

Hosting

Filed under: Software

Also see: LINQ - The Uber FindControl

Hosting

< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> 

My prior three blogs were supposed to be on Hosting.  Each time I got side tracked, first on Exceptions, then on Application Compatibility and finally on Finalization.  I refuse to be side tracked this time… much.

 

Also, I need to explain why it’s taken so long to get this blog out.  Part of the reason is vacation.  I spent Thanksgiving skiing in Whistler.  Then I took a quick side trip to < ?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />Scottsdale for a friend’s surprise birthday party and to visit my parents.  Finally, I spent over three weeks on Maui getting a break from the Seattle winter.

 

(more…)

When Are Two Algorithms the Same?

Filed under: Software

When Are Two Algorithms the Same? Andreas Blass, Nachum Dershowitz, Yuri Gurevich. February 2008

People usually regard algorithms as more abstract than the programs that implement them. The natural way to formalize this idea is that algorithms are equivalence classes of programs with respect to a suitable equivalence relation. We argue that no such equivalence relation exists.

A bit more philosophical than usual, but the issue is quite relevant to discussions in the field.

It is possible to stipulate any equivalence relation that is considered useful (e.g., equivalence up to local transformations) but the notion of a universally applicable relation is indeed problematic.
http://lambda-the-ultimate.org/node/2729

DevWeek 2008 Cross Platform Silverlight Demos

Filed under: Software

I just finished the Cross Platform.NET on Silverlight talk at DevWeek. Demos can be downloaded from http://www.interact-sw.co.uk/downloads/DevWeek2008XPlatDemos.zip

I’m all done at DevWeek for this year. But if you want to hear more about Silverlight, I’ll be teaching Pluralsight’s Applied Silverlight course in London later this month - running from 31st March. (And the following week I’ll be teaching our Applied WPF course, also in London.)


http://www.interact-sw.co.uk/iangblog/2008/03/12/devweek-xplat-demos

Turning bitboards from potential moves into legal moves, pawn moves, and conditional rules.

Filed under: Software

Also see: Generating WPF Content with LINQ

The BitBoards so far have been astoundingly accurate at producing moves. But even after the moves have been produced they have to be fully validated. Take for instance, a bishop in the middle of the board. The number of potential moves for the bishop is 13 or so, but the number of valid moves, unless no spots are blocked, is much less. Further performing friendly versus non-friendly extension is extremely importan since you can’t move into a friendly position, but you can move into the first occuring non-friendly position (capturing). I’ve found some interesting transformations here, but once I can more fully validate them I’ll start to post their intricacies.

Even more frustrating are the pawns. Pawns are capable of special feats when in their original file (forward by 2), they are allowed capturing moves that are different from their standard movement rules, and they are also allowed the ability to capture en-passant. Deciding where and how to implement these extra conditions is very important. Remember the original blocking square algorithm I implemented for removing invalid moves consisted of:

uint myPieces =…; uint notMine = ~myPieces; uint validMoves = moves & notMine;

This has to be expanded a bit, since notMine actually points to all empty and enemy squares. What we need now is a blocking region for all enemy squares (which we have to store anyway, since eventually the board swaps sides and enemy and friendly are reversed). The valid moves become something like:

(more…)

The Exception Model

Filed under: Software

Also see: Spring Web Flow features and feedback request

I had
hoped this article would be on changes to the next version of the CLR which
allow it to be hosted inside SQL Server and other “challenging”
environments.  This is more
generally interesting than you might think, because it creates an opportunity
for other processes (i.e. your
processes) to host the CLR with a similar level of integration and control.  This includes control over memory usage,
synchronization, threading (including fibers), extended security models,
assembly storage, and more.

< ?xml:namespace prefix = o ns =
"urn:schemas-microsoft-com:office:office" /> size=2> 

However,
that topic is necessarily related to our next release, and I cannot talk about
deep details of that next release until those details have been publicly
disclosed.  In late October,
Microsoft is holding its PDC and I expect us to disclose many details at that
time.  In fact, I’m signed up to be
a member of a PDC panel on this topic. 
If you work on a database or an application server or a similarly
complicated product that might benefit from hosting the CLR, you may want to
attend.

(more…)

Important changes to the BASE element for IE 7

Filed under: Software

Also see: Introducing Microsoft Tagspace

Looks like my post went live over on the IETB regarding changes we made to the BASE element in IE 7. Previously the BASE element had some issues, primarily by design, that made certain actions within the guts of IE very easy to do, but polluted the exposed object model and overall tree hiearchy. Well, it was time to fix that. If you are interested in how we fixed it, go check out my entry All your <base> are belong to us.

There have been some comments on the post so I’ll try to cover them over here with what might be some interesting posts about how IE works.


http://weblogs.asp.net/justin_rogers/archive/2005/08/30/424084.aspx






















Get free blog up and running in minutes with Blogsome
Theme designed by Hadley Wickham