Category Archives: .net

First baby steps for Moonlight 2.0: Silverlight for Linux

Miguel de Icaza has announced the first preview release of Moonlight 2.0. This is the one that counts, in that it brings the .NET runtime to Silverlight applets running on Linux:

This is the ECMA VM running inside the browser and powering C# and any other CIL-compatible languages like Ruby, Python, Boo and others. You can use Moonlight/Silverlight as a GUI (this is what most folks do) or you can use it as the engine to power your Python/Ruby scripting in the browser.

The download page has plenty of health warnings:

Keep in mind this preview release is not feature complete. Most importantly not all security features are present or fully enabled in this release. Even existing security features have, at this stage, received only minimal testing and no security audit of the source code (mono or moonlight) has yet been done.

Undeterred, I installed it into FireFox 3.0, running on Ubuntu Linux. The download is under 9 MB. My first effort was unsuccessful; the plug-in appeared to load OK, but no Silverlight apps displayed. My second attempt in a VM worked. Naturally I went along to my Silverlight database example which as it happens runs on Mono. Here it is:

This is what it should look like (Silverlight on Windows):

Well, it is only an alpha preview, and it shows. On the plus side, the data is displayed, the search works, and the buttons operate. It is a considerable achievement. But don’t plan to move your users onto Moonlight applications just yet.

Microsoft’s quarterly results: will it ever make sense of the cloud?

Most comments on Microsoft’s quarterly results are understandably focused on the overall picture: a quarterly revenue decline for the first time ever.

Revenue decline can be forgiven during a recession, but it’s more interesting to look at the breakdown. I made a simple quarter-on-quarter table to look at the pattern:

Quarter ending Mar 31st 2009 vs quarter ending March 31st 2008, $millions

Client Revenue % change Profit % change
Client (Windows) 3404 -15.6 2514 -19.29
Server and Tools 3467 7.07 1344 24.44
Online 721 14.47 -575 -154.42
Business (Office) 4505 -4.78 2877 -7.99
Entertainment and devices 1567 -1.57 -31 -129.25%

The weak Windows client figures are unsurprising. The poorly-received Windows Vista is out in the market, and the highly-praised Windows 7 is being prepared for release. When anyone asks me, I suggest that they should wait for Windows 7 before buying a new PC or laptop, if they are in a position to delay.

The Business division (Office) remains massively profitable, even though it too has declined a little. Office may be ludicrously expensive, but there’s little evidence of a significant shift to cheaper or free alternatives.

It’s also notable that the server and tools business continues to perform well. Again, I’m not surprised: Server 2008 strikes me as a solid product, and there’s not much wrong with products like SQL Server 2008 and Visual Studio.

Not much to say about entertainment and devices. Xbox is doing so-so; Windows Mobile is rather a mess.

The real shocker here is the online business. Revenue is down and losses have grown. It is no use just blaming the recession: this is a sector that is growing in importance. Should Microsoft back out and leave it to Google? That would be as if Kodak had refused to invest in digital photography. But something is badly wrong here.

That said, I’m guessing that the figures mostly represent the failure of the various Windows Live properties to attract advertising income; the small market share of Live Search must be an important factor. The newer cloud computing business model, where Microsoft sells subscriptions to its online platform and services, is largely still in beta – I’m thinking of things like Windows Azure and Live Mesh. Further, I’m not sure where Microsoft puts revenue from things like hosted Exchange or hosted Dynamics CRM, which straddle server and online. There is still time for the company to get this right.

I’m not convinced though that Microsoft yet has the will or the direction to make sense of its online business. Evidence: the way the company blows hot and cold about Live Mesh; the way SQL Server Data Services was scrapped and replaced by full online SQL Server at short notice; and the ugly and confusing web site devoted to Windows Azure.

When I looked at Virtual Earth recently I was impressed by its high quality and ease of development. It illustrates the point that within Microsoft there are teams which are creating excellent online services. Others are less strong; but what is really lacking is the ability to meld everything together into a compelling online platform.

That could change at any time; but we’ve been waiting a long while already.

RIA (Rich Internet Applications): one day, all applications will be like this

I loved this piece by Robin Bloor on The PC, The Cloud, RIA and the future. My favourite line:

Nowadays very few Mac/PC users have any idea where any program is executing.

And why should they? Users want stuff to just work, after all. Bloor says more clearly than I have managed why RIA is the future of client computing. He emphasises the cost savings of multi-tenancy, and the importance of offline capability; he says the PC will become a caching device. He thinks Google Chrome is significant. So do I. He makes an interesting point about piracy:

All apps will gradually move to RIA as a matter of vendor self interest. (They’d be mad not to, it prevents theft entirely.)

Bloor has said some of this before, of course, and been only half-right. In 1997 he made his remark that

Java is the epicenter of a software earthquake, and the shockwaves are already shaking the foundations of the software industry.

predicting that Java browser-hosted or thin clients would dominate computing; he was wrong about Java’s impact, though perhaps he could have been right if Sun had evolved the Java client runtime to be more like Adobe Flash or Microsoft Silverlight, prior to its recent hurried efforts with JavaFX. I also suspect that Microsoft and Windows have prospered more than Bloor expected in the intervening 12 years. These two things may be connected.

I think Bloor is more than half-right this time round, and that the RIA model with offline capability will grow in importance, making Flash vs Silverlight vs AJAX a key battleground.

Flash library for Facebook, Silverlight library for MySpace

Adobe and Facebook have announced that ActionScript 3, the language of Flash 9 and higher, is now officially supported by FaceBook along with JavaScript and PHP. Information about coding for Facebook with Flash is here, and the library itself is on Google Code.

MySpace has announced the MySpace Silverlight SDK which will be hosted on Microsoft’s CodePlex open source site. The focus of the Microsoft Silverlight work seems to be on wrapping the Open Social API used by MySpace in a C# library.

Note that there is already documentation on creating Flash applications for MySpace. On the Facebook side, here’s an intriguing fact: there’s also an Fb:silverlight tag, though the documentation remarks: “For now this feature has no functionality.” Fb:swf is better supported. David Justice has been working on a Facebook library for Silverlight. It’s clear though that Flash is more widely accepted and supported on both platforms, reflecting its maturity and broader acceptance.

Smart developers can already devise code to access the public APIs of platforms like Facebook and MySpace from a variety of clients; this is about making that easier. It benefits the social networking sites if a wider group of developers has access to its platform, and with the advantages of multimedia features; equally it benefits the plug-in vendors if their runtime works smoothly with the broadest possible range of services. Therefore we should expect more of this type of announcement.

It is interesting to see technology partnerships bridging political divides. Microsoft has a stake in Facebook, for example, while Google has a partnership with MySpace.

Perhaps the most interesting outcome may be more Facebook applications based on AIR, Adobe’s Flash platform for the desktop. The existence of AIR applications like Twhirl and Tweetdeck has significantly boosted Twitter; maybe it is now Facebook’s turn.

Leaving Las Vegas: Mix09 wrap-up

I’m heading back to London after 3 days at Microsoft’s Mix09 conference in Las Vegas. I took the opportunity to ask a few delegates what they thought. One thing that everyone seemed to love was SketchFlow, a new feature of Expression Blend which enables designers to sketch out design ideas, distribute them for discussion and annotation, collect responses, and export the results to Word to create a report or proposal. It looks like SketchFlow has been influenced by Bill Buxton, who gave a keynote at Mix, since it embodies one of his key ideas, that design ideas should not look too finished as that inhibits the response.

There was also enthusiasm for Silverlight 3.0, with its numerous new features including out-of-browser support. Several Adobe folk were at Mix sizing up the competition; one was Mike Downey who commented:

I’m really impressed by how much Microsoft has gotten done with this whole platform so quickly. They’re catching up really fast. #mix09

It’s true that Silverlight is maturing with remarkable speed, and many of the developers I spoke to were using it or planning to use it.

That said, we are really talking about Microsoft platform people, most from a developer background. I got some insight into what Microsoft is up against chatting to some design students and a lecturer on the bus to the airport. Microsoft sponsored their visit to Mix in an attempt to get them interested. They all use both Macs and Adobe tools; and the lecturer said to me, “we already get the students to install 7 different pieces of software for the courses we run; why should I add two more (meaning, I think, Expression Blend and Visual Studio)? The Mac issue is huge; there is some work being done to support Silverlight design on the Mac, but it is rudimentary in comparison to Blend.

The sessions on ASP.NET MVC were well attended and of the developers I spoke to, those who grasp what it does are delighted with it and intend to use it – several had evolved their own ASP.NET frameworks out of frustration with Web Forms. It appears though that Microsoft didn’t pitch ASP.NET MVC in a way that communicated well with developers not already familiar with it. Some had attended sessions but still didn’t really grok what it does.

Mix day one, with the Buxton/Guthrie keynote, went down better than day two, which had the IE8 launch and Deborah Adler presenting her research and commercial success designing medicine bottles – interesting but over-long in a web conference. IE8, which was a highlight of Mix08, didn’t make much impact here as everyone already knew all about it, and it no longer looks so impressive one year on, even though it is a big advance on IE7.

Windows Azure didn’t appear to make much impression here, though there is relief that SQL Data Services is getting full relational features. I attended a UK round table on Azure with the other UK journalists who made it out here, Jon Honeyball, Simon Bisson and Mary Branscombe. I observed that Azure is widely misunderstood or not understood, that the follow-up since PDC has been poor, and that the web site relies too much on videos and is confusing to navigate; the early access system based on developer tokens is also problematic. I reckon Microsoft needs to do more work on communicating what Azure is about, if it is to win any mindshare from other cloud contenders.

Still, overall this was a good Mix; one delegate said it was the best Microsoft conference he’d ever attended. The wi-fi worked. The conference layout is good for networking and the warm atmosphere was not just a consequence of the desert air.

By the way – Mix10 has been announced, same place, March 15 – 17, 2010.

How to print in Silverlight out of the browser

Trick question, you can’t, or not in any sane way that I’ve discovered. When an app using Microsoft Silverlight is running in the browser you at least have the browser’s print features, but a SLOOB (Silverlight Out of Browser, a new feature in Silverlight 3) does not even have that to fall back on.

This is unfortunate for business applications, though of course many applications are fine without print features.

Workarounds: well, you can press Alt+PrintScreen and paste into Paint…

Another idea is to generate a document in code, then let the user “download” it from your SLOOB to somewhere on the desktop, since finding a document in the app’s isolated storage would be a challenge. The user can then print the document at his or her leisure.

What this illustrates is that even in version 3.0, Silverlight is not altogether mature, especially for this new out-of-browser feature. I’m told that print support is planned in some future version – Silverlight 4.0 I guess. Software is always a waiting game.

Note this post is based on the Silverlight 3.0 beta; it’s just possible something could be added in the final version.

Technorati Tags: ,,

F#, Enterprise JavaScript at QCon London

The best sessions here at QCon London have been the small ones, not the big ones. Yesterday the slot I enjoyed most was from Attila Szegedi on JavaScript in the Enterprise. He uses Mozilla Rhino for server-side development. It’s not a mainstream choice; but he made a case for it, saying that continuations in JavaScript bring huge benefits, that there is a ready supply of developers with JavaScript skills (albeit mostly browser-based), and JavaScript is so flexible that he can work around any limitations.

One example is that JavaScript has no namespaces; but it does support function pointers, so he adds a bunch of function pointers as members of an object, and then that object works like a namespace.

Szegedi says he has little interest in ECMAScript 4.0 – once thought to be the future of JavaScript – because there is no community consensus around it.

Today I’ve just attended a session on Microsoft F# given by Amanda Laucher. F# is a functional language that will be released as part of Visual Studio 2010. I knew little about it until today. Laucher gave a code-heavy presentation looking at how the ease of concurrency in F# can greatly increase speed of execution, using an example from the car insurance industry.

Laucher said that threading in C# is horrible in comparison.

Developers are not going to abandon C# or Visual Basic in favour of F#. Rather, they will encapsulate pieces of functionality in F# where they can get benefit, and call them from their C# or VB application.

Technorati Tags: ,,,,,

QCon London 2009

I’m at QCon London and covering it on Twitter as wi-fi and battery power allows. The focus of the conference is enterprise development, and it spans Java and .NET, SOAP and REST, but with a bias towards Agile methodology.

I was here last year, and my observation is that last year there was considerable angst about the idea that the SOAP stack was failing to deliver and that new stacks based on REST were the thing to do.

This year this same statement feels more widely accepted and people are moving on, based on that assumption.

One delegate stuck his hand up and asked, “is this a fad, or will it last”? Sounds like a cry of pain from someone who invested heavily in something now condemned. History tells that in five or ten years time we may well be equally enthusiastic about some new thing and observing all the weaknesses in the bad stuff we used to do.

Still, these trends don’t form overnight. We have to choose what looks like the best model at the time.

I’m typing this during a session on test-driven development. Personally I think TDD is a more profound improvement in the software development process than REST vs SOAP; the detail of TDD will continue to evolve and be debated; but its basic ideas are hard to challenge.

As an aside, this is one factor in why ASP.NET MVC is so important for developers on Microsoft’s web platform. Reason: it’s testable.

Mono creeping into the mainstream?

For those of you who have not already seen this link on Twitter: I’ve posted a short piece on Mono, the open source implementation of Microsoft .NET. The piece was prompted by my own experience writing a simple .NET application in Visual Studio and deploying it to Linux. Admittedly I anticipated the move by using MySQL rather than SQL Server as the database; but even so, I was impressed by how easy it was – I spent more time recently deploying an application from Visual Studio 2008 to Windows Server 2008, thanks to some issues with SQL Server Express.

Don’t Miguel de Icaza’s comment about scalability and garbage collection, two of the factors that have deterred some from real-world Mono deployments.

Hands on with ASP.Net Membership, SQL Express and Server 2008

Is it worth using the built-in membership framework in your ASP.Net application, or should you roll your own? I’ve been trying it out recently, and I have mixed feelings.

On the plus side, it does get you up and running quickly with user login and role-based permissions, saving time and possibly achieving more reliable results, on the grounds that Microsoft and countless other users should have found and fixed any bugs by now.

One the negative side, there are annoying limitations. The most obvious one is that a user as defined in the framework only has a minimal number of fields, not including information you probably want to store like first and last name. You are meant to fill this gap by using profiles, another ASP.Net feature which lets you store arbitrary name-value pairs in a database as a kind of persistent session. That works, but the way profile properties are stored makes it hard to do things like sorting users by last name. Therefore, you will probably end up managing your own user database and joining it to the membership system with the user ID, at which point you begin to lose some of the benefits.

Some of the supplied controls, like the CreateUserWizard, seem rough-and-ready too.

Still, the real fun began when I tried to deploy my demo app to Server 2008 and SQL Server Express 2008. By the way, make sure you install .NET Framework 3.5 SP1 and Windows Installer 4.5 before installing the latest SQL Server Express, otherwise the setup spends ages unpacking its files and then exits with a brief message. I got there eventually, copied my application across, and optimistically tried to run it.

When you debug a web application in Visual Studio, it defaults to a SQL Express database in the App_Data folder within the web site, attached on demand. In theory, that should make it easy to deploy to another machine with SQL Express installed: just copy it across, right? There must be a way of getting this to  work, but it seems a lot of people have problems. I got the message:

Login failed for user ‘NT AUTHORITY\NETWORK SERVICE’.

This makes sense, insofar as ASP.NET runs as this user. I temporarily attached the database and added the login, to be rewarded with a different and more perplexing error:

Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance.

A quick Google shows that many users have suffered from these errors, and that a large number of remedies have been proposed. I abandoned the idea of attaching the database on demand and set up a new database, made ready with Aspnet_regsql. I still got one or other of these errors.

Eventually I realised that my application was using more than one connection string. The problem is that the membership framework uses three different "providers", one for membership, one for roles, and one for profiles. By default in IIS 7.0, these all use an attach-on-demand connection string, defined as LocalSqlServer, and inherited from machine.config buried deep within your Microsoft .NET Framework system folder. In order to prevent ASP.Net membership from using this, you have to override all three providers in the web.config for your application. There’s an example in this article from ISP MaximumASP. I wish I’d come across it sooner; but my demo works fine now.