February 19, 2009


It's always nice when you spend time reinventing the wheel when you don't need to.

For example, take my recent post on associating a label to an ASP.NET mangled control name.

Turns out the functionality is built into ASP.NET.

Let's say you have the following ASP.NET code...

<asp:label runat="server" text="Search" /><asp:textbox id="query" runat="server" />

...and you want to link the Label to the TextBox. Set the AssociatedControlID property on the Label and it will automatically handle mangled control names for you.

<asp:label runat="server" text="Search" AssociatedControlID="query" /><asp:textbox id="query" runat="server" />

I'm still going to leave up my original post because knowing how to recursively work with HtmlControls is a good thing, but I hate it when I miss something this obvious.

February 15, 2009

Come On, Utah, Shape Up!

According to the Pew Study, only 22% of Mormons accept evolution as the best explanation for the origins of human life on Earth.

Now, I think we can at least in part blame the way the question was phrased. (Evolution has nothing to do with the origin of life, just the diversity of life.) That said, I find it ironic that a church that would help create one of the top 20% biology programs in the nation has a membership where 4 out of 5 members deny the very keystone science associated with it.

But I guess it shouldn't surprise me. The position of the LDS church has been quite clear...

"Diversity of opinion does not necessitate intolerance of spirit, nor should it embitter or set rational beings against each other... Our religion is not hostile to real science. That which is demonstrated, we accept with joy; but vain philosophy, human theory and mere speculations of men, we do not accept nor do we adopt anything contrary to divine revelation or to good common sense."*

No further official statement has been made by the church since then. Essentially, they are saying that where the word of God is silent, the church will accept anything, but anything that potentially conflicts with the "word" shall not be accepted.

It's sad when Texas, even with the massive SBOE debacle, is still more sane than my home state...

* First Presidency (Joseph F. Smith, John R. Winder, Anthon H. Lund), "Words in Season from the First Presidency", Deseret Evening News, 1910-12-17, sec. 1, p. 3.

February 13, 2009

The Crunch Is Upon Me

Today was the last day of a twelve-day shift.

I've got a three-day weekend ahead of me, and then I start another eleven-day shift.

I'll be taking a single day off for a Shackmeet, then I'm on for another six days.

I'll be taking that weekend off to head down to Austin for the second Cinematic Titanic live riff I'll have ever attended, and then...crunch.

Twenty-six days straight.

This will be a living hell, but the end result will be worth it.

February 11, 2009

TIP: How to use form labels with ASP.NET controls


You want to use <label> to point to fields in your ASP.NET controls, but due to HTML ID mangling, you cannot.


Walk the control tree on load and update the "for" attribute on the <label>.

For example, let's say you have the following code in your control:

<label for="UserName">User Name</label>
<asp:textbox id="UserName" runat="server" columns="30">

First, add runat="server" and an ID to your <label> like so:

<label ID="UserNameLabel" for="UserName" runat="server">
User Name</label>
<asp:textbox id="UserName" runat="server" columns="30">

The ID keeps Visual Studio happy.

Then, in your Page_Load(), call the following helper function:

private void UpdateLabelsWithClientID(Control c)
foreach (Control c1 in c.Controls) UpdateLabelsWithClientID(c1);
if (c is HtmlGenericControl && ((HtmlGenericControl)c).TagName == "label")
string controlName = ((HtmlGenericControl)c).Attributes["for"];
Control c2 = this.FindControl(controlName);
if (c2 != null) ((HtmlGenericControl)c).Attributes["for"] = c2.ClientID;

If you are in an ASP.NET control, you would call it as UpdateLabelsWithClientID(this);.

February 7, 2009

SiN 1 in SiN: Episodes

Before we started working on SiN: Episodes, one of the things we started working on to properly learn Source was a Source engine version of the original SiN ala Half-Life: Source.  A lot of the work was done by Dale Broadbent.

It didn't get very far and barely functions, but there's enough here that some Source engine modders might get a kick out of it.

What is here requires S:E1 to work. Use at your own risk. No warranties are expressed or implied.


February 6, 2009

The Suck

Moving sucks.

Unpacking sucks more.

The first is done.

The second, nowhere near.