Friday, March 13, 2009

Weary

I haven't been posting too much recently. There are a few reasons for this. The big reason for it this past week specifically is that I've been very busy and exhausted since Monday morning; I haven't had time to do much of anything exciting or relaxing. Next week should be fine.

Beyond that, I assume that it's mostly because I've found myself having more actual, non-blogging conversations and email exchanges... all of my good topics are just already used up. I hate saying the same thing over and over, and if I've already told a couple people one of my interesting anecdotes, I feel silly posting the same things here, especially when I know that some of those people also read my blog.

Just so you don't feel left out, here are some random thoughts to tide you over until I come up with something good to say.

Watchmen

I thought that Watchmen was nothing special; I give it three out of five stars. It spent either too much or too little time introducing the characters—enough to bore me, and not enough to make me actually care about any of them by the end, except maybe Rorschach. I'm sure it's much better if you've read the book.

Selling yourself

I've been thinking a bit recently about the whole concept of "selling yourself" to other people, as opposed to simply assuming that other people will eventually realize your special qualities and come to like you for them. At first, the idea seems really distasteful, but I'm coming to think that maybe it's really necessary in an imperfect world where each person only gets a finite amount of time to get to know another person. I'll probably write more about this someday.

Lambdas

[Warning: nerd stuff] I had a legitimate reason to use a lambda expression at work today. I use almost exclusively C++ at work despite how much I abhor the language, and I'm always much happier when I get to use a more expressive and pleasant language for a little bit. C# has a lot of new functionality that I haven't really had a chance to use over the past couple years.

Activity activity = workflow.Activities.Find(child => child is SequenceActivity);

...instead of...

Activity activity = null;
foreach (Activity child in workflow.Activities)
{
    if (child is SequenceActivity)
    {
        activity = child;
        break;
    }
}

In the above case, the "child =>" part defines a short little inline function, and Find is an extension method that can be applied to any IEnumerable<T>, even when the class doesn't actually have a method called Find. It lets you do neat things in code that have the same effect of stuff that would have normally taken up a lot more space on the screen.

4 comments:

Steve said...

You might want to use workflow.Acitvities.OfType<SequenceActivity>() instead of Where for optimal LINQness. :)

Travis said...

Hmm? I didn't use Where.

Travis said...

...and it sort of looks like OfType would do more work than I need.

Anonymous said...

Selling yourself is illegal so I would recommend against it. I hear it's a good way to earn some extra money in these tough financial times though.