Monthly Archives: November 2012

Windows Update 0x800b001 error on Windows 8

wsusWe installed new Windows 8 clients into our existing domain and sadly found, that they cannot update themselves from our Windows Server Update Services (WSUS) server, which works perfectly with all other existing clients. Although the Windows 8 patches were enabled on the WSUS server, the update always failed with 0x8001b001 error code.

The solution is quite simple, just install a recently released update to the WSUS server:

You can read more about the update in the KB2734608 knowledge base article.

We had to restart the WSUS server as well as the clients, but after that the Windows Update process completed successfully on the Windows 8 machines.


Technorati-címkék: ,,

WinJS Tricks: Access is denied exception with multiple MessageDialogs

Using what you learned in the previous episodes of the WinJS Tricks Series about MessageDialogs and their custom buttons, you can write the following code, that displays two MessageDialogs in a sequence:

var dlg = new MessageDialog( 'First message' );

dlg.commands.append( new UICommand( 'OK', function() {
  new MessageDialog( 'Second message' ).showAsync().then( function() {
    // Do something useful here...
  } );
} ) );


The “only” problem with this code is that it unmerficully crashes your app without any notification. If you run your app in Debug mode you can get the following Access is denied exception:


Do you see the bug? If not, you can learn why that happens and how to fix it from the next episode of the series:

(720p, full screen view recommended)


Technorati-címkék: ,,,,

WOWZAPP preparation materials

wowzapp2012On November 9-10 thousands of developers are coming together in event venues worldwide to build apps for the next generation of Windows in WOWZAPP 2012. Many countries are joined to this event where experts, developers and trainers will be available to assist your learning and coding your apps. Check the nearest location on the WOWZAPP website and register!

Here is a quick list of articles I wrote in the last months that WOWZAPP attendees may found useful:

Windows Store

JavaScript development


Windows 8 inatallation

Good luck and have fun!


Technorati-címkék: ,,,

Zebrafying ListView without AlternatingItemTemplate

It’s a common task, that you have to create a table with zebra stripes on the webserver. This is quite easy in ASP.NET using the ListView control, because thanks to its ItemTemplate and AlternatingItemTemplate you can create separate row templates for the odd and the even rows. The drawback of this solution is that if the two templates have only minor differences, – for example just a single CSS class that sets the background color is attached to every second row – the code quickly becomes overcomplicated which is hard to maintain.

You can solve this problem with a single ItemTemplate, if you don’t hardcode, but instead calculate the CSS class of the row on the fly with data binding:

  <tr class="<%# Container.DisplayIndex % 2 == 0 ? "odd" : "" %>">

The same solution works with other controls as well, however you have to slightly modify the condition. For example if you use a Repeater you should use the Container.ItemIndex property to query the current row number.



WinJS Toolkit – JavaScript Toolkit for Windows 8

If you are creating Windows Store applications in JavaScript you may be interested in a new project, called the WinJS Toolkit I created on CodePlex:

The WinJS Toolkit is a set of classes and helper functions that help creating Windows Store applications in HTML5, CSS3 and JavaScript. The WinJS Toolkit also contains templates that you can add to Visual Studio to simplify creating new items in your solution. The goal is to speed up the Windows Store app development by pre-baked code that most apps need.

The project is in very early stage, currently it contains only a few functions and three item templates for VS 2012, but I wanted to publish it on this week to make it available for WOWZAPP. Although the project is just born I believe that it can provide value even in this basic form for this event and your other projects too.

The current version contains the following features:

Extension methods

  • String.format prototype

The WinJSTK class

  • WinJSTK.isConnected() function: Detects internet connection availability.
  • WinJSTK.composeMailAsync() function: Composes an e-mail message.


  • Item template for a WinJS class
  • Item template for About flyout
  • Item template for Privacy policy flyout

Please help spread the word and use the #WinJSTK hashtag if you tweet about the project.

I appreciate and welcome all feedback, and of course all of you are invited to contribute to the project.


Technorati-címkék: ,,

Deleting a result file in ASP.NET MVC

It happens sometimes, that you send back a file to the browser from ASP.NET MVC using FilePathResult with some code like this:

public FileResult GetFile()
    // TODO: something important is done here...
    return this.File( filePath, type );

If the file is actually a temporary file, how can you delete the unnecessary file from the server only after the file is fully sent to the browser?

You can create a result filter:

public class DeleteFileAttribute : ActionFilterAttribute
  public override void OnResultExecuted( ResultExecutedContext filterContext )
    string filePath = ( filterContext.Result as FilePathResult ).FileName;
    File.Delete( filePath );

Of course this code is simplified, you should add additional checks to validate that the action result is really a FilePathResult, check that the file exists, and finally make sure that your code doesn’t blow up if the file deletion fails.

After you completed your filter, just add the [DeleteFile] attribute to your action and you’re done!


Technorati-címkék: ,

Using AppBar icons on classic buttons

You can create fancy application bars in your Windows Store apps thanks to the 194 Metro style icons provided in the WinJS.UI.AppBarIcon object. Just add the data-win-control attribute to a div and a button, and they will be transformed into the appbar:

<div id="appbar" data-win-control="WinJS.UI.AppBar">
    data-win-options="{id:'cmdPrev', label:'Previous', icon:'previous'}"

One of the interesting questions is, that what previous means in the above code? You can find the name of the icons in the WinJS.UI.AppBarIcon object, which is loaded from the ui.strings.js file of WinJS:


This is a classic resource file loaded with values like this:

"appBarIcons\\previous": "\uE100", // ? group:Media
"appBarIcons\\next":     "\uE101", // ? group:Media
"appBarIcons\\play":     "\uE102", // ? group:Media
"appBarIcons\\pause":    "\uE103", // ? group:Media
"appBarIcons\\edit":     "\uE104", // ? group:File
"appBarIcons\\save":     "\uE105", // ? group:File
"appBarIcons\\clear":    "\uE106", // ? group:File
"appBarIcons\\delete":   "\uE107", // ? group:File
"appBarIcons\\remove":   "\uE108", // ? group:File

What the \uE100 value means? The appbar relies on the Segoe UI Symbol font which contains bunch of icons, and the given value is the code of the character:


So actually appbar doesn’t display any image, it uses characters as icons, which is a brilliant solution, because it is faster, and you don’t have to worry about sizing.

You can catch it all in the DOM Explorer of Visual Studio, except the most important part, because Visual Studio cannot display these special character entities (that’s why there are question marks in the previous code snippet). Thankfully Jamie Rodriguez created a simple function that lists all WinJS.UI.AppBarIcon item.

Because the appbar is a mutation of the classic <button>  element, you can use the same technique in your own code. This is how you can reference to character entities in the markup:


So first &#x then the code, and finally a semicolon. And the result is:


Naturally, icons look a bit different in a rectangular button than in a circle, so I made a simple function to display all icons in a button:

for( var icon in WinJS.UI.AppBarIcon ) {
  var btn = document.createElement( 'button' );
  var hex = WinJS.Resources._getWinJSString( "ui/appBarIcons/" + icon )
                 .value.charCodeAt( 0 );
  btn.innerHTML = '{0} (&amp;#x{1};): &#x{1};'.format( icon, hex.toString( 16 ) );
  document.body.appendChild( btn );

Here is the full gallery (click for the high resolution image):


Of course you can use not only those characters that are available in the WinJS.UI.AppBarIcon object, but any character of any font, which is much more convenient, than sizing and positioning img elements…



How can your app get into Spotlight in the Windows Store

There is a Marketing your app section in MSDN, where you can find information about how your app will appear in the Windows Store. But you can find nothing about what your app needs to get into the Spotlight section on the first page of the Store.

Well, that’s intentional to prevent gaming the system and abusing the algorithm. Wouldn’t you just buy your own app ten more times just to get into Spotlight, would you? For this reason don’t expect Microsoft publish the algorithm…

Some tips that can help your app:

Make sure you provide Promotional images in the Description step of the publication wizard, because without this your app has no chance to get into Spotlight. You can upload PNG images in four sizes:


You don’t have to upload images in all sizes, but the more you upload the more chance you have. If you want to upload only a single image, let that be in 414×180 pixel size.

Second, make sure your app is polished. Even the simplest app has more chance to the get into Spotlight if you care about the details when you make it, than a more useful app that look like you spent no time on it. Don’t even hope with the default X icon:


Finally, follow the feedbacks. You can get feedbacks from your users not only through the Review page, but the Store also collects statistics about your app, which you can review on the Dashboard.


Technorati-címkék: ,