Twitter Updates for 2009-01-25

  • @neilhimself Isn’t grooming yourself before the grooming people get there akin to cleaning your house before a maid arrives? #
  • Writing my review is making me feel very frustrated. #
  • How many hours do I have to wait after being told “she’ll call you back”? #
  • Cardiff will be getting taken care of on Wednesday, and should be gone next weekend. Bristol will have to wait for next month. #

Twitter Updates for 2009-01-23

  • I probably shouldn’t use whether my ID works as proof of my continued employment. #
  • It turns out that if your work email is lagged by over three hours, you miss out on a lot. #
  • gci -r | ? { ! $_.Mode.Contains(‘d’) -and !$_.Mode.Contains(‘r’) }
    Returns a list of non-directory/non-read-only files. #powershell #
  • Most popular question in the halls today: “Have you heard anything?” #
  • I need to completely review my mid year review before submitting it to remove all traces of bitterness. #
  • Mo is adorable when he isn’t making noise. #

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!