Category Archives: .net

Microsoft brings Silverlight – not Mono – to Linux via Intel

Yesterday I speculated about what was meant by the inclusion of Silverlight among supported runtimes for Intel’s Moblin Linux, which is being used on netbooks using the Atom processor. I had assumed it was some new development of Moonlight, Mono’s Silverlight implementation, but apparently this is not the case. Here’s what Microsoft’s Brian Goldfarb, director of the Developer Platform Group at Microsoft, said:

Microsoft and Intel announced today that the two companies have agreed to work together to bring support for Silverlight 3 to Intel’s Atom-based Mobile Internet Devices (MID). These Atom-based devices run on Windows and Moblin, an open source, Linux-based operating system targeted at Atom-based devices. In order to help bring Silverlight content to these devices, Microsoft has provided Intel with Silverlight source code and test suites, and Intel will provide Microsoft with an optimized version of Silverlight for Moblin devices that Microsoft can then redistribute to OEMs.

There are a couple of curious aspects to this. One is why Microsoft would not simply feed optimisations into the Moonlight project, which would benefit Silverlight/Moonlight on all Linux systems. Goldfarb did add:

The Silverlight for Moblin announcement is independent from Microsoft’s work with Novell on Moonlight. The Intel/Moblin effort is specifically about building great out-of-box experiences for consumers on Atom-based devices. Microsoft’s efforts with Novell remain critical as they build an open-source, compatible, and broadly available Silverlight solution for Linux.

Another is whether Intel/Microsoft are devising some way for Silverlight to run as a desktop application, rather than just as a browser plug-in. I’m hopping to clarify these points soon.

Intel has a press release here.

London Stock Exchange migrating from .NET to Oracle/UNIX platform

The London Stock Exchange has agreed to acquire MillenniumIT, and will be replacing its TradElect and Infolect systems with the MillenniumIT trading system. TradElect is based on Windows Server and .NET,  and was created by Microsoft and Accenture. Microsoft used to use the LSE’s system as a showcase for .NET scalability, but while it proved that .NET can work for large systems, the LSE suffered an outage in September 2008 that was rumoured to be the fault of TradElect.

I don’t know much about MillenniumIT but note that the company is a partner with Sun and Oracle and that the MillenniumIT Exchange brochure [pdf] states:

Operating System: UNIX or Linux

Database: Oracle

As Brian Bryson of IBM/Rational observes, it is short-sighted to lay the blame on the platform. Nevertheless, considering the high profile of this system and Microsoft’s active involvement it is at least an embarrassment.

The mitigation for Microsoft is that .NET has less to prove these days. Even if running a system as large and performance-critical as the London Stock Exchange was a step too far, particularly for Server 2003 and (apparently) SQL Server 2000, that doesn’t rule out Microsoft’s technology for more usual workloads; and there are improvements in Server 2008 and SQL Server 2008.

Still, I’d love to know more about why the LSE is abandoning TradElect and what the lessons are for those designing and implementing systems at this level.

The problems with TradElect are thoroughly debated in the comments here.

Update: Microsoft’s LSE Case Study from 2006 is here.

I have also received the following statement from a Microsoft spokesperson:

Microsoft continues to support some of the most demanding, mission-critical environments in the world and is constantly raising the performance bar with new solutions.  Most recently, Microsoft completed three different proof-of-concept projects for a major international stock exchange that demonstrate Windows Server 2008 and Microsoft .NET can successfully support very low latency trading activities, in the 100 microsecond range using standard 1 Gigabit Ethernet.  With the addition of Microsoft Network Direct, that latency is further reduced by 50%, which is industry leading performance.

Proof of concept: C#-SQLite running in Silverlight

Noah Hart has ported SQLite to C#. I was intrigued to see whether the code could be adapted to run in Silverlight, which has a cut-down .NET Framework and prohibits platform invoke to native code.

I hacked away at his code until it ran in Silverlight:

Note that the sole purpose of the exercise was to see if SQLite could be made to run, not to prepare a port that is production-ready or even code that is fit to check-in. In essence, I defined SQLITE_SILVERLIGHT, removed all the locking, adapted the file I/O to use isolated storage, and generally took as many shortcuts as I could think of to get it to compile and run. Unfortunately transactions do not work, though that can probably be fixed.

As far as I can tell, Silverlight’s Isolated Storage does not support locking at all. If the same application were opened twice, for example in different browsers, that could cause problems, but in normal use it would likely be OK.

One other point of interest: the XAP file in release mode is 257KB.

Update: The sample app is here. The hacked code is here [zip].

C#-SQLite now published

Noah Hart has published his port of SQLite to C#. The project is called C#-SQLite. The main SQLite author, D Richard Hipp, originally said that the project should not include SQLite anywhere in its name, but has now relented:

I think I would be comfortable with a name like C#-SQLite. The prefix makes it clear that it is a reimplementation, not the original. People notice prefixes much more readily than suffixes. There is also precedent for changing a prefix for a reimplementation. Lucene, for example, was ported to C-Lucene. I’m sure there are others.

The whole point of this exercise it to avoid confusing people. Folks who use C#-SQLite need to be fully aware that what they are using is distinct and separate from the original SQLite. As long as that one condition is met, I am happy.

I downloaded the code, compiled in Visual Studio 2008 (requires project conversion), ran the shell and tried a couple of commands. It works!

Of course there are already a million ways to use SQLite from .NET, but they all require platform invoke to native code, which is not allowed in some scenarios for security and/or cross platform reasons – Silverlight being a prime example.

Next question: how hard will it be to get this working in a Silverlight project?

See also SQLite C# port raises hopes for a Silverlight local database manager which has some early performance results.

Technorati Tags: ,,

Silverlight 3 is out

Microsoft has released Silverlight 3, though some pieces of the platform are still not done – it seems there is always something to wait for.

There are links to the tools developers and designers need to install here:

http://silverlight.net/GetStarted/

Note that Expression Blend and Sketchflow are still at Release Candidate stage.

The .NET RIA services, a server-side piece that simplifies authentication and database operations, is available in a new July 2009 preview:

http://www.microsoft.com/DOWNLOADS/details.aspx?FamilyID=76bb3a07-3846-4564-b0c3-27972bcaabce&displaylang=en#filelist

See this excellent post by Nikhil Kothari for more on RIA Services – it’s from March but does a good job of explaining what they are about.

Using Silverlight 3, or plan to? I’d love to hear from you, along with your views on what is best and what is worst about Microsoft’s RIA efforts.

Is Mono safe to use?

Microsoft has promised not to sue those who develop implementations of its C# language and Common Language Infrastructure – the heart of .NET.

You might assume that to be good news for Mono, the open source implementation of .NET sponsored by Novell; and I suppose it is, though not in any major way.

The key point here is that Microsoft’s .NET platform goes well beyond what is covered by the promise. ASP.NET, Windows Forms, ADO.NET, Windows Presentation Foundation, Silverlight: all this falls outside. The promise covers only what is standardised by ECMA.

Mono leader Miguel de Icaza is clear about the differences in his post, and says Mono will be split into safe and – presumably – unsafe parts:

In the next few months we will be working towards splitting the jumbo Mono source code that includes ECMA + A lot more into two separate source code distributions. One will be ECMA, the other will contain our implementation of ASP.NET, ADO.NET, Winforms and others.

A good thing? Well, it could help promote the core of Mono in the open source community, which is wary. Open source champion Richard Stallman recently stirred up debate on the subject by proclaiming C# dangerous, in what has become a somewhat perplexing post:

It is dangerous to depend on C#, so we need to discourage its use. … The problem is not unique to Mono; any free implementation of C# would raise the same issue. The danger is that Microsoft is probably planning to force all free C# implementations underground some day using software patents.

he says (and is unlikely to be comforted by Microsoft’s recent moves), though he adds:

This is not to say that implementing C# is a bad thing. Free C# implementations permit users to run their C# programs on free platforms, which is good. (The GNU Project has an implementation of C# also, called Portable.NET.) Ideally we want to provide free implementations for all languages that programmers have used.

Confusing. Still, it’s a valid and important question. Is Mono safe to use?

I have been asking myself this for many years; and have asked Microsoft about it on a number of occasions with no clear answer. However, to me the breakthrough came when Moonlight was announced, an implementation of Silverlight for Linux for which Microsoft has partnered with Mono. The dual significance is first, that Microsoft is working with Mono; and second, that it shows how Microsoft has realised that overall Mono is more a benefit than a threat to its platform.

Action against Mono now seems less likely than ever. That opinion is not based on legal knowledge, but on the business & PR case.

Nevertheless, there could be limits. Stallman’s recent statement was provoked by discussions over whether Mono should be part of the default Debian install. It is not; but it is rising higher on the list of packages that are likely to be installed sooner rather than later by users, because Mono applications are growing in number.

On the server, Mono’s implementation of ASP.NET is now rather good. I’m using it on ITWriting.com for a Silverlight demo. I’ve been impressed by its compatibility with Visual Studio, though I’ve also found it increasing resource usage more than I would like. I’m using what is now an old version though, so I expect this to improve.

The cost savings in using Linux+Mono rather than Windows+ASP.NET are significant, which implies that the potential cost to Microsoft is significant too. It’s only a potential cost, because frankly the official platform is still less risky for a commercial deployment, from a technical rather than legal perspective. Mono is currently more likely to attract free or hobbyist users; but that could change. If Microsoft saw server license sales bleeding away because of Mono, my guess is that there would be rumbles.

What then of de Icaza’s move to separate Mono into safe and unsafe parts? I see the sense of it, but wonder if it could be counter-productive. While Mono is, errm, monolithic, Microsoft cannot take action against the unsafe parts without also blocking the safe parts. After the split, it will be easier for Microsoft to agitate about the pieces of Mono which might (or might not; I’m no lawyer) infringe its rights.

It still strikes me as unlikely that Microsoft would risk full-on legal action against its partner and against what is now a significant part of its platform story. However, I doubt we will get any further comfort from the company, beyond what it has already given.

*updated to acknowledge that Silverlight and WPF are covered by the open spec promise – see links in the comments.

Does Visual Basic have a future?

I was interested in this podcast with a member of the Visual Basic team at Microsoft, Lisa Feigenbaum, as I ask myself the same question.

Unfortunately the questioning from Joe Stagner (who also works for Microsoft) is tame. Nevertheless, there are a few points of interest.

“The things that come out of Microsoft, it is C# biased” admits Feigenbaum, which she says is because so many at Microsoft have a C or Java background.

That is part of the reason (though more C than Java) but I doubt it is that simple. If you go back to the beginnings of .NET, Microsoft designed C# and what was then the new framework and runtime together. VB on the other hand was hauled into the new world and still bears the scars.

Let’s answer the question first. Microsoft cannot afford to abandon VB, which remains popular, especially (though certainly not exclusively) at the less professional end of the market. VB isn’t going away.

Further, there’s really very little difference in the capabilities of the two languages, so there is little incentive for anyone to switch. Microsoft has attempted to differentiate them, but these attempts generally fail. “Any time we do something cool in one language, the other folks want it” says Stagner in the podcast.

As I see it, that’s part of the problem. It begs the question: what is the point of VB, other than to keep existing VB developers happy? In what circumstances would you advise a new programmer to learn VB rather than C#?

I dip in and out of both VB and C#, and of the two I prefer C#. I find VB’s slightly increased verbosity annoying, and I dislike the statement continuation character which is unnecessary in C#, because statements end with semicolons. I prefer case-sensitive languages, which give more flexibility when naming variables. If you want to do XNA games programming, currently only C# is supported. 

VB’s dynamic features are useful in some scenarios, particularly Office automation, though this advantage is removed in C# 4.0 which has dynamic variables.

The original attraction of BASIC, its English-like syntax, is nearly lost in today’s VB.

Well, choice is good; and the existence of VB alongside C# proved the cross-language credentials of the “common language” runtime from the get-go.

Nevertheless, I’m expecting VB usage to decline gradually. An external factor is the rise of the JavaScript family, which is more like C# than VB.

Incidentally, Feigenbaum threw in a comment about Visual Studio that I found interesting. After talking about the managed code editor in Visual Studio 2010, she remarks “In the release after 1010 we’re rewriting the compilers in managed code.”

Technorati Tags: ,,,,

Book Review: IronPython in Action

I guess that to many people IronPython, an implementation of the Python programming language that runs on Microsoft’s .NET platform, is little more than a curiosity. For them, a glance at the preface and foreword to this new Manning title may be enough to convince them that it is at least interesting. In the foreword, IronPython creator Jim Hugunin describes how he first worked on Python for .NET as an exercise to prove “why the CLR is a terrible platform for dynamic languages”:

The plan was turned upside down when the prototypes turned out to run very well – generally quite a bit faster than the standard C-based Python implementations.

Next is a preface from the authors, Michael Foord and Christian Muirhead, about how IronPython came to be used in an innovative programmable, testable spreadsheet called Resolver One:

Resolver One is in use in financial institutions in London, New York and Paris, and consists of 40,000 lines of IronPython code with a further 150,000 in the test framework. Resolver One has been tuned for performance several times, and this has always meant fine tuning our algorithms in Python. It hasn’t (yet) required even parts of Resolver One to be rewritten in C#.

Why is Python used in Resolver One?

As a dynamic language, Python was orders of magnitude easier to test then the languages they had used previously.

If that piques your interest, you may find the book itself worth reading. It is aimed at Python programmers who do not know .NET, and .NET programmers who do not know Python, rather than at existing IronPython developers. The authors run through the basics of Python and its .NET integration, so that by the end of Part 1 you could write a simple Windows Forms application. Part 2 is on core development techniques and covers duck typing, model-view-controller basics, handling XML, unit and functional testing, and metaprogramming – this is where you generate and execute code at runtime.

The third part of the book covers .NET integration, and how to use IronPython with WPF (Windows Presentation Foundation), PowerShell, ASP.NET, ADO.NET (database access) , web services, and in Silverlight. Finally, Part 4 shows how to extend IronPython with libraries written in C# or VB.NET, how to use Python objects in C# or VB, and how to embed the IronPython engine into your own application.

It’s a well-written book and fulfils its purpose nicely. I like the way the book is honest about areas where IronPython is more verbose or awkward than C# or VB.NETAs someone who knows .NET well, but Python little, I could have done without all the introductory .NET explanations, but I understand why they are there. I particularly liked part two, on core programming techniques, which is a thought-provoking read for any developer with an interest in dynamic languages.

According to the IronPython site, you can get 35% off by ordering from the Manning site with the code codeplex35.

It is also available on Amazon.com:

and Amazon.co.uk:

 

New Visual Studio 2010 beta has WPF editor, Silverlight designer

I’ve just downloaded and installed the Visual Studio 2010 beta 1 release. I’ve not explored much yet – and it is rather slow in a virtual machine – but it does now seem to have the new editor and other pieces built with Windows Presentation Foundation.

A landmark for both WPF and Visual Studio.

I also noticed that the Silverlight visual designer now works as you would expect, though I had to download the developer runtime and SDK separately:

I’d welcome comments from anyone using the beta.