Birth of the cool
Tomorrow is the day when Microsoft tries to get its mojo working. At the BUILD conference, Windows 8 will be revealed to an audience of eager developers, including yours truly. But although this is a developer conference, the technical details aren’t quite as important as usual. What really matters is the rebirth (and probably detoxification) of the whole Windows brand. At the moment, Windows just isn’t perceived as “cool” in the same way as certain other brands, it’s just something you use because you have to (either because it’s for work or because you have a limited budget).
I suspect the main point of this conference is to make “Windows” not refer to a PC operating system, but instead to cover a whole range of Microsoft services and devices working in synergy. So as a Windows user, you’ll be using your Windows Phone with Windows Live services, keeping your data in the Windows Live cloud, then accessing the same stuff from your Windows tablet, laptop and PC plus your XBox and Surface. You’ll be using Kinect and voice control to access TV, videos and music on your devices without hunting for the remote, and because it all synchronises together so seamlessly you’ll not need to worry about which device you’re using to access which service or where the data’s coming from, because it’s all Windows and it all just works.
Well, that’ll be nice, won’t it? Of course, vision and execution are two different things. After all, Microsoft already has the technology to do all of the above, it’s the synergy that’s missing. So what we’re looking for this week is evidence that in that Microsoft really are pulling everything together, and from a developer point of view that we’re going to be given the tools to build applications and services that will work in the new paradigm.
I’ll be blogging selected highlights throughout the week, but what I’ll be particularly looking out for is:
- Designers, Designers, Designers! This is where HTML5 comes in, of course. Designers just don’t use Expression Blend or Visual Studio, so traditional Windows apps are very rarely a thing of beauty. But if you can use HTML as the basis of your UI then all of a sudden that changes everything. I’ll be looking to see how the HTML and XAML models have been merged or bridged so that we can write .NET apps and still get a properly designed UI.
- The consumer cloud. Developers already have Azure, but we also need an API for the Windows Live cloud services, in particular SkyDrive. For example, a Windows Phone Mango app I just wrote has a facility for uploading images, audio and video. But why should I have to use my own Azure storage account for this when I know that the user has oodles of SkyDrive storage and probably would rather have the uploaded media available in their own account anyway? If developers get proper access to Windows Live, the sky’s the limit in terms of what services we can build.
- Entertainment services. I’ve always been a big fan of Media Centre. I use it for TV, video and music in my living room and I love it. And of course because it’s a PC I can watch iPlayer and other streaming media on the TV as well. But what I really want is a Surface 2 hanging on the wall, doing the same things but with Kinect, voice and multi-touch control. And I also want to be able to access the same media from my phone and tablet (and XBox of course) without having to even think about synchronisation.
- The next version of Windows Phone. With Mango about to roll out, the Windows Phone is definitely a match for the competition. But what’s in the next release to make it a must-have? I’m still hoping for an Xbox Phone with proper game controls, but we’ll see.
- Hardware. Will Microsoft be working with the hardware manufacturers to make it easy for consumers to choose devices without having to worry about what all the technical specs mean?
Check back to the blog for updates and I’ll let you know what we find out!
DotNetNuke in C#? What’s the difference?
So, the last major VB.NET open source project has passed away, to rise phoenix-like from the ashes as a major C# open source project. There has, of course, been some relatively heated debate in the past about whether or not this would be a good idea, particularly since Ben Zhong started maintaining a C# version of the codebase alongside the official VB.NET version. But the decision to change horses has been made now, for better or for worse, so the obvious question is "what difference will it make"?
Well, to be honest, plus ça change, plus c’est la même chose. Most people will notice precious little difference, but of course it depends on what angle you’re coming at it from:
- End users should notice no difference at all. The C# code should be written to do exactly the same as the VB code, and so functionality should be unaffected. (Though there may be the odd cosmetic difference due to the fact that the C# release will be a new major version!)
- Administrators should similarly notice no difference. However, there will be an onus on administrators to test the new version sooner rather than later. Any major version update is going to need more testing than DNN Corp can manage by themselves, but a major version accompanied by a language change is going to need an awful lot of tyre-kicking before you can be confident of it.
- Developers won’t have to change anything. The API will remain the same, and modules can still be written in any .NET language, so you can continue to develop your modules as you always did. Where you will find a difference is when you’re looking through the DNN source code – if you’re a diehard VB.NET programmer then you’ll have to get used to the C# syntax if you want to follow what’s going on.
- The DNN development team get to use a language which is better supported by Microsoft, have access to a wider array of tooling and can also choose from a larger pool of developers.
- Non-DNN people quite simply get the chance to re-evaluate it without prejudice. Although there’s no technical reason for a language change to make any difference, there are a lot of potential reasons due to false perceptions. For example, some developers feel that VB.NET is a language for beginners and amateurs, and that any product written in VB.NET isn’t to be trusted. If these people can cross this mental boundary and actually give DNN a fair chance, the chances are they’ll be quite impressed by how much it’s evolved since they last looked at it in version 2. Also, some decision makers think that their C# developers can’t work as well with a CMS written in VB.NET. There’s still the WebForms bridge to be crossed, but that can wait a while longer!
So as long as we in the DNN community muck in and do our bit to make sure that v6.0 is tested as thoroughly as possible, it should in fact be a smooth transition and should also strengthen DNN’s long-term viability as explained so eloquently in Shaun Walker’s announcement. I know there are people out there who are quite sceptical about this, but I reckon it’ll work.
The Xbox Phone?
Just writing down a prediction here so I can be proven completely wrong in a few months’ time. ![]()
When Windows Phone 7 was first announced, my first thought was “Windows Phone? What are they calling it that for?”. Well known though the brand undoubtedly is, it’s not exactly untainted, particularly when it comes to Windows Mobile.
However, reading Mary Jo Foley’s recent article “Is Microsoft Zune about to be Kinned?” and seeing the introduction of the new Xperia Play “PlayStation phone” got me to thinking, and what I think is this:
- “Zune” will become “Xbox Entertainment”. The Zune brand doesn’t really exist outside the USA, and even there I believe it doesn’t have great traction. Xbox, on the other hand, has a good reputation everywhere.
- The Xbox itself is going to expand from a primarily gaming platform to a complete entertainment hub.
- The next major release of Windows Phone will also introduce an Xbox Phone (xPhone?). The Windows Phone brand will be aimed more at business users, whereas the Xbox Phone brand will be aimed at consumers and will build on Xbox Live and the Kinect integration already demonstrated, possibly with a slide-out controller as well.
So what do you think? Is this likely? Would it work? Will Apple, Google and Sony Ericsson be too far ahead in 6 months time anyway? Answers on a postcard please (or in the comments if you must …)
HTML5 vs Silverlight (and others)
On Wednesday I gave a talk about HTML5 (mostly) and Silverlight (slightly), demonstrating and comparing their relative capabilities and ease of use, and discussing when to use them for application development.
First of all, thanks to everyone who turned up for not taking up the rather more tempting option of watching Arsenal vs Barcelona, and for all the great feedback. I’ll see about doing a more Silverlight-centric talk next!
Secondly, thanks to Telerik for sponsoring the event and providing the very generous draw prizes.
And finally, as requested by several people, here are the slides and the HTML5 demos:
I’ve left some extra notes in with the slides, but of course do feel free to ask if you have any questions.
P.S. Some of the demos are inspired by – or in the case of the 3D canvas taken completely from – HTML5Demos.com and HTML5Rocks.com.
Improve SQL Server performance with a simple query
This is probably embarrassingly simple to a SQL professional, and it’s been around since SQL 2005, but I only discovered it today and it made a noticeable difference to my production databases so I’m going to share it just in case it’s new to anyone else.
The query
Run this query on SQL Server 2005 or later and it will list indexes that you could create to improve the query performance of your database, based on the workload of the server since the SQL service last restarted. (The query just lists the indexes, it doesn’t create them!)
SELECT 'CREATE INDEX IX_Auto_' +
CONVERT(varchar(max), MID.index_handle) +
' ON ' +
[statement] +
' (' +
COALESCE(equality_columns + ', ' + inequality_columns, equality_columns, inequality_columns) +
')' +
ISNULL(' INCLUDE (' + included_columns + ')', '') AS create_statement,
CONVERT(int, avg_total_user_cost * user_seeks * avg_user_impact) AS potential_saving,
[statement] AS table_name,
equality_columns,
inequality_columns,
included_columns,
last_user_seek,
avg_total_user_cost,
user_seeks,
avg_user_impact
FROM sys.dm_db_missing_index_details MID
JOIN sys.dm_db_missing_index_groups MIG ON MIG.index_handle = MID.index_handle
JOIN sys.dm_db_missing_index_group_stats MIGS on MIGS.group_handle = MIG.index_group_handle
ORDER BY avg_total_user_cost * user_seeks * avg_user_impact DESC
The results
Running the query will return results of the following form, with indexes that have the largest potential improvement first.
| Column | Description |
|---|---|
| create_statement | A SQL statement to create the proposed index. |
| potential_saving | The relative query cost saving of this index. |
| table_name | The fully qualified name of the table that the index applies to. |
| equality_columns | Comma-separated list of columns that contribute to equality predicates of the form table.column = constant_value. |
| inequality_columns | Comma-separated list of columns that contribute to inequality predicates, for example, predicates of the form table.column > constant_value. |
| included_columns | Comma-separated list of columns needed as covering columns for the query. These are columns that aren’t used as key columns for the index, but are included for quick retrieval by queries. |
| user_seeks | Number of seeks caused by user queries that the index could have been used for. |
| last_user_seek | Date and time of last seek caused by user queries that the index could have been used for. |
| avg_total_user_cost | Average cost of the user queries that could be reduced by the index. |
| avg_user_impact | Average percentage benefit that user queries could experience if this index was implemented. The value means that the query cost would on average drop by this percentage if this index was implemented. |
How it works
Every time the SQL query optimiser analyses a query, it works out the best indexes for the filtering it will need to do. If these indexes don’t exist, it nevertheless remembers that they would have been useful, including how much quicker the query would have been any how many times they would have been used. After the database has been up and running for a while, SQL Server will have a pretty good idea of which indexes would make a significant difference to your live workload.
The query above uses the Missing Index dynamic management objects to list all these indexes in order of potential query cost saving.
Caveats
- Obviously if you don’t understand SQL indexes at all, it’s best not to fiddle with them. While there is a very good chance that the top few suggested indexes will be beneficial, there’s always a chance that you could seriously degrade write performance, or that you’ll lock the table for a prolonged period while the index is created.
- Don’t create every index in the list! It’s better to create them one at a time and measure the improvements – after a while the savings will become more trivial and it’s more likely that the decrease in write performance will negate the query benefits.
- Not every possible index that might help will be returned. See Limitations of the Missing Indexes Feature.
Further reading
Before you dive in, I strongly recommend having a quick read through Finding Missing Indexes in SQL Server Books Online.
Which Google jQuery hosted link to use?
As you probably know, the best way to load jQuery on an internet website is to get it from Google’s CDN. There are three main reasons for this:
- Parallelism – Browsers limit the number of simultaneous connections to a single server to avoid overload. Any resource that you fetch from a different server than your own will starting loading immediately, rather than being queued up alongside the images, scripts, CSS etc coming from your main server.
- Speed – Google’s CDN has many servers in different physical locations, and your user will be automatically directed to the server that will serve their request most quickly.
- Caching – Most importantly, if the user has already been to a site that uses the same version of hosted jQuery, their browser will already have a local copy and won’t need to download it at all.
However, it’s important to make sure that you use the right URL to load jQuery. Let’s suppose my site works with jQuery 1.4.2 (the latest version at the time of writing). I can actually use three different URLs to get it:
- http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js – This is version 1.4.2, as you would expect. If you’ve tested against 1.4.2 and don’t want any surprises, this is the one for you.
- http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js – This is the latest revision of version 1.4, so while it loads 1.4.2 at the moment, your site will be automatically upgraded to 1.4.3 when it’s released. However, if and when 1.5 is released you won’t get it, which protects you from any breaking changes that might be introduced.
- http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js – This is the latest revision of version 1. You’ll always get the latest and greatest jQuery (until they release version 2), but you do need to keep an eye out for breaking changes. This is the default setting in DotNetNuke when you enable hosted jQuery, so if you’re using this setting then you may want to give your site a quick test when a new version of jQuery is released to the Google CDN (subscribe to Google AJAX API Alerts to know when this happens).
Also worth noting if you’re fine tuning for performance is that if you specify the exact version number then jQuery will be cached in the browser for up to a year, giving the best possible performance. If you only specify a partial version then the browser will still check the Google server every hour to see if there’s a new version available, even though it won’t actually download it if nothing’s changed.
Twitter
MSN/Live Messenger
LinkedIn