Category Archives: Windows

Book Review: Programming Windows® 8 Apps with HTML, CSS, and JavaScript

Windows 8 App development is a must have skill if you favor the Microsoft platform, and if you want to learn how using HTML, CSS, and Javascript (as opposed to C#), Programming Windows® 8 Apps with HTML, CSS, and Javascript (Kraig Brockschmidt, Microsoft Press) is the book for you.


The book is written in tutorial style, encouraging to learn by working along with the author. This is backed up by detailed explanation of what’s going on and why this is important. The book covers a lot of ground, from the anatomy of an application to using device capabilities, audio & video playback etc. I personally don’t like the “trying to be funny” writing style of the author, but it wasn’t too annoying considering the wealth of information and good explanations.

Is HTML dead?

Yes, HTML is great. HTML5 (now just known as HTML) is going to be great. It will finally bring that much needed functionality it’s been lacking all these years, and cross-platform to boot. All the major browser vendors are saying HTML is great, and that their browser supports it best. So what could possibly be wrong? Well, for one the browser really seems to be an out-of-date mechanism to provide rich functionality. As an application platform it’s coming apart at the seams, because users want applications that work awesome on their device of choice. Forget the clunky, lowest common denominator browser-based interface, users want Apps with a capital A!

So while one side of the industry is focusing on standardizing on HTML, the other side (within the same companies) is moving in an entirely different direction. The amazing number of apps available and the growth rate in the Apple AppStore, and the Android and Windows Phone equivalents, is the best evidence that this is actually working better. Cross-platform? Forget it! Cross-platform is slow(er), one size fits all, and most important… not sexy.

Don’t underestimate the importance of being sexy. Let me explain by example. The Dutch government has all laws published on the web at wetten.nl. That means it works in all modern browsers on all platforms, including tablets and phones. There’s no flash involved or anything, so it is truly cross-platform. Also, this is very much in line with efforts of recent years to have the entire government use open standards and open source (see NOIV at http://noiv.nl/service/english/). With mobile touch devices on the rise, the user interface of wetten.nl might need an update to be more suitable to touch and smaller screens. Since the website is all HTML, CSS, and JavaScript, the obvious and NOIV route would be to make adjustments to suite the upcoming devices. But what happened instead? An iPad App was built. Is this a logical choice? Nope, not even close. Even if you don’t look at NOIV and look at reach. The website has a far wider reach, and if you wanted to do something beyond that, well there’s a whole lot more Windows PCs out there than there are iPads. Not to mention that it leaves other devices out in the cold. So really, that much effort (and tax payer money) to build an App that adds nothing? Yep, that’s what “sexy” does.

But wait, isn’t Microsoft betting on HTML with Windows 8? Maybe, but I’m not 100% sure about that one yet. Also, Microsoft isn’t known for its choices when it comes to mobile devices. Microsoft sort of invented the tablet almost 10 years ago, but Apple has taken the credit. Microsoft phones haven’t done particularly well, although Windows Phone shows promise. I love mine actually, but I rarely open the browser on that thing. It’s all apps (yup, guilty!)

Where does this leave us? Well, HTML is going to be around for a long long time, but as things are going it will go back to its original purpose: browse information, and primarily for PCs. PCs which are some are already saying are “legacy devices” (I personally believe we’ll move more to hybrid devices, and different devices connected like with Dropbox, Skydrive, iCloud etc.) For the development community this is actually great. Where previously users were complaining about stuff not being cross-platform, they are now actually demanding customized apps for the specific platform they are using, and the government actually tramples over its own guidelines. This means developers have an excuse to have to build an app for at least two or three platforms, so we won’t be out of a job anytime soon. That said, it means that what’s going on at the server is getting more important, because we have to reuse functionality at some level for the costs not to get out of hand. Enter cloud computing, which is great for developers like me: graphically impaired. This by the way is also great for internet providers, providing they can keep up with the bandwidth demand.

As a developer all I can say is thank you Mr. Jobs for putting users with their nuts in the bear trap, and loving it.

lPeriodically calling a function in your web app

A recurring theme in web programming is calling a function periodically and/or at a specific date and time. This has two aspects:

  • Calling a function on a scheduled basis
  • Making sure time-outs don’t interfere

Calling a function on a scheduled basis

To be able to call a function on your web app, you first need an endpoint (a URL) that you can call to kick the function off. In ASP.NET you can do this in several ways:

  1. Create a page that calls the function.
  2. Create a handler (ASHX) that calls the function (more efficient than a page).
  3. Create a WCF service that allows calls with HTTP GET, as discussed in this blog post by Sasi Suryadevara.

With your endpoint in place, you can use the Windows Task Scheduler to invoke the function at any given time and at intervals as low as one minute. With the Windows Task Scheduler you have several options again:

  1. Create a VB Script that calls the URL, as discussed in this blog post by Steve Schofield.
  2. Create a PowerShell script that calls the URL (same as option 1, but more modern).
  3. Have the Windows Task Scheduler open Internet Explorer and open the specified URL (e.g. C:\PROGRA~1\INTERN~1\iexplore.exe -extoff http://www.google.com, which starts IE without extensions). If you do this, you also need to specify that the Task Scheduler closes IE after 1 minute, which you can do in the Settings tab of the task (Windows 2003), or in the Trigger configuration (Windows 2008), as shown below. NOTE: I’ve found that IE sometimes doesn’t close, even if you tell Windows to close it. Eventually this will cripple your scheduled task.


Task Settings in Windows 2003


Trigger configuration in Windows 2008

Note: In Windows 2008 the dropdowns governing duration and interval show 30 minutes as lowest value. You can in fact change this to 1 minute by editing the text.

Making sure time-outs don’t interfere

A web based call is bound to time-out after a few minutes. If you task takes longer than that, this may abort the call depending on how you programmed it, and what webserver settings are used with regards to disconnected clients. To ensure a time-out does not interfere, you can spawn a new thread and have it call the function. That way the thread handling the request can return a response to the client, and the function is carried out regardless. One issue that may arise there is that the function itself hangs or takes too long. You may want to add logic to ensure that it’s aborted after a certain time, and add logging to notify you of this, and possibly also ensure that the function can only be run by one caller at a time.

Windows “Longhorn” Server Beta 3 beschikbaar, met Go Live license

Windows “Longhorn” Server Beta 3 is te downloaden van het MSDN Evaluation Center. Onderdeel van deze release is ook IIS7 die te gebruiken is met een Go Live License. Dat betekent dat je er mee in productie mag gaan, maar wel voor eigen risico. Meer over de mogelijkheden van IIS7 is te lezen in deze blogpost of op www.iis.net.

Desktop Search weg na installeren Office 2007 Beta?

Onlangs heb ik Office 2007 Beta op mijn werkmachine gezet. Waarom? Een aantal features (zoals contstant de woord-count in de taakbalk zichbaar) zijn erg handig nu ik een boek aan het schrijven ben. Nu dacht ik dat dit geen neveneffecten had, maar ik heb er inmiddels een gevonden: Desktop Search is weg. Nou ja, niet helemaal. Het is nog geinstalleerd, maar er is geen zoekvakje meer waar je iets kunt invullen (wat het geheel redelijk nutteloos maakt). De oorzaak is volgens een post van Chris Pratley dat Office 2007 Beta ook WDS 3.0 installeert zodat je ook de nieuwe documentformaten van Office 2007 kunt doorzoeken. En daar gaat het dus mis… WDS werkt wel in de applicaties afzonderlijk, dus in Outlook (waarvoor ik het ‘t meest gebruik) kan ik gewoon zoeken. Voor bestanden moet ik even  wachten tot er een fix is. Heb je dit echt nodig zul je dus Office 2007 moeten verwijderen en WDS moeten herinstalleren.