PowerShell Tip: Pipe to the Windows Clipboard

Through this blog post, I discovered the wonderful clip, which allows you to pipe to the clipboard from PowerShell (or cmd).

The IT department at my company has a weird scheme that they like to use for assigning computer names, so I find myself running a PowerShell command like this several times a week when I need to summon my cryptic computer name:

$Env:COMPUTERNAME | clip

Wired | Tired | Expired

This should make sense to a significant (and some would say unfortunate) segment of the developer population:

Wired c:\windows\system32\inetsrv\appcmd.exe recycle apppool "MyAppPool"
Tired cscript c:\windows\system32\iisapp.vbs /a "MyAppPool" /r
Expired iisreset

The State of ORM at Microsoft

I just watched a pretty good presentation by Microsoft’s Eric Nelson that untangles the mess that is Microsoft’s ORM strategy. It’s appropriately titled:

ORM, EDM, ESQL, Entity Framework, LINQ to SQL, LINQ to Entities - Confused?

This topic is of particular interest to me, as I’ve begun work on a new application using the latest and greatest Microsoft stuff after having been out frolicking in Railsland for a while.

Some light reading seemed to indicate that the ADO.NET Entity Framework was the officially blessed product going forward, and this presentation confirmed that and provided a nice explanation of how the various technologies listed in the title fit into the picture.

Inherits="WTF?"

My kingdom for a comprehensive reference for the format of the string that goes here:

RottenFlix Live!

I thought I should write an update on where I've gotten with RottenFlix since the last post.

Plans

In my last post, I mentioned some plans that I had for enhancements.

In the future, one major enhancement I'd like to make to RottenFlix is to redesign it to use Web Workers. My original design of RottenFlix fetched all relevant movie ratings up-front with no action required from the user, but it was just too slow and it blocked the UI awkwardly. With Web Workers I'm pretty confident I could go back to my original vision and make it fast and usable.

There's also the issue of new movie titles that are brought into the page via Netflix's own Ajax effects. RottenFlix does not currently handle those movie titles. I could probably make this work, but I'm not sure how.

Reality

Well, after banging my head against the wall extensively on both of these issues, I've reached some conclusions.

  1. It's not actually possible to use workers within Greasemonkey. After much experimentation, googling, and finally Stack Overflowing, I had to accept the fact that my dream of a multi-threaded RottenFlix was dead. Bummer.
  2. This one has a happy ending. After a long fruitless journey down the Live Query path, I stumbled upon a short paragraph in a Dr. Nic blog post that shed light on why Live Query wasn't working for me and never would. Luckily, that post also pointed me at setInterval(), which worked beautifully for my scenario. I'm happy to report that RottenFlix now accounts for movie titles that are added to the page dynamically, and it only took 3 lines of code! (Look at the first 3 changes in this diff, if you're curious.)

Plans?

Now that I've settled these issues, I'm not sure where RottenFlix will go from here. I built this thing for myself, and I'm very happy right now with the functionality. It might benefit from some UI polish. We'll see...

Rotten Tomatoes + Netflix + Greasemonkey = RottenFlix

I give you RottenFlix, my first published Greasemonkey script.

What is it?

RottenFlix is a result of the time-honored tradition of scratching your own itch. I'm a huge movie fan and a devoted member of Netflix. I've also been a user of Rotten Tomatoes for many years and have come to rely on it heavily for movie ratings; I'll rarely commit to watching a movie until I've looked up its rating on RT. While browsing Netflix for intriguing movies, it became tedious and annoying to have to constantly leave the site to look up ratings on RT, so I developed RottenFlix to alleviate this pain by making RT ratings available in the Netflix interface with a single click.

You can find more details as well as screenshots here.

What I learned

Along the way, I learned a great deal about Greasemonkey and its various oddities, including integrating third-party JavaScript libraries, and troubleshooting cross-domain Ajax requests with GM_xmlhttpRequest. I picked up a few new jQuery tricks as well.

Caveats

One thing to be aware of if you install RottenFlix: because Rotten Tomatoes does not have an API for fetching movie ratings, I had to reverse-engineer the scheme that they use to map movie titles to URLs on the site. So I essentially have to make certain guesses that are not always correct, though I'd say at this point that my code guesses correctly about 90% of the time. When a guess is incorrect, you'll see a little "?" where the rating would normally appear, and by clicking the "?" you'll be taken to a search results page for that movie title on RottenTomatoes.com where you can easily find the correct movie yourself.

Plans

In the future, one major enhancement I'd like to make to RottenFlix is to redesign it to use Web Workers. My original design of RottenFlix fetched all relevant movie ratings up-front with no action required from the user, but it was just too slow and it blocked the UI awkwardly. With Web Workers I'm pretty confident I could go back to my original vision and make it fast and usable.

There's also the issue of new movie titles that are brought into the page via Netflix's own Ajax effects. RottenFlix does not currently handle those movie titles. I could probably make this work, but I'm not sure how.

Advertising is Failure

Jeff Jarvis at BRITE '09 conference

On the Market

Crazy times we're living in!  Well, as luck would have it, my torrid love affair of the past five months with Ruby on Rails has come to an end.  So...I'll be on the market for a short time while I decide where my next home will be.

If you're interested in hiring the guy behind this blog (and this résumé), now's your chance.

market

I had a ball with Rails, and I'd be interested in continuing down that path with my next gig, but...there have been some interesting developments in the .NET sphere since I've been away, and I could easily go back in that direction as well.

Ruby Inspires Great Code

Ruby is filled with examples of great, intuitive APIs..., and it seems that developers who write their own code in Ruby strive for the same level of obvious, inspired by the beauty of the language. We all want to provide that same feeling of happiness to developers that they get just from using the Ruby language directly.

- Excerpt from The RSpec Book


I can say from first-hand experience that the above is true. There's something about Ruby that inspires you to write code that's more expressive, obvious, and intuitive.

IKEA v. the Amish

There are at least two separate groups of software developers: craftsman and industrial programmers. Neither of them is better than the other, but they are widely different and service very distinct markets. An analogy that I've been told is reasonable is the difference between IKEA and an Amish Craftsman in Mid-Ohio. People go to them for two different things. You don't go to the Amish Craftsman to build you something on the cheap, made of inferior materials, poorly constructed and that was intended to be replaced in a couple years. Likewise, you don't go to IKEA to buy a piece of furniture that has the potential to become a family heirloom. Different goals and a place for both. Nobody I've talked to has said they think of IKEA as a craftsman workshop, just like nobody thinks of the Amish workshop as an industrial factory pumping out cheap product.

- Corey Haines

Testing ScribeFire

I've been searching for a free blogging client to use on OS X since my beloved Live Writer (possible my favorite piece of software Microsoft has ever produced) is Windows-only.

So here's my first post from ScribeFire, a blogging client implemented as a Firefox extension.  See you on the other side, blog post.

Pop the 'Why?' Stack

You should discuss...the feature and pop the why stack max 5 times (ask why recursively) until you end up with one of the following business values:

  • Protect revenue
  • Increase revenue
  • Manage cost

If you’re about to implement a feature that doesn’t support one of those values, chances are you’re about to implement a non-valuable feature. Consider tossing it altogether or pushing it down in your backlog.

- Aslak Hellesøy, creator of Cucumber

(If you follow the link, you can also read the transcript of an IRC session in which Aslak helps someone pop the "why?" stack for a "login" feature.)