Wednesday, October 29, 2008

Seven Laws of Identity

Identity Management is a complex subject and one that can be hard to wrap your hands around. Journal 16 of "The Architecture Journal" focuses on this subject. One thing that caught my eye was the 7 Laws of Identity:

Law #1 User Control and Consent
Technical identity systems must only reveal information identifying a user with the user’s consent.

Law #2 Minimal Disclosure for a Constrained Use
The solution that discloses the least amount of identifying information and best limits its use is the most stable long-term solution.

Law #3 Justifiable Parties
Digital-identity systems must be designed so that the disclosure of identifying information is limited to parties that have a necessary and justifiable place in a given identity relationship.

Law #4 Directed Identity
A universal-identity system must support both “omnidirectional” identifiers for use by public entities and “unidirectional” identifiers for use by private entities—thus, facilitating discovery while preventing unnecessary release of correlation handles.

Law #5 Pluralism of Operators and Technologies
A universal-identity system must channel and enable the interworking of multiple identity technologies run by multiple identity providers.

Law #6 Human Integration
The universal-identity metasystem must define the human user to be a component of the distributed system integrated through unambiguous human-machine communication mechanisms offering protection against identity attacks.

Law #7 Consistent Experience Across Contexts
The unifying identity metasystem must guarantee its users a simple and consistent experience, while enabling separation of contexts through multiple operators and technologies.

To read more, go to:
http://www.identityblog.com/stories/2005/05/13/TheLawsOfIdentity.pdf

Tuesday, October 28, 2008

Be prepared for "gotchas"

Several months ago, my father and I replaced one of the water heaters in my house. It was about 10 years old, making "clangy" noises, and from my assessment was on its way out. When we had originally looked at the project we thought it would take us about 3 hours from start to finish to replace it. Well, 6 hours later we were finally wrapping things up and it wasn't because we didn't know what we were doing either...there were just so many "gotchas" in the replacement process.

That night as I sat back and reflected on the whole ordeal I realized how similar this particular home improvement project can be to IT development projects. So, here are a few bullet points that elaborate on my analogy:

- Always plan ahead in your project. One of the reasons for the extra time in this project was that I had to make 3 different stops to the hardware store because I didn't plan ahead enough for the project.

- Hope for the best, but be prepared for the worst. Account for this in your project estimation. I hadn't put too much thought into the fact that the new water heater was 3 inches taller and 2 inches wider in diameter. This makes a big difference when all of the plumbing lines are sautered copper...they don't bend and they're not flexible. So, we hadn't built into our estimate the time it would take to redo all of the plumbing.

- Don't be suprised if there are "gotchas"...especially when it comes to your budget. I had no idea that the price of metals had gone up so drastically over the last few years. I spent an additional $100 in project materials...I had originally estimated this cost to be less than half that amount.

- When implementing your solution, think of the worst possible scenario, and account for it. Not only do I have a drain pan underneath the water heater, but I also have a drain line so if leaking starts to occur the water exits through the pvc lines (which we ran through the walls) and to the outside of the house. In addition, the new unit has a "smart sensor" system that would not only prevent an interior flood, but will also shut itself off completely (including the natural gas) if a problem is detected. I'm very confident now that I'll never have a problem in this department.

- When designing your solution, think scalability. The new plumbing lines are "flex" lines going from the actual hard-copper lines to the new water heater unit. This cost me a little more, but the next time I have to replace it, re-plumbing won't be necessary.

- If at all possible, don't go it alone. If you haven't lifted a fifty-gallon hot water heater lately, go to your local hardware store and try. They're quite heavy and an oblong shape. It was good that there were two of us for this reason, but also because we were continually double-checking each other. We had a good system of checks and balances in place.

- Read the fine print. The new unit came with the option to purchase a "lifetime warranty". Folks, water heaters don't last a lifetime, so this wording caught my eye. After reading the fine print though and calculating the cost, I realized their business genius. The total implementation cost would have been 3-4 times as much as I paid doing it myself. In addition, there are ongoing maintenance costs to ensure you comply with the fine print within the warranty. We've all heard it a thousand times, but if something sounds too good to be true, it probably is!

- Don't wait for a problem to occur...be proactive. This is often times easier said than done because the reality of it is that usally the squeaky wheel gets the grease. I didn't have to change the unit when I did, but I saved myself a potential mess and a lot of $$$ by doing it this way.

So, when planning your next development project, take into account the need to have a solid plan, have enough resources available, have adequate funding, set aside contingency dollars for the unexpected "gotchas", anticipate requirements scope creep, and think proactively.

Monday, October 27, 2008

The Story of Stuff

I found this online short-story movie to be very interesting, entertaining, and thought provoking. In your free time I would encourage you to watch it. Individually, collectively, and as a corporate entity we can always improve in this area...even by taking baby steps.
http://www.storyofstuff.com/

Monday, October 20, 2008

Code Snippets

public static DateTime GetDate(int month, int year, DayOfWeek day, int dayNumber)

{
// validation
if (dayNumber < 1
dayNumber > 5) return DateTime.Now;
if (month < 1
month > 12) return DateTime.Now;
if (year < 1900) return DateTime.Now;

// set up our root variables
int daysInMonth = DaysInMonth(month, year);
int earliestDay = (dayNumber * 7) - 6;
DateTime earliestDate = new DateTime(year, month, earliestDay);
// if the earliest date matches the day we are looking for, it is the correct date
if ((DayOfWeek)earliestDate.DayOfWeek == day)
return earliestDate;
else
{
// calculate the new day
int newDay = earliestDate.Day;
if ((int)earliestDate.DayOfWeek > (int)day)
{
newDay += 7 - ((int)earliestDate.DayOfWeek) + 1;
}
else
{
newDay += ((int)day - (int)earliestDate.DayOfWeek);
}
if (newDay > daysInMonth)
{
// new day is more than the days in the month, so we need to go backwards
// start the day at the last day of the month
return GetDate(month, year, day, 4);
}
return new DateTime(year, month, newDay);
}
}


PIVOT TABLES -- SQL SERVER 2005

CREATE TABLE [dbo].[Quotas](
[Week] [smallint] NOT NULL,
[Days] [varchar](3) NOT NULL,
[Quota] [smallint] NOT NULL,
CONSTRAINT [PK_Quotas] PRIMARY KEY CLUSTERED
(
[Week] ASC,
[Days] ASC
)
Inserts
insert into Quotas (Week, Days, Quota) values (1, '1', 8)
insert into Quotas (Week, Days, Quota) values (1, '2', 7)
insert into Quotas (Week, Days, Quota) values (1, '3', 6)
insert into Quotas (Week, Days, Quota) values (2, '1', 5)
insert into Quotas (Week, Days, Quota) values (2, '2', 4)
insert into Quotas (Week, Days, Quota) values (2, '3', 3)
insert into Quotas (Week, Days, Quota) values (3, '3.5', 2)

SQL

select *
from
(select Week, days, quota from Quotas) q
PIVOT
(
sum(quota)
FOR days IN([1],[2],[3],[3.5])
) as pvt

It requires a function in the first argument of the pivot keyword, so as long as the week/day combination are unique, your "sum" will always only be on one row, so it won't matter. Maybe you could try an isnull(quota,0) and see if that works.