Blog Posts from May 2009 (page 1 of 2)

A Somewhat Scary Birthday

Yesterday was my 39th birthday. Among other things I got a vasovagal syncope (aka I fainted), a trip to the hospital and an MRI.

Yeah, I’ve had better birthdays. But I’m feeling much better now.

Since Monday, I’ve been having weird numbness and tingling in my hands, feet and midsection. Ever have your foot fall asleep? You know how it feels when your foot wakes up again? It’s kinda like that. After three days of that, I decided it was time to go see the doctor. My doctor is right by my daughter’s school, so I try and schedule my appointments so I can drop her off and save my wife the trip. But the only appointment they had yesterday was thirty minutes before my daughter’s school starts, so I ended up going alone. That turned out to be a very good thing.

Diabetes is one of the things that can cause this numbness and tingling, so my wife and I figured that I shouldn’t eat anything in case the doctor wanted to check my blood sugar. Sure enough, they wanted to run a few blood tests. My wife called as they were drawing my blood – she had dropped off our daughter and wanted to know if I wanted her to stop by.  I told her to stop by if she wanted, hung up, and promptly fainted. Luckily, Jules had decided she wanted to stop by so she was there when I came to.

Apparently, vasovagal syncope is the most common cause of fainting and having your blood drawn is a common trigger. I’ve never had that reaction to having my blood drawn, though I can’t remember ever having my blood drawn while fasting. But I tell you what, I don’t ever want to go thru that again. All I really remember was trying to get my brain to focus, and it wouldn’t. Pretty scary.

Playing it better safe than sorry, I was sent off to the hospital to spend two hours crammed in the MRI machine to get an scan of my brain and spine done. Also not a pleasant experience, but much better than fainting. There was much more ominous talk like “admitting for observation” and “lumbar puncture”, but apparently the MRI didn’t show anything requiring all that so I was sent home.

I still have the numbness and tingling, though it’s somewhat better today than yesterday. The good news is that it’s not diabetes or my thyroid or anything like that and they don’t think the fainting was related at all. Since the tingling and numbness is a little better today, I’m thinking it’s something like a pinched nerve. My doctor wants me to go see a specialist, so I’ve got an appointment with a neurologist in a couple of weeks. We’ll see how it feels by then – in the meantime, I’m taking it easy. I even skipped work again today – five day weekend FTW!

As for my birthday, we did decide to postpone my “FANTASTIC surprise”. Jules had arranged for us to go camping on Orcas island over the weekend. I’m really excited for the trip – it’ll be our first real camping trip outside of the back yard – but I’m not sure if I’ll be up for it this weekend. My parents sent me a bunch of Capitals gear as well as some money for new hockey equipment – I really need a new helmet and elbow pads. My kids both made me awesome cards – Patrick’s new thing is to make pop-up cards. He also made me a paper “cake” crown.

So even though that whole tingling/vasovagal/hospital/MRI thing was a less than fun way to spend the day, I still ended up having a pretty decent birthday. I’m especially thankful for my awesome wife, who does an amazing job taking care of me when I’m sick – much better than I am able to do for her when she’s sick I’m afraid.

IronPython 2.6 Beta 1

In addition to the IronPython CTP for .NET Framework 4.0 Beta 1 I blogged about earlier, we also released the first beta of IronPython 2.6 today. How about that – two IronPython releases in one day! This is our second preview release as we work towards our 2.6 RTM in September. 2.6 Alpha 1 was released back in March.

There are two big new features in this release. The first is our implementation of the ctypes module. The ctypes module is like P/Invoke for Python. It allows Python code to call into unmanaged DLL functions. Here, for example, I’m calling into the standard wprintf function from msvcrt.dll

IronPython 2.6 Beta 1 ( on .NET 2.0.50727.4918
>>> import ctypes
>>> libc = ctypes.cdll.msvcrt
>>> ret = libc.wprintf("%sn", "hello")

Between ctypes and Ironclad, I think we’ll eventually be able to load most native Python extensions in IronPython. Woot!

The other big new feature in this release is a real implementation of sys._getframe. _getframe lets you write code that inspects the Python callstack. Previously, we supported _getframe only with a depth of zero which is to say you could inspect the current frame, but no others. Now, by default we don’t implement _getframe at all unless you pass in –X:Frames or –X:FullFrames on the command line. Removing the version of _getframe that only worked for depth zero fixes an issue with that broke much of the 2.6 standard library in IronPython 2.6 Alpha 1.

The difference between Frames and FullFrames is in what is returned by frame.f_locals member. If you’re running with FullFrames, we hoist all local variables into the heap so they can be accessed by our frame walker. If you’re running with Frames, our ability to access locals up the stack is limited. Sometimes they are available – If you called locals() in a frame up the stack for example, then f_locals will be available – but usually not. There’s a performance difference between the default (i.e. no Frames), –X:Frames and –X:FullFrames, hence why we provide the user fine grained control over the Frame support.

Our performance has gotten better relative to 2.6 Alpha 1. Our PyStone numbers have improved 80% from Alpha 1, similar to where we were in IronPython 2.0.1. We’ve also been able to cut our startup time about 25% from 2.0.1. We’re still an order of magnitude slower than CPython on startup, but we’re getting better. We’re significantly worse on PyBench than we were in 2.6 Alpha 1, but that’s primarily because there’s now a second exception test. As I described back in March, we get killed on the exceptions benchmarks – the two combine to consume nearly 62% of our total run time. Ouch!

Finally, there are bug fixes. Of particular relevance to readers of this blog are a series of fixes that allow me to continue on with my __clrtype__ series. Watch for that soon.

As I said back when we released Alpha 1, the release cycle on 2.6 will be much shorter than it was for 2.0. 2.0 had eight alphas, five betas and two release candidates over the course of around twenty months. We expect 2.6 to have one alpha, two betas and a release candidate over eight months. So please start trying using the beta as soon as you can so you can give us your feedback and we can fix your bugs!

IronPython 2.6 CTP for .NET 4.0 Beta 1

The .NET Framework 4.0 and Visual Studio 2010 Beta 1 is now generally available for download. Jason Zander has a very thorough rundown on some of the new features in this release. Of course, my favorite new features in VS2010 is the new dynamic language support in C# and Visual Basic, which let’s you easily call out to IronPython code from those languages.

For anyone who wants to experiment with interoperating C# or VB with IronPython, we released IronPython 2.6 CTP for .NET 4.0 Beta 1 today. There’s also a walkthru showing how you can use the standard Python library module random from both C# and VB. Note, there’s currently a URL bug in that walkthru – it links to IronPython 2.6 Alpha 1 rather than the .NET 4.0 Beta 1 IronPython CTP. Make sure you pick up the right version of IronPython if you want to try out the walkthru. Looks like they fixed the redirect in the walkthru.

FYI, this is a CTP quality release with about the same functionality as IronPython 2.6 Alpha 1.  Essentially, this is the version of IronPython that was in the source tree when the VS team branched for Beta 1.

If you’ve got any feedback, please drop us a line on the mailing list.

Microsoft and Open Source

In a couple of weeks, I‘m participating in an internal “Presentation Idol”competition. It’s a contest of presentation skills against impressive competition (I can’t name names, but rest assured it’s a strong group) being judged by Microsoft executives (again, I can’t name names, but this time it’s because I don’t know who’s judging) in front of what I assume will be a large technical internal Microsoft audience. To top it off, we each only get three minutes and thirty three seconds each to deliver our presentations.

So yeah, no pressure.

The topic we’re all presenting is “What is the one thing we should do to improve Microsoft?” For those who know me, it should come as little surprise that I picked a variant of “more open source” for my presentation. More specifically, I’m planning to present the following:

  1. Any product Microsoft gives away for free should also be Open Source.
  2. Open Source Microsoft products should accept contributions from the community.

I realize that many people consider this separation between “source availability” and “community contributions” completely artificial. Sure, the accepted definition of Open Source only addresses the availability and distribution of source code, but most Open Source advocates consider the ability to collaborate and contribute – what Wikipedia calls “Commons-based peer production” – a critical aspect of Open Source. For example, with respect to the announcement that ASP.NET MVC would be released under the Ms-PL, Keith Elder tweeted:

“Giving someone your source code is NOT open source. So although Asp.Net MVC’s source code is out there for download, not open source.”


In what now seems like a huge coincidence, Keith and his co-host Chris “Woody” Woodruff interviewed me later that day for their podcast Deep Fried Bytes. As you might imagine, while we started with talking about IronPython, we eventually started discussing open source at Microsoft more generally. It was a great conversation, and we found lots of common ground.

Personally, I think Microsoft is making small steps in the right direction when it comes to Open Source. Not only have some high profile Microsoft projects go Open Source like ASP.NET MVC and MEF, but we’ve even started taking baby steps for including external intellectual property. Releasing ASP.NET MVC under Ms-PL is a big deal, but I think including jQuery “in the box” is a much, much bigger deal. It remains to be seen if it’s a one-time-only deal or if it’s a new trend inside Microsoft.

Obviously, I hope it’s a trend. Going from “include jQuery in ASP.NET” to “accept community contributions in ASP.NET” seems like a relatively achievable goal.

Now, here’s where I need your help.

I can easily fill three and a half minutes talking about Open Source community collaboration. But since my presentation is about taking contributions from the community, I decided to put my money where my mouth is and crowdsource it:

What is the elevator pitch *you* would make for including community contributions in Microsoft Open Source products?

Leave me a comment, send me an email, tweet it, whatever – I’ll be keeping an eye out for responses. Please remember that I only have three and a half minutes to present, so keep your ideas short and sweet.

Checkin Comments for IronPython Source

We’ve been slowly but surely increasing the frequency of IronPython source drops. When I joined the team last April, we we only pushing the source about twice a month (sometimes only once a month). By last July, we were pushing source about once a week. Since mid-January, we’ve pushed out the latest source 131 times, which comes to about once a day on average since the start of the year. Big kudos to Dave Fugate, who’s primarily responsible for improving the frequency of our source code drops.

However, while we’ve been good about source code drop frequency, we haven’t been good about transparency. All those source drops have the same less-than-useful checkin comment “Latest IP sources migrated to CodePlex TFS”. If you wanted to know what was changed in a given changeset, you had to do the diff yourself.

But all that opaque code changes is a thing of the past now. Dave upgraded out source push script so that it emails a list of changes as well as the checkin comments whenever we update the source on CodePlex. For example, check out the source push announcement for our latest source drop.  Now we publish added, deleted and modified sources as well as the comments for any checkins included in the source drop.

As Dave said on the mailing list, please let us know if you have any feedback on these source update emails. I think they’re awesome (though I did have one small suggestion) but we want to know what you think.