Monthly Archives: 

January 2009

Congratulations Mono team!

Having spent an undue amount of time in compiler-land over the last four months, I have nothing but respect for a team that acknowledges the shortcomings of their architecture, and so REWRITES IT.

Congratulations on the new release, mono team!

http://tirania.org/blog/archive/2009/Jan-20-1.html

Twitter Updates for 2009-01-20

  • At less than a pound in weight after ELEVEN WEEKS of live, RCA is still the easiest kitten to hold. She’s just the hardest to put down. #
  • 4 hours is NOT enough warning that you’re going to be expected to give a demonstration. #
  • I find the concept of a non-programmer discussing when he would like to encounter breaking changes inherently nonsensical. #
  • I should have just known it would be one of THOSE days. #
  • The word “cell” looks really odd when typed too often. #
  • The easiest way to get real code in your demo: write it yourself. #
  • Things might come together for the day, but couldn’t they have done it sooner? #

Powershell Powers, Activate!

Yesterday, I had a problem to solve. I didn’t want to stay at work until 9pm, waiting for another team’s process to publish a file. (Grossly simplified, but you get the idea). I also didn’t want to log in from home at 9pm in order to wait for it to happen (I did that the night before).

So I used Powershell! Could I have used a batch file? Of course! However, I know with Powershell I can just chain commands together via a semi-colon.
I searched for “Powershell sleep”, and saw immediately that there was, in fact, a Powershell sleep command: start-sleep.

My final commandline:
start-sleep -s 7000 ; GetFileCommand ; msbuild /t:clean,build

And I could just walk away, knowing it would be waiting for me when I got into today.

(That didn’t happen, but it was unrelated to the Powershell issue.)

However, that wasn’t my only use of Powershell yesterday. The MSBuild Project system defines a build through a series of linked .XML files. I uncovered an issue where a particular task wasn’t being completed as I expected. I could, through the wonders of “Find”, locate where I EXPECTED the work to be taking place, but in a 10,000+ line XML file, scrolling upward to find the parent is not entirely pleasant.

So I used code.

I read the XML into an XML object, then found the tag I was looking for. I then got an XML Navigator object for where I was in the document, and walked back up the tree until I found something identifiable (it turned out I was screwed). All told, it took me less time to puzzle out (via get-member) how to do so under Powershell than it would have taken for me to write a real program, or to find it by hand.

Here’s the entirety of what I wrote:
$xmldoc = [xml] [string]::join(“`n”, (gc -read 10kb Native.Build.targets))
$xmldoc | get-member
$xmldoc.GetElementsByTagName(‘Internal_LinkOutputFile’)
$xmldoc.GetElementsByTagName(‘Internal_LinkOutputFile’) | get-member
$xmldoc.GetElementsByTagName(‘Internal_LinkOutputFile’).Item(0)
$xmldoc.GetElementsByTagName(‘Internal_LinkOutputFile’).Item(0) | get-member
$nav = $xmldoc.GetElementsByTagName(‘Internal_LinkOutputFile’).Item(0).CreateNavigator()
$nav
$nav | get-member
$nav.MoveToParent()
$nav
$nav.MoveToParent()
$nav

There was an awful lot of get-member calls, but I didn’t need to know ANYTHING else.

Yay Powershell!

Getting Engaged (Finally)

Calling this post long-delayed is a bit like calling the Pacific Ocean “wet” or the guy who slipped up on the Zune leap-year bug “fired” – it is a severe understatement while still being accurate. I was recently alerted by Nightsinger to the fact that my lovely wife repeatedly tells her version of the engagement story, which has certain elements which depart wildly from the truth. Admittedly, that’s mostly because she’s assuming chaos where there was intention, but there were equal parts chaos where she assumes intention. It evens out on my side, because I’m writing this.

Read more