Tuesday, November 22, 2011

Software Clusters

Tuesday, November 15, 2011

Test If Date Ranges Overlap

Test If Date Ranges Overlap

A commonly-used idiom for determining if one range of dates overlaps with another range of dates

Problem: Given two date ranges, each with start and end dates (and possibly times), how do you determine if the ranges overlap?

Solution:

Testing the range "start1 to end1" against the range "start2 to end2" is done by testing if...

	( start1 <= end2 and start2 <= end1 )
If TRUE, then the ranges overlap.

If the ranges do not include the "end" value itself, then use "<" instead of "<=" in the comparisons.

Important Assumption:

This assumes that start date <= end date in each range. This can also be stated as...

	( start1 <= end1 and start2 <= end2 )
For discussion of what to do if this is not true, see below.

Applicability: Is not limited to date/time comparisons; can also be used for ranges of numbers, names, and any other data type where ranges are meaningful.

Alternate Expression:

	not (end1 < start2 or end2 < start1)



The expression in brackets is true when one range is entirely to the left or right of the other. This condition is pretty easy to visualize. The ranges overlap if and only if it is false.
Implementation: See MartinFowler's RangePattern for implementation details. http://www.martinfowler.com/ap2/range.html

[CategoryPattern]

 

Check the original post http://c2.com/cgi/wiki?TestIfDateRangesOverlap for more information

Friday, November 11, 2011

SecurityTrimmingEnabled Issue

We Faced a weird issue in our application today. We have a horizontal menu in the header portion of our application.

In development environment all menu items are getting rendered.

WithAllMenu

Some of the menu items refered the web links which links are part of another application.

But when we drop the executables to the QA environment, above mentioned menu items are not rendered.

WithoutAllMenu

The QA environment is SSL enabled application and the outside application is non-SSL enabled.

So we found that, when the Webmenu.Sitemap constructs the menu,
it does not show the non-SSL links when those links are invoked from SSL enabled.

We did not get any warning messages. After analyzed a lot, we understand that, we have to switch off the setting

SecurityTrimmingEnabled to false since we are not using windows accounts for roled based menu.

code

To know more about that visit the following links.

http://blogs.msdn.com/b/dannychen/archive/2006/03/16/553005.aspx