I’ve been working in .NET 1.1 the past few weeks and this morning I figured out a simple solution to a problem that may not even exist anymore in later versions (I try to stay away from UI work so I’m a bit behind in that area). I created a custom business object that exposes several properties as primitives (string, bool, etc.). What a pleasant surprise to find that binding my object to a DataGrid required nothing more than setting the grid’s DataSource equal to an instance of my object. No different than binding to a DataSet, which I’ve done many times.
Enter the problem: one of the properties in my object exposes a Collection, and the DataGrid doesn’t know how or what to display in that column. After flailing around in Google for an hour, I found a clue in my own code: in the column that is mapped to the collection was the fully-qualified name of the Collection class. Extrapolating from this that the DataGrid is probably calling ToString() on each field to display its contents, I overrode my collection’s ToString() method and iterated the internal collection to build up the output string. And what do you know, sure enough, the data I wanted to see in that column automagically appeared with a recompile and a simple browser refresh.
Granted – this is far from the perfect generic solution for this problem. There is no way to modify the output’s format short of parsing and reassembling it (nasty!). But in following the YAGNI principle I know this can be fixed up later with relatively little pain if it becomes necessary.
Space.com has an interesting article today about solar satellite power (SSP). In a nutshell, put satellites around the earth that collect sunlight and convert it to microwaves. Beam the microwaves down to the surface and convert the energy to electricity. The technology behind it has already been proven, and for the cowering pussies out there it’s even terrorist-proof (at least until Osama learns how to fly Saturn-V’s). It would cost a lot to start up, but the benefits are enormous, and it would even give us a jump start on moon colonization.
So Jerry Falwell dies on my wedding anniversary. Could life get any better?
The answer, of course, is yes. It’s called I Can Has Cheezburger.
Politics has been on my mind a lot lately, which is a real pain-in-the-ass state to be in (the lack of any interesting .NET news hasn’t helped any either). Other than religion, nothing wields more influence to immediately make friends and foes. It’s usually best to avoid both subjects, but I hope this help focus and channel my anger where it’s most deserved. Call it self-therapy, prompted by a rerun about 9/11 on the Discovery Channel. Watching it all unfold again – the panic, confusion, terror, and death – just feeds the underlying rage.
On one hand I’m relieved that the country has finally woken up to the deception that Washington has inflicted on us since 9/11; the last elections and Bush’s current 28% approval rating adequately demonstrate that fact. But being able to say I was right about Iraq from the beginning (they were never a threat to us) doesn’t bring back the more than 3,000 of our kids that have died there. How can “I told you so” provide any sense of satisfaction after so much damage has been done? September 11 was supposed to be the Pearl Harbor of our generation, a cowardly sneak attack that we avenged and settled the score. The quintessential American story.
But that’s not what happened. In the midst of our near universally-accepted response, our Commander in Chief inexplicably took his eye off the ball. For whichever of the many reasons speculated, he fraudulently refocused our anger and outrage on a country which posed no threat to us and had nothing to do with the events of that horrible day. We had most of the world behind us in the following weeks and months, and we squandered that goodwill with our ham-handed venture into Iraq. We took resources from the real war in Afghanistan. We allowed that piece of subhuman trash bin Laden to go free, with even the President himself declaring that we weren’t that interested in finding him.
Throughout all this, those of us who opposed the war were called traitors, unamerican, and were told we were aiding the enemy with comfort. Is it any wonder that so many of us became exasperated, angry and disgusted by this administration? It was so apparently obvious what was going on, but seemingly no one could or would see it.
Now they do see it, but it’s too late. All we can hope to do is minimize the potential for more damage. That’s why I and so many others say the war is lost – it was lost the day we set foot in Iraq. It wasn’t our military’s fault; they did what they could with what they were given. Now it’s imperative that we stop this escalating commitment to failure and get the hell out. We already broke Iraq; there are no longer any plausible positive outcomes. The simple fact is this: if we are to be prepared to fight “The Long War”, the first step has to be to admit we made a terrible mistake, apologize to the Iraqi people and the world, fulfill our promises of aid and assistance, and leave. They need to rebuild, and we need to regroup and replenish our depleted, demoralized military. And it would be preferable to do this before it’s too late.