Morning Coffee 162

  • Another nice thing about the new job: I’m working in the vicinity of some good friends. I was over in building 42 yesterday and made it a point to stop by Pat Helland's office yesterday and spend an hour or so chatting about the new gig. Pat is down the hall from David Hill, whom I worked with on Architecture Strategy. Back in my building, we’re down the hall from the VSX folks including my friends Ken Levy and Gareth Jones. I’m sure there are more folks I know around, but hey it’s only my second week!
  • I’m a big fan of Carbonite, which I use to back up all the digital media on my home computer. With two little kids, we have lots of digital photos as you might imagine . However, one thing that bugs me about Carbonite is that it doesn’t back up video files by default, you have to go in on a folder by folder basis and select “‘Back up Video files in this folder” from the context menu. Given how much trouble this “feature” has given me, I imagine less techie folks don’t even realize their video files aren’t getting backed up. However, I will say the latest version of the Carbonite Software at least makes it easy to find files that aren’t backed up. A quick sweep revealed around a dozen folders that had un-backed-up video files in them, which I promptly fixed.
  • The big news yesterday was the new Google App Engine, which looks to give you access to virtualized infrastructure that sounds similar to what GOOG is rumored to use internally. I like Dave Winer’s comment that this enables “shrinkwrap net apps that scale that can be deployed by civillians.” Given Google’s history w/ Python – Python’s BDFL Guido van Rossum works there – it’s no surprise that Google App Engine (GAE?) runs on Python, though apparently they “look forward to supporting more languages in the future”. I’m guessing “more languages” == Ruby, maybe Erlang too.
  • I wonder if/how Google App Engine will affect Ruby on Rails momentum? If there’s a significant lag before App Engine supports Ruby, will that drive developers to Python web stacks like Django? (Django is included in “the box” with App Engine)?@ PyCon, I was surprised at the intra-language animosity I observed. I wonder how many Python developers are secretly hoping Google never ships Ruby support. I highly doubt Google would do that – they want to tap the exploding RoR market like everyone else – but I’d bet it would really take the wind out of Rails’ sails if they did.
  • Today’s Michael Foord Link: Embedding IronPython 2, Examples of the DLR Hosting API. You can read the DLR Hosting spec, but it’s pretty out of date so Michael’s article helps fill in some of the gaps.
  • Looks like PowerShell has gotten the open source community treatment in a project called Pash. While I’m sure others are excited about PS on Linux or Mac, I’m excited to see PS running on Compact Framework. I wonder if it would work with XNA?
  • Speaking of XNA, XNA Console is a new CodePlex project that provides an IPy console to manipulate your XNA based game on the fly. Python is no stranger to game development – Civ IV for example provided mod capabilities via python. Alas, the compact framework can’t run IPy today, so neither can XNA on Xbox. But wouldn’t it be cool to hack your game in IPy running on a 360 using the messenger kit? (via IPy URLs)
  • Bart De Smet gets functional, writing type switch and pattern matching in C# 3.0. I guess it works, but it sure is ugly. Why not just use F# and be done with it?
  • Soma announces that the VC++ Feature Pack has shipped. Somewhere, I assume, there is much (some?) rejoicing.

Morning Coffee 143

  • I’ve been sick for three days, hence the lack of posting around here.
  • As a Redskins fan, it’s hard to root for any other NFC East team. On the other hand, it sure was easy to root against the Patriots. Congrats to the Giants on their Super Bowl victory. Favorite headline: 18 and uh-oh!
  • Sounds like there’s cause for optimism regarding the writer’s strike. But is it already too late? Will the 9% drop in viewers ever come back? Personally, I think the studios have hastened their own irrelevance.
  • With last night’s win, the Caps are one game above .500. In and of itself, that’s nothing to be proud of – Coach Boudreau remarked when we reached .500 that the Caps had “officially reached mediocrity”. However, the Caps are the only team in the SE conference that’s above .500. If hockey used baseball standings, Carolina, Atlanta and Florida would each be 1/2 game back of the Caps. It’s going to be a fight to the finish.
  • In fairly big managed Ruby news, Wayne Kelly has decided to contribute to the IronRuby effort, effectively walking away from the Ruby.NET which helped get off the ground. One the one hand, obviously this is great for IronRuby. On the other hand, I liked the idea of multiple managed implementations of Ruby, so here’s hoping Ruby.NET doesn’t fade away.
  • Speaking of the DLR, I know I mentioned Martin Maly’s blog in my Lang.NET Morning Coffee Post, but I didn’t actually get to read his posts on targeting the DLR until I unexpectedly had several days off sick. If you are at all interested in writing your own language for the .NET platform: Go. Read. Now. You should also check out Tomas Restrepo’s blog, he has also started writing about targeting the DLR.
  • Larry O’Brien’s blog is currently offline, but he commented that he doubted my ToyScript F# parser would be more than 600 lines of code. Currently, the parser is clocking in at 287 lines of code plus about 50 more for the AST. It’s not done yet – see earlier statement about being sick – but I’m fixing bugs not writing additional code at this point. To be completely accurate, that’s 287 lines of FParsec code. It’s taken me a little bit to learn FParsec, but so far I’m pretty happy with it.
  • Scott Hanselman points to the new MS Deploy project, a tool for managing content and configuration on web servers. I’ve never understood why this wasn’t a standard part of IIS. It seems every hosting company I’ve used has rolled their own web-based management tool like DotNetPanel.
  • Oh yeah, Vista SP1 and Windows Server 2008 shipped Monday. Congrats!
  • I fired up Inside Xbox the other day, and there was a page about the new Disney Channel show “Phineas and Ferb“. Of course, with two kids under five, anything new on the Disney Channel is notable in my house. What made this blog-worthy is the fact that it’s directed and written by Dan Povenmire, who I knew from my USC days. I used to go see his band Keep Left and groan loudly at the bad puns in their song “PSA”. Dan, if you found this searching for yourself online: Awesome work, my kids love the show!

Morning Coffee 134

  • Bill de Hora responds to a few of my Durable and RESTful ideas. He points out that relying on a client-generated ID can be troublesome, and recommends using multiple identifiers – one created by the sender, one by the receiver and one representing the message exchange itself. However, the sender ID is vulnerable to client bugs & tampering as Bill points out, and neither the receiver ID nor the exchange ID can be used to determine if a given message is a duplicate. If you don’t trust the sender, is it even possible to determine if a given message is a duplicate?
  • Pablo Castro confirms that there are “practical limits” to what ADO.NET Data Services can do with respect to idempotence. Nothing in his post was surprising, though I hope it will be more explicitly called out in the final docs. Developers used to the comforting protection of a transaction may be in for a rude awakening.
  • Dare Obasanjo has a great post comparing the new features in C# 3.0 to dynamic languages like IronPython. I believe many of the productivity aspects of dynamic languages have little to do with being dynamic.
  • Pat Helland noodles on durability and messaging, two topics near and dear to my heart (probably from working with him for a couple of years). I’m not sure where he’s going with this – his conclusion that “Basically, big, complex, and distributed system are big, complex, and distributed” isn’t exactly ground-breaking. But his point that “durable” isn’t a binary concept is worth more consideration. Also, his description of IMS only looking at the effects of a committed transaction is very similar to how web sites work, though obviously HTTP isn’t durable so you can’t make event horizon optimizations like IMS did.
  • Tangentially related, Werner Vogels discusses the idea of eventually consistent distributed databases. Today, that’s a problem mostly only Internet-scale sites like Amazon deal with. In the near future of continued data explosion + manycore, we’ll all have to deal with it.
  • Nick Malik argues that categorizing enterprise applications by lifecycle is much less useful than categorization based on organizational impact. He might also need a new chair.
  • Jesus Rodriguez digs into one of SSB’s new features in SQL 2008: conversation priorities.
  • Arnon Rotem-Gal-Oz and Sam Gentile are mixing it up over the definition of SOA. Sam thinks SOA has to include business drivers and Arnon doesn’t. I’m with Sam on this, defining “SOA” independently from “Applying SOA” seems pointless. Then again, rigorously defining SOA – much less arguing about said definition – seems like a waste of time in the first place IMHO.
  • Wow, this guy Zed is mad at the Ruby community.
  • Andrew Baron has 8 Reasons Why The TV Studios Will Die. Personally, I think reason #2 – Expendable Middle-Person – is the most important. If content producers can reach consumers directly, what value-add will the networks provide? (via United Hollywood)

Morning Coffee 125

  • So I wasn’t quite as close to the end of Dead Rising as I thought I was. Those who’ve played the game thru will understand.
  • After their promising start, the Capitals lost yet again. At the 20 game point, they’re now 6-13-1 for a league-worst 13 points. I think we’re at the point where they need to fire Glen Hanlon. Nothing personal Glen, but it’s not getting done. The only problem is who you would replace him with? Bob Hartley? Uh, no thanks. I think most Caps fans want Dale Hunter, but I think he’s too involved with the London Knights – he’s co-owner, president and head coach. But if we could get Dale, I’m guessing Glen would be gone in a heartbeat.
  • The XNA team blog announced that XNA Game Studio 2.0′s beta has released. The download is available from Creators Club Online. The big new feature in this release is network support, and they’ve shipped a new starter kit to get you started.
  • In addition to shipping VS08 & .NET FX 3.5, a new CTP of SQL 2008 shipped yesterday. I couldn’t find a good overview of what’s new, but the SQL Express team has a post on what’s new in just their corner of this release. (via Jesus Rodriguez)
  • In more “I know it’s Thanksgiving week, but we’re shipping anyway” news, the Ruby.NET folks have shipped v0.9 – the first release since transferring control to the community. Does it run Rails? Not yet, but apparently they’re “close to getting Ruby on Rails to run successfully”. One thing that caught my eye is that it includes VS integration. Nice.

DataReaders, LINQ to XML and Range Generation

I’m doing a bunch of database / XML stuff @ work, so I decided to use to VS08 beta 2 so I can use LINQ. For reasons I don’t want to get into, I needed a way to convert arbitrary database rows, read using a SqlDataReader, into XML. LINQ to SQL was out, since the code has to work against arbitrary tables (i.e. I have no compile time schema knowledge). But XLinq LINQ to XML helped me out a ton. Check out this example:

const string ns = "{http://some.sample.namespace.schema}";

while (dr.Read())
    XElement rowXml = new XElement(ns + tableName,
        from i in GetRange(0, dr.FieldCount)
        select new XElement(ns + dr.GetName(i), dr.GetValue(i)));

That’s pretty cool. The only strange thing in there is the GetRange method. I needed an easy way to build a range of integers from zero to the number of fields in the data reader. I wasn’t sure of any standard way, so I wrote this little two line function:

IEnumerable<int> GetRange(int min, int max)
    for (int i = min; i < max; i++)
        yield return i;

It’s simple enough, but I found it strange that I couldn’t find a standard way to generate a range with a more elegant syntax. Ruby has standard range syntax that looks like (1..10), but I couldn’t find the equivalent C#. Did I miss something, or am I really on my own to write a GetRange function?

Update: As expected, I missed something. John Lewicki pointed me to the static Enumerable.Range method that does exactly what I needed.