Passion * Technology * Ruthless Competence

Thursday, April 16, 2009

Issue Tracking for my GitHub Projects

FYI, anyone using ipydbg, devhawk_ipy or Pygments for WL Writer can now submit issues, bugs and feature requests other the associated GitHub project page. Head to the associated GitHub project page and click the “Issues” tab at the top. There’s a short video of introducing the GitHub Issues feature you can check out.

BTW, thanks to defunkt @ GitHub for the ipydbg shoutout.

Posted By Harry Pierson at 3:48 PM Pacific Daylight Time

Thursday, January 08, 2009

Kid Programming with Kodu Coming to Xbox 360

As I’ve written before, I originally got the programming bug from a desire to build my own text adventure games. with significant influence from my dad. Now that I’m a father myself, I want my kids to have a similar opportunity, even if they never choose to go into the “family business”.

kodu_guy Of course, the technology has moved on significantly since the days of “You are in a maze of twisty little passages, all alike”. At CES yesterday, Microsoft announced Kodu which I’ve written about before under it’s original name Boku. Kodu came out of Microsoft Research as a tool for teaching kids how to program. The programming language is very visual and iconic and you use the Xbox controller exclusively for all input. Here’s a screenshot:

To demo Kodu at CES, Robbie Bach brought a 12 year old girl named Sparrow up on stage to demo. I showed the video to my kids this morning and they went gaga for it. They’re a little young - Patrick turns 6 next month and Riley turns 4 later this year – but I think they’ll be able to get the hang of it (with a little help from dad). Below is the video of the CES demo, and there are more Kodu videos at On10 (Matthew MacLaurin on Kodu and Watch Kodu in Action).

Personally, I think this is brilliant. I have been eagerly waiting a change to play this with my kids for over a year, so I’m very excited that they’re bringing this to market. Seriously, Halo Wars just got bumped to the #2 slot on my “Most Anticipated Xbox Games of 2009” list.

I’m most interested in how these creations will be shared online. I couldn’t find any details, but Robbie specifically said “And on Xbox Live they can distribute and share those finished games with other people.” Will there be a charge? (“normal” Community Games cost between $2.50 and $10 a pop) How will parental controls affect shared Kodu games? I guess those details will come closer to release.

Posted By Harry Pierson at 11:19 AM Pacific Standard Time

Friday, September 12, 2008

Afternoon Coffee 174

You know, this gets pretty long when I go a week between morning coffee posts.

Dynamic Language Stuff

Other Stuff

  • Don Syme blogs about an update to the F# CTP, a mere week after the original release. One week? That's more often than even IPy releases. I can't wait to see what they ship in next week's release! :) Seriously, I hope they can keep the release sprints short, but every week would be a bit crazy!
  • Speaking of F#, Matt Podwysocki updates FsTest for the F# CTP and posts about Extension Everything in F#. Unlike C#, which only supports extension methods, F# also supports extensions properties, static methods and events, though like Matt I can't think of a good use for extension events.
  • Still speaking about F#, Andrew Kennedy has a three part series on the new units of measure feature of F#. If you were going to use F# to build the physics engine of a game, I would suspect UoM would be extremely useful. (via Don Syme)
  • Oh look, Chris Smith built an F# version of artillery game that uses Units of Measure for the physics code. I'll bet UoM was extremely useful. :)
  • Talking about Live Mesh at TechEd Australia - where much to my surprise frankly they were demoing Live Mesh Apps - I pointed out to Scott Hanselman that Mesh is running an embedded CoreCLR (aka the same CLR from Silverlight 2). Scott went poking around and posted what he discovered. Looking forward to finding out what he digs up on using CoreCLR outside the browser.
  • Speaking of Scott, I need to set up a family video conference solution like Scott's before my next trip.
  • Congrats to Glenn Block and the MEF team for their initial CodePlex source drop! I've been hearing about this possibility since Glenn joined the team, so I'm really excited to see it happen. I need to take a look at it in detail (in my copious spare time) because I want to find out how to make it work with IPy.
  • Bart de Smet has a whole series (starting here) on Dynamic Expression Trees. However, given that he specifically writes "This blog series is not about DLR itself" makes it seem pretty conceptual to me. Why not talk about DLR expression trees instead Bart?
  • I'm sure you noticed ASP.NET MVC preview 5 dropped last week. I really liked Brad Wilson's discussion of the new view engine design.
  • Tomas Restrepo has started publishing his source code on GitHub. Personally, I haven't published any source code lately but I am using Git for all of my non IPy core work (which is stored in TFS). Like Tomas, I'm still getting the hang of Git but I'm really digging it's speed, it's branching and the fact that there's zero infrastructure requirements. SVN provides the lightweight svnserve, but Git is even lighter weight than that.
  • I liked Steve Yegge's post on typing. I am a touch typer, but I doubt I type 70 words a minutes. I do know where the number keys are without looking though, so I guess that's pretty good. I remember seeing Chris Anderson demo Avalon WPF long before it was public and being impressed at how fast he could type.
Posted By Harry Pierson at 1:20 PM Pacific Daylight Time

Monday, August 25, 2008

Morning Coffee 172

  • I took the kids to see Fly Me To The Moon recently. We had to trek to Monroe (about 30 minutes away) because it's a special 3D movie, and it was only playing there and in downtown Seattle. The movie's story is insipid - three flies stow away on Apollo 11 - but all the space shots were actually kinda cool. It sure felt like they wanted to be scientifically and historically accurate about the the actual mission (well, other than the part about the flies). Patrick really liked it (he wants to build a rocket in the back yard) and Riley sat thru the whole thing with a minimum of fussing.
  • I'm a big fan of Joe Biden, so I'm really happy Obama picked him to be his running mate.
  • I know it's old news but what the frak was John Edwards thinking? I like his policies, but the arrogance it takes to run for president when you know you've got that skeleton in your closet is mind-boggling.
  • On the other hand, watching the Sean Hannity and guest's hypocrisy on Edwards' affair, only to watch them scramble like cockroaches when Colmes points out McCain had admitted to having an affair was frakking hilarious.

OK, onto geek stuff:

  • My new boss Dave Remy has moved to a new blog. If you're curious what he was up to for the 10 months he was away from Microsoft, he's happy to share.
  • IPy and IRuby developer Curt Hagenlocher (aka Iron Curt) is blogging. Cue the Ozzy...I AM IRON CURT. Or don't. Anyway, he dives in the deep end of the pool - no "hello world" lollyblogging for Iron Curt - digging into the stack implications of rethrowing exceptions and debugging emitted IL.
  • Srivatsn writes about static compilation of IPy scripts. Note, we're not talking about static typing - it's still the same good-old dynamically typed IronPython, just packaged up as an assembly, rather than as a bunch of .py files. Note, if you're interested in compiling IronPython, you should check out the PYC sample we published as part of Beta 4.
  • Speaking of IPy Beta 4, Shri Borde posts about the COM dispatch support which is enabled by default as of Beta 4. If you're driving COM automation clients (like Office) from IPy, this is a huge improvement over the old mechanism.
  • Jeff Hardy has released a new version of NWSGI, a managed version of Python's Web Service Server Gateway Interface. My understanding is that this would allow any Python web stack written against WSGI to run in IIS with IronPython (subject to IronPython's compatibility with CPython). Jeff's been documenting his efforts getting Django running with NWSGI on his blog. Awesome work Jeff! (Thanks for the correction Seo!)
  • I never really bought into the "Attention Economy", but Chris Anderson's economic analysis of his DIY Drones site traffic was fascinating.
  • Lutz announces "it is time to move on" from Reflector and there was a collective horrified scream in the .NET community. He's handing it over to Red Gate, who promised they "will continue to offer the tool for free to the community".
  • I missed this when he posted it in June, but I really liked Nikhil Kothari use of the DLR in Silverlight to cut down on the XAML verbosity in his ViewModel action binding.
  • Brian McNamara previews the new Add Reference and file ordering support in the upcoming F# CTP. I'm really looking forward to the project-to-project reference support. I can't tell you how many times I've gotten burned because my main project recompiled but my test project didn't. You just get used to hitting Rebuild All instead of Build. As for file ordering, it's a bit of a bummer that F# requires it, but the new experience is hella better than editing the project file by hand. I'm really looking forward to the new CTP.
Posted By Harry Pierson at 9:56 AM Pacific Daylight Time

Thursday, March 20, 2008

WebDev.WebServer PowerShell Function

In experimenting with NWSGI yesterday, I found I wanted the ability to launch the development web server that ships with Visual Studio (WebDev.WebServer.exe) from the command line. I hacked up the following PowerShell function and dropped it into my $profile so I can easily launch the web server in any directory any time I need. Thought I'd share:

function webdev($path,$port=8080,$vpath='/')  
{  
    $spath = 'C:\Program Files\Common Files\microsoft shared\DevServer\9.0\WebDev.WebServer.EXE' 

    $rpath = resolve-path $path 
    $params = "/path:`"$rpath`" /port:$port /vpath:$vpath" 

    $ignore = [System.Diagnostics.Process]::Start($spath, $params
    "Started WebDev Server for '$path' directory on port $port" 
}

There's probably an easier way to launch an exe with parameters than Sys.Diags.Process.Start, but it works. Using resolve-path is the key, that lets me pass in a relative path on the command line, but the script converts it to an absolute path in order to pass it to the webdev server. Also, I'm not sure I should have hard coded the path to the exe, but again it works and it's not like it's tough to change.

Enjoy.

Update: Tomas Restrepo pointed out an easier way to start the process:

&'C:\Program Files\Common Files\microsoft shared\DevServer\9.0\WebDev.WebServer.EXE' "/path:$rpath" "/port:$port" "/vpath:$vpath"

I couldn't figure out how to correctly launch the exe when the physical path to serve has a space in it. Thanks Tomas.

Posted By Harry Pierson at 2:39 PM Pacific Standard Time

Tuesday, March 18, 2008

Lunchtime Coffee 158

  • My friend (and hopefully my next representative) Darcy Burner is leading a group of congressional challengers in publishing A Responsible Plan To End The War In Iraq. I haven't read the plan itself in detail, but I sure like what I'm hearing about it.
  • Speaking of politics, Obama's speech today "A More Perfect Union" was fantastic.
  • Bioshock is getting a sequel. 'nuff said.
  • There's a new version of FolderShare out and I've got mixed feelings about it. On the one hand, I've been a regular user of FolderShare for a while so it's nice to see it get a face lift. On the other hand, it's been over two years since Microsoft bought FolderShare and we're only just now getting a new version, which is literally nothing more that a face lift - this version introduces no new functionality at all.
  • I was hoping to geek out vicariously via someone else's hacking around with Singularity. Luckily, Matthew Podwysocki provides just such an opportunity.
  • Looks like "Prism" is the new CAB. Glenn Block has two extensive posts covering a project overview and their first drop. I think it's interesting that the Prism team is focused on building a reference implementation, and letting the framework eventually fall out. Reading thru the description, it sounds awesome. However, based on the massive increase of inbox throughput I'm experiencing since I accepted the new job, I can't imagine I'll have time to play with it. Maybe Matthew will start playing with Prism too! (via Sam Gentile - btw, thanks for the kind words on the new job Sam!)
  • Speaking of Sam, he points to a series by Bob Beauchemin entitled LINQ to SQL and Entity Framework: Panacea or evil incarnate? With a title like that, who can resist reading the whole series? Err, I can because LINQ 2 SQL & EF performance just fell off my radar entirely. However I gotta agree with Sam's point that he "can't think of anyone more qualified than Bob" to tackle these questions.
  • Tomas Restrepo blogs his dev environment PS script as well as a PS fortune script. Personally, I use Chris Tavares' vsvars wrapper for PS, though I'll gladly take an "official" PS based dev environment.
  • I wonder if Ted Neward will get jumped for admiring Mort the way Nick Malik did. Given that Ted called himself Mort while Nick compared Mort to agile developers, I'm guess Ted will have to go back to his Vietnam analogy if he wants to create controversy.
  • Speaking of Ted, I agree with his point that conferences are about people. As a python pre-newbie (I figure I'll reach full newbie status by the time I actually start my new job), I spent most of my PyCon time connecting with people rather than trying to learn technical stuff. Also, I love Ted's WHISCEY acronym.
  • Speaking of PyCon, my soon-to-be new teammate Srivatsn Narayanan blogs his thoughts on PyCon. I'll try and get to my PyCon thoughts soon.
Posted By Harry Pierson at 11:49 AM Pacific Standard Time

Tuesday, February 19, 2008

Morning Coffee 147

  • My son Patrick turns five today. The big treat was his cousin Jack coming up for a visit. Here's a picture of the two of them at Patrick's party on Saturday. My wife has all the details on her blog. Update: My wife just posted a whole slew of Early Patrick Pictures.
  • If my son is five, it means this blog is also five - I started this blog about a month before Patrick was born. I never remember to mark the occasion until Paddy boy's big day comes around.
  • Major props to the House of Representatives for growing a backbone and not caving to President 30% Approval on telecom immunity...yet. Personally, I'd like to see the House bury the measure completely, though I'm not holding my breath. But given that even the right-wing Washington Times reports "Analysts say FISA will suffice", maybe the House Dems will do the right thing.
  • After tearing it up since Thanksgiving, the Caps have gone a little cold. 5-4-1 in their last ten and 2-2-1 in their last five. In the month of February, they're 1-3-1 against SE division opponents. Good news is that they're still even with Carolina (two points behind with two games in hand), half a game up on Atlanta, a game and a half up on Florida and two and a half games up on Tampa Bay.
  • Bill Gates announced a new program called DreamSpark to provide college students access to all of Microsoft's developer and designer tools, including Visual Studio, Expression, SQL Server, Windows Server and XNA Creators Club membership. This looks like an outgrowth of the MSDN Academic Alliance program. I think it's a great idea. Update: Looks like high-school students will be able to access the DreamSpark program too. However, since they're minors, they have to get the software via their teachers. (via LiveSide)
  • The winners of the XNA Silicon Minds contest have been announced. Of the five winners, Specimen looks the coolest to me. I wish I had more time to get into game development. (Via LetsKillDave)
  • Speaking of game development, this week is the Game Development Conference, so be on the lookout for lots of game-related news. Xbox Live VP John Schappert is giving a keynote on "Unleashing the Creative Community". XNA GM Chris Satchell said last year they would "announce full details on, and ... vision for, opening XNA creations to the community" sometime this year. I'm guessing this is said announcement.
  • Speaking of Xbox, there's a rumor that Microsoft and Netflix will announce this week that Netflix is bringing their Watch Instantly service to Xbox 360. If true, sign me up!
  • Grigori Melnik announces the GAX/GAT February 2008 final release. Key feature is VS08 support. Is it just me, or does calling it the "final release" make it sound like they won't be upgrading GAX/GAT further?
  • Speaking of p&p, Grigori also announces the Feb 2008 CTP of Unity, p&p's new IoC container. I've seem lots of folks echoing the announcement, but not much in the way of specifics on Unity itself. For example, Chris Brandsma describes IoC and mentions Unity, but he doesn't cover any Unity specifics. :(
  • MSIT EA Nilesh Bhide has started blogging. His first post is on Customer perception of Service Quality in S+S/SaaS. I've worked closely with Nilesh in the past two years, so I'm excited to see him take to the blogosphere. (via Nick Malik)
  • I don't know how I missed it, but the MSDN Code Gallery launched last month. As Charlie Calvert explained, this is logical successor to GotDotNet's user samples area. Between Code Gallery and CodePlex, GotDotNet has finally been shuttered for good.
  • Telligent, makers of the very popular Community Server, have released Graffiti CMS, which looks like a more flexible content platform than Community Server. (via DNK)
  • In somewhat unexpected news (at least, unexpected by me) Microsoft has released specs for the Office binary file formats. I'm not sure why this is happening now, rather than say when we released the specs for the Open Office XML file formats. (via DNK)
Posted By Harry Pierson at 11:29 AM Pacific Standard Time

Thursday, January 31, 2008

Morning Coffee 141 - Lang.NET '08 Edition

header I was hoping to blog my thoughts on Lang.NET as the event went along. Obviously, that didn't happen, though I was pretty good about dumping links into my del.icio.us feed. The talks were all recorded, and should be up on the website in a week or two. Rather than provide a detailed summary of everything that happened, here are my highlights:

  • The coolest thing about conferences like this is what John Rose called "N3" aka "Nerd-to-Nerd Networking". It was great to meet in person, drink with and geek out with folks who's blogs I read like Tomas Petricek, Wesner Moise and Larry O'Brien. Plus, I got to meet a bunch of other cool folks like Gilad Bracha, Stefan Wenig and Wez Furlong. That's worth the price of admission (which was admittedly nothing) right there.
  • Coolest MSFT talk: Martin Maly "Targeting DLR". I was wholly unaware that the DLR includes an entire compiler back end. Martin summarized the idea of DLR trees on his blog, but the short version is "you parse the language, DLR generates the code". That's pretty cool, and should dramatically lower the bar for language development. Of course, I want to write my parser in F#, so I'm going to port the DLR ToyScript sample to F#.
  • Runner-up, Coolest MSFT talk: Erik Meijer "Democratizing the Cloud with Volta". Erik is a great speaker and he really set the tone of his session with the comment "Division by zero is the goal, not an error". He was referring to an idea from The Change Function that user's measure of success is a function of perceived crisis divided by perceived pain of adoption. Erik wants to drive that adoption pain to zero. It's a laudable goal, but I remain unconvinced on Volta.
  • Coolest Non-MSFT talk: Gilad Bracha "Newspeak". Newspeak is a new language from one of the co-authors of Java. It's heavily smalltalk influenced, and runs on Squeak. He showed developing PEGs in Newspeak, and they were very compact and easy to read, easier even than F#. He calls them Executable grammar, and you can read his research paper or review his slides on the topic. Unfortunately, Newspeak isn't generally available at this time.
  • Runner-up, Coolest Non-MSFT talk: Miguel de Icaza "Moonlight and Mono". The talk was kinda all-over-the-place, but It's great to see how far Mono has come. Second Life just started beta testing a Mono-based script runner for their LSL language (apparently, Mono breaks many LSL scripts because it runs them so fast). He also showed off Unity, a 3D game development tool, also running on Mono.
  • Resolver One is a product that bridges the gap between spreadsheets and applications, entirely written in IronPython (around 30,000 lines of app code and 110,000 lines of test code, all in IPy). Creating a spread-sheet based app development environment is one of those ideas that seems obvious in retrospect, at least to me. If you do any kind of complicated spreadsheet based analysis, you should check out their product.
  • If you're a PowerShell user, you should check out PowerShell+. It's a free console environment designed for PowerShell and a damn sight better than CMD.exe. If you're not a PowerShell user, what the heck is wrong with you?
  • Other projects to take a deeper look at: C# Mixins and Cobra Language.
  • I thought my talk went pretty well. It's was a 15 minute version of my Practical Parsing in F# series. Several folks were surprised I've been coding F# for less than a year.
Posted By Harry Pierson at 10:25 AM Pacific Standard Time

Friday, December 07, 2007

Morning Coffee 128

  • After using Outlook 2007 as my RSS reader for a few months, I've gone back to RSS Bandit. I run two work machines (desktop + laptop) and I finally got tired duplicated blog entries because each copy of Outlook downloads the same post. Also, for some reason Outlook downloads the same Technorati posts over and over again.
  • ADO.NET Entity Framework Beta 3 was released. The latest CTP of the EF Tools is also available. And as per the press release, EF has gained support from "Core Lab, DataDirect Technologies, Firebird Foundation Inc., IBM Corp., MySQL AB, Npgsql , OpenLink Software Inc., Phoenix Software International, Sybase Inc. and VistaDB Software Inc". I'm not sure what that means, exactly, but I guess you'll be able to LINQ to Entities on a wide variety of DB platforms. Interesting Oracle isn't on that list. Not really surprising, but interesting.
  • Here's a new ASP.NET MVC article from Scott Guthrie, this one on views and how you pass data to one from a controller. Using generics to get strongly-typed ViewData is pretty sweet. But where's the MVC CTP that was supposed to be here this week?
  • In news about web app tool previews that did ship this week, Live Labs announces Volta. Haven't installed or played with it yet, but I did read the fundamentals page. It primarily looks like a tool to compile MSIL -> JavaScript, so you can write your code in C# but execute it in the browser. Sam and Jesus are excited, Arnon not so much. Arnon's argument that being able to postponing architectural decisions is to good to be true is fairly compelling, and not just because he quotes me to support his argument. But I'll download it and provide further comment after I experiment with it myself.
  • Simple Sharing Extensions is now FeedSync. Not sure what else is new about it, other than it's been blessed with "1.0" status. The Live FeedSync Dev Center has an introduction, a tutorial and the spec. (via LiveSide)
  • Dare likes tuples. Me too. I also like symbols.
Posted By Harry Pierson at 11:06 AM Pacific Standard Time

Monday, October 08, 2007

Morning Coffee 116

"Looks like I picked the wrong week to stop sniffing glue"
Steve McCroskey, Airplane!

  • So it's been a while since my last post. Just over a month, not including The F5 High, which wasn't "original IP". Frankly, I just stopped reading pretty much cold turkey. I wanted and needed to go heads down on day job stuff for a while. Since I haven't been reading, Morning Coffee is going to be a little cold while I ramp back up.
  • The new NHL season is upon us, and the Caps are looking good so far. Obviously, they have the new uniforms, but they're also out to a 2-0 start for the first time in five years. And in those two games, they've only allowed one goal and are 100% on the PK. It's nice to see them start strong, but obviously there's a long way to go. Here's hoping the can stay strong all season.
  • Speaking of staying strong, the wheels that were rattling last week came off the Trojan bandwagon completely this week. I'm not sure it's as big an upset as Appalachian State beating Michigan but it's close. What happened to the team that scored 5 TD's in a row on Nebraska?
  • Big news last week is that MSFT is going to release the source code to much of the .NET Framework. Scott Guthrie has the details. Frankly, between Rotor & Reflector, it wasn't like you couldn't see the source code anyway, so this seems like a no-brainer. But integrating it directly into the VS Debugging experience, that's frakking brilliant.
  • I haven't had a chance to install the new XML Schema Designer (Aug 07 CTP)  but I was really impressed with this video. The XML Team blog has more details. However, I'm not sure what the ship vehicle is. The CTP install on top of VS08 beta 2, but in the video they keep saying "a future version" of VS, implying that it's not going to be in VS08.
  • Dare is spending some time investigating SSB. I think it's interesting that some of the REST crowd are starting to see the need for durable messaging. Dare argues that the features and usage models are more important than wire protocol. As long as it's standardized, I don't care that much about the protocol. Several of the REST folks mentioned AMQP. While I've got nothing against AMQP technically (frankly, I haven't read the spec), but what does it say about durable messaging vendors (including MSFT) that a financial institution felt the need to drive an interoperable durable messaging specification?
Posted By Harry Pierson at 9:57 AM Pacific Daylight Time

Thursday, August 23, 2007

Morning Coffee 113

  • I'm in Chicago today and tomorrow for a reunion of sorts. In my last job, I managed a group of external architects called the Microsoft Architecture Advisory Board (aka the MAAB). We discontinued the program a while back, but the core of the group found the program valuable enough they have continued to meet anyway. I found the MAAB meetings incredibly valuable and insightful, so I'm really excited to be invited to continue my involvement with the group.
  • I picked up Bioshock Tuesday (Circuit City had it on sale) on my way to my bi-weekly campus excursion. My meetings were over around 2pm so I headed home early, expecting to surprise the kids. But Jules had decided to skip naps and go shopping with them. Her cell phone was dead, so I ended up at home with a couple of hours to myself and a brand new copy of Bioshock. Wow, is that a good game. Certainly deserving of the amazingly good reviews it's garnered.
  • Speaking of reviews, this transparently biased review of Bioshock over at Sony Defense Farce Force is frakking hilarious. Somehow, I doubt their dubious review will stem the tidal wave of Bioshock's well-deserved hype. Can't wait to read their Halo 3 review.
  • Pat Helland writes at length on master-master replication. I reformated it into PDF so I could read it - the large images were messing up the text flow on my system. As usual for Pat, there's gold in that thar post. His thoughts on DAGs of versions and vector clocks as identifiers are very exciting. However, I think he glosses over the importance of declarative merging. I would think programmatic merge would likely be non-deterministic across nodes. If so, wouldn't you end up with two documents with the same vector-clock identifier by different data?
  • Joe McKendrick points to a few people who predict the term "service-oriented" will eventually be subsumed under the general heading of "architecture". Not to brag, but I made that exact same prediction almost three years ago.
  • Erik Johnson thinks that SOA 2.0 centers on transformational patterns. The idea (I think) is that if systems "understand each other more deeply", then we can build a "smarter stack" and design apps via new constructs to promote agility and simplicity. Personally, I'm skeptical that we can define unambiguously system semantics except in the simplest scenarios, but Erik talks about using "graph transformation mathematics" to encode semantics. I don't know anything about graph transformation mathematics, but at least Erik has progressed beyond hand waving to describing the "what". Here's looking forward to the "how".
  • New dad Clemens Vasters somehow finds time to implement an XML-RPC binding for WCF 3.5. I was encouraged that it didn't require any custom attributes or extensions at the programmer level. Of course, XML-RPC fits semantically into WCF's interface based service model, so it shouldn't be a huge surprise that it didn't require any custom extensions. But did it need WCF 3.5? Would this work if recompiled against the 3.0 assemblies?
  • Phil Haack writes a long post on Duck Typing. VB9 originally supported duck typing - the feature was called Dynamic Interfaces - when it was first announced, but it was subsequently cut. I was really looking forward to that feature. Between it and XML Literals, VB9 was really stepping out of C#'s shadow. I guess it still is, even without dynamic interfaces.
  • Since I've been doing some LINQ to XML work lately, I decided to go back and re-write my code in VB9 using XML literals. While XML literals are nice, I don't think they're a must have. First, LINQ to XML has a nice fluent interface, so the literals don't give you that much cleaner code (though you do avoid writing XElement and XAttribute over and over.) Second, I find VB9's template syntax (like ASP <%= expression %>) clunky to work with, especially in nested templates. Finally, I like the namespace support of XNames better. As far as I can tell, VB9 defines namespaces with xmlns attributes just like XML does. So I'm not dying for literal XML support in a future version of C#. How about you?
Posted By Harry Pierson at 7:23 AM Pacific Daylight Time

Friday, August 17, 2007

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.

Posted By Harry Pierson at 4:55 PM Pacific Daylight Time
ADO.NET | Database | Development | LINQ | Ruby | XML

Thursday, August 09, 2007

Fantasy, Free Code and the SharePoint Model

It might sounds like a fantasy, but Nick Malik really wants free code. He started talking about it a few months ago when he was getting raked over the coals by debating Mort with the agile .NET community:

Rather than look at "making code maintainable," what if we look at making code free.  Why do we need to maintain code?  Because code is expensive to write.  Therefore, it is currently cheaper to fix it than rewrite it.  On the other hand, what if code were cheap, or free?  What if it were cheaper to write it than maintain it?  Then we would never maintain it.  We'd write it from scratch every time. 

Then about a week ago, he laid out the reasons why free code would be a good thing. At a high level (Nick's blog has the details), those reasons are:

  1. Lower the cost of IT through reduced skill requirements. 
  2. The speed of development goes up. 
  3. Projects become more agile. 
  4. Solution quality goes up. 

Talking about the benefits of free code is sorta like talking about talking about the benefits of dating a movie star. The benefits are actually pretty obvious, but talking about them doesn't really help you get there from here.

Actually, Nick isn't suggesting that all code can be free. He's focused on separating out business process modeling/development from the rest of software development. In essence, he's describing a new class of developer (should we call the persona Nick as an homage?) who needs their own class of tools and for the IT department to "formally" allow them to "easily develop, test, and deploy [aka host] their processes." For the most part, these BP developers wouldn't be traditional developers. They'd be more like software analysts who do the work directly instead of writing specs for developers.

I call this separation of business and IT concerns the SharePoint Model. SharePoint, IMO, does an amazing job of separating the concerns and needs of business and IT users when it comes to running intranet web sites. Only the truly geeky stuff that requires specialized access, knowledge or equipment - installing the SharePoint farm in the first place, keeping it backed up, installing service packs, etc. - is done by IT. Everything else is done by the business folks. Need a new site? Provision it yourself. Need to give your v-team members access to it? Do it yourself. I see similarities in the free BP code approach Nick's suggesting. I'd even argue that SharePoint is the natural "host" for such business processes. It already supports WF and can provide access to back-end enterprise data via the Business Data Catalog.

On the other hand, some of what Nick suggests seems fairly impractical. For example, he thinks IT should "formally and officially take control of managing the common enterprise information model and the business event ontology." First off, who officially manages this today? Does such an official information model or event ontology even exist? I'm guessing not. That means you've got to start by getting the business people to agree on one. That's usually a sucker's bet. Nick also suggests we "reduce the leaky abstractions" in our services. To suggest this is even possible seems incredibly naive.

The good news is the things that will work (evolving BP into its own development discipline, building custom tools for BP development, getting IT into the BP hosting business) don't depend in any way on the things that wont work (getting lots of folks to agree on anything, breaking the laws of physics, overcoming the law of leaky abstractions). I'm not sure it will result it truly free code, but it sure would bring the costs down dramatically. Thus, I think most of Nick's free code vision is quite practical and not a fantasy at all.

As for dating a movie star, you're on your own.

Posted By Harry Pierson at 4:53 PM Pacific Daylight Time

Wednesday, August 08, 2007

Morning Coffee 109

  • I forgot to add a number to my last morning coffee post. However, after extensive research, I have determined that it was #108. So thing are continuing as usual today with #109. On the other hand, do you really want development and architecture opinions from a guy who can barely count? :)
  • The finalists in the Dream-Build-Play contest have been announced. I haven't played any of them yet (some are available for download) but they several of them sure look good.
  • And speaking of gaming, MS announced an Xbox 360 price drop yesterday. So if you want to get in on some of the XNA action, here's your chance (or you could just build for your PC - take your pick).
  • Finally on the gaming front, if you're not busy Monday you can watch the first day of Gamefest 2007 online. Get the scoop on XNA 2.0 as well as the new XNA networking support. I, alas, am busy Monday so I'll have to catch it on demand.
  • On to, you know, actual geek stuff things. Scott Guthrie seems to have retired his LINQ to SQL series and moved on to LINQ to XML. He shows how to build an RSS reader application with LINQ to XML. An oldie demo, but a goodie.
  • Wanna learn F#, there's a whole site of samples up on CodePlex. (via Don Syme)
  • Jeff Atwood is annoyed at how many different products you have to install to get a current & complete setup of VS 2005. Of course, MS shipped two parts of that stack since VS05 shipped (TFS & DBPro), three service packs (VS05 SP1, SQL 05 SP2 and DBPro SR1) and a major OS upgrade (VS Vista update). Doesn't the same thing happen with any shipping product after a few years? BTW, if this is such a huge hassle, I wonder why Jeff doesn't create a slipstreamed VS installer?
  • Udi Dahan has a great post on estimation where he claims "Developers don’t know how to estimate." No argument, but the way he phrases it sounds like it's the developer's fault they suck at estimation. It's not. Developing - by definition - is building something you've never built before. Is it any surprise we suck at estimating how long it will take us to do something we've never done before?
Posted By Harry Pierson at 10:15 AM Pacific Daylight Time

Wednesday, July 25, 2007

*Now* How Much Would You Pay For This Code?

Via Larkware and InfoQ, I discovered a great post on code reuse by Dennis Forbes: Internal Code Reuse Considered Dangerous. I've written about reuse before, albeit in the context of services. But where I wrote about the impact of context on reuse (high context == low or no reuse), Dennis focused on the idea of accidental reuse. Here's the money quote from Dennis:

Code reuse doesn't happen by accident, or as an incidental - reusable code is designed and developed to be generalized reusable code. Code reuse as a by-product of project development, usually the way organizations attempt to pursue it, is almost always detrimental to both the project and anyone tasked with reusing the code in the future. [Emphasis in original]

I've seen many initiatives of varying "officialness" to identify and produce reusable code assets over the years, both inside and outside Microsoft. Dennis' point that code has to be specifically designed to be reusable is right on the money. Accidental code (or service) reuse just doesn't happen. Dennis goes so far as to describe such efforts as "almost always detrimental to both the project and anyone tasked with reusing the code in the future".

One of the more recent code reuse efforts I've seen went so far as to identify a reusable asset lifecycle model. While it was fairly detailed at the lifecycle steps that came after said asset came into existence, it was maddeningly vague as to how these reusable assets got built in the first place. The lifecycle said that a reusable asset "comes into existence during the planning phases". That's EA-speak for "and then a miracle happens".

Obviously, the hard part about reusable assets is designing and building them in the first place. So the fact that they skimped on this part of the lifecycle made it very clear they had no chance of success with the project. I shot back the following questions, but never got a response. If you are attempting such a reuse effort, I'd strongly advise answering these questions first:

  • How does a project know a given asset is reusable?
  • How does a project design a given asset to be reusable?
  • How do you incent (incentivize?) a project to invest the extra resources (time, people, money) in takes to generalize an asset to be reusable?

And to steal one from Dennis:

  • What, realistically, would competitors and new entrants in the field offer for a given reusable asset?

Carl Lewis wonders Is your code worthless? As a reusable asset, probably yes.

Posted By Harry Pierson at 2:47 PM Pacific Daylight Time

Monday, July 23, 2007

Morning Coffee 104

  • I'm presenting at a an internal training conference today and tomorrow, so my Morning Coffee roundup posts will be lighter than usual. On the other hand, I'm taking a bus downtown to the convention center, so I might write something more substantial on the way there and back. Or maybe I'll just read.
  • My wife's blogging will also be light, because she's got her nose buried in a book. If I do read something to or from the conference, it's not that book because she won't let me near it until she's done! :)
  • Speaking of "that book", Werner Vogel drops a few details about how well Amazon handled 1.3 million pre-orders that were delivered on Saturday (including our copy).
  • First drop of IronRuby is available. For now, you can get it from John Lam's blog. Unlike IronPython, IronRuby will be hosted at RubyForge, not CodePlex, but the site isn't set up yet. Other big news is that the IronRuby team will be accepting external contributions. Are these encouraging signs to the Ruby community?
  • More MS Research goodness: a new drop of Spec# is available. I've written about Spec# before, but haven't had the time to dig into it. (via Larkware)
  • Scott Hanselman takes the red pill. Congrats!
  • Speaking of Scott, he forwards on advice to remove a programmatic crutch. Good advice. Not to go all Petzold on Visual Studio, but I would guess the IDE is the biggest crutch out there. As for giving up compulsively checking email, if that's a goal Scott, I think you might have joined the wrong company...
Posted By Harry Pierson at 8:15 AM Pacific Daylight Time

Thursday, July 12, 2007

Thoughts on C# Fluent Interfaces

Martin Fowler points to a couple of articles by Anders Norås on building internal / embedded domain specific languages in C#. Anders has built a DSL for creating calendar events and tasks, like you might expect to do in Outlook. Here's an example:

ToDoComponent planningTask =
   Plan.ToDo("Plan project X").
      StartingNow.
      MustBeCompletedBy("2007.08.17").
      ClassifyAs("Public");
planningTask.Save();

EventComponent planningMeeting =
   Plan.Event("Project planning meeting").
      RelatedTo(planningTask).
      WithPriority(1).
      At("Head office").
      OrganizedBy("jane@megacorp.com", "Jane Doe").
      StartingAt("12:00").Lasting(45).Minutes.
      Attendants(
         "peter@megacorp.com",
         "paul@megacorp.com",
         "mary@contractor.com").AreRequired.
      Attendant("john@megacorp.com").IsOptional.
      Resource("Projector").IsRequired.
      ClassifyAs("Public").
      CategorizeAs("Businees", "Development").
      Recurring.Until(2008).EverySingle.Week.On(Day.Thursday).
      Except.Each.Year.In(Month.July | Month.August);
planningMeeting.SendInvitations();

It may not be as clean as a say a Ruby version might be, but even with all the parens and periods it's still pretty readable. Fowler calls this a fluent interface, a term I like better than "internal DSL".

Two things jumped out at me reading Anders' entry on how he built this fluent interface. First, there's a lot of code to make this work. Anders didn't publish the code, but he did admit:

"Believe me, there will be a lot of code when you're done. I'm almost there with this DSL, and at the time of writing it consists of 58 classes not including the API and tests."

That's 58 classes just to implement the fluent interface, not counting the underlying EventComponent API. That's a lot of non-business logic code to write. How many projects are willing to invest that kind of time and effort to build a fluent interface? (I would guess "not many")

However, I bet there's a lot of template-izable code in Anders fluent interface. When he writes about keeping the language consistent by "creating branches within our grammar using different descriptor objects", I can help but think about parser development with YACC and the like. These tools typically use a DSL like BNF. Maybe we could build a DSL for building fluent interfaces?

Second, Anders makes a very interesting point about the structure of the fluent interface code:

Writing DSLs is a little different from the regular object oriented programming style. You might have noticed that the Plan class has a verb for its name rather than the usual noun. This allows us to have a natural starting point for writing out the "sentence" explaining our intention.

Where have you seen this verb based approach before? Powershell cmdlets.

Windows PowerShell uses a verb-noun pair format for the names of cmdlets and their derived .NET classes. For example, the Get-Command cmdlet provided by Windows PowerShell is used to retrieve all commands registered in the Windows PowerShell shell. The verb part of the name identifies the action that the cmdlet performs. The noun part of the name identifies the entity on which the action is performed.
[Cmdlet Verb Names, MSDN Library]

I've written about this aspect of PowerShell before:

In OO, most of the focus is on objects, naturally. However, administrators (i.e. the target audience of PS) tend to be much more task or action focused than object focused. Most OO languages don't have actions as a first class citizens within the language. C# and Java don't even allow stand alone functions - they always have to be at least static members of a class.

I'm fairly sure there are many reasons why strongly typed OO languages aren't popular among administrators. I'm not going to go down the static/dynamic typing rat hole here, but I would guess the object/action language tradeoff is almost as important as the typing tradeoff. What's nice about PowerShell is that while it has strong object support, it also has strong action support as well. In PS, actions are called Cmdlets. While I'm not a big fan of the name, having first class support for them in PS is one of the things I find most interesting.
[Perusing Powershell Part 1: Get-SQLServer, DevHawk]

While there is no first-class support for verbs or actions in C#, it looks like Anders has essentially rolled his own. For example, his Plan.Event() method returns a new EventDescriptor object. Subsequent calls on this object (RelatedTo, WithPriority, OrganizedBy) change the internal state of this EventDescriptor object. When you reach the end of the chain of calls, EventDescriptor has an implicit EventComponent cast operator that creates a new EventComponent with all the data that's been collected along the chain by the EventDescriptor.

Again, I can help but think a significant amount of code in this approach can be generalized and the creation automated. Also, I wonder if any of the new C# 3.0 capabilities could be used to improve the implementation. For example, would Extension Methods make it easier to build the fluent interface? Maybe / Maybe not. Regardless, Anders has given me a lot to noodle on.

Posted By Harry Pierson at 2:38 PM Pacific Daylight Time

Friday, June 22, 2007

Morning Coffee 93

  • newcapsjersey The Washington Capitals unveil their new jersey tonight, though they have a picture on their web site. I've got mixed feelings, though I'm trying to reserve judgement until I see it "in action". I like that they're back to the traditional Caps colors. But the Caps have jersey change fatigue. They only had the screaming eagle jersey for twelve years, and they swapped out the blue jersey for the black one (that started life as a third jersey) somewhere along the line.
  • Lawrence Lessig hangs up his IP spurs to go after the deep corruption of the political process. He points out that after a decade focusing on IP, he's learned all he is going to about these issues so he decided (among other reasons) that it was time to start fresh learning about something new. I keep telling my kids that "always keep learning" is one of the secrets to life. This move by Lessig is the embodiment of that principle. Good for him. (via John Lam)
  • My old team keep chugging along. They've recently added "special coverage" sections on Agile Development and Enterprise Architecture.
  • Miguel de Icaza details the three week "hackathon" (his words, not mine) they went thru to get a working version of Silverlight on Mono - aka Moonlight - in time for ReMix 07 in Paris. It's an impressive engineering achievement, to say the least. Also, it's nice to see the folks from Microsoft France invite Miguel to come be a part of their keynote. (via Larry O'Brien)
  • Rob Bazinet points out VisualSVN in response to my question about SVN clients other than Tortoise. Like AnkhSVN, VisualSVN snaps into Visual Studio. However, where AnkhSVN is a native SVN implementation, VisualSVN depends on Tortoise. Scott Bellware wrote "VisualSVN takes a novel approach to bringing SVN into the Visual Studio IDE... it brings Tortoise into the IDE!". So it still sounds like Tortoise is the SVN client everyone cares about.
  • Scott Berkun details a variety of immature development and management methodologies, including Development By Denial (DBD), Cover Your Ass Engineering (CYAE) and my personal favorite Asshole Driven development (ADD). Scott Hanselman suggests looking around and making sure you're not said asshole. I tend to be somewhat...how should I say it?...strong willed about the direction projects I work on should take. My current project is about driving a paradigm shift to service orientation, and I don't think you can't drive that kind of change without being somewhat strong willed. It's a thin line between strong willed and asshole and hopefully I come down on the right side of that line more often than not.
Posted By Harry Pierson at 9:50 AM Pacific Daylight Time

Wednesday, May 16, 2007

Morning Coffee 78

  • Ian Griffiths posts a much longer version of "Even though the runtime supports multiple languages, most programmers are only fluent in one." (via Larkware)
  • I wrote yesterday that Pat Helland's first post back was light on the tech talk. Luckily (for us) he takes the bus to work so he has plenty of time to write blog entries. Today's post is his "personal opinion about how computers suck". Money Quote: "We try too hard as an industry.  Frequently, we build big and expensive datacenters and deploy big and expensive computers. In many cases, comparable behavior can be achieved with a lot of crappy machines which cost less than the big expensive one."
  • Steve Jones wrote that CRUD is CRAP. I agree 100%, but for additional reasons. Not only is it boooooring to write, it also delegates control outside of the service which I think is a mistake. Check out this post from Maarten Mullender who advised to do CRUD only when you can afford it.
  • MIT Media Lab has created Scratch "a new programming language that makes it easy to create your own interactive stories, animations, games, music, and art -- and share your creations on the web" targeted at kids 8 and up. It's a dynamic visual programming language that looks like Lego. Between Scratch, Boku and Phrogram I think my kids will have lots of fun learning to program like daddy does. (via GeekDad)
  • Halo 3 is coming September 25th! I foresee lots of people calling in sick that day. And the next. And the rest of the week, etc. etc. etc.
Posted By Harry Pierson at 12:01 PM Pacific Daylight Time

Wednesday, May 02, 2007

Hawkeye on Silverlight

While I was crusing the zoo with the family on Monday, everyone else was focused on the big announcement coming out of MIX. Short version of the press release: the next version of Silverlight contains a small, cross platform CLR. As you might imagine, this is somewhat significant. Check out reaction from TechCrunch, Sam Gentile and Scott Hanselman.

A year ago, I wrote "Where else should the CLR live?" At the time, I was talking about XNA (which had just been announced) though I was aware of the plans around what I think is now officially called CoreCLR (got the name from Scott's post). The first time I heard about this, it literally floored me. Part of me is surprised that in the year since then the news didn't leak and no one figured it out. I mean, doesn't it seem sorta obvious, in retrospect, that a Silverlight should run on CLR? I mean, if we can shrink the CLR down to fit on a watch, getting it into the browser seems like a no-brainer. On the other hand, it's such a huge departure from "Windows, Windows, Windows" that I wonder if most people had (have?) a hard time wrapping their mind around it.

(Actually, in searching for CoreCLR, I discovered this post from last summer basically confirming "the CoreCLR team working on the Macintosh version of the MiniCLR that's going into WPF/E". So it did leak, but it seems to have been met with significant skepticism and didn't make much news. )

Now that you know all about Silverlight and CoreCLR, go back and re-read my Virtuous Cycle of Virtual Platforms post. Especially the last paragraph (complete with the bad grammar):

If the end user isn’t committed to a virtual platform like Flash, then who is? The developers who build software for that virtual platform. This is Virtuous Cycle of Virtual Platforms between the platform and developers instead of the platform and users. In the old model, developers go where the users are. In the new model, users go to where developers are. And developers go where they can be most effective.

Silverlight vs Flash looks to me like the next big platform war competition. It's just getting started, so you can't say with any certainty which platform will be "most effective". But early Silverlight reviews are pretty impressive. TechCrunch's Michael Arrington wrote that Silverlight "makes Flash/Flex look like an absolute toy". That doesn't erase Flash Player's head start in the RIA space, but it certainly makes catching and surpassing Flash sound feasible. I suspect most people didn't think that sounded at all feasible last week.

Of course, while catching Flash may sound feasible, Microsoft is a long way from achieving that goal. While the point of my earlier post is that that market penetration doesn't provide much advantage in the virtual platform market, Adobe does derive significant advantage from shipping nine versions of Flash while we haven't quite shipped the first version of Silverlight yet. Also, while I'm fairly sure the number of .NET developers far exceeds the number of Flash developers (anyone have hard numbers?), I would also expect that the number designers using Flash far exceeds the number of designers using Expression (given that MSFT only just shipped Expression on this week). I believe an important facet to the Silverlight / Flash platform competition will be a race to woo the competitor's core constituency. Can Microsoft woo more designers with Expression than Adobe can woo developers with Flex? We'll see.

I'm also curious to see how people's perspective of Adobe's Apollo project changes in the wake of the Silverlight/CoreCLR announcement. From my perspective, both Microsoft and Adobe are trying to unify web and desktop development. Not surprisingly, each is trying to unify around the model where they're stronger: Apollo takes the web development paradigm (Flash, HTML, AJAX and JavaScript) to the desktop while Silverlight takes desktop development paradigm (WPF, CLR) to the web. I'm sure you can guess which paradigm I think will be more successful, but how will the market react? Again, we'll see.

Posted By Harry Pierson at 10:54 AM Pacific Daylight Time

Monday, March 19, 2007

VSTDB, Where Have You Been All My Life?

Honestly, this post started off as a rant entitled "Is it Me, or is DB Development a Pain in the Ass?" about the sorry state of database development tools in Visual Studio. But in searching around on MSDN for information about the built-in "Database Project" type (which could more accurately be called "just a bunch of SQL scripts"), I stumbled across information about the Database Professionals edition of Visual Studio Team System. That's right, I had forgotten that we shipped this late last year.

I short, VSTDB (or whatever the "official" acronym is) is 90% of what I was looking for in a DB dev tool. Sure, it's not perfect, but it's a massive improvement over the previous state of the art.

The primary feature of VSTDB is the ability to "build" your database the same way you build your code. You use lots of small scripts that get compiled together into a model (for lack of a better term) of the database as you've defined it. That model can be deployed to a new database instance or used to update an existing instance. You can also compare that model against an existing database in order to determine what's changed and automatically build update SQL scripts for the DBA's to run in the production environment (since you don't want your developers doing that).

It takes a little getting used to, but the "lots of small scripts" approach has a lot of upside. If you have a table with a primary key, you're supposed to define the primary key, indexes, constraints, triggers, etc. in separate scripts from table creation script. This makes things much easier when you're trying to figure out what's changed in your source control system.

VSTDB has a variety of other cool looking features like data generation and unit testing, but I haven't really dug into them much yet. One thing that VSTDB supports that I wasn't expecting was Service Broker! SQL Management Studio has limited SSB support - if you want to create new SSB objects you have to write the DDL directly. VSTDB requires you to write the SSB DDL also (it makes you write DDL for everything, see below) but it at least has templates for all the SSB object types. Very Cool!

Of course, there are always things that could be improved. The T-SQL editor does syntax highlighting but not IntelliSense. It doesn't support the existing visual database tools like the Table Designer. And while you can build T-SQL stored procs, functions, types, etc, VSTDB doesn't support the development of managed SQLCLR stored procs, et.al. Things to work on for v2, I suppose. 

If you're using VS Team Suite, you can download an add-on that adds VSTDB functionality to your existing VSTS installation. It's only 8MB, so it's definitely the way to go for Team Suite users.

Posted By Harry Pierson at 4:15 PM Pacific Standard Time

Thursday, February 15, 2007

Morning Coffee 32

  • As 24 sputters, Lost hits it's stride. Last nights episode rocked.
  • My old team keeps churning out great stuff. This time, it's the new Composite Applications site.
  • In a follow up to a post from a couple of weeks ago, Joe McKendrick declares that "Rogue IT is Cool". In the spirit of rogueness, maybe we get the Rogue Ale guys to whip up some IT themed beers? Service Oriented Stout? Architecture Ale? Programmer's Porter? (you get the idea)
  • Scott Hanselman provides a detailed look at static analysis in general and NDepend in particular. I hereby coin the acronym YAGTSR, which stands for "Yet Another Great Tool Scott Recommends".
  • Jeff Atwood thinks we should code smaller. He lists some positive aspects of small code (less bugs, less chance of failure, etc) and links to Bob Koss talking about the negative aspects of big code (harder to understand, harder to reuse, higher likelihood of duplication, etc). OK, I'm down, but where's the how? I've got fairly radical ideas on this subject: regularly throw out your old code and start over. In movie making, there's this idea that you have to "kill your babies". Not literally of course, they're talking about having the willingness to scrap your pet idea, favorite line, coolest shot, etc. for the sake of the bigger picture. I think the same goes for making software.
Posted By Harry Pierson at 10:47 AM Pacific Standard Time

Tuesday, January 23, 2007

DevHawk.ColorConsoleTraceListener

As mentioned this morning, I factored the ColorConsoleTraceListener code into a seperate assembly and added config support. It's pretty simple, but I find it useful. Let me know if you do too.

Download DevHawk.ColorConsoleTraceListener here.

Posted By Harry Pierson at 4:27 PM Pacific Standard Time

Friday, November 03, 2006

Slight Workflow Annoyance

One of the cool things about WF is that you can specify the Guid it uses to identify a workflow instance. WorkflowRuntime.CreateWorkflow has an overload (actually two) where you can specify said workflow instance identifier. This is awesome for using WF with Service Broker, as Service Broker already has the idea of a conversation group which is roughly analogous to a workflow instance. Conversation groups even use a Guid identifier, so there's not even any mapping required to go from conversation group to workflow instance.

However, things get less cool when you call WorkflowRuntime.GetWorkflow. If you call GetWorkflow with a Guid that has no corresponding workflow instance, it throws an InvalidOperationException instead of just returning null. That seems like an odd choice. If you're going to support specifying the instance identifier when you create the workflow instance, doesn't it make sense that you should also gracefully support the scenario where an instance identifier is invalid?

I see two ways to deal with this:

  • Iterate through the list of loaded and persisted workflow instances looking for the one in question.
  • Call GetWorkflow and swallow the exception.

I ended up picking the "Swallow the Exception" approach as I can't imagine the iteration thru every loaded and persisted instance would be very performant. But swallowing exceptions always makes me feel icky. I'm a fan of the "exceptions only for exceptional situations" approach and as far as I'm concerned, an invalid instance identifier isn't that exceptional. Still, it's a minor annoyance, especially given how cool it is to be able to specify the workflow instance identifier in the first place.

Posted By Harry Pierson at 11:36 AM Pacific Standard Time

Wednesday, October 11, 2006

More Stuff I Didn't Know About WF

4. All communication from the host to the workflows goes thru the WorkflowQueuingService. Unlike other WF services, the queuing service is not replaceable. Communication from a workflow activity instance to the host goes thru some other service. There is no "default" activity -> host communication service, though WF ships with the ExternalDataExchangeService. You have to manually add the ExternalDataExchangeService to your workflow runtime instance. WF also includes the wca.exe utility which generates strongly typed HandleExternalEvent and CallExternalMethod activities for your workflow. And according to Jon, the External Data Exchange system was added specifically for SharePoint.

5. The built-in sequential and state machine workflows are customizable. So if you wanted to have a custom designer or validation experience for an otherwise standard sequential or state machine workflow, you can inherit from the standard workflow type and add the custom validation and / or designer support. For example, as I wrote earlier, you can load a workflow from XAML. XAML workflows can't support the Code Activity. So if you wanted to use the standard sequence designer but disallow the use of the Code Activity, you wouldn't have to rewrite the sequence activity from scratch.

6. You can execute workflows across a farm, similar to how you build a web farm. Workflows that get persisted to the persistence service can be loaded on any node in the farm. Of course, like web servers in a farm, you'd have to have the same bits installed on all the machines in the workflow farm. Sounds like an opportunity for something like Application Center for WF.

7. The built in SQL Persistence Service is a toy. When you start your workflow engine, the SQL Persistence Service will auto-load all the existing persisted workflows into memory, as an "optimization". So if you have thousands of order workflows persisted in your database and you decide to bring another workflow processing node online, that new workflow processing node will happily load ALL of the outstanding orders that it can find in the database. This service should have been included as a sample like the file based persistence service sample rather than described as "a fully functional persistence service" in the docs.

8. WF Web Service integration is also a toy. WF leverages basic ASMX for all it's web service integration, so your only choice for web services - consuming or exposing - is atomic request/response style services. You can have a workflow with multiple operations, but the default ASMX hosting infrastructure squirrels the WF Instance ID in the ASP.NET session, which will time out in twenty minutes (by default). Furthermore, the built in ASMX workflow host doesn't provide an option to specify the web service namespace, so it ends up with the default http://tempuri.org namespace. Again, like the SQL Persistence, this should have been included as a sample, not included in the standard activities.

9. Activities can generate code. In the previous item, I mentioned there's basic ASMX hosting integration for a workflows. Turns out the WebService Activities generate that hosting code as part of the workflow compilation process. So in other words, if you add a WebService activity to your workflow, the activity will inject the custom ASMX hosting code into your compiled workflow. In this WebService activity case, the injected code isn't very good, but the fact you can do this at all is very cool.

Posted By Harry Pierson at 1:52 PM Pacific Daylight Time

Monday, October 09, 2006

Cool Toy From the Teacher

As I wrote this morning, I'm in training this week. The instructor (who I wrote earlier is "pretty good") is Jon Flanders. I didn't recognize his name, but I did recognize his Atlas based WF Designer that he released a month and a half ago or so. It's a cool piece of work so it's doubly cool (for me anyway) that he's teaching this class.

Posted By Harry Pierson at 3:31 PM Pacific Daylight Time

Things I Didn't Realize About WF

1. You can customize how you load workflows. My favorite part of Customizing the Microsoft® .NET Framework Common Language Runtime is custom loading assemblies from a structured storage file. In WF, you can load workflows by type or from XAML. Of course, these the XAML - or even the types - can be loaded from anywhere, or even generated on the fly. If you need more control, you can swap out the default workflow loader service with one of your own creation.

2. You can swap out the default workflow scheduler. How about a scheduler based on the Concurrency and Coordination Runtime (CCR)?

Side note - How about a official home page for CCR? And while I'm asking, how about a download for CCR separate from MS Robotics Studio?

3. You can add any object to the workflow runtime as a service. You're not limited the services the WF runtime knows about. Of course, WF won't use your service, but you can build activities that use it. This is likely to be huge for getting data in and out of the workflow instance.

Posted By Harry Pierson at 2:45 PM Pacific Daylight Time

Hawkeye on Standard WCF Bindings

I'm in WF/WCF training this week, so any daytime blogging will be on breaks and at lunch. So far, the instructor is pretty good, though we've only covered "intro to WCF" so far. Given the amount of content he's laid out, I wonder how were going to get through it all.

The instructor said something interesting as he was going over the bindings that come "out of the box" with WCF. He commented that these bindings were the ones the WCF developers thought would be used most often. Of course, he doesn't speak for the WCF team, but it does make some kind of sense. You can extend WCF to support any potential binding, but it makes sense the WCF team would want to enable the common cases without having to write much code.

So take a look at the list of nine standard bindings. Given that WCF is about unifying the windows stack for distributed computing, most of the bindings are at least conceptually similar or in some cases leverage previous distributed paradigms and technologies. You have two HTTP based bindings (with and without WS-* extensions) which are analogous to ASMX and WSE. There's a TCP binding which is comparable to .NET remoting. And there are two MSMQ bindings (with and without SOAP support) for those needing to interop with existing MSMQ systems or who need durable messaging.

That leaves four "new" standard bindings. These are interesting as they don't herald back to previous technologies and paradigms of distributed computing (at least on the Windows platform) but still the WCF team thought enough of the scenarios they enable to include them in the box with WCF. For example, I the wsFederationHttpBinding is designed to take advantage of the significant investment they've made in federated identity. Several years ago, Don Box talked about shrinking the service metaphor rather than stretching the object metaphor across the network. NetNamedPipesBinding is an obvious implementation of that vision. And wsDualHttpBinding is a way to take advantage of the WCF's duplex channel shape while still using HTTP as your transport.

Finally, there's netPeerTCPBinding. From where I sit, this is a radical addition to an otherwise standard set of bindings. Now don't get me wrong, I'm glad it's there. But I'm guessing developers who look at it are more likely to think along the lines of "Wow, what can I do with this?" rather than "Yes, I expected that to be there." Certainly, that was my thought process.

Anyone got any cool uses for netPeerTCPBinding?

Posted By Harry Pierson at 12:55 PM Pacific Daylight Time

Friday, September 29, 2006

New Version of Gamer Card Writer Plugin

Gamer Card Writer Plugin There's a new version of WL Writer, so I spent a little time updating my Gamer Card Writer Plugin. The big addition in this version is support for the different card styles from MyGamerCard.net. Also, I added a preview, so you can see what the card will look like before you insert it into your post.

Rather than post it here, I submitted it to the Windows Live Gallery, since they've added an area for Writer Plugins. You can download it from there.

Posted By Harry Pierson at 5:15 PM Pacific Daylight Time

Thursday, September 21, 2006

Revisiting the AJAX Ecosystem

Seven months and one job ago, I wrote this about AJAX toolkits:

The network effect that Dion doesn't consider is the component ecosystem phenomenon that Microsoft has a ton of experience with. Old school VB, COM/ActiveX and .NET have all had large ecosystems of components and controls evolve that extend the functionality of the baseline development platform. There's no reason to believe that won't happen with Atlas. I think it's wrong to describe Atlas as a monolith or self-contained or enclosing. It's an extensible baseline platform - i.e. the baseline functionality is set down once at the development platform and the ecosystem can extend it from there. Sure, overlapping extensions happen (how many rich text editor components are there for ASP.NET?) but at least they all have basic compatibility.

I bring this up now because I saw on Shawn Burke's blog that they've shipped the September release of the Atlas Control Toolkit. There are now 25 different controls (they had 10 in their first release). But there's something more significant than the addition of 15 controls overall:

Slider is just a super-useful little control.  There are so many times when you want to let users use this type of UI.  Another great thing about Slider is that it's a 3rd party contribution, from Garbin, who did a great job on it. (emphasis added)
[Atlas Control Toolkit September Release]

I just wanted to brag that I called this 7 months ago.

Posted By Harry Pierson at 9:09 PM Pacific Daylight Time

Sunday, September 17, 2006

Managed Lex and Yacc

Buried deep in the docs for v3 of the Visual Studio SDK is something called the Managed Babel System. Babel - in the context of Visual Studio - is the framework for creating language services for stuff like syntax highlighting, brace matching, and IntelliSense completion. As part of the Managed version of Babel, the VS SDK includes the Managed Package Lex Scanner Generator (MPLEX) and the Managed Package Parser Generator (MPPG). Online docs are pretty thin, but there are a few white papers in the additional documentation of the VS SDK install.

Interestingly enough, the white papers were written by John Gough of QUT's Programming Languages and Systems group. John wrote Compiling for the .NET Common Language Runtime and PLAS has several interesting language projects including Metaphor and Ruby.NET. As you might expect for a group that focuses on languages on .NET, they have a managed version of YACC called GPPG available and John said at Lang.NET that they would be releasing a managed version of LEX "soon". I'm thinking that QUT's GPPG/GPLEX combo has been absorbed into the VS SDK and renamed MPPG/MPLEX. Unfortunately, my laptop power connector is broken, so I can't verify this until Monday.

It's not a Rosetta stone and the lex/yacc model is getting pretty long in the tooth, but I'm thinking at least Larry O'Brien will be interested in these tools.

UPDATE - Apparently, this is somewhat old news, as per Aaron Marten:

The tools we're including are called MPPG & MPLex (which stand for Managed Package Parser Generator and Managed Package Lexer). They are derivative works from the open-source GPPG/GPLex tools developed at the Queensland University of Technology.
[Managed Language Tools in Visual Studio 2005 SDK]

Posted By Harry Pierson at 9:08 AM Pacific Daylight Time

Friday, September 15, 2006

Gamer Card Plugin for WL Writer

In my last post, I wanted to include a link to my gamer card, showing the NHL 07 logo on it. It turns out that in addition to the "official" gamer card from Xbox.com, there's also the MyGamerCard.net site which provides both image and flash versions of gamer cards. Since I'm using Windows Live Writer, and I hear it's really easy to extend, I decided to throw together a plugin for inserting Gamer Cards. It was, as advertised, extremely easy. I spent more time laying out the dialog box than I did writing the code to interface with WL Writer.

The plug in provides basically five Gamer Card options:

  • Standard Xbox.com Gamer Card
  • MGC.net Gamer Card image with link to Xbox.com Profile
  • MGC.net Gamer Card image with link to MGC.net Profile
  • MGC.net Gamer Card image only
  • MGC.net Gamer Card flash movie

I'm interested in feedback and suggestions for future versions. MyGamerCard.net provides ten different Gamer Card styles (that's my Gamer Card in the "H2O" style to the left) so that's an obvious enhancement for another day. I'd also like to evolve the plugin into a "Smart Content Source", which allows you to edit the content after it's been created (like the default "Insert Map" option). Finally, I'm thinking of adding support for GamerScoreChart.com.

Download GamerCard.WriterPlugin.Setup.zip (142.41 KB) and enjoy. Let me know what you think.

Posted By Harry Pierson at 4:48 PM Pacific Daylight Time

Thursday, September 07, 2006

Python and DSLs

When I read Larry O'Brien's post IronPython as a Foundation for DSLs, I had a strong sense of deja-vu. I went thru a very similar thought process when I discovered the early versions of IronPython were written in Python. I figured that meant Python must have some support that makes building compilers easier. Unfortunately, that doesn't turn out to be the case. Python provides a standard module called parser which "provides an interface to Python's internal parser". That means that compiling Python is easy, but there's no support for compiling any language other than Python.

I've been doing a little experimenting in this space. First, as I've written before, I've been playing with parsing expression grammars. Second, I want to take a close look at Metaphor from QUT:

Metaphor is a programming language with support for type-safe run-time code generation -- a form of meta-programming. Metaphor is based on a subset of C# or Java and combines the imperative, object-oriented nature of these languages with the multi-stage programming constructs from MetaOCaml. Metaphor uses the static type system of multi-stage languages to achieve compile-time safety of run-time generated code...

Metaphor is implemented as a compiler on the Microsoft CLR.

Finally, I need to take a closer look at ANTLR. Don't know how I missed it, but I had never seen ANTLRWorks until Larry linked to it.

Posted By Harry Pierson at 8:12 PM Pacific Daylight Time

Monday, August 21, 2006

Language Features I Wish C# Had - Symbols

Ruby's symbols are often talked about in terms of efficiency - taking up less memory and executing faster. While these are both laudable goals, symbols are more than just performance improvers. The ability to name things is valuable semantically. Take a look thru p&p's Composite UI AppBlock and you'll see strings used as names for things all over the place. It's great for loose coupling, you see. But how do you tell the difference between a string used as a name and a string used for some other reason like user input? You can't.

Rails makes extensive use of symbols - anyone who has Rolled on Rails has seen "scaffold :recipe". That's just the tip of the iceberg. Rails uses symbols extensively across both ActionPack and ActiveRecord (and probably others I'm not familiar with). It's a great approach, but one that's unique to Ruby as far as I'm aware.

Posted By Harry Pierson at 11:05 PM Pacific Daylight Time

Language Features I Wish C# Had - Tuples

Several languages, such as Python, have the concept of a Tuple built into the lanugage. One of things it's used for in Python is multiple return values. So you can call "return x,y" to return two values. Of course, C# can only return one. If you need to return more values, you have to define out parameters.

LINQ / C# 3.0 / VB 9 support the idea of anonymous types, which is similar to a tuple. The big difference is that, because they're anonymous, they can't leave the scope they're defined in. In other words, they're great within a function, but if you want to pass them out of your function type-safely, you have to define a non-anonymous type for them.

Interestingly enough, F# supports tuples, though it a bit of a hack. Since the CLR doesn't support tuples, F# basically defines different Tuple classes for up to seven tuple parameters (i.e. Tuple<t1,t2,t3,t4,t5,t6,t7>), For .NET 1.x, it's even worse - they have to define different type names (Tuple2, Tuple3, etc). Ugh.

Update - Robert Pickering pointed out that F#'s tuple implementation is entirely transparent inside of F#. He's right - I was writing from the perspective of a C# developer using F#'s implementation of tuples. Maybe I need to be looking closer at F#?

Posted By Harry Pierson at 11:01 PM Pacific Daylight Time

Tuesday, August 15, 2006

Modular Compilers

During Lang.NET, I ended up sitting next to Hua Ming, who's been working on the .NET Classbox project I wrote about previously. .NET Classbox introduces a new syntax for "using" to C# - basically, you can use individual classes as well as whole namespaces, and you can extend the individual classes you use. Obviously, that meant having a custom compiler that was 99% vanilla C# + the extra classbox syntax. Rather than building a C# compiler from scratch, the Classbox project extended the Mono Project C# compiler. Hua described the process as taking a "huge amount of time" and he described the compiler as "a monster". Now, I'm not trying to knock Mono here, I imagine our C# compiler is just as hard to work with. SSCLI's C# compiler directory is 5.5MB of source code alone spread across 126 .h and 68 .cpp files.

Is it just me, or does it seem crazy to have to muck about with such a large code base in order to add a relatively simple language feature? What I'd like to see is a more modular way of building compilers, so that integrating a small language feature like classbox would be a small amount of effort.

Of course, there is some work that's been done in this space. MS Research had a Research C# compiler paper, but it's three years old and one of the two authors has moved on to a cool product group job. I also discovered SUIF and the National Compiler Infrastructure Project, but these don't look like they've been updated in a while.

I like the model that the Research C# compiler proposes. Basically, it looks like this:

  1. Specify the grammar in a modular way. In the paper, the grammar is specified in an Excel file, and you can use multiple files in a modular fashion. i.e. have one file for the core language and another for the extensions.
  2. Late bind a grammar production to an action. Typically, in a lex/yacc style scenario, you embed the action code for a given production directly into the grammar, which makes it extremely hard to extend the existing syntax. In the paper, each production is linked with an instance of a type, so swapping out a new type would seem to be possible.
  3. Generate an abstract syntax tree, that gets processed by multiple visitors. From the paper, the compiler has broken the "traditional" compiler steps - bind, typecheck, rewrite and generate binary (in this case IL) - into separate visitors. That makes adding extra steps or chaning existing steps fairly straightforward.

The only think I don't like about this specific approach is their Excel file based parser generator. It's a huge step beyond the LEX/YACC approach as it is scanner-less (having separate scanner and parser steps kills any chance of modularity) but it still has to deal with ambiguous grammars. Personally, I've been looking at Parsing Expression Grammars in part because they aren't ambiguous. For programming lanugages, support ambiguity in the grammar is a bug, not a feature.

Posted By Harry Pierson at 10:46 AM Pacific Daylight Time

Wednesday, August 02, 2006

Lang.NET Is Helping Game Developers

Back at POPL 06, Tim Sweeny of Epic Games delivered a talk titled "The Next Mainstream Programming Language: A Game Developer’s Perspective". I imagine he was a little too busy getting Gears of War out the door to attend the Lang.NET Symposium. Too bad, as there were interesting solutions presented that solved two of the issues Tim identified in his his POPL talk.

One of the issues Tim identified is one of Modularity. Gears of War uses the Unreal Engine 3. In other words, UE3 is a game framework and GoW uses that framework. As you might expect, this framework is exposed as a hierarchy of objects. Tim's example had "Actor" as the base class in the framework hierarchy, with classes like "Player", "Enemy" and "InventoryItem" inheriting from "Actor". Then he had game-specific classes like "Dragon" and "Sword" inheriting from the generic "Enemy" class. The problem is that game developers also need to extend the functionality of the framework's base classes. That is, they need a game-specific version of "Actor" or "InventoryItem" in addition to the game specific subclasses like "Dragon" and "Sword". Unfortunately, the current generation of languages don't support this, so game developers often clone the entire framework, which is error-prone and hard to support.

At Lang.NET, Professor Markus Lumpe demonstrated an implementation of the Classbox concept for .NET. Classbox is essentially a solution to the modularity problem Tim identified. They've modified C#'s using syntax to apply to individual classes. When using a class in this fashion, you can add extensions to it like new methods and new fields. I'm not sure the scope of these extensions - whether it's the file with the using clause or the containing assembly - but it's key to realize this is a local extension. The original framework isn't modified at all. Within you assembly, the metadata for the extended classes is re-written to include the new extension. So to use Tim's example, if you extended the framework's "Actor" class, it would create a YourGame.Actor class that inherited from the Framework.Actor and contained your extensions. Then it would re-write the inheritance metadata (again, only for your assembly) so classes that inherited from Framework.Actor such as Framework.Enemy and Framework.InventoryItem now inherit from YourGame.Actor.

Now I'm sure there are some nefarious uses of this type of inheritance tree hacking. But there are scenarios such as Tim's Gaming Framework example where this behavior is exactly what you want. I spoke briefly to Markus and at length with Hua Ming, one of Markus' grad students, about perhaps having a keyword indicating that a class is "classbox enabled" rather than allowing any class to be classboxed in this way. Looking forward to their future work.

Another issue Tim identified was Reliability. He called this problem "If the compiler doesn’t beep, my program should work". He showed a very simple method to iterate an index array and transform the associated vertex from a vertex array by a provided matrix. A simple function - four lines of code. Yet, the compiler can't detect null pointer or out-of-bound array access. Adding code to check those runtime conditions would easily double or triple the length of the function. While modern managed languages (C#/VB/Java) have made great strides in eliminating "random memory overwrites" (via type safety) and "memory leaks" (via garbage collection) they don't help you with these other types of dynamic failures.

At Lang.NET, Microsoft Researcher Mike Barnett demonstrated Spec#. Spec# is a superset of C# that solves these and other types of dynamic errors. The idea, in Mike's words, is to better bridge developer intent and code by embedding certain specifications into the code itself. Furthermore, it uses a combination of static and data flow analysis to detect the types of dynamic errors Tim described in his talk. So if you took Tim's simple transform function and fed it into the Spec# compiler, it would warn you of the possible null pointer dereferences. Furthermore, you can eliminate this warning by specifying the caller never pass you a null pointer. This is simply accomplished by adding an exclamation point to the type declaration. In other words, the vertex array method parameter would be declared "Vertex[]! vertices" to indicate you can't pass in a null array. With Spec#, you can also specify method pre and post conditions, which can solve the out-of-bound array access issue, as well as object invariants, which can specify the valid states an object instance can be in.

I didn't see Tim give this presentation, I only saw the slides after the fact. But I get the feeling that one of Tim's points is that game development is extremely cutting edge, and the issues they're running into now will be mainstream issues in a few years. Good to see language researchers are already well on their way to solving these issues.

The only thing I worry about is when will these ideas make it into mainstream languages? And will they be extensions to existing languages - i.e. will C# 4.0 and VB 10 include classboxing and specifications - or will they be entirely new languages? How much can you improve a language by adding features until it collapses under it's own weight?

Posted By Harry Pierson at 12:37 PM Pacific Daylight Time

Tuesday, August 01, 2006

More on Lang.NET

Jason Bock left me a comment that he's covering Lang.NET over at his .NET Languages site. His coverage of day one is here. Looking forward to his coverage of day two and three!

Posted By Harry Pierson at 3:51 PM Pacific Daylight Time

Lang .NET 2006 Symposium

Yesterday, I attended the Lang .NET 2006 Symposium - basically a public version of the CLR Compiler Lab I went to back in March. Unfortunately, with my new job, I couldn't attend all three days, but I did attend day one. Here we're my thoughts on the various sessions.

Anders Hejlsberg - LINQ and C# 3.0

  • This was basically a rehash of his talk from the March Compiler lab. Makes sense as it was a new audience, but the "Query the Running Processes" demo is getting pretty old. Check out my notes from March for more details.

John Gough - Dealing with Ruby on the CLR

  • John is a professor from the Programming Languages and Systems group at Queensland University of Technology. They're the ones building Ruby.NET. He's also the author of Compiling for the .NET Common Language Runtime, a great if somewhat dated (i.e. .NET 1.0) book.
  • Much of John's talk covered the ground that Jim Hugunin covered back in March around the difficulties of mapping dynamic languages to the static CLR. For example, most Ruby.NET objects are instances of Ruby.Object, with their link to a class - a Ruby.Class - managed by the Ruby.NET runtime rather than leveraging the CLR's built-in class structure.
  • He didn't spend much time talking about the really hard problems like continuations, which I was really hoping he would.
  • There are a series of "allied" tools coming out of this project which look really interesting in their own right:
    • PE File Reader/Writer - a managed component for reading writing DLL and EXE files.
    • Gardens Point Parser Generator (GPPG) - a Yacc/Bison style parser generator, written in and generating C#
    • Gardens Point LEX (GPLEX) - companion to GPPG for generating C# scanners, a la LEX or Flex. Not released yet, but John indicated it would be available in the next couple of weeks.

Christopher Diggins - Cat Programming Language: A Functional Optimization Framework for the CLI

  • I'm fairly sure Christopher doesn't present often. Otherwise he would have know that there's no way to present 107 slides in 30 minutes.
  • Christopher had a hard time expressing why someone would use Cat, even when asked point blank by an audience member. Most of his 107 slides were describing various features of the language. I don't know about the rest of the audience, but I got lost pretty quickly.
  • It's too bad Christopher was so obtuse as a speaker, as Cat seemed pretty interesting. If you skip the first 78 slides (!) of his deck, you get to a slide named "Transformation Engine" which seems to be the primary reason for Cat's existence. The idea seems to be to build a large number (Chris said potentially thousands) of little optimization transformations which are used to "prune" the tree during the binary generation stage of a compiler.
  • The only problem with this (other than the difficulty of following the presentation) is that I don't think compiler optimization is a particularly useful area of study. I subscribe to "Proebsting's Law" on this one: "Advances in compiler optimizations double computing power every 18 years." This implies that programmer productivity is far more important than compiler optimization. Ruby is the latest great example of this phenomenon.

Mark Cooper - Page XML : An XML based domain specific language for developing web applications

  • Page XML is a DSL for building web apps. Unfortunately, it isn't released yet and it was hard to get a sense of what a solution built with Page XML would look like from the individual features described on slides. But I was certainly intrigued.
  • As a DSL, Page XML needs to encode domain-specific abstraction. One example they provided that I thought was cool was their URL handling. Good URL design is an important usability feature. URLs in PageXML are split into constant and variable parts, so in a URL like mysite.com/news/somechannel/4, the "somechannel" and the "4" would be variable parts that would map into parameters that are passed to a page handler. Very cool.
  • There were a large number of what felt like small and simple yet eminently usable features. Too many for me to write down.
  • The only think I didn't like is the use of XML. No only are domain specific concepts like URLs encoded in XML, but also relatively mundane things like loops and if statements. This gets ugly really quickly. I imagine, the creators of Page XML did this so they wouldn't have to build their own parser, but it really hurts the usability of the language.
  • The last point really points to the need for a simple meta-language - a language for building languages. Lex/Yacc and their derivatives just don't cut it. Ruby is good for building internal DSLs, but I'd like something faster and amenable to static typing as well as something more light weight for building external DSLs.

This post is long enough and I have "real" work to do (the downside of leaving evangelism! :) ). I'll post about the afternoon sessions later.

Posted By Harry Pierson at 1:48 PM Pacific Daylight Time

Friday, July 28, 2006

Dynamics of Software Development

Speaking of Sam, he talks today about one-week iterations and having a "shippable" version of the code every week. Reminds me of Jim McCarthy's classic book "Dynamics of Software Development". One of the many rules from that book is "Get to a Known State and Stay There" - I'm sure that sounds familiar to Sam. Other classic rules include "Don't Flip the Bozo Bit" and "When You Slip, Don't Fall".

I just noticed MS Press is putting Dynamics of Software Development back in print with a new cover and a DVD of the the original “21 Rules” presentation that begat the book. It's a great book - I highly recommend it as well as his other book "Software For Your Head". Also, Jim and his wife Michelle are doing a podcast called The McCarthy Show. Subscribed.

Posted By Harry Pierson at 10:38 AM Pacific Daylight Time

Wednesday, June 21, 2006

Alpha Release of Ruby.NET

I'm not sure what a "Preliminary Beta" is but QIT has released a one for their Ruby.NET compiler. They expect to achieve "full semantic compatibility" (can you tell this is an acidemic project?) by the end of the year. Thanks to David Ing for the link.

They claim to "pass all 871 tests in the samples/test.rb installation test suite of Ruby 1.8.2." which seems odd since later they say "We have a plan for how to deal with continuations but we have not yet implemented them." Doesn't the Ruby test suite test continuations? I wish they would provide more details on this plan, continuations might not be the most interesting thing in Ruby, but it's up there and it's probably the hardest thing to implement on top of the CLR.

BTW, there are two other projects @ QIT that Ruby.NET leverages that look interesting. The Gardens Point Parser Generator is essentially a YACC clone written in C# and making extensive use of generics. Personally, I'm more interested in Parsing Expression Grammars, but there's no C# implementation as of yet. QIT also has a library for reading and writing program executable files (i.e. EXEs and DLLs).

As a quick aside, I'm getting pretty tired of all the different euphemisms for "alpha". In the age of perpetual beta, isn't alpha the new beta? But everyone seems worried about calling their releases alpha as if it means "it might not cause your machine to explode, if you could actually get it to compile". So we end up with things like "Preliminary Beta" and "Community Tech Preview". We all KNOW what these terms mean, so lets just call an alpha and alpha, shall we?

Posted By Harry Pierson at 10:37 AM Pacific Daylight Time

Wednesday, April 26, 2006

ChucK Audio Programming Language

I saw reference to ChucK on Prompt Criticality, a Second Life Blog. I wanted to blog it for my own reference if for no other reason. ChucK is "a new audio programming language for real-time synthesis, composition, and performance" that "presents a new time-based concurrent programming model, which supports a more precise and fundamental level of expressiveness, as well as multiple, simultaneous, dynamic control rates, a precise and straightforward concurrency, and the ability to add, remove, and modify code, on-the-fly, while the program is running, without stopping or restarting".

Sounds facinating, esp. given my recent discussion of internal vs. external DSLs w/ Neal Ford. Plus it deals w/ concurrency and is dynamic.

Posted By Harry Pierson at 4:13 PM Pacific Daylight Time

Monday, April 24, 2006

Sacred Code Cows

I wrote of my meeting w/ Neal Ford a few weeks ago. Today he has a long post on what he calls Eating Sacred Hamburger that goes into more detail of some of the things we discussed:

Software development cults tend to create sacred cows: habits and idioms that might have meant something at one time but only remain as baggage now. I tend to like to kill sacred cows and grill them up, with some nice lettuce, tomato, and a sesame seed bun. On my current project, we're actively killing some sacred cows.

The main sacred cow he's talking about slaughtering is Hungarian Notation for interfaces. You know, interfaces like IDbConnection and IHttpHandler.

Thankfully, Hungarian Notation has mostly been banished, except for one lingering, annoying location in the .NET world: the stupid "I" preface on interfaces. In fact, if you understand how interfaces should be used, this is exactly the opposite of what you want. In our application, every important semantic type is represented by an interface. Using interfaces like this makes it easier to do a whole host of things, including mocking out complex dependencies for testing. Why would you destroy the most important names in your application with Hungarian Notation telling you it's an interface? Ironically enough, that your semantic type is an interface is an implementation detail -- exactly the kind of detail you want to keep out of interfaces. I suspect this nasty habit developed in the .NET world because interfaces first came to the Microsoft world as COM (or, back when it started, OLE). It's a stupid cow now, and should be slaughtered.

I agree 100% with this, though I'm guessing the next time I write an interface, I'll have to go back and delete the stupid "I" because I'm so used to writing it.

The other convention he's looking to do away with camel and pascal casing, which is convention in .NET. He's a bigger fan of using underscores between words (which is big in the Ruby world). So far, he's only using underscores in his test methods since they tend to be longer, such as "Verify_end_to_end_security_connectivity_to_infrastructure". Frankly, I'm ambivalent on this one. I'm pretty good at reading camel and pascal casing and I would hope never to see a production method name like that.

So that's two down, but there's still an entire herd of sacred cows out there. What other ones do we need to get rid of?

Posted By Harry Pierson at 2:50 PM Pacific Daylight Time

Tuesday, April 18, 2006

Lang.NET 2006

Erik Meijer just posted details about Lang .NET 2006 over on Lambda the Ultimate. Looks to be the next generation of the Complier Dev Lab I attended last month. The appear to have opened up the program significantly, and are asking for abstracts for both 30 minute talks as well as 10 minute "lightning" talks. If you're interested in submitting, here's the list of topics they are most interested in:

  • Dynamic languages and scripting
  • AJAX and ATLAS
  • Domain specific languages
  • Functional languages
  • Object-oriented and aspect-oriented programming
  • Web-services and mobile code
  • Libraries
  • Language-Integrated Query (LINQ)
  • Compiler frameworks
  • Garbage collection
  • JIT compilation
  • Visual Programming
  • Success and failure stories
  • Non-standard language features and implementation techniques
  • Tools and IDE support
Posted By Harry Pierson at 1:23 PM Pacific Daylight Time

Friday, April 14, 2006

Talking Dynamic Lanugages with Neal Ford

I spent a couple of hours chatting with Neal Ford from ThoughtWorks yesterday. Ted Neward had virtually introduced us a few months ago and he was in town for MTS, so he arranged a meeting. I had asked Ted to introduce me to some dynamic language folks for some research and public debate purposes, and Neal was one of the people he hooked me up with. Unfortunately, this was right before I changed roles and got real busy. Of course, dynamic languages in general and Ruby in particular plays a large role in Edge Architecture, so I’m thankful Neal took the time to drop me a line and meet with me.

Above all else, talking to Neal made me realize that I just don’t know enough about dynamic languages, which limits my ability to discuss them. To date, I’ve flirted with them, but haven’t made a real commitment. For example, I’ve played around with Instant Rails, but hadn’t actually installed Ruby yet. It was time to re-image my dev partition anyway, so I’m going to try using Ruby exclusively for a while.

Here’s a brain dump of some of what we talked about. Not sure what it all means yet, so I’ll try and refrain from making commentary.

  • Hungarian notation for interfaces (i.e. ISomething) is a big code smell. This has nothing really to do with Ruby or dynamic languages, but it’s an important point that I wanted to include here. Neal’s point is that the interface defines the semantics of the type and the concrete class is an “implementation detail”. In other words, contract-first isn’t just for web services. Apparently, ThoughtWorks doesn’t use ADO.NET directly primarily because the interfaces “aren’t pervasive enough” and are difficult to mock out. Also, they’re using Rhino Mocks which I wasn’t previously aware of.
  • For all the debate about static vs. dynamic languages, it seems like the value Ruby brings is in meta-programming rather than dynamic typing. Certainly, that’s one of the big differentiators for Ruby vs. other dynamic languages like Python. While Rails has pushed the popularity of Ruby thru the roof recently, Neal seems much more enamored with Ruby than Rails.
  • There is an even bigger gulf between dynamic and static typing proponents than I had thought. I brought up Singularity, which uses static typing exclusively to deliver a provably dependable system. Neal disagreed with that approach, pointing out that “tests are the best way of encoding the specification of the system” rather than compile time checking. Given my lack of expertise in this space, I’m withholding comment (for now) but I’m guessing the truth is somewhere in the middle.
  • However, while the dynamic vs. static typing gulf is big, meta-programming is potentially the bridge. I don’t believe meta-programming is exclusive to dynamic languages. Certainly, some of the new features in the “Orcas” versions of C# and VB bring more expressiveness to the languages while still remaining type safe.
  • All this meta-programming leads to domain specific languages. Ruby has strong support what Martin Fowler called “internal DSLs”, but Neal thought over time the focus would shift to external DSLs as they are more expressive and not constrained by the semantics of an existing language. Obviously, we’re pretty heavily focused on DSLs. However, Neal did think our focus on graphical DSLs is misplaced. He called them a “hangover” from CASE/UML tools. He rightfully pointed out that “business analysis speak English”.

All in all, it was time well spent. Neal, I hope we can pick up the conversation again sometime.

Posted By Harry Pierson at 7:42 AM Pacific Daylight Time

Thursday, April 06, 2006

LINQ + WAP == Coolness

I never really missed Web Application Project support in VS05 until I realized what I could do with it. I've been experimenting with LINQ and wanted to be able to use it in a web application I'm prototyping. Under the file system model, there's no easy way to change the compiler used for dynamic compilation of web pages. With WAP, it's no problem.

If you've got both WAP and LINQ installed, you can enable LINQ support in your web apps by doing the folllowing.

  1. Open your WebApp.csproj file in notepad.
  2. Add references to System.Query, System.Data.DLinq and System.Xml.XLinq.
  3. Change the Target Import element to import "$(ProgramFiles)\LINQ Preview\Misc\Linq.targets" instead of "$(MSBuildBinPath)\Microsoft.CSharp.targets"

That's it! Seems simple, but it let me bind a GridView to the following function:

public static IEnumerable<Titles> GetTitles()
{
 
var con = new SqlConnection(Properties.Settings.Default.PubsConString);
 
var db = new Pubs(con);
 
var q = from t in db.Titles select t;

  return q;
}

It would be even cooler if I could simply write that query in the conext of the ObjectDataSource, but of course ObjectDataSource doesn't know about LINQ. I imagine a LinqDataSource would be a logical next step.

Posted By Harry Pierson at 5:48 PM Pacific Daylight Time

Tuesday, March 28, 2006

The Dual Schema Problem

A few months ago, Ted Neward wrote a great article about the history of the Object Relational Impedance Mismatch problem and how LINQ is addressing it in a new way. Basically, LINQ is introducing new language abstractions and complementary libraries to enable queries as a first class concept within the language. However, I don't believe that O/R Impedance Mismatch is the whole problem. More specifically, it's a follow-on problem to what I would call the Dual Schema problem.

In a nutshell, the Dual Schema problem is that you have to design and implement two separate versions of your persistent entities. There's the in memory version, typically written in an OO language like C# or Java. Then there's the on disk version, typically written in SQL. Regardless of the difficulties translating between the two versions (i.e. the aforementioned impedance mismatch), you have to first deal with the complexity of keeping the two versions in sync. While LINQ does a great job eliminating much of the friction translating between on disk and in memory formats, it could go much farther by eliminating the need for translation in the first place.

A variety of solutions to the Dual Schema problem have evolved, primarily outside the hallowed halls of enterprise vendors (i.e. MS and others like us). One such solution is Ruby on Rails. In a Rails environment, I simply declare the existence of a given persistent entity:

class Person < ActiveRecord::Base
end

The ActiveRecord base class (a standard part of Rails) will dynamically create methods and attributes on the Person object at runtime, based on the schema of the People table in the database. (Rails is smart enough to understand English plurals, hence the automatic connection of Person and People.) So technically there are still two schemas, but the in-memory version is automatically derived of the on-disk version.

(Note, DLinq provides a conceptually similar tool - SqlMetal - that can generate the static types from a given database schema. However, as static types they have to be defined at compile time. So while SqlMetal reduces the effort to keep schemas in sync, it doesn't eliminate it the way Rails does.)

By slaving the object schema to the database schema, Rails essentially solves the Dual Schema problem. The problem with the Rails approach is that defining a database schema requires a significant amount of skill and effort. Defining classes is typically trivial in comparison.The fact Rails allows you to implement a persistent entity with almost no code doesn’t help you much if you have to write and maintain a ton of SQL code to define your database schema.

I believe the Rails model is actually backwards. It would be much better for the developer if they could define their persistent entity in code and slave the database schema to the object model instead of the other way around.

Of course, this approach isn't exactly news. In his article, Ted writes of the rise and fall of OO database management systems, which were supposed to solve the Dual Schema and Impedance Mismatch problems. I'm certainly not suggesting a return to the heyday of OODBMS. However, one of the reasons Ted points out OODBMS failed was because big companies were already wedded to RDBMS. But those big companies are the short head. As you move down the long tail of software, relational database as the primary storage paradigm makes less and less sense. For the vast majority of applications, relational databases are overkill.

Ted's other point about OODBMS is that loose coupling between the data store and the in memory representation is a feature, not a flaw. He's totally right. But can't we advance the state of the art in database typing to the level of modern day OO languages? How about eliminating anachronisms like fixed length strings? What if we derive the database schema from the object model - Rails in reverse if you will - but is still loosely coupled enough to allow for schema evolution?

An example of this code-centric model for data storage is Consus. It’s written by Konstantin Knizhnik, who has written a bunch of open source, object-oriented and object-relational databases across a wide variety of languages and execution environments, including CLR. Consus is actually written in Java, but he provides version compiled for .NET using Visual J#. Consus lets you to define your data either as tables or objects. So you can do this:

Statement st = db.createStatement();
st.executeUpdate(
    "create table Person (name string, address string, salary bigint)");
st.executeUpdate(
    "insert into Person values ('John Smith', '1 Guildhall St.', 75000)");
ResultSet rs = st.executeQuery(
    "select name, address, salary from Person where salary > 100000");

Or you can do this:

class Person {
    String name;
    String address;
    long salary;
    Person(String aName, long aSalary, String aAddress) {
        name = aName;
        salary = aSalary;
        address = aAddress;
    }
};

Person p = new Person("John Smith", 75000, "1 Guildhall St.");
ConsusStatement st = db.createStatement();
stmt.insert(p);
ConsusResultSet cursor = (ConsusResultSet)st.executeQuery(
    "select from Person where salary > 100000");

Consus also handles OO concepts like derivation and containment. Of course, the embedded queries are ugly, but you could imagine DLinq style support for Consus. In fact, one of the primary issues with Consus is that it supports both object and tuple style queries. When you explicitly request tables (i.e. "select name, address salary from Person"), you’ve got a tuple style query. When you don’t (i.e. "select from Person”) you’ve got an object style query. Of course, the issues with tuple style queries are well documented in Ted’s article and is exactly the problem that LINQ is designed to solve.

(Konstantin, if you’re reading this, drop me a line and I’ll look into getting you hooked up with the LINQ folks if you’re interested in adding LINQ support to Consus.NET.)

The tradeoff between the Rails approach and the Consus approach is one of performance. I have a ton of respect for Konstantin and the work he’s done on Consus and other OO and OR databases available from his site. However, I sure the combined developer forces at major database vendors like Microsoft (and other DB companies) means SQL Server (and the like) will out perform Consus by a significant margin, especially on large scale databases. So if execution performance is your primary criteria, the Ruby on Rails approach is better (leaving aside discussion of the Ruby runtime itself). However, in the long run execution performance is much less important than developer productivity. So I believe that  for all the current interest in Rails, I think a Consus-style model will become dominant.

Posted By Harry Pierson at 2:35 PM Pacific Standard Time

Wednesday, March 22, 2006

CLR Everywhere

Big news from the Game Developers Conference this week is the XNA Framework. From the press release:

The XNA Framework contains a custom implementation of the Microsoft® .NET Framework and new game-development-specific libraries designed to help game developers more easily create cross-platform games on Windows® and Xbox 360 using the highly productive C# programming language. Using the XNA Framework, game developers will benefit from the ability to re-use code and game assets in developing multiplatform titles, without sacrificing performance or flexibility.

So now I can the Xbox to the list of personal technology I can program, joining my phone, my TV, my server and my laptop all with C# or VB (VB plug brought to you by Brian and Erik who think I should to switch). I wonder if XNA Framework will support WPF?

BTW, I still want an easy way to program my house and my car, but I'm sure those are coming.

Where else should the CLR live?

Posted By Harry Pierson at 7:51 AM Pacific Standard Time

Friday, March 17, 2006

The Annoying C# 3.0 "Unsupported Version" Dialog

I am sick and tired of the warning dialog box for the C# 3.0 preview. Every time you launch VS it pops up a dialog reading "This is an unsupported version of Microsoft Visual C# 3.0. As such many features may not work as expected." You know, this isn't my first time working with alpha or beta quality software. I'm also running WinFX Feb CTP, VB 9.0 Jan CTP and the Expression Interactive Designer March CTP. None of them feel the need to constantly remind me that they're unsupported.

Who suddenly thought C# developers need hand holding?

Posted By Harry Pierson at 1:41 PM Pacific Standard Time

Wednesday, March 15, 2006

The SQL Complexity Problem

I mentioned on the first day of the Compiler Dev Lab that Brian Beckman is a hoot. He's also wicked smart. He posted about his demo from Monday where he demonstrates building indexes for use in LINQ queries. In his words:

In the terminology of relational databases, a “join” is, semantically, like a nested loop over a pair of lists (or tables) of records, saving only those where some certain fields match. Unless we do something smart, this could be very expensive. Imagine searching a database of a million DNA profiles for the closest match to a sample that has 10,000 DNA features (I have no idea whether those are real numbers: I just made them up, but they sound ballpark to me). A dumb join would search all 1 million profiles for each of the 10,000 features, resulting in 10 billion match tests, almost all of which will fail – by design, of course. That’s going to hurt.

The “something smart” is to build an index and search through that. Your database doesn’t have to be large at all for this to pay off. In fact, even with just a few records, it’s cheaper to build an index, use it, and throw it away than it is to do a nested loop.

He goes on to prove out his point about building an index. For his full dataset (joining 3053 cities with 195 countries) it is literally 65x slower not to build a one-off index. Even for smaller datasets, the time difference is less dramatic but still significant. For example, with 89 cities instead of 3053, it's 3x slower not to build the index.

The reason I'm so interested in Brian's post is because of my experiments with Ning. As you might recall, in trying to build a .NET version of Partisan Hacks, I found ASP.NET 2.0 to be significantly simpler than PHP (which Ning uses). However, building even the trivial SQL Express database for Partisan Hacks was a non-trivial exercise. Sure, I've done it many times before, but it seems strange that ASP.NET makes it so easy to build a site while SQL Server makes it so complex to build a database. If I was a novice user, I would never be able to build a database for my web site.

Why is this? I think that the simple app or amateur developer is simply not the target audience for SQL Server (even SQL Express). If you don't know the difference between nvarchar(100) and varchar(max) you're pretty much out in the cold when it comes to SQL Server. Their target audience appears to be enterprise databases that are cared for by enterprise database administrators. Databases with scores of tables and millions of rows. Great for them, bad for novice users who just want to persist their data somewhere quickly and easily.

Why can't building my database be as simple as building my site?

Ning makes it easy to use their Content Store. You create an instance of a content object, you set properties (dynamic ones), you hit save. No fuss, no muss, no db schema. Sure is an easier model to understand and program to. In that regard, it blows away everything, even Ruby on Rails. RoR is pretty sweet, but it needs a real database schema on the back end in order to drive RoR's guiding principle of "convention over configuration". If there's no DB schema to discover, I think much of the RoR model would break down. (but that may just be my lack of RoR experience talking)

I not sure what a simpler database system would look like, but one idea of mine is to use a schemaless database. Much of the complexity comes from having to define both an in memory as well as perseistant schema, as well as the translation between them. If you just stored managed .NET objects, you would eliminate the redundant schema specification. It's not a fully fleshed out concept, but it is a start of an idea.

What other ideas would make persistant data significantly easier to work with?

Posted By Harry Pierson at 11:51 PM Pacific Standard Time

Compiler Dev Lab - Scripting

Day Two of the Compiler Dev Lab was all about scripting. Iron Python was the primary focus of the day, but they also had Phalanger (Managed PHP) and Monad folks there as well.

  • I hadn't realized just how performant these dynamic languages are on the CLR when compared to their native versions. The original version of Iron Python was 1.7x faster than the standard C implementation back in the summer of '04. Now with CLR 2.0, that version is now 2x faster with out any code changes. The Phalanger folks said they are 2.5x faster than the native version of PHP (1.7x faster than PHP + the Zend Optimizer). That's pretty impressive performance.
  • The IronPython folks are heavy users of the new DynamicMethod class from .NET 2.0. Otherwise known as Lightweight Code Generation, DynamicMethod allows you emit a static function but have it get garbage collected when it's no longer needed. IP almost never generates new classes, since new types can't be garbage collected. The only times they generate actual classes are when you inherit from an existing .NET class or when you generate a new delegate type.
  • It's really hard to serve the dual masters of both the existing language community and the .NET community. Jim Hugunin used the example of String.Trim(). A .NET developer would expect String.Trim() to "just work". A Python developer would expect that to throw an AttributeError exception (the Python equivalent of Trim is strip). How do you handle this? In IP, it defaults to pure Python mode, but if you enter "import clr", you move into .NET hybrid mode.
  • One of the typical features of dynamic languages is the ability to change the base class of an object on the fly. Jim demoed this with WPF. He created a class that inherited from one type of panel and then set the __class__ property of the object to a different panel and the display changed immediately. Freaky, but cool.
  • Jim showed a demo of a WPF app that hosted Python for extensibility. One of the scripts in turn hosted Python to create an interactive console for the app. Having a scripting engine that can host itself is awesome.
  • The VSIP SDK CTP (reg required) includes an sample lanugage integration project for Iron Python. So you can get both the source into IP language itself as well as the source to the integration into Visual Studio.
  • I got an email yesterday from someone asking about the possibility of Visual Ruby.NET. I haven't heard anything about it, but it would be cool to see Ruby on Rails runing under CLR. John Lam is working on RubyCLR, but my understanding is that is a bridge between the CLR and the Ruby runtime, not a CLR implemenation of the Ruby runtime. (IP is a CLR implementation of the Python runtime.) I'm thinking that there are some similarities between Ruby and Python, so having the source of IronPython would be a huge help in building a Visual Ruby implementation. For example, both Ruby and Python have closures. IP has a FunctionEnvironment class which is used to lift stack variables onto the heap in a variety of scenarios, including closures. So if I was building Visual Ruby, having access to the FunctionEnvironment class would be a good start.
  • I said yesterday that I need to learn more about F#. They showed a video of an internal F# presentation, but I spent most of my time cracking jokes with Sam Gentile who's in town for an SC-BAT workshop.
  • I didn't pay enough attention to the Monad presentation. :(
Posted By Harry Pierson at 10:25 AM Pacific Standard Time

Tuesday, March 14, 2006

Compiler Dev Lab - LINQ

Even though I haven't finished my ETech postings, I'm already onto another event. This week, thanks to an invite from Michael Lehman, I'm sitting in on a Compiler Lab discussing implementing other languages for CLR. The first day was about LINQ. Much of the info is rehashed from PDC or the docs up on MSDN. However, I have learned a few new things.

  • One of the standard features of LINQ is Extension Methods. That enables you to declare a static method like "static void Foo(this string source)" and then use it like "stringvar.Foo()". Apparently, they are considering adding other types of extension members including properties and fields. The idea of extension fields is somewhat scary but powerful.
  • LINQ uses something Anders called deferred query execution. The query isn't executed until the values are asked for (typically by calling foreach on the query). That means you can compose queries to your hearts content with no perf impact until you actually invoke the query.
  • Query Comprehensions in C# and VB is a pattern implementation in a similar vein to foreach. Foreach is relatively simple shorthand for iterating through an collection by calling IEnumerator.MoveNext until it returns false. While LINQ enables arbitrary composition of queries, there is obvious gravitational pull towards the SELECT / FROM / WHERE / ORDER BY / GROUP BY approach favored by SQL. So if you build your own query operator, you can include it in a LINQ query, but C# and VB won't be able to include it in the Query Comprehension syntax. Probably not a big deal, given the breadth of standard query operators as well as the deferred query execution, but it's good to understand how the abstraction works.
  • I want to know more about how DLinq is implemented. I've been refining my thinking about data since working with Ning's content store and I'm convinced of the need for a simplified datastore. SQL is designed for significantly complex database schemas, which means a significantly complex development environment.
  • I'm looking much more closely at VB, given the new features in VB 9.0. Not only the LINQ stuff from C# like type inference, extension methods and anonymous types but also VB specific stuff like XML Literals and Duck Typing. Combined with VB's existing support for late binding, there are compelling features to make VB attractive over C#.
  • I've been hanging out with Brian Beckman. He's a hoot.
  • I think I need to take a deeper look at F#.
Posted By Harry Pierson at 10:33 AM Pacific Standard Time

Thursday, February 23, 2006

ASP.NET Trust Levels

For reasons to be named later, I'm experimenting with the various trust levels of ASP.NET. While "most things" work fine when you ratchet down the security, if finding that the things that break aren't well documented. For example, at anything other than Full Trust you can't use the Response.OutputStream.Write() method to write binary information to the response buffer. So that means that using ASHX Handlers for images doesn't work. That means that, among others, the Personal Web Site starter kit breaks on any photo related features.

Also, does anyone know what happened to permview in .NET 2.0?

Posted By Harry Pierson at 6:27 PM Pacific Standard Time

Monday, February 13, 2006

The Next Mainstream Programming Language

Terra Nova is not the usual place I go to get news around programming language improvements. But they linked to a great presentation from POPL 2006 by Tim Sweeney of Epic Games. Tim's talk is called The Next Mainstream Programming Language: A Game Developer's Perspective and it talks at great length the major issues facing game developers today. As Nate Combs at Terra Nova remarked, most of these issues are not specific to the game industry, but will likely be seen there first.

Most interesting (to me) was the issue of concurrency. Tim uses Gears of War for all his examples. Of course, Gears of War is an Xbox 360 exclusive. Xbox 360, as many of you probably know, has three hyper-threaded CPUs for a total capactiy of six hardware threads. Herb Sutter talked about this in his DDJ article The Free Lunch Is Over. Tim points out - rightly so - that "C++ is ill-equipped for concurrency". C#, Java and VB aren't much better. Tim conculdes that we'll need a combination of effects-free non-imperative code (which can safely be executed in parallel) and software transactional memory (to manage parallel modifications to system state).

Tim also touches on topics of performance, modularity and reliability. And he has an eye on the practical at all times. For example, he points out that even a four times performance overhead of software transactional memory is acceptable, if it allows the code to scale to many threads.

Anyway, it's a great read so check it out. Also, MS Research has a software transactional memory project you can download if you're so inclined.

Posted By Harry Pierson at 3:07 PM Pacific Standard Time

Monday, January 09, 2006

Outlook Integration Sample

For the past few months, I've been heavily involved in a project but I wasn't allowed to blog about it. Last week, it went live on MSDN so finally the gag is off.

About a year ago, word started to surface about something called Project Elixir which aimed to integrate back end CRM systems with Microsoft Outlook. Part of that effort resulted in the addition of Outlook Managed Add-ins to Visual Studio 2005 Tools for Office. However, the VSTO team's primary deliverable was an add-in loader that enforced security, enabled shutdown unloading and provided a better startup/shutdown developer experience that IDTExtensibility2. (Check out the VSTO Outlook Architecture document for more details.) While those are important fundamentals that needed to be gotten right, VSTO Outlook doesn't provide much in the way of tools or guidance for building Outlook add-ins that leverage managed forms and controls or integrate with your back end systems. That's where the CRM Integration for Outlook sample comes in.

What we've built is a sample application that surfaces CRM style data inside of Outlook. Outlook is the natural home for your calendar and your personal contacts. Why not make it the natural home for your customer contacts, activities and opportunities as well? As part of the demo project we've implemented:

  • Using Windows Forms for editing custom items. Check out this screenshot. The Activity form is a standard managed Windows Forms form, not an Outlook custom form.
  • Using a Windows Forms user control as a folder home page. Here's a screenshot of the "CRM Today" page. Again, that's a standard managed Windows Forms user control.
  • A framework for adding menu items and toolbars. In Outlook, the developer has to manage adding the custom toolbars and menu to each explorer and inspector window themselves. With our sample, we built a framework to handle that for you.
  • Using SQL Express as a local cache of CRM data. It turns out that for many scenarios, storing a copy of all the back-end data directly in Outlook is a bad idea. First, it increases the size of the users mailbox, requiring more storage on the Exchange server. Furthermore, any custom data in Outlook has to be synced twice - once from the back end system to Outlook on the desktop, then from Outlook back to Exchange. By minimizing the amount of back-end data stored in Outlook proper, we reduce the mailbox size and sync bandwidth needs. In both the above screenshots, the displayed data is coming out of the local SQL Express instance, not Outlook.
  • Having two separate storage locations (Outlook & SQL Express) means having to sync between them. We've built a local sync engine that can sync both individual items between Outlook and SQL Express as well as a collection of items between SQL Express and a given Outlook folder.
  • Finally, there are some utility classes to make it easier to deal with Outlook folders and items. Of primary note is the ItemAdapter class which provides a pseudo base class for Outlook items (appointments, emails, tasks, etc). Those items all have a set of similar properties and methods, but don't have a common base class so they can't be treated polymorphicaly. ItemAdapter uses runtime reflection to implement those common operations without needing to cast to the concrete Outlook item type.

Check out the Architecture Design Guide, as well as the Outlook Customization Guide and the Local Sync Engine Guide up on the Solution Architecture Center. You can also pick up the source code. Also, I spun up a GDN Workspace so we can have a discussion forum and to track bugs and requests.

Going forward, I'm going to be focusing on the remote data sync story for this scenario. Among other responsibilities, I "own" the Data pillar of our Connected Systems model so this dovetails nicely. You'll note above that while we have a local sync engine in the sample, we don't have any way to move the data back and forth between the local copy in SQL Express and the remote copy in the CRM back-end. We are working on some guidance around this right now, but we didn't want to hold up publishing the rest of the sample.

Frankly, it's been nice to be involved with something so technical after spending time on the marketing team. I'm pretty proud of the project and I look forward to your feedback.

Update: Removed the link to the running demo as it's been taken off the download site for reasons I am not aware of. If you want the binary and you don't know how to compile it, drop me a mail.

Posted By Harry Pierson at 11:51 PM Pacific Standard Time

Friday, November 04, 2005

Deploying Databases with SQL Server Express

Things have been quiet around here lately because I've been heads down on a dev project. We (that is to say, I) reached code complete today, so look for more posts shortly. But I wanted to quickly post a few things on deploying application that use SQLServer Express. It turns out that there are some significant differences between SSE and it's older sibling with respect to Xcopy deployment.

First off, go read this article on Xcopy deployment and this article on User Instances. And while you're out surfing, download SSEUtil - it's a great little command line utility (i.e. no installer) that you can use to list, detach, attach, and create SSE databases.

Anyway, one of the MAJOR changes (and the one that gave my installer fits all day) is this idea of user or child instances of SSE. From the docs:

The user instance, also known as a child or client instance, is an instance of SQL Server that is generated by the parent instance (the primary instance running as a service, such as SQLExpress) on behalf of a user. The user instance runs as a user process under the security context of that user. The user instance is isolated from the parent instance and any other user instances running on the machine. The user instance feature is also referred to as “Run As Normal User” (RANU).

This is a big deal because essentially you have 2 instance of SSE running - the main one and the user specific one. And they're different. I was totally confused by this because I didn't realize it was happening. I created a new DB in .\sqlexpress with VS but then it wouldn't show up when I listed the databases with SSEUtil. The reason is the SSEUtil defaults to the child instance while creating a new DB with VS defaults to the main instance.

This is particularly relevant if you want to use the AttachDBFilename feature. I'm using SSE as a cache, so I wanted to put it in the <username>\Application Data folder. But I couldn't get the main instance of SSE to attach to a database in that folder tree. It drove me batty! I literally would move the DB from folder to folder - it works fine in My Docs, but not in App Data. However, it works fine from the child instance - I'm guessing that's on purpose.

So my installer puts the DB file in the <username>\App Data folder (as per Keith's book) and changed my connection string to include the parameter "user instance=true". Also, if you're using AttachDBFilename, you need to include the initial catalog or database parameter, but without a value. In other words "Initial Catalog=". Weird. But it worked like a charm.

Posted By Harry Pierson at 6:55 PM Pacific Standard Time

Monday, October 17, 2005

Suggestions on Digital Audio Programming

Anybody have any suggestions of book and/or sites with information about programming with digital audio? I primarily care about mixing and fading, but also some effects and changing the playback speed without effecting the pitch. Feel free to leave comments or email me.

Posted By Harry Pierson at 9:09 PM Pacific Daylight Time

Tuesday, October 04, 2005

Dave is Pimping his Ride

I'm pretty excited to read about my friend David White building his own in-car navigation and entertainment system. He took a look at available systems and came away with the following opinions:

The problem with all these [existing systems] is three fold as far as I am concerned: 1) they are way too expensive, 2) they are not extendable (meaning I can't program on them), and 3) they are not connected to the car. Imagine the last two put together!

<snip>

So what exactly is my thought? I mean there are people shoving Mac Minis and mini-ITX form factors in cars now right? Yes they are, but to me it is wrong tool for the job and just not that interesting (I would love to hear if you think I am wrong). I think there are problems with power consumption and conversion, instant on and off scenarios, dash placement, etc. So I thought to go out and build my own system. I mean build my own system -from the ground up board and all. Add a flip out screen with a wiring harness into the car bus network and away I go. I plan on using Windows mobile 5.0 and the .Net Compact Framework for the UI of applications and part way down the stack until the real time requirements outstrip what a garbage collected environment can do.

I've always had a hankering for learning embedded development, so I'll be following David's blog with great interest. I also love the title of his blog - Architect Must Implement.

Posted By Harry Pierson at 9:53 AM Pacific Daylight Time

Tuesday, September 20, 2005

TinyCLR and Invisible Computing

When I was at PDC, I saw the Phidgets folks in the Coding4Fun booth. Is it just me, or is this stuff dying to get merged with MSR's Invisible Computing project? Haven't heard of Invisible Computing? Here's the description:

This site has the source code and documentation for Microsoft Invisible Computing. It is a research prototype for making small devices part of the seamless computing world. This site contains the source code and is available free of charge for research and educational use under the Microsoft Shared Source License.

Microsoft Invisible Computing consists of compact middleware for constructing embedded web services applications and a small component based Real-Time Operating System with TCP/IP networking to make middleware run straight on the metal on several embedded processors.

The goal is to make it easy to build custom smart devices and consumer electronics, especially battery operated; and to support research in invisible computing, operating systems, networking, ubiquitous computing, sensor nets, distributed systems, object-oriented design, and wireless communication.

FYI, I discovered the Invisible Computing project by searching the web for TinyCLR. TinyCLR is what powers the MSN Direct watch. From what I can tell (i.e. this is based on publicly discovered info) is that Invisible Computing is a shared source version of TinyCLR that works with a variety of hardware platforms. Sort of like a Rotor for embedded devices.

Check out a presentation and the code.

Posted By Harry Pierson at 3:52 PM Pacific Daylight Time

Monday, September 19, 2005

New Dev Partition Contents

I'm feeling particularly geeky having just re-imaged my laptop's dev partion. This is what's running on it so far:

Not that this is of much use to anyone, but I thought it was cool. Not sure what I'm going to do with all this stuff yet, but I just had to have it all. I guess the stint in marketing didn't completely wipe out my interest in coding.

FYI, I have to give major thumbs up to Terabyte Unlimited's BootIt NG product. My laptop runs three partitions: Production, Development and Documents. Putting all my docs on their own partition means I can pave the other two pretty much whenever I want. However, Windows XP wants to make the first partition it finds the C drive, even if you eventually choose to boot off another partition. This means I can't create an image from on partition and restore it to the other. What a pain. But with BootIt NG, I can choose which partition to boot and hide whichever of the others I want to.

I still use VPC for a lot of my dev work, but for Avalon and/or device development - where VPC isn't really practical - having a separate partition for dev work is really helpful.

Posted By Harry Pierson at 9:01 PM Pacific Daylight Time

Wednesday, September 14, 2005

PDC Quick Hits

I'm sure lots of people are blogging a ton about PDC stuff, but I wanted to call out two things quickly.

First is Microsoft Max. I have a friend on this team, so I've heard a bunch about this. Given the number of pictures I have taken of my kids, I can't wait to play with this in earnest.

Second is LINQ or Language Integrated Query and it's use in C# 3.0 and VB 9.0. I started to write a language a few years ago called Dart (named after my dog) that had SQL-esque commands that were strongly typed. So I'm really impressed with what they've acomplished in LINQ. Not only is it doing strongly typed queries in the lanugage, they even can do joins across stores! In the keynote demo, they joined a query of running processes with data from a database. So now any C# or VB developer has their - or should I say will have their - own query processor around at the ready!

Posted By Harry Pierson at 5:17 PM Pacific Daylight Time

Thursday, September 01, 2005

Code Smell Question

So as a quick break from all this architecture talk, I've got a code smell question. Here's a scenario, I'm interested in feedback on the best way to solve the issue.

I'm writing some VSTO code for Word using VS05. I want to be able to add and update custom properties on the document. You do this via the CustomDocumentProperties property off the document object. This DocumentProperties collection supports the standard collection type operations such as Add and an indexer. However, it's a little exception happy. If you attempt to access a property that doesn't exist, it throws an exception. And if you attempt to add a property that already exists, it throws an exception. So the first time you set a custom property you use the Add method and then after that you use the indexer to access the existing item in the collection and update it's value.

Of course, the way my code is written, I want to hide this ugliness behind a method so that the rest of my code can simply set custom properties with ease. However, I want to use the same method regardless if the item already exists in the collection. So what's the best way to implement the method? I can think of two primary ways.

  1. Attempt to access the custom property via the indexer. If it throws an exception, trap it and call Add instead.
  2. Manually iterate through the existing custom properties. If the property exists, update it directly. If it doesn't, call Add instead.

Neither of these is particularly fragrant from a code smell perspective, but which is less odorous? The first one is more direct to write, but since this is all COM interop code, the COM exception is pretty generic. Theoretically, if something else caused an exception to be thrown, I'd still assume the custom property was just missing and swallow the exception, potentially causing an error somewhere else. However, writing the code to manually iterate through the collection just seems excessive.

In the end, I went with #2 as I was more worried about swallowing exceptions than manual iterating though the collection. What do you think? Was that the right choice?

Posted By Harry Pierson at 11:33 PM Pacific Daylight Time

Monday, April 18, 2005

Office PIAs

Not that I do a bunch of Office development, but I did build a pretty nifty utility for PowerPoint a while back. Getting it installed on anyone elses machine, however, was a pain in the ass because while I always remember to install the Office Primary Interop Assemblies when I install Office, I'm fairly certain I'm in the minorty on doing so. So installing Build Slide Exporter was alway tricky. Now, the Office PIA's are available as a seperate install. Not sure if you can redist them, but the readme file that comes with the installer specifically mentions "Wrap the O2003pia.msi in another setup package through Visual Studio or other Windows Installer aware setup editor" so it sounds like they expect it to be redistributed.

Posted By Harry Pierson at 9:17 PM Pacific Daylight Time

Monday, April 11, 2005

Not Your Father's C++

Certainly not my father's C++. I sat thru a presenation on VC++ 2005 today. Wow, I hadn't realized all the coolness there.

First off, all the syntax is working it's way thru the standards bodies, so no more underscore underscore syntax. It makes the code somewhat easier to read, but more importantly it's following a similar standardization process to CLI and C#.

Secondly, you can now use all the native C++ features (templates, multiple inheritance, buffer overrun protection, etc) and all the CLI features (garbage collection, generics, language interop) together. Previously, you had very limited choices for mixing the two coding idioms. No longer - go ahead and mix and match. This gives you the best of both worlds. Use templates, and expose them to other .NET languages as generics.

Finally, it brings deterministic finalization to .NET. In VC++ 2005, you can declare both a destructor (used when a class goes out of scope or is explicitly deleted) and a finalizer (used when the class is garbage collected). This is similar to the whole IDisposable approach for classes that wrap unmanaged resources (file handles, network sockets, etc). Actually, it's identical to IDisposable because that's how it's implemented! And it works both ways - if you instance a managed class that implements IDisposable "on the heap" then it will automatically call dispose at the end of scope. For example:

{  //C++ Version
   
FileStream fs = FileStream(path, FileMode::Create); 
   fs.Read(...);
   fs.Write(...);
//fs.Dispose called automatically

Even though the FileStream is implemented in C#, it behaves here like a stack type and is destructed as you would expect. In C#, you'd have to use a using statement to achieve the same effect. For this trival example, it's not that big a deal. But if you have multiple stack instances created at different times within a scope, this helps out immensely.

Not sure I would move to C++ for all my managed programming, but I'll certainly be giving VC++ 2005 another look.

Posted By Harry Pierson at 8:54 PM Pacific Daylight Time

Friday, March 11, 2005

Coming Soon: Xamlon Flash Beta 2

Robin has a hilarious post on the upcoming beta 2 of Xamlon Flash. I started looking into flash a few weeks back for a couple of things I'm working on. I took a quick look at what it takes to build flash movies, but quickly realized I didn't have the personal bandwidth to learn it. However, Xamlon looks like it will give me the ability to work with familiar tools. Robin sums it up this way:

"Flash users are finally going to have access to good tools. Anyone who tells you Actionscript and Flash are better tools for programming than C# and Visual Studio is on crack"

I asked Robin on email a few weeks ago if they saw Xamlon Flash as a way to bring .NET developers to Flash or if they say Flash as just another way to deploy Xaml based apps. In beta 1, it was firmly on the former as you had to write a bunch of flash specific stuff to make anything work. But it sounds like they've almost solved that:

We were programming at the swf level...Then another sample came out that was using the early version of our component set. Suddenly the layout is all coming from markup (well not 100%  yet, but very close), as are the graphics. And this markup is Xaml (and in fact could easily be changed to XUL or whatever). Because of this, the code isn't dependant on anything in swf, so hey, it could actually be run on Avalon. The beautiful thing about the markup is it abstracts away the most system dependant things, making it pretty easy to deploy to swf OR the native OS. Maybe this is the icing, but that might well be the biggest deal in the end.

For me, the being able to code to Flash from VS is the critical feature. But it's nice to know that moving to Avalon in the future may been simple or even simply a recompile.

BTW, check out this pretty cool photo demo.

Posted By Harry Pierson at 11:07 AM Pacific Standard Time

Monday, March 07, 2005

Will We See CTP Drops of XNA Studio

Rob Caron has the scoop...as usual. MS is building a game specific version of VSTS called XNA Studio. From the press release, sounds like a bunch of additional features primarily around digital asset management. I wonder if such tools will be available to mere non-game-coding mortals?

Posted By Harry Pierson at 10:39 PM Pacific Standard Time

Sunday, February 13, 2005

Another Vector Option - Xamlon Flash

Another option besides ActiveSWF is the recently announced Xamlon Pro Flash Edition. Xamlon is essentially an implementation of XAML the current version of Visual Studio. There's a version for Windows Forms, for Compact Framework and now for Flash. So basically, you can write your flash app with XAML and C#. Apparently, you can also code directly to the Flash format, bypassing the XAML layer entirely. I like the idea of using a managed component like Xamlon better than a COM based component.

My big issue with using Flash is that it's a totally seperate programming environment from the browser. Using VML in IE, you can manipulate the vector objects with javascript. In Flash, you may be doing one thing in the browser and something completely different in the flash movie. That's a pain in the behind.

Posted By Harry Pierson at 8:33 PM Pacific Standard Time

Saturday, February 12, 2005

I Give Up On CSS but Not On Flash

Larry O'Brien clued me into the fact that the new DevHawk theme didn't render correctly in FireFox. When I redid my theme, I tried to be good and use all div and span tags, but apparently building a three column layout with a dynamically sized middle column that works on IE and FireFox is beyond my CSS skills. So I went back to using tables. Maybe the folks at CSS Zen Garden would freak out, but the table works just fine.

Larry also pointed me to ActiveSWF, a server side COM component for generating dynamic flash movies. You munge up an XML file describing the movie, hand it to ActiveSWF and it does the rest. Sweet. Only thing missing is a .NET version (I realize I can interop to COM, but that's a pain to deploy).

Thanks Larry!

Posted By Harry Pierson at 9:11 PM Pacific Standard Time

Friday, February 11, 2005

Vector Graphics in the Browser

I guess there's no real good story for vector graphics in the browser. I know IE supports VML natively, but no other browser does. SVG is the standard, but you need a plugin to make that work in IE and FireFox. Adobe makes an SVG plugin, but who has that installed? Everyone has Flash installed, but that seems like overkill to render a few vector graphics. Avalon would be perfect, except that it isn't shipping yet.

Does that mean that if I want to build a wide reach website that creates relatively simple data driven graphics (bsaically filled boxes) that I still have to use images?

Posted By Harry Pierson at 11:10 PM Pacific Standard Time

Sunday, February 06, 2005

Crazy Idea

When web servers were first built, there was a one-to-one mapping between virtual files (i.e. addressable via http) and the physical files (the ones in the file system). Over time, two important capabilities were added. First, the contents of a given file became dynamic. So while you the reader always come back to default.aspx (or rss.aspx as the case may be) the content changes everytime I post something new. Secondly, the physical file dependency was removed. It's not used much in dasBlog, but in .TEXT this is very prevelant. My last post on blogs.msdn.com is located at http://blogs.msdn.com/devhawk/archive/2005/02/01/364380.aspx. Obviously, there is no actual file named 364380.aspx, .TEXT uses the filename as a key into the DB to find the actual entry content. This technique is used extensively in the new MSDN2 (if you haven't already, check out Tim Ewald's MSDN Magazine article about URL design for MSDN2).

So now for the funky idea part - why couldn't we generate dynamic local files the same way? I'm not sure I've got a great use for this yet - most of the apps I use are programmable to some extent, so dynamic content can be generated at the app level rather than at the file system level. But I'm thinking there may be some scenarios where it would make sense to do this at the file system. For example, in the new Winter Fun Pack there's a new version of the WMP blogging plugin that autoupdates the Outlook and Outlook Express signature files whenever the song being played changes (a la Duncan's Coding4Fun article). But with virtual files in the file system, you could generate these files when they are accessed instead of writing new ones everytime the song changes, even if Outlook open.

Of course, our local file system typically has more writing activity than the web, so I'm thinking this isn't that great an idea. But I figured I'd share in case someone else could think of some good uses. Or maybe this already exists and I just don't know about it.

Posted By Harry Pierson at 10:32 PM Pacific Standard Time

Friday, January 21, 2005

Dare on C-Omega

I just read Dare's awesome article on C-Omega. If I had any time at all, I'd experiment with it to rewrite dasBlog (well, at least the back end parts of dasBlog anyway). Of course, I don't have any time at all, so it's not going to happen (well, at least I won't make it happen)

Posted By Harry Pierson at 3:45 PM Pacific Standard Time

Monday, December 27, 2004

Concurrency: Next New Major Language Feature?

Several people have pointed out Herb Sutter's great article on concurrency entitled The Free Lunch Is Over. When I blogged last week about new possible features of "full-grown" OO languages I mentioned dynamic typing but I didn't think about concurrency. I think Herb is right: "programming languages...will increasingly be forced to deal well with concurrency" as applications get more CPU bound. Maybe I need to take another look at Comega (or Cw). Cw extends C# in two areas - data typing/querying and concurrency. The concurrency extension used to be called Polyphonic C#, but the name got changed when it merged with Xen/X#. (BTW, there's a new Cw release (v1.0.2) but no specifics as to changes other than no longer needed VS.NET 2003 to be installed in order to use it.)

Cw adds the idea of asynchronous methods and something called chords - sets of methods with the same method body. The chord method body in only executed when all the associated methods have been called. In the simple buffer tutorial, the buffer class has a synchronous Get method and asynchronous Put method. If you call Get before Put, it blocks until Put is called, then the method body is executed. If you call Put before Get, then the Put call returns immediately (it is async after all) but the call is queued so that when Get is called, the method body is executed immediately. FYI, the Cw docs have a variety of other tutorials of async methods and chords.

BTW, speaking of my post on full grown OO languages...My father suggested that I not jump to conclusions regarding the X-develop's support for what they term "toy languages or little domain specific languages". In fact, Hans Kratz of Omnicore (which makes X-develop) had this to say:

This comment on our website was not intended to bash DSLs at all. Instead we wanted to make clear that the plugin API in X-develop is powerful enough to allow integrating support for "full-grown" languages without placing arbitrary restrictions on language complexity.

For a language developer/integrator this is a plus regardless if he wants to integrate support for a DSL or "full-grown" programming language.

Makes sense. Maybe I was just too sensitive to the use of the word "toy" so close in proximity to "DSL". Sorry about that Hans. 

Posted By Harry Pierson at 1:50 PM Pacific Standard Time

Thursday, December 16, 2004

More Transparency...But I'd Like To See More Still

I saw a post on TSS.NET pointing to the Outlook 2003 Integration APIs:

Microsoft has released former "internal only" APIs for developing applications that work with Microsoft Outlook. The APIs include account management, connection state, free/busy, MAPI-MIME conversion, and the Outlook store.

I have no idea why these APIs have been released at this time, but providing more options/control/tools to developers is better than less - along the same lines of the ASP.NET 1.1 Membership Prototype.

My only issue is that not all the APIs are documented. For example, recently I was interested in being able to progammatically set Outlook's online/offline status. When I read the post above, I thought the Connection State API would be the answer. Alas, that API can only be used to get notification when the connection state changes. Or, at least, that's all that's documented: the IMAPIOfflineMgr interface has seven undocumented methods and the IMAPIOffline interface has two. I'm sure there's a good reason those others aren't documented, but it's frustrating all the same.

Of course, even with the ommisions, that's a lot of cool stuff to add to Niobe. Simon?

Posted By Harry Pierson at 8:07 PM Pacific Standard Time

Wednesday, December 15, 2004

MSDN2's Hackable URLs + MSN Toolbar

This is just too cool:

You can also use a $w to indicate a parameter.  For example:

@msdn2, http://msdn2.microsoft.com/library/$w

...and then you can type msdn2 System.String - for the easiest way to lookup classes in the MSDN2 library.

[Simon Guest - Off Topic: MSN Toolbar Suite]

Posted By Harry Pierson at 10:04 AM Pacific Standard Time

Monday, December 13, 2004

.netcpu? .netcpu!

Tom sent me a link to Jonathan Wells' blog entry about the .netcpu:

.netcpu Corporation's new '.NET' Embedded development kit includes a .netcpu CPU Module, a general purpose microcontroller for programming embedded solutions using C# and the Microsoft .NET Embedded CLR. Use the kit to experiment with projects such as low-power and sensor applications( eg data collection and logging sensor) or create a simple, smart embedded device (eg smart refridgerator, robot or home automation system).

Note the words “Embedded CLR“...i.e. I'm 99% sure this is the same CLR that powers the SPOT watch. Rick Rashid had something in his OOPSLA keynote about this SDK. You can order the .netcpu Starter Kit for $499 or just the CPU module for $199.

I think I need to update my xmas list...

Update - There's a good technical article about the .NET Embedded on WindowsForDevices.

Posted By Harry Pierson at 11:32 AM Pacific Standard Time

Member Management Component Prototype

How about this for transparency?

The Microsoft ASP.NET v1.1 Membership Management Component Prototype contains classes that allow a developer to more easily authenticate users, authorize users, and store per-user property data in a user profile. The authentication feature validates and stores user credentials which a developer can use to manage user authentication on a web site. The authorization feature lets you treat groups of users as a unit by assigning users to roles such as manager, sales, member, and so on. Combined with ASP.NET's built-in authorization functionality, Windows Shared Hosting developers have end-to-end support for maintaining user-to-role mappings and authorizing users based on this information. The profile feature enables you to provide users of your Web site with a custom experience. By defining and using profile properties, you can track any custom information your application requires, including user information and user preferences.

Important: The functionality provided by this component is a preliminary version of the Membership, Roles, and Profile functionality coming in ASP.NET 2.0 and will change in the final release of ASP.NET 2.0. This means that any ASP.NET v1.1 applications you develop using this component will need to be updated when you migrate to the final release of ASP.NET 2.0. This is also a non Microsoft supported component.

What I love about this the most is that it really reflects a change in mindset. In the past, I doubt we would have shipped this because it is likey to change before release. Personally, I like this approach - ship early and often and be honest about the quality and longevity. Sure, you have to deal with a few people who don't read things like “will change“ or “not supported“ but the benefits outweigh the issues dramatically.

Posted By Harry Pierson at 11:24 AM Pacific Standard Time

Wednesday, October 27, 2004

And Now For Something Completely Different

We interupt this blog's coverage of OOPSLA with a quick observation & question related to development...

I'm hacking around writing a Word 2003 SmartTag in C# (more on the why later). I wanted my recognizer to be document-dependent - i.e. depending on some custom document properties, I wanted to change what gets recognized. A little digging reveils that there is no way (that I could find) to access the Word object model from the recognizer! The Recognize (and Recognize2) method receives strings as parameters, but it doesn't receive an app-specific target object. This is unlike the Smart Tag Action's InvokeVerb (and InvokeVerb2) method which receives a Range object (from which you can navigate to the containing document, application and window) when running inside of Word. Bummer.

I think the reason for this is that the recognizer appears to run on a background thread while the action appears to run on the main app thread. Furthermore, both threads are STA apartment threaded, so if I can access the COM-based object model from the action thread, I can't access it directly from the recognizer thread. I actually hacked up an add-in to provide the ActiveDocument to the recognizer thru a backchannel and it hangs Word on shutdown. I thought there might be an issue releasing the COM reference, but explicitly releasing it crashes the recognizer the next time it accesses the ActiveDocument.

So I've come to the conclusion that I somehow need to marshal this call from the background thread to the main app thread the action and addin are runing on (I did verify that both of those run on the same thread). The question is, what's the best way to do that given that I'm writing this in C#? I thought I might use a system similar to Windows Form's Control.Invoke(...), but it turns out that works by sending windows messages which isn't particularly feasible for my problem. So now I'm thinking I have pass the ActiveDocument reference to the background thread using CoMarshalInterface. Or I might be able to use RemotingServices.Marshal() instead.

Anyone have any ideas? If so, leave a comment or drop me a line.

Posted By Harry Pierson at 12:12 AM Pacific Daylight Time

Monday, October 18, 2004

Virtual PC 2004 SP1

I'm sure this has made the rounds, but VPC 2004 SP1 is available. Among other updates, it has a new version of the VM Additions, which significantly improves the performance of XP SP2.

Posted By Harry Pierson at 10:43 AM Pacific Daylight Time

Tuesday, October 12, 2004

WSE2 and WSDL

I may be at Strategic Architect Forum, but I've actually been coding off and on today - using WSE2 to expose web services. I hadn't realized that SoapService supports auto generation of WSDL - pretty cool. I dug around with Reflector to figure out how it works. Turns out that SoapReceiver (parent of SoapService) exposes a method called GetDescription that returns the WSDL as an XmlDocument. The SoapReceiver version of GetDescription returns null, but the SoapService implementation uses an internal class called WsdlCreator to generate construct a ServiceDescription from SoapService type that you write. Pretty cool.

The only downside is that if you use raw SoapEnvelopes as the input and output parameter of the SoapService methods, the WsdlCreator has no way to know what schema to use for the corrisponding SOAP messages. So, it punts and represents a SoapEnvelope as sequence of xsd:any tags. :( If you use XML serializable types for parameters, then the WsdlCreator generates the associated schema in the WSDL. Only issue, I gave up on XML serialization a while ago.

I wish there was a way to adorn the SoapService methods with an attribute indicating the associated message schemas (with the ability to validate those messages automatically).

Posted By Harry Pierson at 4:56 PM Pacific Daylight Time

Saturday, August 21, 2004

No Time To Experiment, So I'm Reading About Cw

COmega (otherwise known as Cw since most people don't have an omega key on their keyboard) is on a long list of stuff for me to look at. But instead of actually coding with it, so far I can just read Steve Maine's blog. He's got interesting posts on syncronization and streams, the two big features of Cw over C# (come to think of it, we use the “#” symbol as most people don't have an actual sharp key on their keyboard). I also learned from Steve that Cw comes with basic VS integration - you get project support, syntax highlighting and some Intellisense. Now I just need a few extra hours in the day.

Posted By Harry Pierson at 3:22 PM Pacific Daylight Time

Friday, August 20, 2004

Weird VPC Issue

I'm setting up a new SQL 2005 / VS 2005 VPC. While I'm pretty excited about SQL Express, I want to experiment with some of the features in the full product so I'm installing Express's big brother. However, there must be some weird issue w/ VPC's shared folders feature - the setup support files fail to install. If I connect to my host across the virtual network to the loopback adapter then the install works fine. As I said, weird.

On a related note, anyone know a good, simple, free/cheap DHCP server for XP? The one issue w/ using the loopback adapter is that you either hardcode network addresses or use the “Automatic Private Address” (i.e. the 169.254.*.* address). The auto private address works fine, except that it takes a while for the DHCP to time out before assigning the private address. Plus, in XP SP2, there's an annoying tray icon that pops up to tell you that the loopback adapter failed to get a DHCP address. If I had a DHCP server for the virtual network hanging off the loopback adapter, then I could avoid all that timeout and annoying pop up tray icon stuff.

Posted By Harry Pierson at 10:01 PM Pacific Daylight Time

Friday, July 09, 2004

Hacking EXIF w/ Omar's PhotoLibrary

I love my Olympus digital camera, but it does have one annoying issue. Occasionally, it “forgets” the current time and date. This leaves me with a bunch of images with a corrupt “Date Picture Taken” field (here's an example). Luckily, Omar's PhotoLibrary let me hack up a little program to update the date fields in the EXIF header. I couldn't use JPEG Hammer out-of-the-box becuase it doesn't handle the corrupt date fields. No matter. My app is a total hack, but since I only need to use it once-in-a-great-while, it's no big deal. 

Posted By Harry Pierson at 10:50 PM Pacific Daylight Time

Thursday, June 03, 2004

XMLSPY Home Edition

I'm guessing someone blogged it last week (I gave up on catching up on blogs since I was almost three weeks behind), but there's now a free home edition of xmlspy. Many of the cool features, including the schema editor, are available. However, the web services support, primarily the WSDL editor, remain only a part of the enterprise edition.

I keep wondering if someone in the community will build a WSDL editor with VSIP, esp. one that supports WSDL 1.1 and 2.0. I know CapeClear has their WSDL editor, but I find the explorer style view much less usable than the xmlspy-style graphical view.

Posted By Harry Pierson at 8:24 PM Pacific Daylight Time

Tuesday, May 11, 2004

The Managed P2P Hit Parade

From the one-less-thing-for-me-to-do department, Chris Dix has created a managed wrapped of the WinXP P2P SDK. He also has several sample apps, including a Scoble-inspired MagicFolder. According to his site, Chris plans to extend his library to support web services (WSE custom channels?) which should be very cool.

It's funny, I used to get really sad when I discovered someone else had built something that I had started building. Especially if, as in this case, theirs was better. Now, I'm just relieved that I can reuse the library without having to build all the surrounding infrastructure. I'm glad I never released my managed P2P wrapper, it would be one more thing for me to kill. Like my HtmlReader stuff. I still get people looking for it even though I killed it a while ago. (Hasn't everyone figured out they should use SGML Reader instead?)

Posted By Harry Pierson at 8:11 PM Pacific Daylight Time

Enterprise Media Services

The more I understand about Windows Media Services 9, the more I like it. I especially like the fact that can create your own data source plug-in as part of a custom broadcasting solution. However, one quick gotcha - you can only use custom plug-ins with WS03 Enterprise Edition. Didn't realize until I had built and configured my virtual media server and compiled the sample data source plug-in. Annoying, but not the end of the world.

Posted By Harry Pierson at 2:52 PM Pacific Daylight Time

Tuesday, April 20, 2004

Broadcasting Music

The first thing I need for my DJ idea is to be able to broadcast content. This means a variety of things, but first and foremost is music. The  RIAA provides special webcasting licenses as long as the webcaster meets specific criteria. (I'm guessing I'll have to talk to our legal dept. before I actually broadcast any music). The criteria is pretty acceptable - I could easily build a bot that streams music 24/7 from my own ripped CD collection in accordance with the RIAA's criteria.

Of course, all that ripped music is on my personal home machine and I have no interest in copying it all up to my media server. What I really want to do is broadcast from my home machine to the server, which in turn broadcasts to potential listeners. From what I understand, I need to use the Windows Media Encoder (or an app built with the WMEncoder SDK) to push media to the server for rebroadcast. No problem - building a bot to do that should be no big deal. Except that it is a big deal.

WMEncoder can only work with two sources of media (not including screen captures, HTML and script which are not applicable to this post) files and devices. Since I'm mixing together the contents of multiple files, I can't use a single file as a source. Which means a device. The problem lies in the fact that audio apps are designed to write to audio rendering devices (like the sound card) not to audio capture devices. What I need is a audio "loopback" device that takes the audio sent to the virtual audio rendering device and sends it directly to the virtual audio capture device. Thus, the output of the bot is fed as input into the encoder. So far, I've found Virtual Audio Cable from NTONYX that looks like it will do the trick (I actually dug out the windows driver book and entertained very brief thoughts of building my own, but in the end, I'd rather just spend the $50 for VAC).

I'm not sure if I'm going to use DirectSound or DirectShow to build my broadcast bot. I'm leaning towards DirectShow since it seems more suited to this sort of problem (even though it is the only piece of DirectX w/o a managed wrapper). I just wish there was a Windows Media Broadcast rendering filter that didn't require the use of VAC or the encoder.

Anyone out there have any experience with DirectShow?

Posted By at 10:54 PM Pacific Daylight Time

Thursday, April 08, 2004

It's all a Platform

I used to say that everything we build should be a platform except for games. What's interesting is that games are becoming platforms in their own right. Dungeon Siege has the freely downloadable Siege Editor which allows you to "rework nearly every aspect of the gaming world, making Dungeon Siege not only a game, but also a platform for those who wish to create their own spells, dungeons, and even entire worlds." There are several projects that do just that. And Dungeon Siege II is coming later this year, which looks amazing (all trailer graphics were rendered with the game engine). If RTS is more your speed, Relic - developers of Impossible Creatures - has their developer network which provides both a companion tool for enhancing Impossible Creatures as well as the Impossible Creatures SDK "which includes source code from the IC engine that can be used to create Total Conversion Mods for IC" (Relic Developer Network requires registration). Of course, there's also the Allegiance source code which was released a few months ago.

I guess the new viewpoint is that everything we build should be a platform, including games.

Posted By at 6:10 PM Pacific Daylight Time

Thursday, April 01, 2004

Code is Real

After several weeks of using NewsGator's online services to read blogs, I'm finally got app reinstalled (machine switching and paving - you know the drill). While the web-based reader is nice in a pinch, it's not as convient as the Outlook-based reader, so I got way behind on blog reading (which is partly why I've been behind on blog writing). So there may be a few things that made the rounds in the past few weeks that I'm only getting to now. Like this.

True.

Posted By at 11:19 AM Pacific Standard Time

Thursday, March 11, 2004

Burning Desire

After actually building something for the first time in a while, I spent some time last night researching other stuff I want to write. One of the things I'm thinking about building is a WMA to Audio CD burning program. Of course, WMP9 (and many other programs) does this today. However, there's one specific feature I need and it doesn't appear to be one of the more standard ones.

Pretty soon, we're going to make the Architecture Strategy Series content available for download. For each presentation, we're going to provide the slides, the full Producer presentation, and a WMA file suitable for burring to CD. We're even using the Windows Media Time Compression technology to get all the sessions under 80 minutes so they fit on CD. However, when you burn the file, it creates basically one long track, making it difficult to move back and forth within the presentation. I could break it into separate files per track, but that's a pain. At least with one big file, there's no chance of getting it out of order.

The Windows Media Format supports named markers. My burning program could build multiple tracks, based on those markers. Other audio players or CD burners would just ignore those markers. That way you get one file to download, but multiple tracks when you burn - the best of both worlds.

However, I have precious little time to dedicate to such a project, primarily as I have higher priority projects to build first. Additionally, I'd have to write it in C++ due to the lack of managed support for the various APIs and SDKs I would need. (Windows Media Format SDK to read audio file and the Image Mastering API to create the audio CD) So I gotta wonder if this capability already exists somewhere? Are there commonly-available tools that can use either named markers or a playlist file to create multiple tracks from on audio file? I'd hate to reinvent the wheel if I didn't need to.

Posted By at 11:59 AM Pacific Standard Time

Wednesday, March 10, 2004

Build Slide Export

I blogged yesterday about the issues I’m having with manually repurposing content. One of the specific issues has to do with the Architecture Strategy Series. We provide that content via three channels – DVD, online seminars and (soon) download. We use Producer to create the DVD and download files. However, online seminar system doesn’t support Producer. The primary issue is that Producer uses the Save as HTML version of the PPT, but the online seminar system only supports static images. This means having to manually strip out the animations, which is a pain in the ass. Since I don’t ever want to have to do that again, I wrote a PowerPoint add-in to do it for me.

When you invoke the Build Slide Export add-in , it will step thru your presentation and screen capture each slide build to disk. It’s very similar to the built in Save as JPEG/GIF/PNG feature, except that it creates an image per build, not per slide. So those complex build slides turn out multiple image files. It’s sort that you can’t use the machine for anything else while it’s processing, but it was really easy to write the code. I tested it on a long complex PPT file with lots of builds (i.e. the one that took me hours to repurpose on Monday) and it took about 10 minutes.

I’m also providing the source to the add-in. It’s not much code: maybe 150 lines of relevant code at most. I grabbed the screen capture code from Perry Lee on C# Corner.

There were a couple of gotchas involved with this add-in. For example, the add-in project type uses version 7.0 of the office.dll that comes with VS.NET. However, Office 2003 comes with version 11.0 of that DLL and not 7.0, so the first time I went to deploy on my production machine, it didn’t work. I had to grab the right version of office.dll out of the GAC in order to reference it, so it’s included in the lib directory of the source archive (it looks like Simon did something similar with Niobe). Also, PowerPoint’s object model is a little funky. Specifically, SlideShowView.Next() has to be called differently depending on the types of builds in the slides. I handle four different scenarios in the code: no builds, only auto trigger builds, and manual trigger builds, optionally with a set of auto trigger builds before the first manual trigger build.

I’m sure there’s other enhancements that could be made – for example, the directory the images are saved isn’t selectable nor is the image format. If there’s any interest, I’ll spin up a GDN workspace.

Update: I just noticed a bug, albiet a cut-and-paste bug on my part. Turns out the screen capture code that I used is creating four image objects for each screen capture. To make matters worse, three of them are never assigned to a variable, so you can't call Dispose() on them. So for any real-sized presenation, memory usage goes thru the roof. It's relatively easy to fix. Take the code that looks like this:

Bitmap image = new Bitmap(
Image.FromHbitmap(new IntPtr(hBitmap)),
Image.FromHbitmap(new IntPtr(hBitmap)).Width,
Image.FromHbitmap(new IntPtr(hBitmap)).Height);
image.Save(fileName,imageFormat);

And replace it with this:

Bitmap image = Image.FromHbitmap(new IntPtr(hBitmap));
image.Save(fileName,imageFormat);
image.Dispose();

With the improved code, only one bitmap per screen capture is made, and it's explicitly disposed. That keeps memory usage under control.

Another Update: I've updated the binary and the code links above with the new v1.0.1 version that fixes the memory hogging problem.

Posted By at 5:41 PM Pacific Standard Time

Tuesday, March 09, 2004

Looking for SPSynd Volunteers

I had eight people waiting to be admitted to the SharePoint Syndication GDN Workspace. Sorry for the delay folks - my workspace was maxed out on users and I had to get upgraded by GDN. Anyway, I've been given more membership slots, so the people who've been waiting - some since January - are now in.

There has been a lot of interest in this project and others like it. Jonathan Malek has his SpsRssGen project. Sig Weber has an RSS Generator for SPS. All in all, there is quite a bit of interest in this developing for SharePoint in general and creating syndication feeds in particular. Too bad I can't get more involved. With my new job, I just don't have the time to work on this project anymore. :(

Since I can't keep the project up, I'm wondering if someone else would like to take up the reins. I posted all the code to the workspace, but so far there's been little traffic other than people wanting to join. I was hoping for more participation, but then I haven't done anything to foster that so I really can't complain. So let me ask explicitly: If you're interested in being an admin on this project, please send me email. Once I get an admin (or two) and a core group of interested developers, I'll start hosting chats / email lists / live meetings / conference calls / smoke signals / whatever to discuss the project direction. Personally, my #1 feature is an admin interface for creating the syndication feeds integrated directly into the existing SharePoint admin interface. Not sure how doable that is, but let's find out. After that, I'm open to suggestions as to project direction.

Posted By at 3:20 PM Pacific Standard Time

Thursday, March 04, 2004

URL Addressability

In a meeting with Ward the other day, he brought up the importance of URL addressability in the context of a project we are working on. I've run into this issue twice recently.

  • We just posted the streaming content for The Architecture Strategy Series on the MSDN Architecture Center. While I can link directly to the sessions, there's a script on that page that pops the session up in it's own window and checks what version of Media Player you have installed. If I link directly, the window resizes wrong and you don't get video with the audio. So I end up linking to the series page instead.
  • TechEd just posted their list of breakouts, including the session I'm delivering. However, I can only link to the overall breakout page, not to my specific session. If you want to see my session, you can filter by speaker.

Suffice to say, I'll be considering URL addressability from now on in anything I have a hand in developing in the future.

Posted By at 3:33 PM Pacific Standard Time

Monday, February 16, 2004

Service Oriented Language

I like Jeff's suggestions for a Service Oriented Lanugage as well as RebelGeekz' idea of how to include XML Infoset information in a language without resorting to angle brackets. I wonder what a community developed lanugauge would look like? I've experimented with Coco/R which really reduces the effort it takes to build a parser. Of course, the language design and code generation are the hard parts!

Source for Coco/R is available on the Rotor Community Projects page. Other cool projects include a port of Rotor to WinCE, two different AOP projects - one for C# and the other language neutral and a set of improved collections.

Posted By at 5:19 PM Pacific Standard Time

Wednesday, February 11, 2004

Allegiance Source

Again, I'm late to the story but I think it's ultra-cool that MS Research released the source code to Allegiance . At 511 MB, it's almost thirty times bigger than Rotor + Gyro, which is a significant code release in itself, though honestly, only about 5% of the Allegiance archive is code, the 95% is in the "Artwork" subdirectory. That still leaves about 25MB of compressed code.

I'd love to see a port to MC++, a la Quake II.NET. Is anyone working on it?

Posted By at 10:52 PM Pacific Standard Time

Tuesday, February 10, 2004

Hacking InfoPath

I had a few negative things to say about InfoPath a while back. Today, I finally used it to solve a "real" problem and I was extremely pleased with the result.

I'm working on some team stuff and needed to collect a bunch of info on all my teammates and stick it in an XML file. Traditionally, I'd have to send out email asking everyone to send me this info, then manually cut-and-paste the results into an XML file. Instead, I whipped up an InfoPath form (well, truthfully, I whipped up several - but that's just because I'm not familiar with the tool) and stuck it on a SharePoint site. Now, all my teammates can go fill out the form and I can merge the results together in one big XML file. All in under an hour, including learning curve. InfoPath even supports pictures, so my teammates can even provide a photo of themselves in the form.

I'm not exactly uninstalling VS.NET, but it's good to know how well InfoPath hits the mark for target scenarios like this one.

Posted By at 5:39 PM Pacific Standard Time

Monday, February 09, 2004

SOA vs. SOP

Don pointed out to Goran that the Indigo definition of "a service is simply a program that one interacts with via message exchanges." Goran pointed out that that definition "really doesn't highlight how it'll help a customer". I think part of the reason they are both right is that they are talking about different things. I would say Don is talking about Service Oriented Programming where Goran is talking about Service Oriented Architecture. This gets back to the levels of architecture that I blogged about. Platform tools like Indigo are components used in systems. I'm guessing the customer's Goran mentioned are at the system-of-system level for whom the messaging plumbing is below the abstraction level they care about. 
 
 Of course, SO* buzzwords are thrown about with such frequency these days it's hard to keep track of the difference.

Posted By at 3:36 PM Pacific Standard Time

Sunday, February 08, 2004

P2P Blogger

Noah Horton, former teammate who has gone on to become PM in the Peer Networking Group, has started a blog. Of course, with the new aggregated feed of MSDN bloggers, you probably already knew that. However, I am compelled to blog this as Noah is a friend, works in the next building over from me and I've got a special interest in P2P. I'm looking forward to his promised tips and tricks. Subscribed.

Posted By at 10:39 AM Pacific Standard Time

Monday, February 02, 2004

SharePoint Component Directory

Going thru my referrer logs, I noticed that my SPSynd project is now listed in the SharePoint Products and Technologies Web Component Directory. Thanks for the listing!

Posted By at 10:44 PM Pacific Standard Time

Thursday, January 22, 2004

Authorization and Profile Application Block

patterns & practices has published a new App Block: Authorization and Profile.

This block is a reusable code component that builds on the capabilities of the Microsoft .NET Framework to help you perform authorization and access profile information.

You can read it online or download it.

Posted By at 10:19 AM Pacific Standard Time

Monday, January 19, 2004

Project Niobe

My teammate Simon has posted details of his managed SDK for Outlook codenamed Niobe. He's also created a GDN workspace for it. Coolness.

Posted By at 10:29 AM Pacific Standard Time

Thursday, January 15, 2004

Thinking about SPSynd

I'm kicking around SharePoint Syndication again. There are a variety of reasons. I got email from someone @ the SP Web Component Directory about it. According to Scoble, the Front Page team is interested in RSS. And the primary kicker, there's a project going on in my group internally that is using WSS and wants to expose RSS feeds.

Glad to know it's popular. Too bad it's not done and I'm not sure how to finish it.

Generic feed generation works just fine. The problem is customization. I need a user-friendly way (i.e. not hacking XML in the config file) to configure the feeds. Currently, the config file specifies which lists and webs expose feeds as well as the format of the feed for different list templates. I want to move that config so that it can be managed by the administrator using a simple UI, not the XML file. But that leads to questions: Do I try and stash my config data into the existing web and list configuration via the standard object model or do I bite the bullet and store it somewhere else (i.e. another DB)? What's the best way to add admin of the feed to the existing admin pages? Frankly, I don't know the answer to these questions.

One way to solve this problem would be to completely refactor the solution. Instead of relying on the WSS object model, I would leverage the WSS web services. This would let me run the feed generator outside of the confines of WSS. Basically, I'd just be translating formats - the output of the web services into RSS and OPML. This would be really great for hosted WSS since it wouldn't require any change to the WSS site itself. However, doing the security right for this scenario would be a pain in the ass. WSS web services use transport level authentication which means it's difficult to "hop" credentials across servers.

I don't know if the answers to these dilemmas are out there in the blogosphere, but I figured I might as well put the questions out there.

Posted By at 2:05 PM Pacific Standard Time

Monday, January 12, 2004

Teredo Sans P2P

I hadn't realized this before, but you can still use Teredo without using the P2P stack. By default, IPv6 sockets block incoming Teredo traffic. But if you set the socket's IPv6 protection level to unrestricted, incoming Teredo traffic is allowed. Not sure how useful this is, especially since I haven't seen an easy way to set the IPv6 protection level from managed code. You may be able to setsockopt using the Socket.Handle property, but I haven't tested it.

Posted By at 3:29 PM Pacific Standard Time

Thursday, January 08, 2004

More Embedded Info

Dave Hamilton is a Microsoft Consultant who's currently working on CE project and is blogging his efforts. His CE-related posts provide a ton of infomation. He doesn't explain what he's building, but he does point out the the board he's using is "intended for embedded media-centric devices". Dave provides links to sites for Mini-ITX and EPIA enthusiasts.

Thanks to Michael Earls for the pointer to Dave's blog.

Posted By at 8:57 PM Pacific Standard Time

Wednesday, January 07, 2004

Homebrew Embedded Hacking

I finally have my busted laptop back. I paved it and was in the process of reinstalling the important stuff when the storm hit. Since I'll be moving back to that machine very soon, I figured I could break quarantine on the machine I'm currently using. Since the one thing you can't run in Virtual PC is the embedded device emulator, I decided to install Windows CE. I stumbled across this article for DIY Wireless Access Points (from Wireless Hacks) which pointed me to a couple of embedded system vendors - Soekris and OpenBrick. I'd love to get CE up and running on one of those boxes and roll my own media client device, to learn about hacking embedded if for no other reason. I know Duncan has a cool homegrown audio PC project, but I was thinking something embedded would be even cooler.

There doesn't seem to be much, if any, grass-roots community around building CE based devices. All the efforts on the embedded website seem to be geared towards large companies. For example, the US distributors of CE don't list prices on their pages. I can only assume it's a case of "if you have to ask, you can't afford it", at least for the individual developer. CE is not included in MSDN (though it used to be if memory serves). I can only find info on homebrew embedded hardware on Linux sites.

Where are there any other DIY or homebrew embedded sites that I don't know about?

Posted By at 11:24 PM Pacific Standard Time

Tuesday, January 06, 2004

P2P in Longhorn

I realized I wasn't going into the office today @ 6am. My wife's school called to let us know school was canceled. Given how hard it has been to get my email all day, I'm guessing I'm not the only one. Since I'm not at work or doing email, I figured I'd mess around with my new Longhorn machine.

I noticed browsing through the samples that Longhorn has a managed P2P API. The PDC build only supports PNRP and identities, which means you can't acually communicate with another machine via P2P (yet), but it's nice to see that it exists.

Posted By at 3:55 PM Pacific Standard Time

Monday, January 05, 2004

Objects vs. Data

Christmas was crazy (my wife's blog has the details), so I didn't get a chance to blog about Sean & Scott's desire for unification of objects and data, Erik Meijer's two papers on the topic, or Dare's responses to both. Programming language evolution is something I've keenly interested in. When I first started this blog almost a year ago, one of my early posts was about a disruptive programming language technologies presentation from MS Research. Among the areas mentioned for improvement: were database integration and XML manipulation. Sounds like the Xen language demoed @ XML 2003 is a step in that direction.

When you read Erik's papers, you'll notice that one of the goals is to natively integrate XML into the language. He writes: "In our approach XML documents or document fragments become first class citizens." What's interesting about that is that if you take XML to mean pure-infoset-data (as opposed to angle-bracket-serialization-format) then you can argue that Data (with a capital D) is not a first class citizen of today's Object-Oriented languages. Given that a lot of OO code has been written to manipulate data, having a language that explicitly distinguished between the two could be valuable (assuming it made the programming easier and the programmer more productive).

Note, this is the opposite approach from tools like O/R mappers and XSD.exe which attempt to hide the differences from the programmer. We've seen a similar evolution in the way we think about invoking objects across the network. Tools like DCOM and .NET Remoting attempt to hide the RPC and make it appear as a local call. But as the thinking evolves, tools like Indigo is designed to make the boundaries across apps and machines explicit. Initial thoughts on data access were to make it all look like objects (i.e. O/R mapping). But as the thinking evolves, maybe we need to make the boundaries between objects and data explicit (and easy) as well.

Posted By at 11:49 AM Pacific Standard Time

Sunday, January 04, 2004

Eating Dogfood

I know I blogged that I haven't been dogfooding, but Don's post about programming without generics hit home. For example, look thru the source code for dasBlog and you'll see a ton of hand-written type-safe collection classes that Whidbey will just eliminate en masse. So I loaded up an older laptop with Longhorn & Whidbey. I have been more interested in Whidbey than Longhorn so far, but I figured since I could dedicate hardware (LH runs much better on my 650MHz P3 than in a VPC on my 2GHz P4) I might as well go all the way. Plus, an old friend who spent his Christmas vacation @ Whistler brought me an authentic Longhorn Saloon & Grill hat.

Posted By at 6:23 PM Pacific Standard Time

Saturday, January 03, 2004

Support for MSNP8

Robert M. Wagner Jr. sent me (and Chris) an update for IMCLI to support MSNP8. I haven't tested it or integrated it into Messenger.NET yet, but here's the code if you don't want to wait.

I've spun up a GDN Workspace for IMCLI and Messenger.NET. Nothing's up there yet until I get Chris's permission to post his code. Permission has been granted - I'll have the code up there in the next day or so.

Posted By at 12:02 PM Pacific Standard Time

Monday, December 29, 2003

Messenger.NET Currently Hosed

I haven't checked it personally, but I hear that Messenger.NET is no longer working. Apparently, MSN shut off access to all versions of their protocol prior to MSNP8 (Messenger.NET uses imcli which implements MSNP7) back in October.

There's a good description of the MSNP8 protocol up on hypothetic.org as well as some info on the changes in MSNP9 and MSNP10. I don't have time to upgrade imcli and/or Messenger.NET. Any volunteers?

BTW, as an alternative, I found the dotMSN library on hypothetic's project page. Version 1.1 of dotMSN implements MSNP8. It's free, though the source is not provided. I have no idea if it's any good, but it's the only .NET library for MSN messenger that implements MSNP8 that I could find.

Posted By at 9:55 PM Pacific Standard Time

Friday, December 19, 2003

Whitespace

While checking out the list of projects hosted at the Rotor Community site, I stumbled across an implementation for Rotor of  Whitespace "a programming language whose syntax is entirely based on space (0x20) tab (0x09) and (0x0A) linefeed". Seriously.

BTW, the other projects on the Rotor community are much more useful. Check them out.

Posted By at 10:31 AM Pacific Standard Time

Thursday, December 18, 2003

P2P Revisited

So I want to start kicking the P2P SDK around again. However, most of my work to date is on my busted laptop that I am still waiting to get fixed. Rather than reinvent the wheel, I started looking at wrapping two other relevant SDKs: IP Helper and Internet Connection Sharing & Firewall. IP Helper allows access to the network configuration of the local computer (including IPv6 settings). ICS/F allows you to programmatically manage XP's NAT and firewall functionallity (including the IPv6 firewall). Both are relevant to P2P due to the management of IPv6.

I'm not sure why these systems have a custom API instead of just using WMI, but they do. So I'm looking to wrap them either in managed code or WMI (which is then available to managed code via System.Management).

UPDATE: MSFT just published a document about the new Windows Firewall in XP SP2. One of the big new features is the ability to configure the firewall at the global scope., though you can still specify connection settings which override the global settings. SP2 also includes the IPv6 firewall that is a part of the Advanced Networking Pack (which may mean that the P2P infrastructure is baked into SP2). I'm sure this will imply changes to the ICF API.

UPDATE 2: I finally got my laptop back today, and I found my previous P2P work. I hope to kick some code around over the holidays.

Posted By at 7:35 AM Pacific Standard Time

Tuesday, December 09, 2003

WTL 7.1

I cut my teeth developing for the windows platform with Windows++ by Paul Dilacia. It was about building a framework to wrap the Win32 api. Because of the elegance of Windows++, I never ever liked MFC. I disliked it so much that when I joined Microsoft, one of my ex-coworkers remarked "But you hate Microsoft" to which I replied "No, I hate MFC."

Anyway, even though most people have moved on to managed code now, Microsoft continues to ship updates to the Windows Template Library. WTL is an extension to the Active Template Library that supports typical Windows applications (controls, dialogs, frame windows, GDI objects, etc). The new 7.1 version support VS.NET 2003, Windows XP and Windows CE.

I wish I had had access to WTL back in the day. I liked it so much better than MFC.

Posted By at 9:20 PM Pacific Standard Time

Monday, November 24, 2003

C++ CLI Binding Candidate Spec

I blogged on the new ECMA working group for standardizing the C++ binding for CLI last month. Last week, Herb Sutter blogged the candidate specification. And to answer the question I posed, it does appear that the double underscore syntax has been removed. Instead of "__gc class {...}", it's just "ref class". For __value and __property, you just lose the double underscore. Cool, though it does mean any MC++ code will eventually need to be migrated to the new syntax. Also. the specification is forward looking, including support for CLI generics.

Herb also blogged in depth on the new keywords as well as the gcnew operator.

Posted By at 2:40 PM Pacific Standard Time

Wednesday, November 12, 2003

SharePoint Syndication v0.5

I've finally updated the SharePoint Syndication project to support the RTM version of Windows SharePoint Services. Since I'm in process of updating my blog software, I haven't updated the project page, though I have updated the GDN workspace with the release bits, source code and readme file. The workspace even has a freshly minted url: http://workspaces.gotdotnet.com/spsynd. Enjoy.
Posted By at 4:40 PM Pacific Standard Time

Sunday, August 31, 2003

Links relevant to P2P

My contact on the P2P team just gave me two more important links for the construction of IPv6 based P2P apps. The first is IP Helper, a library included with XP that "enables the retrieval and modification of network configuration settings for the local computer". I had never seen that library before, but it's full of useful methods like GetAdaptersInfo and GetAdaptersAddresses. I want to be able to retrieve the IPv6 address of my NICs directly, so this is the library I need. Anyone out there wrapped it in managed code yet? I was hoping to do this part with WMI, but the IPv6 info doesn't seem to be exposed via WMI.

The other relevant link is the IPv6 Internet Connection Firewall SDK, which "contains all the software required to configure the IPv6 Internet Connection Firewall". I assume that means that I can open relevant ports to enable P2P communication. As I wrote yesterday, the issue I'm having with GraphChat is likely related to the IPv6 Firewall configuration. I'd like to include in my P2P managed library the ability to manage the IPv6 Firewall.

Posted By at 9:10 AM Pacific Daylight Time

Saturday, August 30, 2003

P2P Problems Solved

Someone from the P2P team internally saw my blog and set me a list of commands to execute and send back to him to help troubleshoot my problem. One of those commands was "net start pnrpsvc". Aha! I hadn't realized that the WinXP Adv. Networking Pack installed any services. Turns out it installs four, including the "Peer Name Resolution Protocol" service (i.e. pnrpsvc). What's odd is that now that I've started it manually once, it seems to autostart on demand now. I can resolve addresses, as well as ping the seed server. GraphChat doesn't work yet, but I think that's because the IPv6 firewall only has two ports open by default - PNRP (UDP 3540) and Grouping (TCP 3587). The GraphChat sample uses a dynamically chosen port, which would be blocked.

So now that I'm back on track, I've got the PNRP namespace provider API wrapped in Managed C++. I can register, unregister, resolve and enumerate PNRP clouds from managed code. I've also got a first pass of the Identity Manager API and a skeleton of the Graphing API done. I'll post code when I have a managed GraphChat sample working.

Posted By at 9:57 AM Pacific Daylight Time

Monday, August 11, 2003

More on P2P Problems

I discovered a FAQ for the WinXP Advanced Networking Pack Among other FAQ's (including "What is a F.A.Q.?") are "What is a PNRP seed server?" and "How do I know if I can contact the Microsoft hosted PNRP seed server?". A seed server is a bootstrap for a PNRP "cloud". PNRP is supposed to be serverless, but there has to be some way for the system to be bootstrapped. MSFT runs a seed server at a well known address (well known to the P2P system, since no one told me). To see if you can reach said seed server, you can run "netsh p2p pnrp diag ping seed". If the number is one or greater, all is good. In my case, that command raises Error 0x800706d9: "There are no more endpoints available from the endpoint mapper". I'm not sure what that means, but I'm guessing that explains why I can't resolve PNRP names.
Posted By at 9:55 PM Pacific Daylight Time

Friday, August 08, 2003