Sunday, May 17, 2009

Backup horrors

Two words: Offline backups.

Conditional answer

Ecce:

The second and third operands of the ?: operator control the type of the conditional expression. Let X and Y be the types of the second and third operands. Then,

  • If X and Y are the same type, then this is the type of the conditional expression.

  • Otherwise, if an implicit conversion (Section 6.1) exists from X to Y, but not from Y to X, then Y is the type of the conditional expression.

  • Otherwise, if an implicit conversion (Section 6.1) exists from Y to X, but not from X to Y, then X is the type of the conditional expression.

  • Otherwise, no expression type can be determined, and a compile-time error occurs.



Moral of the story: Know your language spec.

Monday, May 11, 2009

Conditional Mystery

Imagine a C# function like so:

public object Foobar(double baz_)
{
return baz_ < 12 ? new Foo(baz_) : baz_;
}

where Foo has a function as such:

public static implicit operator Foo(double d_)
{
return new Foo(d_);
}

What is the type of Foobar(2)? Foobar(15)? The shocking answer revealed whenever I get around to blogging next. Yes this was causing an outage in production.

Monday, May 4, 2009

Status update 3

Work progresses on many fronts. I had forgotten how much random foolishness needs to be dealt with. We have unreplicated databases, strange source control, and a distinct overlap between production and development.

I think I'm getting hives.

Oh well, more work for me I guess. Hopefully I can leverage some of my knowledge of how things are done elsewhere to great utility.