Category Archives: Microsoft

Microsoft Shared Source Licenses Approved by OSI

Two of Microsoft’s open licenses, the Microsoft Reciprocal License and the Microsoft Public License, have been certified by the OSI. This is a big deal because only with an OSI certification can you call your license an "open source" license.

This won’t be enough to satisfy the purists (since, to them, anything with Microsoft’s name on it is suspect) but it should be enough to get the utilitarians (like me) excited.

Database Queries with Windows Powershell

I haven’t done a serious learning project for a while so this week I decided to play around with Windows Server 2008 and PowerShell. I’ll post some thoughts about Server 2008 soon (at first glance it looks terrific once you get past the fact that IIS is now a "role" instead of something you install). But I wanted to post a PowerShell example first because I wanted to do something with it that I couldn’t find information about anywhere — specifically, perform a database query and dump the contents to the console. (Later we’ll get fancy and dump it to HTML or send it somewhere via email, etc.)

PowerShell can invoke any .NET object, so I knew it was possible to do database stuff with a PowerShell script, but I couldn’t find any examples anywhere, so here’s what I cooked up via trial and error.

The first step is to create a database connection:

$cn = New-Object -TypeName MySql.Data.MySqlClient.MySqlConnection

The syntax to load a .NET assembly in PowerShell is pretty awkward; couldn’t they have provided a Get-Assembly cmdlet? (I suspect that thousands of PowerShell users have already written that one already.) Also, you have to know the assembly name of your ADO.NET provider (which, for MySql, is "MySql.Data," not "MySql.Data.MySqlClient," which was my first guess). The thing to remember is that loading an assembly is syntactically different than including a namespace even though the objective is sort of the same.

Fortunately this is the only part of the process that I didn’t get right the first time, and I had it resolved after a few minutes of experimentation.

I should mention that I’m using the MySql data provider because we use MySql on, but you can obviously use any ADO.NET provider you want here. This assumes that your ADO.NET provider is installed in the GAC; if you need to make an explicit reference to an assembly in the file system the syntax is different.

Next, open the database connection:

$cn.ConnectionString = "SERVER=localhost;DATABASE=mydb;UID=xxx;PWD=yyy"

If you want, you can check the value of $cn.State here to make sure it worked. Then execute the query:

$cm = New-Object -TypeName MySql.Data.MySqlClient.MySqlCommand
$sql = "SELECT ID, FirstName, LastName FROM Person LIMIT 50"
$cm.Connection = $cn
$cm.CommandText = $sql
$dr = $cm.ExecuteReader()

ADO.NET programmers know that there are lots of ways to do this that require fewer lines of code, but I like to assign everything out explicitly using properties of the ADO.NET Connection and Command objects.

Finally we iterate over the results and close the connection:

while ($dr.Read())
    write-host $dr.GetInt32(0) " " $dr.GetString(1) " " $dr.GetString(2)

This is not too different than what a C# developer is accustomed to, particularly reading out the data. I like that you can just pass a big list of values to write-host without having to explicitly concatenate or convert to strings here. PowerShell figures out what you want to do and does the right thing.

On we have a bunch of utilities that we use to monitor system health and site activity (like how many people registered that day, whether people are discovering and using certain features of the site, etc.). Every web site should crunch these numbers frequently (otherwise you have no idea whether the work you’re doing matters to your users).

I think I’m going to eventually migrate our various statistical and maintenance utilities to Powershell. The power of the .NET framework combined with the convenience of script is going to come in handy for a lot of stuff.

Data-Driven ASP.NET Ajax

This week I presented two talks at VSLive in New York. I love speaking at this conference because of its technical focus and because I’ve done it so long — eleven years — there are always a bunch of people I run into at this conference that I only see when I’m there.

I’ve posted here several times about how I’d been trying to get the conference to let me talk about interesting yet sorta-non-mainstream topics such as unit testing (which I pitched to them unsuccessfully back in 2000) and open source (which I succeeded in doing in 2006 with the first talk on MySQL for .NET developers). In the past few years the conference has been much more open to talks on the kind of tools and technologies that are important to me (as well as many other developers for whom Microsoft’s out-of-the-box offerings are not always sufficient).

So my "Data-Driven ASP.NET Ajax" talk is an attempt to take the ASP.NET demonstrations and tutorials that Microsoft provides and tailor them to more real-world scenarios. Here I’m trying to show how a dynamic web application can display data from a database, but also how you can use ASP.NET Ajax to efficiently display large (million-row-plus) data sets, do database transactions, perform server-side data validation without a full page refresh, and so forth. This is a new talk, and I really worked hard on it. I gave it for the first time on Monday afternoon and there were about 120 people in the audience, which was gratifying.

Because I like promoting alternatives to the Microsoft defaults, and because I wanted to be able to give away the source code for my demos and the data without forcing people to go through a big configuration step to get it running on SQL Server, I used System.Data.SQLite as my database. System.Data.SQLite is the .NET implementation of the terrific free embedded database SQLite. Because it’s free (as in public domain) and small, I can distribute the database engine itself along with my demos, which means you don’t have to download or configure a thing to run the demo web site. Just open the project in Visual Studio or drop it into an IIS virtual directory and open index.aspx in your browser.

Here’s the download. It’s about 9 MB because I included the million-row SQLite database I included in my demo, and it also includes the System.Data.SQLite dependency. This version of the site also fixes a problem that I encountered while doing one of the demos (I changed a reference to the master page right before I gave the talk which caused one of the demo pages to barf).

Microsoft: Giving You The Services You Wanted 3 to 10 Years Ago, 3 To 10 Years From Now

Link: Microsoft Offers a Web-Based Strategy

"’We’re not moving toward a world of thin computing,’ said Steven A. Ballmer, Microsoft’s chief executive, referring to systems in which simple processing takes place on a PC, but more complex processing is moved to a centralized computer through a network connection. ‘We’re moving toward a world of software plus services.’

Nearly every Microsoft software application will be transformed with the addition of a Web-services component within 3 to 10 years, he said.

He rejected the notion that in the future all software would be based in what computer industry executives refer to as ‘the cloud’ — computer hardware and software reachable over the Internet. ‘People tend to get weird and extreme about this,’ Mr. Ballmer said. ‘Does everything move to the cloud? I think that is wrong-minded.’"

Microsoft looks to improve its name game

Link: Microsoft looks to improve its name game

"The group also put several dozen posters around campus with a box of Band-Aids and the caption: ‘You wouldn’t call it Wound Healer 2.0.’

The company has a rich history of products with names that are excessively wordy. Arguably one of the most convoluted monikers announced by Redmond (though thankfully later shortened) was its appellation for the mainstream 64-bit version of Windows XP: Windows XP 64-Bit Edition for 64-Bit Extended Systems.

Its woes in product naming and packaging are legendary both within and outside the company. A popular video has made the rounds on YouTube outlining what Microsoft might have done if it had been tasked with designing the iPod’s box. Instead of the minimalist carton that Apple came up with, the video ends up with a text laden container for the ‘iPod Pro 2005 XP Human Ear Professional Edition with Subscription.’
It later emerged that the video was done by people inside Microsoft."

Funny piece, but the underlying problem is very serious and certainly not limited to Microsoft.

It’s important to remember that a "product" is a totally subjective construct. Products are principally comprised of two things: feature functionality and information about that feature functionality. If you don’t have both of these, then you don’t really have a product.

If you aren’t good at describing what your products are, then you’re missing out on what may be the one and only opportunity to convey its value to a customer. This is what I was talking about back in December 2005 when Microsoft released something called Windows Live Local and my first reaction was "I will never remember the name of this product, and therefore I am very unlikely to use it." (I’ve been hearing murmurs that they’re getting ready to rebrand the whole "Live" line which should be interesting. We’ll know they’re serious if the word "Windows" gets dropped from the brand.)

When I was at Yahoo, I felt it was important to cast the Developer Network organization as a product organization because Yahoo hadn’t really done a lot with developer products before then. I think we were pretty successful in that regard — when I was running that team, we released about one new developer product each month and we spent very little time having to explain our products to confused customers.

One common thing I see in my consultancy today is companies that don’t treat developer products as real products. As a result, their products commonly don’t get good names, their benefits aren’t articulated very well, and in many cases they aren’t even officially announced to customers at all — they just sort of slide out the door with the implicit understanding that the smart dorks will figure out what to do with them. With this attitude, it’s no wonder that techies hate marketers.

A Better VBA Than VBA

I am a self-taught programmer; I got my start in college creating an Excel-based system for balancing the books of an administrative office at UCSB, where I was an undergrad at the time. It was very unusual for undergrads to work in administrative jobs on campus, but having major spreadsheet mojo at a time when spreadsheets were becoming the greatest thing since sliced bread is what opened the door for me.

The programming language that made all this possible came to be known as Visual Basic for Applications, an embedded version of VB that lived in most Office apps (as well as some third-party apps).

A few years back Microsoft began nudging developers to use .NET for Microsoft Office programmability. When I was at eBay, my team participated in the launch of Office 2003 and Visual Studio Tools for Office, which was basically a big interoperability library to let you program Office from .NET. At the launch event, Bill Gates demonstrated an Office app that used our API, which was impressive and exciting even if nobody would use Word and Excel to list stuff for sale on eBay in real life.

I’m a .NET fan, but I have to say that it doesn’t seem to be such a terrific fit with Office — it added quite a bit of complexity and in many ways reduced, rather than enhanced, the things you can do with Office application programming. I’m not even sure where the whole Office/.NET programability initiative has gone today. I wonder if Microsoft should revisit it, to start from scratch. I definitely find myself missing writing nice little VBA macros to automate my work in Excel and Word. (My last big VBA project was the Excel/Yahoo Maps integration I did back in 2005 and which people still occasionally email me about.)

I also wonder whether the very interesting work that’s being done on the dynamic language runtime might have something to offer here.

I could envision how IronPython (or even C# utilizing the dynamic runtime) could become a better VBA than VBA. One of the big historical criticisms of Office/VBA applications is that they’re brittle — difficult to maintain and upgrade and prone to breaking if the user doesn’t have a configuration that is just right. But I was never clear on how .NET solved those problems. Maybe some dynamic language extensions that are specific to the mission of automating applications like Word or Excel would add some value here?

I’d love to build an integration between Microsoft Office and, but frankly at this point I have no idea where to get started. Do I need to pay Microsoft for a copy of Visual Studio Tools for Office? Will Office 2010 break my application somehow? What happens if I need a solution that will work on the Mac?


We woke this morning to an radio news report that Microsoft and Yahoo are in merger talks. This kind of thing popped up several times during the time I was there. I recall that in 2006 the hot rumor was that Yahoo and eBay would get together, which would have been interesting for me. The Microsoft rumor has come up a few times in the last few years, too, but this time they sound more serious.

As always there is a lot of armchair quarterbacking about what a combination would look like which is humorous because we don’t have any information about what a combined Microsoft/Yahoo would look like at this stage.

Erick Schonfeld of Business 2.0 posts comments that are typical. He says "any move would smack of desperation" but I think that assigns an emotional quality that doesn’t (or shouldn’t) exist in deals like this, casting Yahoo as the homely prom date and Microsoft as the nerdy (and wealthy) boy next door who can’t get a date no matter how much money he spends on the limousine.

The truth is that Wall Street looks for synergies in any kind of merger/acquisition and there are plenty here. Yes, there are cultural differences between the two companies, but my sense is that they’re not unmanageable, and a healthy cultural cross-pollination could be just what the doctor ordered for both companies. From an engineering/developer standpoint, there’s a
lot to love — Microsoft engages in tons of projects that Yahoo wouldn’t touch today. If Microsoft can attract an engineer like Jim Hugunin to their side, they can certainly find something to keep Yahoo’s senior engineers interested.

Patent Fights Are a Legacy of MP3’s Tangled Origins

Link: Patent Fights Are a Legacy of MP3’s Tangled Origins

Microsoft says it was doing the right thing: paying a German rights holder $16 million to license the MP3 audio format, the foundation of the digital music boom. Then an American jury ruled that Microsoft had failed to pay another MP3 patent holder, and slapped it with a $1.52 billion judgment.
But the MP3 toll gates do not end there.

The confusion stems from the number of companies and institutions — including Thomson, Royal Philips Electronics and AT&T (through Bell Labs, now part of Alcatel-Lucent) — that worked to create the MP3 standard almost two decades ago. The patent claims of those and others are increasingly being backed up by aggressive enforcement efforts, including lawsuits and even seizures of music players by customs authorities.

This situation is a mess but the story completely biffs it by failing to mention that there’s a free alternative to MP3. The fact that only twelve people use it is beside the point — It’s as if the reporter did a story on a mass-suicide without asking why all the nice people killed themselves.

The situation with MP3 patents is a very interesting counterpoint to the way that Microsoft has attempted to taint open-source over the years. In the past Microsoft argued (speciously) that there was huge risk for businesses that permitted to let open source anything come within 100 miles of their code base. Now we find that the real threat is not open source but software patents, and, ironically, the biggest victim may be Microsoft itself.

Live Search for Windows Mobile

Dan Wahlin linked to Live Search for Windows Mobile, a client application that improves the experience for local search. Its big selling point is the fact that it incorporates maps, which is huge.

I like being able to download stuff directly on my phone instead of having to use the loathsome ActiveSync (which I gave up on completely once I started storing most of my vital information on the web anyway). This took less than a minute to install and it looks pretty cool.

Microsoft hurt by poor Live branding, analysts say

Link: Microsoft hurt by poor Live branding, analysts say

"Microsoft’s Live branding has been tremendously confusing and has hurt the company, and it is very likely contributing to the situation they are in right now," said David Smith, an analyst at Gartner. "They’ve created another brand and have not differentiated it."

I made the call on this back in December 2005, when I was still at Yahoo! and people were sure that Microsoft’s entry into the ad-driven hosted services space was going to matter. (Remember those days? Good times.)