Skip Navigation Links / Posts / Posts By Category

Posts for Category: Vista

Feed for this Category
Coding Horror: On Exposé, Flip3D, and Switcher

Well, Jeff Attwood might start by saying that he's a Vista fan...

Coding Horror: On Exposé, Flip3D, and Switcher

But I think that it takes a certain type of geek to say that they prefer a busy, confusing arrangement of random crap:

Over something beautiful that was designed to be used by humans:

posted on 9/22/2007 9:29:26 AM ( 3 Comments )


Restart Manager in VS 2008

I woke up this morning after a hard night coding and noticed that my laptop had restarted after some automatic Windows Updates were applied overnight.  How did I know this?  Well I knew because VS 2008 told me that it was restarting and wanted to know whether I wished to recover my files.  Daniel Moth has a screenshot of this here.  RestartManager should be a certain feature if you are implementing any current Windows application (and have sufficient resources smile_regular - we'd actually planned to implement it in EagleEye but then had some resourcing pulled at the last minute smile_sad). 

posted on 8/16/2007 8:16:32 AM ( 2 Comments )


Expression and Silverlight videos

There appears to be a lot of awesome video content washing around today in line with the kick-off of MIX07. 

Microsoft Expression Knowledge Center Videos

Dozens of Sliverlight videos from the Silverlight site

A bunch of Silverlight screencasts from Tim Sneath's team

posted on 5/1/2007 9:14:49 AM ( 0 Comments )


Running Excel in Elevated (Administrator) Mode

This is just a tip entered for my future self...

To run Excel in Elevated Mode on Vista:

  1. Click the Start Button
  2. Type "Excel"
  3. Press SHIFT + CTRL + Enter

Voila!

posted on 4/26/2007 8:55:08 PM ( 0 Comments )


dbartholomew.net has CardSpace authentication

Dan is rapidly becoming our in-house Card Space guru and now he's added it to his blog.  You can try it out here: 

Link to dbartholomew.net > Home ( DNN 4.4.1 )

How long will it be before we can add this to our own website I wonder smile_regular

posted on 3/26/2007 9:10:51 PM ( 0 Comments )


World Cup Cricket Gadget - Progress Report

OK, so I'm back in Australia and wanted to provide a little status report on the progress of my World Cup Cricket Gadget.

The Gadget itself allows you select a game from a list and display the details of that game.  The list looks like so:

As you can see, the list is divided into 3 groups: Current, Future, and Completed.  Selecting a Completed game will display the result for that game.  Selecting a Current Game will display a progress score if that game has started.

The gadget hasn't exactly set the world on fire.  In the 4 days that it's been online here are the download stats on a per country basis:

 

On a per-day basis the download figures look like this:

 

posted on 3/19/2007 10:58:02 PM ( 0 Comments )


My WF Webcasts are up

Recently I put together 3 Webcasts to show how to use the State Machine workflows in Windows Workflow.  You can view them here:

  1. Introduction to State Machines
  2. Architecting State Machines
  3. Using Persistent Workflows

You can view all of the Readify Webcasts on .NET 3 technology via this landing page:

http://www.readify.com.au/tech+tutor.aspx

posted on 3/2/2007 7:58:09 PM ( 2 Comments )


My Sidebar Gadget article is up...

During the past month I think that we changed the mailing process for our External Newsletter so that it is now directly run off of our contacts in CRM. I think that in updating to that process I may have been omitted because I don't remember getting a copy.  Anyways, it went out and my article was the feature article for the month.  It was about Vista Sidebar Gadgets.  You can read it here:

Tech Talk

Oh yeah, don't forget to sign up to receive the newsletter!  I believe that the feature article for our next newsletter - due in a couple of weeks - was written by Chris Burrows and is on the topic of how to professionally manage the processes of building and releasing your SQL Code.

posted on 3/2/2007 7:53:30 PM ( 0 Comments )


NYT Reader

This afternoon I flew back to Canberra from Melbourne and was seated next to a lady right up at the back of the plane.  We both started out reading the Qantas in-flight magazine and when I finished she noted that there wasn't really anything terribly exciting in there this month - we both agreed on that point!  I then mentioned to her that I was planning to read the New York Times once we were in the air.  Once we were in the air and the seatbelt sign when off I immediately pulled out my new Tablet, folded the screen over, and started up my NYT Reader.

This is a perfect reading experience and you can even annotate articles with notes - using both text and Ink - of your own.

My fellow traveller was totally amazed by how friendly the application was to use.

If you haven't yet downloaded and used NYT Reader... go do it immediately! 

To download the Times Reader, click here.

posted on 3/2/2007 7:44:29 PM ( 2 Comments )


House: Turn on lights

Yesterday I mentioned that I had been using the new Speech stuff in Vista.  It's pretty cool and the more I use it the more accurate and faster I get.  I was again showing Harrison how it works tonight and he loves it.  More than that, he doesn't even question that you can do it. 

I jumped on, started up Speech Recognition, and started talking:

"Start Listening; Switch to Outlook"; "Move up four times"; "Press Enter"; ... {reads email message}; "Close Window"; "Press Delete"; "Stop Listening"; {coughs}; "Start Listening"; ...

I asked Harry what he thought of that and he said that it was pretty cool, so I asked him to give me an example of how he'd do it.  Without having read any help notes and without any training my 6 year old son said:

"Open Games"; "Start World Explorer"; ...

The more I use it the more I can see that this is really going to be the future of how we interact with computers moving forward.  Imagine it...

"House: Turn on lights"; "House: turn on airconditioning"; "House: turn on television"; "Computer: Open Internet Explorer"; "Computer: Browse to Google.com"; "House: load Madegascar DVD"; ...

Or, even better...

"Begin Conversation With House"; "turn on airconditioning"; "turn on television"; "tell me the time"; "End Conversation"; "Begin Conversation With Computer"; "Open Outlook"; "Read Me All New Emails"; ...

posted on 2/27/2007 7:34:32 PM ( 2 Comments )


Highlight of the day

In our house we have a dinner time ritual called "Highlight of the day".  In it, we take turns to ask another member of the family what was their highlight of the day.  Today I had two and I was easily the winner.

My first highlight was that I went to the Parliamet for Question Time.  It was awesome to see this process in action and I highly recommend it to all.

My other highlight was that I used the Speech To Text stuff in Windows Vista to control my computer for nearly the entire morning.  Regardless of what the naysayer's have to say about Vista, both Harry and Charlie thought that it was cool that I could tell my computer what to do and that it would just do it.  Welcome to the future smile_regular

posted on 2/26/2007 6:41:41 PM ( 0 Comments )


Windows Vista "Wow" Ad

Scrap that buggy Soapbox link...

Link to Soapbox on MSN Video

 

Here's a couple of links to the "Wow" on YouTube:

 

This first one is an extended, launch video:

http://www.youtube.com/watch?v=aL3rfuKwMDI

 

This next one is pretty grainy but its the same one as the Soapbox ad:

http://www.youtube.com/watch?v=c33gk1QvHnY

 

Having watched these I'm not sure why this marketing campaign has received such bad press.  I actually like these videos.

posted on 2/7/2007 5:15:22 AM ( 1 Comments )


Dynamically generate your own countdown gadgets

The other day I wrote about dynamically generating gadgets for personalization purposes:

    http://markitup.com/Posts/Post.aspx?postId=98a4d0e8-cf3c-43d2-b431-e1e1e29958f6

There's been some talk around the place since then about being able to dynamically generate countdown gadgets so I thought that I'd use my little gadget API to "hack" such a feature.  The steps for creating your own countdown gadget are simple:

  1. Go to this URL: http://markitup.com/CountdownGadget.aspx
  2. Fill in the form:


    generator form
  3. Download the gadget from the generated link:

    generated URL
  4. Open the gadget into your own Sidebar:


    generator gadget

Enjoy! smile_regular

posted on 1/6/2007 8:21:35 AM ( 9 Comments )


An API for creating Gadgets

Today I started writing an API which allows me to easily access Gadget "packages" programmatically.  Here's a little snippet of my sample code that uses my API:

// Open a Gadget package and returns it as a strongly-typed object model.
Gadget gadget = Gadget.Open(existingGadgetPath);

// displays the name in the manifest file
Console.WriteLine(gadget.Manifest.Name);  

foreach (GadgetFile file in gadget.Files) {
    if (file.FileName == "main.js") {
        string js = file.Text;
        file.Text = UpdatePersonalizationKey(file);
    }
}

Gadget.Create(gadget, newGadgetPath);

This code opens an existing Gadget, updates some of the JavaScript in the main .js file, and then saves the files back as a new package. 

Code such as this would be really useful for personalizable gadgets, picture the following scenario:

You have created a gadget that will be downloaded from your website.  Users fill in a form and then get access to the gadget - maybe it's a valuable gadget such as a custom financial investment research gadget. 

Now you want to be able to track usage of the gadget and potentially push some targetted advertising down into the gadget as well.  Using the above gadget packaging API code you could easily embed a personalization key into the gadget which would then get passed along with each web service call made by the gadget.  This would allow you to easily track gadget usage and to provide personalized services and ad views to the gadget user.

Now that I'm creating my gadget API I'm also thinking about building a small IDE which will allow people to easily create new gadgets and browse existing ones.  I'm thinking that you could easily create something which gives people a simple File|New or File|Edit experience over gadgets.

posted on 1/1/2007 8:34:29 PM ( 3 Comments )


How to build a Vista Sidebar Gadget with a Flyout Window

This article discusses how to create a Vista Sidebar Gadget using a technique called "screen scraping" to fetch data from an external web page.  I'm not sure what the actual protocols are for using data from another site but at the very least I think that you should first gain the permission of the owner of the web page before doing so.  If you would like to learn more about screen scraping then this Wikipedia article is a great place to start: Screen Scraping article on Wikipedia.

 

The code that accompanies this article can be downloaded from here.

 

Getting Started

To get things started create a folder named ScraperGadget and add the following things into it:

  1. An HTML file named ScraperGadget.html
  2. An HTML file named Flyout.html
  3. An XML manifest file named Gadget.xml
  4. A JavaScript file named Main.js
  5. A CSS file named Main.css
  6. A CSS file named Flyout.css
  7. Create a folder named "Images" and add an icon for yourself and one for the gadget. 

In my images folder I have the following images for my icons:

Scraper Gadget images

Adding a Manifest

Open the Gadget.xml file and add the following content for your manifest definition:

<?xml version="1.0" encoding="utf-8"?>
<gadget>
    <name>Dilbert Homepage Scraper Gadget</name>
    <namespace>MarkItUp.Gadgets</namespace>
    <version>1.0</version>
    <author name="Darren Neimke">
        <info url="http://MarkItUp.com" />
        <logo src="images/MarkItUpIcon.jpg"/>
    </author>
    <copyright>MarkItUp.com 2006</copyright>
    <description>
        A Gadget allows a user to display content from the Dilbert home page
        which is located here: http://dilbertblog.typepad.com/.
    </description>
    <icons>
        <icon height="48" width="48" src="images/scraper.jpg"/>
    </icons>
    <hosts>
        <host name="sidebar">
            <base type="HTML" apiVersion="1.0.0" src="scrapergadget.html"/>
            <permissions>Full</permissions>
            <platform minPlatformVersion="1.0"/>
            <defaultImage src="images/scraper.jpg"/>
        </host>
    </hosts>
</gadget>

 To learn more about the makeup of a Gadget manifest file, view the following MSDN article:

http://msdn2.microsoft.com/en-us/library/aa965879.aspx

Defining the HTML User Interface

Finally, add some HTML into the ScraperGadget.html file to get things started:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
        <title>Dilbert Homepage Scraper Gadget - Main</title>
        <script src="main.js" language="javascript" type="text/javascript"></script>
        <link href="main.css" rel="stylesheet" type="text/css" />
    </head>
    <body onload="initializeMain();">
        <ul id="myList"></ul>
        <div id="errorView"></div>
    </body>
</html>

That's all that we need at this stage for the main view of our gadget which will ultimately display a list of the titles of the posts on the main page of the Dilbert website.  You can see how the gadget has a reference to both the main.js file and also the main.css file and if you take a look at the body tag, you can see that we call a function named initializeMain() to get things rolling.

A pinch of CSS

To make our gadget look a little nice we can add some CSS code to spice up the UL and LI elements and alter the default font sizes to get more text into our small viewing space.  Here is the code for Main.css:

body {
    margin: 4px;
    width: 130px;
    height: 245px;
    font: 9pt Calibri;
    color: #000;
    background-color:#cccccc;
}

a {
    color: #ffffff;
    text-decoration: none;
    text-overflow:ellipsis;
}

a:hover {
    color: red;
    text-decoration: underline;
}

ul {
    width: 90%;
    border: 1px solid #000;
    background-color: #8aa;
    padding: 0px 5px ;
    cursor: default;
    margin-left: 0px;
}

ul li {
    list-style-type: none;
    margin: 0px;
    position: relative;
}

ul li:hover {
background-color: #ffa;
color: #000;
}

 

The Javascript behavior code

The initializeMain function is responsible for grabbing the source of the page that we are scraping, breaking it down into an object model, and then displaying elements of that object model onto the page.  Here is the content of the initializeMain function:

 

function initializeMain() {
    try {
        var scraper = new WebScraper() ;
        gPageString = scraper.Scrape(gURL) ;
        parseDocument() ;
        renderDocument() ;
    } catch ( ex ) {
        displayError( ex.message ) ;
    }
}

There's some error handling and other stuff in there but it's mostly just fetching data and formatting it on the page.  You can learn about the underlying screen scraping code by reading the following article and by downloading the source files for this article and going through them:

http://markitup.com/Posts/Post.aspx?postId=96d2941f-591f-4363-b5a5-0535ef710f1b

One interesting thing about the parsing of the HTML is that we break it down into an object model before we display it - this makes the data much simpler to work with when the gadget is running.  Here's the code for the Article data class that we store each article's data in:

function Article(title, body, index) {
    this.Title = title ;
    this.Body = body ;
    this.Index = index ;
}

Each instance of this class will have a Title, Body, and Index property that we can access when we want to use the data.  In the parseDocument function we actually grab each article from the page, create an Article object for each one, and store the whole lot of them in a globally-scoped Array so that we can use and access the data on-demand quite easily.  The code for the parseDocument function is shown here:

function parseDocument() {
    var titlePattern = "<h3 class=\"entry-header\">(([^<]|.)+?)</h3>" ;
    var bodyPattern = "<div class=\"entry-body\">(([^<]|.)+?)</div>" ;
    var matches = new RegexHelper().Matches( gPageString, titlePattern ) ;

    var titles = new Array() ;
    for( i=0; i<matches.length; i++ ) {
        titles[i] = matches[i].Groups[0] ;
    }

    matches = new RegexHelper().Matches( gPageString, bodyPattern ) ;
    for( i=0; i<matches.length; i++ ) {
        var body = matches[i].Groups[0] ;
        var article = new Article(titles[i], body, i) ;
        gArticles[i] = article ;
    }
}

Once we have our array (gArticles) of Article objects, all that remains is to render a list of their titles in our gadget - this task is performed by the renderDocument function:

function renderDocument() {

    for( i=0; i<gArticles.length; i++ ) {
        var article = gArticles[i] ;
        var text = document.createTextNode(article.Title);
        var e = document.createElement("li");
        var a = document.createElement("a");
        a.dataIndex = article.Index; // custom prop

        a.attachEvent('onclick', handleClick);

        a.appendChild(text);
        e.appendChild(a);
        myList.appendChild(e);
    }
}

It's important to highlight that the way that this code wires up the handleClick event hander is not by any means cross-browser compatible, but it's running in the gadget runtime which is the same as IE so that's not important.  The handleClick event handler is a simple function that will be invoked whenever the user clicks on a title and will display the content in a gadget Flyout window.  For now simply add the following code for handleClick function in the main.js file and we'll test our gadget:

function handleClick(event){
    var selectedIndex = event.srcElement.dataIndex ;
    errorView.innerHTML = "You clicked on article " + selectedIndex ;
}

As you can see, this code will simply display the index of the article that was clicked on in our errorView DIV element.

An Initial Test of our Gadget

The simplest way to test the gadget is to open the ScraperGadget.html file in a browser to check that everything runs OK.  Running the page and clicking on an article heading show give you a result similar to this:

Scraper Gadget in browser

Once you've got it working in the browser it's time to package up the gadget and get it running in the Vista Sidebar.  Open the ScraperGadget folder and create a .zip file of all the contents.  When the .zip package is created, rename it to ScraperGadget.gadget (NOTE the .gadget extension!).  Upon renaming to a .gadget file, the icon should change to indicate that the package is now a gadget package.  Double-click on this file to begin the installation.

ScraperGadget gadget file

Double-click on the gadget and press 'Install' when asked.  After doing that the gadget should now appear in the Sidebar like so:

ScraperGadget gadget file

The Dilbert screen scraping gadget is displayed at the head of the list here - just above my custom Cricket Gadgetsmile_regular  If you open the Sidebar gallery (by pressing the + icon at the top of the Sidebar, you will see how the gadget has used the data in the manifest file to display information about itself:

ScraperGadget in gadget gallery

 

Adding the Flyout code

Now we've tested out gadget and can see that the important bits are all working as they should be.  We've rendered the UI for the default view and have our object model stored nicely in memory.  It's time to open that Flyout.html file and get started with creating the flyout behavior.  When we've finished we'll have a flyout that will display the stories behind those headlines, here's a peek at the finished product:

ScraperGadget with flyout

 The behaviour here is similar to the RSS Gadget that comes as a standard gadget with Windows Vista.  In the picture you can see that the user has clicked on the first article in the list and this has then displayed the entire post content in the flyout window.  The title of article is displayed at the top of the flyout and the body of the article is displayed in a scrollable DIV element.  If the user clicks on the same article title in the list, the flyout will close but if they click on another title then its content will be displayed in the flyout.

Just as with the main window, the HTML for the flyout is dirt simple:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
        <title>Dilbert Homepage Scraper Gadget - Main</title>
        <script src="main.js" language="javascript" type="text/javascript"></script>
        <link href="flyout.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        <div id="flyoutBackground">
            <h4 id="title"></h4>
            <div id="bodyContent"></div>
        </div>
    </body>
</html>

You can find the CSS for those elements in the download for this article.

Loading the Flyout Window

It's now time to revisit that handleClick function which receives the clicks from the links in the list and add the code for displaying the Flyout.

var gSelectedIndex = -1 ;

function handleClick(event) {
    var idx = event.srcElement.dataIndex ;

    if( idx == gSelectedIndex ) {
        gSelectedIndex = -1 ;
        System.Gadget.Flyout.show = false ;
    }else{
        gSelectedIndex = idx ;
        if(System.Gadget.Flyout.show) {
            addContentToFlyout();
        } else {
            System.Gadget.Flyout.show = true;
            System.Gadget.Flyout.onShow = function() {
                addContentToFlyout();
            }

            System.Gadget.Flyout.onHide = function() {
                gSelectedIndex = -1 ;
            }
        }
    }
}

Here we can see that the handleClick function gets the index of the link that was clicked and compares it against the previously clicked item in the list; if it's the same as the previous selection then we reset the selected index and hide the flyout.  If the index is different to the previously selected one we check to see whether the flyout window is open and then load the content into it with our addContentToFlyout function.  You can also see that whenever the flyout is shown we wire up event handlers for the onShow and onHide events.

Finally, the code for adding content to the flyout is dirt simple:

function addContentToFlyout() {
    try {
        if(System.Gadget.Flyout.show) {
            var flyoutDoc = System.Gadget.Flyout.document;
            var article = gArticles[gSelectedIndex] ;
            flyoutDoc.getElementById("title").innerHTML = article.Title ;
            flyoutDoc.getElementById("bodyContent").innerHTML = article.Body ;
        }
    } catch ( ex ) {
        displayError( ex.message ) ;
    }
}

We simply get a handle to the document in the Flyout window, grab the current article object from our list of articles and then bind the Title and Body properties of that object to some HTML elements in the window.

I encourage you to download the code that accompanies this article and to play around with customizing it for your own purposes.

posted on 12/30/2006 4:33:00 PM ( 24 Comments )


Share Your [WEI] Score

Mitch linked to this great site that allows you to view performance data for WEI scores.

Here's mine:

1

 

Ouch! smile_omg  Time to upgrade this old clunker?

posted on 12/30/2006 10:40:16 AM ( 1 Comments )


RegexHelper - a javascript wrapper for regex usage

Now that I've started to do a lot more work with javascript again - to create Vista Sidebar Gadgets - I need to revert to some of my old helper libraries of useful functions.  One that will probably be very useful is this one that I wrote to assist me when working  with javascript regexen:

Link to ShowUsYour : RegexHelper - a javascript wrapper for regex usage

Here's an example of how you would use that code to help enumerate the headings on the home page of the Dilbert blog and displays them in a list in my Gadget:

window.onload = function() {
    try {
        var url = "http://dilbertblog.typepad.com/" ;
        var titlePattern = "<h3 class=\"entry-header\">(([^<]|.)+?)</h3>" ;
        var scraper = new WebScraper() ;
        var pageString = scraper.Scrape(url) ;
        var matches = new RegexHelper().Matches( pageString, titlePattern ) ;

        for( i=0; i<matches.length; i++ ) {
            var match = matches[i] ;
            var text = document.createTextNode(match.Groups[0]);
            var e = document.createElement("li");
            e.appendChild(text);
            myList.appendChild(e);
         }
    } catch ( ex ) {
        alert( ex.message ) ;
    }
}

That function also uses the WebScraper class that I've been using to grab web pages from within my Gadgets:

 

/////////////////////////////////////////////////////////////////////////////
//
// WEBSCRAPER MODULE
// Author: Darren Neimke
//
/////////////////////////////////////////////////////////////////////////////

// WebScraper Class
function WebScraper() {
    var xmlHttp = null;
   
    this.Scrape = function( url ) {
        var html = "" ;
        initializeProxy() ;
       
        try {
            if (xmlHttp != null) {
                xmlHttp.open("GET", url) ;
                xmlHttp.send(null) ;
                html = xmlHttp.responseText;
            }
        } catch(ex) {
            throw new ErrorObject( ex.message ) ;
        }
    return html ;
}


function initializeProxy() {
    xmlHttp = null ;
    if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest()
    } else if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP")
    }
}
}

posted on 12/30/2006 9:41:01 AM ( 1 Comments )


My little Cricket Gadget

I got to work on the little cricket Gadget that I wrote about here yesterday.  I implemented a summary view for the normal state of the Gadget.  In the following image you can see the details of the current South Africa versus India test being shown:

CricketGadget.PNG

 

You can also use the settings window to choose from any other current or recent match:

 

GadgetSettings.PNG

 

Here I have selected to view the 4th Test in the current Ashes series between Australia and England.  Notice that the current score panel is replaced by a "Game Completed on ..." label because this game has finished.

 

CricketGadget.PNG

 

I love the way that my Gadget appears in the Gallery...

 

GadgetSettings.PNG

 

... and you can also expand the details panel in the Gallery to get more information about the gadget...

 

GadgetSettings.PNG

 

Cool eh? smile_teeth

posted on 12/29/2006 10:30:44 PM ( 13 Comments )


Letter to the ABC - please give us a Cricket Gadget

I sent the following email to the ABC this morning:

To ABC Sports Online, my name is Darren Neimke and I work for an Australian IT company called Readify. I’m an avid follower of your cricket broadcasts and regularly visit your cricket scorecard pages to get score updates. I’ve seen that you have a Konfabulator cricket desktop widget for getting the scores directly on your desktop but I wondered whether you have plans to create a Vista Sidebar Gadget? Sidebar Gadgets are similar to Konfabulator widgets except for the important distinction that Vista Sidebar comes as a standard component of Windows Vista – meaning that *everyone* who has Windows Vista will have it installed. This will mean that the reach of Vista Sidebar Gadgets will be significantly greater than Konfabulator widgets.

Here’s a brief overview of how Vista Sidebar Gadgets work. When you add a Vista Sidebar Gadget to the Windows Vista Sidebar, it appears in its normal state. Here’s a picture of my desktop with 3 gadgets displayed in their default docked state – a Notes Gadget, a Flickr Calendar Gadget, and a Virtual Earth mapping Gadget:

GadgetsStandard.PNG

When you hover over a Gadget, a settings selector appears which allows you to display the Settings window for the gadget. Here the settings window for my Notes Gadget is displayed allowing me to change the colour and the font settings of my notes:

GadgetSettings.PNG

You can also add a Flyout feature for displaying detailed information from your Gadget. Here the detailed Flyout is displayed for my Virtual Earth gadget:

GadgetFlyout.PNG

I was thinking that we could do something similar for a cricket gadget and use the Settings view to allow the user to select different cricket games to view and use the Flyout for displaying detailed scorecard views. Here is a conceptual view of how I would see an ABC Cricket Vista Sidebar Gadget:

CricketGadget.PNG

If you would like some advice about creating Vista Sidebar Gadgets I would love to help out – heck, I’d even create it for you free of charge smile_regular

I look forward to hearing from you in the near future.

Regards,

Darren Neimke
Readify - Resource Manager 

Suite 206 Nolan Tower | 29 Rakaia Way | Docklands | VIC 3008 | Australia
M: +61 439 855 046 | E: darren.neimke@readify.net | C: darren.neimke@readify.net | W: www.readify.net

posted on 12/28/2006 9:33:29 AM ( 2 Comments )


Creating interesting Gadgets - Getting data from a web service

If you are building a Sidebar Gadget you will nearly always need to get your hands on data of some type.  Some of the common data types that you will want to access are:

  • RSS Feeds from the web
  • RSS Feedstore
  • Web Services
  • Mail and Calendar data
  • Messenger Contacts
  • File and Folder information
  • Other LOB data

In this article I'm going to show how to get data from a web service.  Here's a web part that accesses the ProjectDistributor web services and uses the ListProjectsByLatest method to return a list of recently added projects:

PD Recent Projects Gadget

 

When accessing a web service you can either use a GET method or a POST method to make the web service call.  The simpler of these is a GET as you can simply use a URL with the arguments contained in the querystring to call the web service, here's the GET URL for the ListProjectsByLatest web method:

http://projectdistributor.net/WebServices/ProjectDistributor.asmx/ListProjectsByLatest?countOfItems=5

You can see that this method takes an argument named countOfItems which it uses to determine how many items to return - in this case I am returning 5 items.  By default, ASP.NET web services are configured to deny GET access and so if you are planning to make a GET call, you will need to add the following configuration entry in the web.config file for the applicaiton that is hosting the web service:

<webServices>
    <protocols>
        <add name="HttpGet"/>
    </protocols>
</webServices>

The next thing to do is to write some Javascript code that will call the web service and get the XML contained in the web service response so that we can begin working with that data.

function loadData() {
    gXMLHttp=null ;
    if (window.XMLHttpRequest) {
        gXMLHttp = new XMLHttpRequest()
    } else if (window.ActiveXObject) {
        gXMLHttp = new ActiveXObject("Microsoft.XMLHTTP")
    }

    if (gXMLHttp!=null) {
        gXMLHttp.onreadystatechange = state_Change
        gXMLHttp.open("GET", gWsUrl, true)
        gXMLHttp.send(null)
    } else {
        alert("Could not get an XMLHTTP instance.")
    }
}

function state_Change() {
    var xmlDoc = null ;
    if (gXMLHttp.readyState==4 && gXMLHttp.status==200) {
        xmlDoc = new ActiveXObject("Microsoft.XMLDom");
        xmlDoc.async="false"
        xmlDoc.loadXML(gXMLHttp.responseText);
        processData(xmlDoc);
    }
    xmlDoc = null ;
}

Here we see that an XMLHTTP instance is created and a event handler method named state_Change is wired up to the onreadystatechange event of that object.  When the web service call returns the state_Change method will be called and the readyState for XMLHTTP will be 4 and the status will be 200 (OK).  Once we have that return call we create an XML document instance and load the responseText of the XMLHTTP response into it using hte loadXML method of the XMLDom instance.  Finally, once we have our XML document we pass that instance off to a method that will create our UI - in this case the method is named processData.

The processData method will use XML DOM methods to grab the data from the XML document and then use string concatenation to embed the values into some user interface elements.  The following code displays the processData logic which loops through the nodes in the XML document and renders Project elements as a list of HTML DIV elements with a clickable project name:

function processData(doc) {
    var projects = doc.documentElement.selectNodes("//Project");
    projectItemHolder.innerHTML = "" ;
    var node = null ;
    gBuilder = new Array();

    for (var i=0; i<Math.min(projects.length, 5); i++) {
        buildProjectDiv(projects[i]) ;
    }

    projectItemHolder.innerHTML = gBuilder.join("");
    node = null ;
    projects = null ;
    gBuilder = null ;
}

function buildProjectDiv(node) {
    var idNode = node.selectSingleNode("Id") ;
    var displayNameNode = node.selectSingleNode("DisplayName") ;
    var purposeNode = node.selectSingleNode("PrimaryPurpose") ;
    var dateCreatedNode = node.selectSingleNode("DateCreated") ;

    var id = idNode.childNodes[0].nodeValue ;
    var projectName = displayNameNode.childNodes[0].nodeValue ;
    var purpose = purposeNode.childNodes[0].nodeValue ;
    var dateCreated = dateCreatedNode.childNodes[0].nodeValue.substr(0, 10) ;

    gBuilder.push("<div id=\"") ;
    gBuilder.push(id) ;
    gBuilder.push("\" class=\"ProjectItem\">") ;
    gBuilder.push(" <a class=\"ProjectItemLink\" href=\"http://projectdistributor.net/Projects/Project.aspx?projectId=") ;
    gBuilder.push(id) ;
    gBuilder.push("\" title=\"") ;
    gBuilder.push(projectName) ;
    gBuilder.push("\" onmouseover=\"toggleBack(this.parentElement, true);\" onmouseout=\"toggleBack(this.parentElement, false);\">") ;
    gBuilder.push(projectName) ;
    gBuilder.push("</a><div class=\"ProjectItemName\" style=\"float:left;text-align:left;\">") ;
    gBuilder.push(purpose) ;
    gBuilder.push("</div><div class=\"ProjectItemDate\" style=\"float:right;\">") ;
    gBuilder.push(dateCreated) ;
    gBuilder.push("</div></div>") ;
}

 As you can see, the processData method calls out to a helper method named buildProjectDiv which extracts the values from each XMLNode and places those values into a UI display.

posted on 12/20/2006 2:48:46 PM ( 21 Comments )


Creating interesting Gadgets - User Interface Elements

Vista Sidebar Gadgets are changing the way that we consume data.  Over the next few weeks I will be looking at some of the interesting behaviors that you can add to your gadgets to make them interesting and I'll be using different Gadgets that I find on MicrosoftGadgets.com to highlight various features along the way.  To get things started I'd like to talk about the various UI elements that you can use to present information to your users.

The default view

Below is an image of one of the core Windows Vista Gadgets (a gadget that ships with the core Vista operating system and therefore is located in your C:\Program Files\Windows Sidebar\Gadgets folder), the Notes Gadget.  Here we see the Notes Gadget in its standard docked state in the Sidebar:

Notes Gadget docked in Sidebar

 

This UI is a simple HTML file which displays an image as its default background that gives it an appearance of a stack of notes.  The default view (HTML file) for a Gadget is a configuration setting in the XML manifest file of the Gadget:

 

<gadget>
    <hosts>
        <host name="sidebar">
            <base type="HTML" apiVersion="1.0.0" src="TestGadget.html" />
        </host>
    </hosts>
</gadget>

 

Customizable Gadgets 

The Notes Gadget provides the user with the option of creating new notes or deleting an existing notes and they perform those interactions by mouse'ing over the Gadget and having additional UI elements displayed.  Here we see the additional UI elements that appear when we mouseover the Notes Gadget:

Mouseover the Notes Gadget displays additional UI options

The elements on the upper-left side of the Gadget are added by the Vista Gadget system and allow the user to perform different actions.  The [x] icon is standard for all Gadgets and allows the user to remove the Gadget from the Sidebar.  Underneath that we have a spanner icon that allows the user to manage the settings of the Gadget, this icon is only present when an HTML file has been associated with the System.Gadget.settingsUI property.  Setting this is done at runtime like so:

System.Gadget.settingsUI = "settings.html"

With the settingsUI property assigned, the Gadget will display the spanner and when the user clicks on that, the contents of the settings.html file will be displayed to allow the user to make configuration changes to their Gadget.

Settings UI displayed for the Notes Gadget

 

Here the settings UI for the Notes Gadget allows the user to choose their note color and change their font settings.  When the user has made their choices and pressed OK, the Gadget would use the Gadget.Settings API to persist that configuration information.  Reading and writing configuration settings is as simple as this:

 

var settingValue = System.Gadget.Settings.readString("SettingName");   // reading

System.Gadget.Settings.writeString("SettingName", mytextbox.value);  // writing

It's important to note that the Settings.html file in the above image did not contain the Title bar with the text "Notes" and nor did it contain the OK or Cancel buttons as these were all provided by the Gadget runtime.  The Title bar text was read by the runtime from the title that is supplied in the Gadget's manifest file.

Providing a detailed view

Another useful UI feature of Gadgets are Flyout's.  Flyout's are used when your Gadget contains some summary information and you want to allow the user to click on that summary data to see a more detailed view of that data.  One of the standard Gadget's which makes use of Flyout's is the Feed Headlines Gadget (another of the standard Vista Sidebar Gadgets).  By default the Feed Headlines Gadget displays a summary of recent feed items in a list.

The Feeds Summary Gadget

 

The user can then click on an item in the list to display a detailed view of that item.  Clicking on the item displays the following Flyout with the detailed content for the RSS item displayed:

 

The Feeds Summary Gadget with Flyout information displayed

 

Again, the Flyout is simply another HTML page which you set on the file property Flyout object.   When it comes time to display the Flyout you simply set the value of the show property of the Flyout to 'true':

System.Gadget.Flyout.file = "flyout.html"

System.Gadget.Flyout.show = true;

As with the Configuration Settings view, the Title bar and surrounding chrome for the Flyout view are provided by the Gadget infrastructure.  To populate data into the Flyout window the Feed Headlines Gadget makes use of the onShow event of the Flyout object to determine when the Flyout is available and then the document property of the Flyout to gain access to the DOM of the HTML document for the flyout view:

System.Gadget.Flyout.onShow = function() {
    addContentToFlyout();
}

function addContentToFlyout() {
    if(System.Gadget.Flyout.show) {
        var flyoutDiv = System.Gadget.Flyout.document;
        flyoutDiv.getElementById("flyoutTitleLink").innerHTML = tempTitle;
        flyoutDiv.getElementById("flyoutTitleLink").href = g_feedURL;

        ....
    }
}

posted on 12/19/2006 11:08:21 PM ( 0 Comments )


NPR : New Windows Has New Sound

As Frank pointed out, some of the new Vista sounds have started finding their way on the web.    Just today NPR put up a soundbite which explains the Windows sounds dating back to Windows 95 and also provides us with the new Vista startup sound: 

Link to NPR : New Windows Has New Sound

posted on 11/12/2006 8:54:43 PM ( 1 Comments )


Free Windows Vista Icons

I got this link from Duncan's blog this morning:

Link to .: VistaICO.com :. FREE Windows Vista Icons - Best Desktop Icons for Windows

This site offers 82 large sized png icons for Vista.  Looks good!

posted on 11/9/2006 7:03:04 AM ( 1 Comments )


Mitch in The Age

I was sitting in a coffee shop in Melbourne this morning having a morning coffee with Graeme Armstrong when I noticed a very large picture of Mitch Denny in The Age.  The article was in the business section and was about Vista.  Unfortunately I haven't been able to locate the article on The Age's website as yet. 

There's also a comment from Adam Cogan in the article too.

posted on 10/10/2006 1:01:29 PM ( 1 Comments )


Ford Falcon or Plymouth Fury - Is Vista good enough to sell?

By almost any measure the 1962 Plymouth Fury was an awesome beast in it's day.  A car that looked great and which was more secure and comfortable than many other cars of its day.  Two extra rear lights, bucket seats and console.  Heck!  No wonder dealers and buyers alike loved it.

1962 Plymouth Fury

Regardless of how cool the belt moulding spear that ran from the front to the rear of the Plymouth made it look we aren't driving them today.  Today Plymouth's aren't advertised and we don't buy them.  Today we are much more likely to buy a more conventional modern car like the Ford Falcon:

Ford Falcon

The Ford Falcon boast such features such as Air-Conditioning, Alloy Wheels, CD Player, Front and Rear spoilers and also Traction control.  Who wouldn't want to own a 2006 Ford Falcon over a 1962 Plymouth Fury?  It's a no brainer right?

What's the compelling reason for upgrading to Vista?

It's amazing how many times I've been asked this question of late.  Perhaps the most interesting thing is that the people who have been asking the question have been primarily either Microsoft employees or other leading technical readiness people.  The conversation usually goes something like this:

Them: What's the compelling reason for upgrading to Vista?

Me: Well, there's a few.  UAC is probably the biggest one that immediately springs to mind.

Them: Yeah, sure.  But it's not really a good enough reason to move over though - don't you think?

Me: Hrm, sure, OK.  What about user experience.  Vista has dozens - if not hundreds - of new user experience features that make using the computer easier, more secure, and more enjoyable.  My favourite of these features is Search and Organize.

Them: But user experience isn't really a compelling business reason to migrate over.  I mean I've got MSN Desktop Search on XP and it does a great job - don't you think?

Me: Right, whatever.  Finally, I think that the new Windows API's in Vista are going to enable new types of features and experiences to added to the core OS experience.  These API's include things such as RestartManager, LivePreview, etc.  These are things that we can use today but will probably be expected by users in 3 or 4 years time.

Them: Yes but.... blah de blah, blah, waffle, wah.

Why is it that we are having such difficulty in understanding why Vista will sell?  It's not the market that are having trouble - Microsoft's own research tells us that they expect a few hundred million copies of Vista to be sold within the first 4 years alone!  The trouble that we are having is because of either a rash of conservatism or from pessimism that exists within our own industry.

I mean heck, you tell people about Search and Organize and they come back with... "Yeah but I can install MSN Desktop Search on XP"... Sheesh!  I wish that my artistic skills were good enough to superimpose the Ford Falcon front spoiler and other features on top of the Plymouth Fury so that they could see how ridiculous this really is :-)

People like comfort, they like safety, and they like features.  These are things that the Ford Falcon has over the Plymouth Fury and they are equally things that Vista has over XP/2000/ME/98/95.

 

posted on 7/28/2006 12:17:43 PM ( 12 Comments )


Installing the Windows SDK bits on Vista

When you install WinFX you need:

The Windows SDK is a 1 Gig .iso file and so you need a way to mount it so that you can run the Windows SDK Setup executable.  I tried the Virtual CD ROM tool that is listed on the downloads page but couldn't get it working quite right on Vista.  Grant then suggested that I use VirtualCloneDrive which worked a treat on Vista Beta 2.

posted on 6/25/2006 8:01:06 PM ( 0 Comments )


Using FINDSTR in Monad... err, Powershell

Here's a great article by Ian Griffiths about using the FINDSTR command in Powershell:

    http://www.interact-sw.co.uk/iangblog/2006/06/03/pshfindstr

posted on 6/4/2006 8:29:37 AM ( 0 Comments )


Vista Vibes # 1 is up - interview with Frank Arrigo

Check out the first of the Vista Vibes interviews with Frank Arrigo here:

    http://techtalkblogs.com.au/blog/archive/2006/05/21/124.aspx

Subscribe to the the TechTalkBlogs feed to catch upcoming interviews with other Australian developer community folk.  If you have an opinion on Vista please drop me a line so that I can line you up for a Vista Vibes interview :-)

posted on 5/21/2006 12:28:44 PM ( 0 Comments )


TechTalkBlogs

Because of the upcoming Vista community events here in Australia, I'm going to be taking over the blogging mantle at TechTalkBlogs from Rocky.  Expect to see most of my posting on Vista to move across to there for the next couple of months or so:

    http://techtalkblogs.com.au/blog/

posted on 5/19/2006 6:55:24 AM ( 0 Comments )


Chuck's Vista Ready Hardware Review

Chuck has written up a great post which walks through his experiences of using Vista on three different pieces of hardware:

    http://blogs.msdn.com/charles_sterling/archive/2006/05/18/600482.aspx

I've been the lucky beneficiary of the Samsung and have been very impressed by it.  After using Dell Notebooks for the past 3 years it has been great to have a sexy beast like the Samsung sitting on my desk.  Anyways, go read Chuck's article to learn more about his experiences with: Asus Lamborghini, Toshiba  A7, Toshiba M400 Tablet, and the Samsung  X60.

Also, here's a link to an article which states that we should see something firm around Vista Logo requirements real soon:

    http://news.com.com/Microsoft+to+detail+Vistas+needs/2100-1016_3-6073056.html

Oh yeah... God I love Aero :-)

posted on 5/18/2006 1:51:37 PM ( 0 Comments )


UAP pain

When I spoke about UAP at Code Camp recently I stood up and told the people there to "work it out" as opposed to sitting around and complaining about it.  And I believe in that,  however, in reality I fully accept that it's not that easy.  I forget who it was who mentioned this to me - probably Mitch or Rock - but it was very insightful; they said that under UAP it will start to become very obvious which product groups at Microsoft run as administrator on their own desktop because it's those products that will break and crumble in Vista.

Based on what I've seen so far I'm guessing either the ASP.NET team or the SQL Server team must be running as Administrator because I don't know of anyone on the planet who has managed to get the auto-created SQL Server User Instance databases to be auto-created when developing in Visual Studio to work.  At least I could work around the User Instance stuff by working off of a central SQL Server.  Not sure how to get around this little goof by the MSN team:

LUA Error

posted on 5/10/2006 10:39:08 PM ( 0 Comments )


Vista UAP

It appears that the uproar that occurred during my discussion on Vista UAP on the weekend is nothing compared with other discussions that have been taking place around the web.  Tonight Joseph sent me a link which actually explains how to turn off "those annoying security warning dialogs".  Well it doesn't actually turn them off, it just allows Administrator users to run as Admin. 

    http://www.codinghorror.com/blog/archives/000571.html

In a nutshell:

[..] even if you are logged in as Administrator, you're not getting Adminstrator rights. There's a way to turn this feature off by the way:

  • Run gpEdit.msc
  • Go to: Computer Configuration | Windows Settings | Security Settings | Local Policies | Security Options
  • User Account Control: Run all users including Administrators as standard users - Disable
  • User Account Control: Behavior of the elevation prompt - No Prompt

Then log off and log back on.

I'm sure that this will make many people very happy and others.... well, let's just say that you can't please all of the people all of the time.  As for me: I think that this time I will actually attempt to make good my promise of running as a Standard User.

posted on 4/27/2006 10:12:13 PM ( 3 Comments )


Vista Touchdown - Day 2

Today was really intense.  We finished off WPF by looking at Animation, 3D, Documents and Text formats, and also Interop.  My favorite two topics here were definitely the Text formats with the new font rendering - just wait until you see it - and the Metro document stuff.  The interop stuff was also very impressive and I'll be interested to see what kind of discussions come up around migration when we show this in Australia.  Basically you can host Win32 in WPF and you can host WPF in Win32.

Just prior to and immediately after lunch we looked at Peer-to-peer technologies and then InfoCard.  InfoCard is very, very exciting as it is built around open standards.  Imagine a federated identity system that uses open standards... Mmmmmmmmm!

The afternoon was spent in what I'd call WCF immersion.  We basically go through the architecture of WCF and then look at specific implementation patterns that use the technology and finish off by looking at some of the tooling that supports administration of WCF applications.

At the end of the day I was totally stuffed and so stayed at the hotel for a few beers - as opposed to going out to the local electronic gadget store.  Luckily for me Ian Griffiths was equally stuffed and so we were able to have dinner together.  Over dinner I stole more information from his brain but shared a few beers, a main course, and many interesting stories - ranging from languages, to blogging, to some wild speculation about where the next major branch of ASP.NET innovation might occur (discounting Atlas of course).

Anyways, tomorrow us WF, Deployment, and RSS.  Here's a couple of photo's from today.  One is a photo that I took during a break where a few of the guys were eating the interesting ice-creams that we were given and Ian seems to be happy for the opportunity to catch his breath. 

The second photo is a close-up of the ice-creams.  Notice the flavours: Sweet Corn, Red Bean, Yam, and Durian.  Believe me, they were actually very nice :-)

Well earned break
Well earned break!

 

Interesting Ice-Creams
Interesting Ice-Creams

posted on 3/29/2006 11:34:08 PM ( 0 Comments )


Vista Touchdown - Day 1

Well, I'm in my hotel at Singapore getting ready for Day 2 of the Vista Touchdown training event and thought that I'd better make some notes about what happened yesterday.

There are about 25 people in our group plus Ian Griffiths who is the teacher, and then Ed and Mary - the two Microsoft DPE guys from Redmond and Angela the Program manager from Asentus in Canada.

Yesterday we started off with a short presentation from Intel which walked us through the various chipsets and how they support the features that will be required for Vista.

After the Intel presentation we got straight into WUX (Windows User Experience) and went through the updated style guidelines for building great Vista applications.

Next up came Search and and we learned about the Search system and the Properties system and saw how to consume those services from within our own applications.

After lunch we went through the new User Account model and saw how the the new least privellage stuff in the Vista security model works.

After that we ran straight into pure presentation stuff.  A short session on how to develop Sidebar Gadgets and then 3 sessions of pure WPF content- WPF Overview and 2D, WPF Tools, WPC Databinding.  Now I can finally say that I've built some custom UI using Sparkle and written code against it in VS.NET!

Everybody was thoroughly rooted by the end of the day but we persisted on to dinner at a local Chinese restaurant where I managed to have my first ever dish of Jellyfish :-)  It was great to really get to spend time with people at dinner and there were lots of really funny jokes and stuff to keept he night entertaining.

Dinner finished at around 8:30 and we caught a bus to the Singapore zoo so that we could go to something that they call the "Night Safari".  The Singapore zoo is huge and we basically caught a train that they have there which ran us all around it to show us the animals.  The ride lasted for about 45 minutes.

Here's some photo's from dinner last night:

View from restaurant View from restaurant View from restaurant
This is the view from the restaurant.

 

Eating Jellyfish!
Eating Jellyfish!

 

At dinner
The guys on my table at dinner.

 

posted on 3/29/2006 9:55:18 AM ( 0 Comments )


Vista training in Singapore next week

I'm heading to Singapore on Monday to attend the Vista Touchdown Trainer Event.  Throughout the 4 days of training we cover Vista User Experience, WPF, InfoCard, WCF, and WWF.  After attending the course I will be a "go to" trainer for the Vista Touchdown program which will start in Australia around the middle of the year.  The Touchdown program will be run bu the DE team in Australia so keep an eye on Frank's blog for details.

One of the highlights of the Singapore training trip will be that I get to meet Ian Griffiths (who is the trainer for the week).  I've followed Ian's writing for a long time and it will be great to finally meet with him.

posted on 3/25/2006 10:07:20 AM ( 0 Comments )