Windows Runtime must come to Windows Phone

I’ve been trying Windows Phone 7 in its latest “Mango” version over the last couple of days and mostly enjoying it. One thing I am not impressed by though is the range of apps available. Have a look at the Marketplace – Microsoft may claim 30,000 apps, but given how unexciting even the “top” selections are, you can imagine how bad the bottom ones must be. Microsoft I guess has been guilty of accepting almost anything to puff up the numbers.

What would fix this? Sell more phones, of course; but also improve the platform for developers. Windows Phone 7.x is not a bad platform: you get Silverlight, XNA, C# and Visual Studio.

By contrast though, the Windows Runtime (WinRT) shown at the BUILD conference earlier this month is a platform mobile developers can love. Here are what seem to me three great features:

  • Three first-class languages and programming platforms – C#/.NET, JavaScript and HTML 5, C++ and native code. All three are strategic platforms. I particularly like the native code option, as many mobile developers like native code and it is a weakness of Windows Phone 7.
  • Asynchrony built into the platform. This is a smart move: make every API call that might cause a delay an async-only call. On top of that, build easy async programming into the languages. The result should give apps a responsive user interface almost by default; developers will need to make an effort to freeze the UI.
  • Contracts which integrate apps with the operating system and with one another. There are five contracts: search, share, play to, settings, and app to app picking (for example, file selection).

Microsoft’s Windows chief Steven Sinofsky says Windows 8 is for tablets but not for phones. But he has to say that, because if Microsoft announced that the current Windows Phone 7.5 is a platform without a future, it would further dampen enthusiasm for the product.

Is there any reason why WinRT should not come to Windows Phone? A few:

  • Windows Phone is currently built on Windows CE, a cut-down version of Windows, whereas WinRT runs on top of the full Windows API.
  • The Metro-style UI is designed for tablets rather than phones.
  • Finally, the existence of Desktop Windows is presumed in the current Windows 8 design. If Microsoft has not had time to work out a Metro-style UI for something, you simply use the Desktop version.

All of these are good reasons why the arrival of WinRT on the phone will be delayed, but none are insuperable. Long-term, I find it inconceivable that Microsoft will persevere with a different programming platform for the phone and for tablets.

What are the implications for Windows Phone developers today? Well, WinRT and Metro borrow from the phone OS, so the porting effort should not be too bad, except in the case of XNA, a .NET wrapper for DirectX which WinRT does not support.

Of course this post is entirely speculative, and I have no insight into Microsoft’s plans beyond what is publicly stated, so there might be other compatibility options when and if the time comes.

And it is time that is Microsoft’s biggest enemy. Fumbling tablet computing has been a costly mistake, and the big question is whether anyone will care how good some future Windows Phone will be, if the ecosystem which Nokia likes to talk about is firmly established as Android vs Apple.

PhoneGap likely to move to Apache Software Foundation

Nitobi’s Brian LeRoux, who works on PhoneGap, has announced the start of a process to move the project to the Apache Software Foundation:

We have initialized the process to contribute PhoneGap to the Apache Software Foundation (ASF). The process is straightforward beginning w/ a submission of a proposal to the ASF that describes the move in detail. We’ve been looking at different options for a foundation contribution since the beginning. Now is the time. PhoneGap is hugely adopted and the IP belongs in an org aligned w/ our goals, philosophy and the web. It will remain free software, licensed as it always has been: Apache/BSD/MIT.

Apparently the name may change thanks to a trademark dispute.

PhoneGap seems to have plenty of momentum and is turning up in a variety of tools, including Adobe DreamWeaver and Embarcadero RAD PHP XE2, to mention two I am aware of.

Amazon Silk: fast cloud-powered browser, or a new way to mine your data?

Amazon announced its new range of Kindle devices today and the web is buzzing with debate about the impact of the new Android-based Kindle Fire tablet on Apple and others.

Amazon knows how to pile high and sell cheap, and can make money from content even if it gives away the hardware, so it is a strong contender in this space.

The real innovation announced today though was in the web browser. Amazon announced Silk, which splits the browser between your Kindle Fire and EC2 (Elastic Compute Cloud).

image

Amazon’s point: it can hold a massive cache of web content on EC2, as well as performing common-sense optimizations like scaling images to an appropriate size before sending them to your device.

Is this really new? Much of it sounds familiar, if you know about caching and proxies. Nevertheless, Amazon is in a strong position with its large cloud resource, and can design the web browser specifically for its cloud proxy. In addition, it knows the exact size and capability of the device. And perhaps its smart engineers have come up with better ways to cache. One feature is predictive caching – sending down the page it things you will visit next, before you actually go there.

There are some hard problems, as I have found in trying to optimize my own web site. Caching dynamic content, so that PHP script does not get executed by every browser request, is an obvious thing to do; but web pages draw content from multiple sources, including scripts that serve ad content that is meant to be targeted for the specific viewer. Optimizing that is harder.

It does also occur to me that a side-effect of Silk is that every single bit of browsing you do will go through Amazon and could potentially be mined for data about your browsing habits. Amazon, naturally, is well-placed to send you related ads from its own retail site. Amazon has not mentioned this aspect, but I am sure it has been thought about.

A few observations on Windows Phone 7.5 “Mango”

I received a Windows Phone running version 7.5 “Mango” for review yesterday. Here are some initial observations; I am not going to call it a review after such as short time.

image

There is still no screen capture utility – well, there is this one but it requires a developer accounts. So no screens, sorry. Microsoft should fix this – how difficult can it be?

Microsoft says there over 500 updates in Mango, and it does feel like a significant update, though retaining the look and feel of the first release. A half-version upgrade is about right.

Some things I noticed:

  • Task switching. Press and hold the back button, and swipe through running apps. This is excellent, better than iPhone or Android.
  • Voice control. This is expanded in Mango to include web search, text messaging and more. Tip: to see the commands, hold down the Windows key to go into speech mode, and click the help icon.

    It has great potential, especially with a bluetooth headset for true hands-free. I have a Plantronics Voyager Pro bluetooth headset, reviewed here. Using this guy, I can press and hold the call button on the headset, to put the phone into speech mode.

    I found this works well for calling people or simple searches, but general speech to text is not too good. I tried texting someone the message “Your parcels have arrived”. After several attempts, all of which were interpreted as various strings of garbage starting “George”, I gave up. I would still use it for making calls though; it seems that when the scope is narrowed to people in your contacts list, the interpretation is more reliable.

  • The search button is no longer contextual – it always takes you to Bing search. I think this is a retrograde step.
  • Local Scout is a feature that is meant to find restaurants, shops, things to do, and other handy information based on your location or the current map location. This is a neat idea, but when I tried it for my home town it did not work well. The first problem: I found that tapping the Local Scout tile is unreliable, and sometimes reports that Bing cannot find the location even when the location button in Bing Maps works fine.

    Fortunately you can also use Local Scout from Bing Maps. The Local Scout listing was not good though. Of the top 20 food and drink places, one had been closed for years, others were duplicated under old and new names, and there were hardly any ratings or reviews. Tap “Suggest changes” and you can submit changes to the address details or report closure, but you cannot add a review or rating, which seems a severe omission.

    I downloaded the TripAdvisor app which is a great deal more useful, mainly because of the amount of user-generated content.

    Maybe I’m missing something, but it seems to me that Microsoft needs to join a few dots here; Local Scout is only as good as its data.

  • Office and SharePoint integration. As soon as I gave Windows Phone my Live ID, it picked up my SkyDrive account and was able to open, edit and save documents there. I also hooked up Outlook to my own Exchange server, and added an Office 365 SharePoint account as well.

    SkyDrive support is new and a huge feature, especially considering that it is a free service. Editing features on the phone are limited, but you can include basic formatting.  More important, you can easily access what could be a large document repository.

    OneNote support is good, and notes made on your phone sync automatically to SkyDrive, where you can further view and edit them in a browser, or in desktop OneNote. I guess I can show a grab of the browser, which shows that the voice memo is inaccessible:

    image

    I discovered a few oddities. I was unable to link Windows Phone to my own SharePoint 2010 test server, receiving a message “We don’t support this authentication scheme”. Later I found this information:

Unless your organization uses a Microsoft Forefront Unified Access Gateway (UAG) server, you can only access a SharePoint 2010 site if you’re in the office and connected to your organization’s Wi-Fi network.

That is a considerable limitation. It did work OK with SharePoint on Office 365, except that for some reason I can find no way to create new documents on Office 365 – well, maybe in the browser. The Office Hub can create new documents on SkyDrive, but not on SharePoint, which is odd as the two have a lot in common.

Despite these issues, you get a lot out of the box for using Office on the move, particularly if you use a supported SharePoint configuration or SkyDrive. The on-screen keyboard is good too.

  • Music search. This is a fun feature. Go to Bing search, click the music icon, and it will try to recognize what is playing. It had no problem finding Katy Perry’s Teenage Dream. It struggled a bit with the more obscure Strangely Strange but Oddly Normal by Dr. Strangely Strange; but on the second attempt it found that too.
  • The social media features seem strong to me, though you are limited to the baked-in services which are Twitter, LinkedIn, Facebook and Windows Live (no Google+). You do have to link each service to your Live ID for full features; for example, you give permission to Windows Live to post to your Twitter account. The integration is smooth and if you spend your time juggling with these four services then this may well the phone for you. For example, you can post a message to all of them at once. I found the People hub good enough as a Twitter client.
  • Apps are still lacking. The issue is not the quantity of apps available, but their quality, and the lack of certain key apps. There is no official Dropbox app, for example, so you will need to use the web or a third-party workaround. On the positive side, the free Guardian app is great, especially since you can pin a section to the Start screen – I did this for Technology – and there are apps for WordPress, Amazon Kindle, the ubiquitous Angry Birds and some other essentials.

    I noticed that TripAdvisor has 61 ratings on the Windows Phone Marketplace, whereas the Android version has 39,930. That illustrates the scale problem Microsoft is facing.

  • Still no Adobe Flash.
  • Microsoft’s new Windows Phone site is clean and informative. Not always the case with Microsoft’s sites. The My Windows Phone site lets you find your, lock or erase your phone, once configured.
  • Internet sharing, which makes your phone into a wireless hotspot, is coming but subject to operator support and approval. This means you will likely pay extra for “tethering”. I have a free app which does this on my Android phone and find it useful, though whether it is worth paying extra every month is another matter.
  • Microsoft has introduced some features aimed at enterprises. In particular, Information Rights Management is now supported for Outlook and Office mobile documents. Another important feature is the ability to deploy custom applications as hidden apps, which do not appear in Marketplace searches, but can be downloaded from a link circulated internally. There is now a Lync (business messaging and conferencing) client for both Office 365 and on-premise Lync servers.

Future of Windows Phone?

My guess is that Microsoft is badly disappointed by the sales performance of Windows Phone to date. The problem is not so much the phone itself, but that it has failed to convince either the operators, or the retailers, or the general public, that it is something special and worth choosing ahead of either an Apple iPhone or Google Android device. In fact, typically retailers have few if any Windows Phones on display, and even customers asking specifically for one may be redirected to something else. The truth is, there is a disadvantage in having a minority-choice device, most obviously in the selection of apps available, but also in features that rely on user-generated content.

I asked about this problem at the Mango press launch and was told that the Nokia partnership will be the solution.

My review device is a first-generation HTC Trophy, and while it is decent enough it is not outstanding. Give Windows Phone some truly desirable hardware and a few must-have apps, and its fortunes will change, but that is not an outcome that I take for granted.

I do like the SkyDrive and Office 365 integration though, with the caveats noted above, and if I were Microsoft I would be pushing the value of those features.

Delphi and RAD Studio XE2 gets its first update as Embarcadero confesses copyright issue

Embarcadero has posted its first update for Delphi XE2 and C++Builder XE2. Whether this shows commendable responsiveness, or that that the original release was buggy and premature, is a matter for debate.

Either way, the list of fixed bugs is extensive. There is also a copyright issue, since Embarcadero says – note use of that mightily abused word “may”:

We were recently made aware that some code in the 3D support in FireMonkey may be similar to code in GLScene, an MPL open source project. We worked with Eric Grange, a key contributor to the GLScene project to remedy the issue and replace the code in question.

Unfortunately applying the patch means a full uninstall and reinstall, though Embarcardero says that future patches will be based on this new build which I presume means this surgery will not be required again.

The Adobe Flash and Windows Phone 7 mystery

I attended Microsoft’s Mix event in March 2010, where Microsoft gave us the first detailed preview of Windows Phone 7 from the developer perspective. At that time, Microsoft made it clear that the Adobe Flash plug-in would not be supported in the first release, but implied that it would follow.

Did Microsoft ever announce that Flash support would definitely come? I am not sure that it was quite promised, though I do recall Microsoft spokespersons including Charlie Kindel explaining that native code development would not be possible for developers, other than for operators customising the device – the HTC Hub is an example – and for Adobe building Flash.

Adobe’s Mike Chambers did state that:

Adobe and Microsoft are working together to bring Flash Player 10.1 to Internet Explorer Mobile on Windows Phone 7 Series

In June, still pre-release, I spoke to Adobe’s Michael Chaize who told me that work on Flash for Windows Phone 7 was well advanced and that it would follow “within months” of the initial release.

There has also been contrary evidence. Microsoft’s Andy Lees explained to Mary Branscombe:

There is no ActiveX plug-in extensibility [in the browser] because of the security model; we’re not going to do that. And with no ActiveX plug-in model, how would we do Flash?

Fair enough and even sensible, but why did Microsoft imply earlier that Flash was on the way if in fact the security architecture made it impossible? Plans change of course, but I have never been able to get a clear statement on the matter other than vague expressions of cooperation between Adobe and Microsoft. Like this one from Microsoft’s Joe Marini:

We are working with Adobe, but it has not yet been decided the last time I checked – part of that is Adobe is doing what they have to do and we’re doing what we have to do. The last I checked the team is working with them but I don’t think they have any announcement whether it’s going to definitely work or not.

Now Microsoft has just released Windows Phone 7.5 “Mango”, the first major update to the the Phone OS, and Flash is still not supported. Either because Adobe has not yet done “what they have to do”, or because Microsoft has not done “what we have to do”, or because the architecture prevents it, who knows?

You can debate of course whether Flash support is a selling point or a burden for a smartphone – but it would be good to have clarity on the matter.

My own best guess is that if it has not come by now, it never will. Although Microsoft will not say so, for obvious reasons, I also think it is inevitable that the Windows Runtime and the Metro-style development model found in Windows 8 will form the operating system for a future Windows Phone, though I am not sure if it will be Windows Phone 8 or later, but that will change the rules. Currently IE in Metro does not support plug-ins, so I would say the prospects for Flash in the browser on Microsoft’s phone are not good.

What about Adobe AIR for Windows Phone? Interesting question, though it might be difficult given that Adobe would have to in effect create a Flash to Silverlight conversion tool which might hurt a bit. This would be easier on Metro since native code development is supported.

Adobe’s MAX conference is on next week so there may be further information on this long-running topic then.

An ugly dialog from Spotify

I am a big fan of Spotify, mainly because it works so well. Search is near instant, playback is near instant.

I understood when, under pressure from the music industry, it limited the value of the free version by restricting the hours of play and the number of times you can play a specific track.

This is ugly though:

image

Spotify says:

From today, all new Spotify users will need to have a Facebook account to join Spotify. Think of it as like a virtual ‘passport’, designed to make the experience smoother and easier, with one less username and password to remember. You don’t need to connect to Facebook and if you do decide to, you can always control what you share and don’t share by changing your Spotify settings at any time.

Why care? Privacy? Because you might want Spotify but not Facebook?

I would put it another way. I am wary of putting Facebook at the centre of my Internet identity. If others follow Spotify’s example and the Web were to become useless unless you are logged into Facebook, that would give Facebook more power that I would like.

If for some reason you want to withdraw from Facebook, why should that affect your relationship with Spotify? It is an ugly dependency, and I hope that Spotify reconsiders.

See also Cloud is identity management says Kim Cameron, now ex-Microsoft.

Miguel de Icaza talks about Windows 8 and the failure of Linux on the desktop

At Microsoft BUILD earlier this month I arrived early to hear Anders Hejlsberg talk about the future of C#, and found myself next to Miguel de Icaza, co-creator of the GNOME desktop and of Mono, the open source implementation of Microsoft .NET. I took the opportunity to ask a few questions, which I have his permission to post.

I recall that when .NET was first announced in 2000, it was not long before de Icaza announced Mono. I was interested therefore to know his reaction to Windows 8 and the new Window Runtime which powers “Metro-style” apps. Will we get an open source implementation of Metro-style on Linux?

I don’t think so. To be honest, with Linux on the desktop, the benefits of open source have really played against Linux on the desktop in that we keep breaking things. It is not only incompatibilities between Red Hat, Unbuntu, Suse, but even between the same distribution.  Ubuntu from this week is incompatible with the one nine months ago. And then there are multiple editions, the KDE version, the Gnome edition, the one that is the new launching system.

When you count how many great desktop apps there are on Linux, you can probably name 10. You work really hard, you can probably name 20. We’ve managed to piss off developers every step of the way, breaking APIs all the time.

I’m heartbroken, that’s the bottom line.

What about compiling your Metro app for iOS or Android?

I think that Linux has a tough time on the desktop. And the desktop is starting to not matter any more. On the other hand, building WinRT is going to be a significant amount of work. A large chunk probably could be reused from Moonlight. But it is a lot of work, to be able to reuse existing Windows apps, and in the case of iOS they already have their own stack, and Mac has its own, Cocoa is really nice and we have .NET bindings for it.

So I think we’ll learn interesting lessons from Metro. There is stuff that will be useful on other platforms like the JSON reader. But I’m not going to spend any time on WinRT for other systems.

And we can speculate about how well Metro will work in the market …

They are Microsoft, it’s going to succeed. In three years they are going to have this thing on half a billion computers, so it will be out there.

It seems like they are going to use their muscle for two things. It’s going to be a tempting space [for developers], but if you want to go into the right distribution channel for that half a billion computers, you need to abide by the Metro guidelines. They are not going to give you full API access, they are going to give you the sandboxed version. Which is good, because it can finally fix the security problems on Windows. They are going to use their muscle to reset the rules for Windows.

Especially on ARM

Right, and it is needed, they definitely need to fix this mess, a lot of malware, spyware, and the fact that everybody is sysadmin, and has to reinstall their machine every so often.

I’ve heard the word “safe” a number of times.

Right, and think of an iPad, you don’t need to be a sysadmin.

Now, you could argue that by WPF not being available to everybody and being bound to .NET they limited the effect WPF would have had, whereas Metro gives this to C++ developers, but they’re saying, hey, you can’t call Win32, there is all the Win32 stuff you can’t call. You have to use Metro. So they might be repeating that [mistake], but maybe it’s eclipsed by the fact that there’s going to be a rush to the app store. It seems like there is a big enough carrot now.

How are you getting on with the Windows 8 tablet?

I have to say, I actually like Windows 8. I am not a Windows user. It’s probably the first time that I would use a Windows machine.

Miguel de Icaza is now at Xamarin, providing cross-platform tools for using C# and .NET to build apps for Apple iOS and Google Android.

Android tablets ahead of Apple iPad on Amazon

Following Gartner’s report on the expected dominance of Apple’s iPad2 in the tablet market throughout 2011 I took a quick look at Amazon’s sales and user ratings.

My guess is that Apple stores and direct sales online account for a large proportion of iPad sales, so no doubt the iPad is ahead overall. Even so, I was interested to find  the iPad at number 7 on Amazon.co.uk, not only below three cheap 7” cheapies from little-known brands, but also below the Asus EeePad Transformer and the Samsung Galaxy Tab 10.1, both of which are at iPad-like prices.

image

Buyers on Amazon.com seem to have less enthusiasm for the cheapies. At the time of writing, bargain prices have pushed HP’s discontinued TouchPad to number 1, followed by the EeePad and the Motorola XOOM. Apple iPad is at 4, with Galaxy Tab 10.1 at 5 and 6.

When you see nearly 500 user reviews and a four star average rating, as for the Eee Pad, it shows that these things really are selling and being enjoyed.

Of these I have only properly tried the TouchPad and the iPad. I did not much like the TouchPad, though apparently firmware updates have considerably improved it.

A simple example of async and await in C# 5

I have been playing with the Visual Studio 11 developer preview and exploring its asynchronous features, specifically the async and await keywords which are new to C# 5.0. These features have actually been available as a CTP (Community Tech Preview) since October 2010, but I had not found time to try it.

I like to keep examples as simple as possible. I have a Windows Forms application which has a long-running task to perform, and I do not want to lock the UI while it runs. Here is my long-running function:

 private int slowFunc(int a,int b)       
 {          
 System.Threading.Thread.Sleep(10000); 
 return a + b;
 }

Yes, it takes 10 seconds! I am going to click a button on a form, call the function, and show the result on a label control.

Now, here is how I might try to achieve the goal of not locking the UI using Visual Studio 2010 and C# 4.0:

 private void button1_Click(object sender, EventArgs e)
 {            
 this.button1.Enabled = false; //prevent re-entry 
 var someTask = Task<int>.Factory.StartNew(() => slowFunc(1, 2));
 this.label1.Text = "Result: " + someTask.Result.ToString(); //oops, blocks calling thread 
 this.button1.Enabled = true;       
 }

Oops, this did not work at all! The reason is that although I have gone to the trouble of creating a Task in order to run the slow function on a background thread, my work is undone when I call the Result property of the Task object – since this blocks the thread until the Task completes.

Here is how you can fix it in Visual Studio 2010 – remember, there is an easier way in C# 5.0 coming up soon:

 private void button1_Click(object sender, EventArgs e)        
 {
 this.button1.Enabled = false;          
 var uiScheduler = TaskScheduler.FromCurrentSynchronizationContext(); //get UI thread context 
 var someTask = Task<int>.Factory.StartNew(() => slowFunc(1, 2)); //create and start the Task 
 someTask.ContinueWith(x =>     
   {                                          
   this.label1.Text = "Result: " + someTask.Result.ToString();   
   this.button1.Enabled = true;   
   }, uiScheduler  
  );        
 }

This one works. I click the button and the UI does not lock up at all; I can minimize the form, move it around the screen, and so on.

However, I have had to do some extra work. The ContinueWith method tells the Task to run some other code after the background thread has completed. By default this code will not run on the UI thread, which means it will raise an exception when it updates the UI, but you can pass in a TaskScheduler object so that it continues on the UI thread.

Now here is a look at the same problem using C# 5.0. The slowFunc is the same, so I will not retype it. Here is the code for the button click:

 private async void button1_Click(object sender, EventArgs e)
 {
 this.button1.Enabled = false; 
 var someTask = Task<int>.Factory.StartNew(() => slowFunc(1, 2)); 
 await someTask;  
 this.label1.Text = "Result: " + someTask.Result.ToString(); 
 this.button1.Enabled = true;
 }

Less code, same result, which is usually a good thing.

What is going on here though? First, the async modifier is added to the click event handler. This does not mean that the method runs asynchronously. It means that it contains code that will run asynchronously using await. As Eric Lippert explains, it tells the compiler to rewrite the method for you.

Second, there is the await keyword. I cannot improve on Lippert’s explanation so here it is:

The “await” operator … does not mean “this method now blocks the current thread until the asynchronous operation returns”. That would be making the asynchronous operation back into a synchronous operation, which is precisely what we are attempting to avoid. Rather, it means the opposite of that; it means “if the task we are awaiting has not yet completed then sign up the rest of this method as the continuation of that task, and then return to your caller immediately; the task will invoke the continuation when it completes.

If you refer back to the Visual Studio 2010 examples, you will see that the code is very close to my first, non-working example. In other words,using await makes the code work in the way that intuitively I hoped that it might, without specifically called the ContinueWith method and messing around with the thread context as in the second example.

This is still concurrent programming though. One thing that C# 5.0 cannot prevent is an impatient user clicking several times on the button when the result does not appear immediately, so in all the examples I have disabled the button while the background thread runs.