May 27th, 2009 by Mike Fulton
Categories: Microsoft, Web Design & Programming, Windows
NVIDIA Graphics Gadget

NVIDIA Graphics Gadget

I first got involved in creating Vista Sidebar gadgets back when Windows Vista was still in beta release.  I was asked by NVIDIA to create a gadget that would display the type of graphics card you have installed, the current NVIDIA driver version, how much graphics memory was on the card, and the current operating temperature.  And if you had two cards working in NVIDIA’s SLI mode, it needed to show the separate information for each of the installed cards.  Lastly, it had to be able to generate an alarm if the temperature got too hot.

It sounds like it’s really not that hard, provided you have a means of collecting those various tidbits of information about the installed graphics card(s), but it was still a challenging project in some ways.  For one thing, when I started the project, the documentation about creating gadgets was brand new and still undergoing occasional changes.   The first few weeks I was working on the gadget, the documentation changed 3 times.

Also, there were really no samples to look at except for those gadgets included with the Vista beta.   Some decent gadgets are included there, but none of them were created with the goal of being sample code for developers.  Between the lack of samples and the shifting documentation, there were a lot of questions about “Can you do xxx in a gadget?” that nobody seemed able to answer quite yet.

What Is A Gadget?

Gadgets are basically small, specialized webpages that exist independently of any visible browser.  Windows Vista isn’t the first system to have such an animal.  The Macintosh OS X has the Dashboard and “widgets”, and Yahoo has their Yahoo Widget Engine, previously known as Konfabulator.  All of these are slightly differnet flavors of the same idea.  They are all created with a mix of browser-compatible artwork, HTML, CSS, and your favorite scripting language. Generally, they can do almost anything you can do on a regular webpage, but are typically designed to show a specific and limited amount of information.

There’s usually some manifest file gluing it all together.   For Windows Sidebar Gadgets, there’s an XML document that specifies all the information needed by the system.

Gadget Scripting

Most gadgets need to allow for some interactivity with the user, or with web servers, database servers, or who knows what.  To manage this, you can use any client-side scripting language that is supported natively by Internet Explorer.  That means Javascript or VBScript for most people.  The good news is, you don’t have to worry about targetting 14 different combinations of browser type and version. 

Javascript code running in a gadget has some additional restrictions compared to code running in a standard browser.  Certain things just don’t work, such as alerts or input prompts.   And you’re not able to open new windows.

On the other hand, gadgets also have some additional capabilities available through Javascript compared to code running in a standard browser.  For example, they have access to a special system object class that provides access to variety of things that Javascript would ordinarily not be able to access.

Gadget Security

Gadgets have to live within a security model that’s more or less similar to what a regular webpage has, but there are some important differences.  The main example is that the System.Gadget object class allows your script code to access to the local file system and a variety of other things that Javascript would ordinarily not be able to access.

Another nice thing is that because gadgets are based locally instead of coming from a web server, the usual security restrictions for not allowing cross-domain script access have been lifted.  Your Javascript code can make Ajax requests of any domain as desired.

The NVIDIA Status Gadget

The NVIDIA Status Gadget needed to be able to display information that could only be obtained from one source: directly from the NVIDIA graphics drivers.  Since it was not possible to access the drivers directly from the gadget’s Javascript code, I needed an alternative way to get the information.  So what I did was to create an Active-X control that implemented an object that was accessible from Javascript.  This control was basically just a wrapper for the calls in the NVIDIA drivers that returned the desired information.

This got the job done, ultimately, but it did complicate development at first.  Before I could write the gadget, I needed the Active-X object, and before I could really test that the Active-X object was working right, I needed the gadget as a client.  Ultimately, the Active-X control wasn’t really that complicated, as such things go, but it was an added task that most gadgets don’t have to worry about.

May 4th, 2009 by Mike Fulton
Categories: Trade Shows

The Web 2.0 Expo trade show happened last week at San Francisco’s Moscone Center.  I had not originally planned to attend, but while watching Tekzilla on Wednesday night, they said that the next episode would be taped live during the expo the following day.  That sounded like fun, so I went to the expo’s website and discovered one could still sign up for a free exhibits-only pass.  So I did.

Tekzilla is a videocast hosted by Patrick Norton and Veronica Belmont, with occasional guest appearances by other people from Revision3.  If you haven’t ever watched it, you really should go to their website and watch an episode or two.  You can also pick it up in the “Podcasts” section of iTunes.  There are actually two versions of the show.  The first is a weekly show, about 40-ish minutes per episode, with tech news & tips, product reviews & comparisons, and so forth.  They also do a “Daily Tip Show” that’s just a minute or three and which features a single quick tip.

Thursday afternoon I arrived at the show about 90 minutes before the Tekzilla event.  I figured I’d walk the exhibit hall for awhile first.  I wasn’t quite sure to expect as far as exhibitors were concerned.  The exhibit hall is one of the main reasons I attend trade shows like this, and that uncertainty is why I hadn’t planned originally on attending this show.  I do enjoy some of the conferences when I go to them, but access to most of the conferences requires a different, and usually much more expensive, registration.  So I don’t usually plan to go to a show unless there are particular exhibitors that I expect to see.

 

At a show like MacWorld, the exhibitors are mostly showing off physical products that work in conjuntion with one of Apple’s products.  But “Web 2.0” is really more of a broad concept than a particular product, so I was interested to see what sort of exhibits would be on hand.  As I walked the show floor, I discovered that the exhibits fell into three broad categories:

  1. Companies with some sort of physical product to sell.
  2. Companies whose product is basically whatever website they do.
  3. Companies offering a service, such as web hosting, marketing, etc.

Certainly there is some overlap with some exhibitors, but generally most fell into one of those three categories.

The companies with physical product included O’Reilly Books, a regular tech expo exhibitor who had several new titles on display at a show special price of 30% off.   I picked up a new title covering the Twitter API that I’m especially looking forward to reading.  I also grabbed a book titled “Everything You Know About CSS is Wrong!” that talks about the emerging CSS 3.0 specification.  It’s small, but packed with good information about the new features in the new spec.

Another physical product, hereafter known as a “physprod” (Can I do that?  Coin a new word right in the middle of a blog like that?  I think I can, so spread it around!) was Adobe’s Flash.  Strangely, Adobe didn’t seem to be showing Dreamweaver, Photoshop or other apps.  Given how these are the basic tools many webmasters rely on, it seems an odd omission.  On the other hand, it may also be a sign at how some companies are scaling back what they’re willing to do for trade shows like this.

Microsoft was showing off several interesting things.  They had Windows 7 on display, and you could pick up a beta DVD to take home with you.  They were also showing off the developer functions of the new Internet Explorer 8.  In many ways, IE has always lagged behind other browsers like Firefox when it came to helping developers figure out what was what when problems arise.  That all ends with IE 8, which has a variety of new functions that will help web developers solve problems quickly and easily.

Microsoft also showed Silverlight and Expression Blend 2.  I’d previously not paid a lot of attention to Silverlight.  My initial impression, as with many other people, was that Silverlight was nothing more than Microsoft’s attempt to do something like Flash.  In large part that may be true, but the way they’ve integrated later versions with the .NET platform has some interesting implications.  I plan to read more about Silverlight in the near future.

Companies whose product is basically their website included Facebook and Meetup.com.  There are a few other companies where the website is the mechanism for delivering their product… If the previous category was about physprods, then I guess one would say these companies are pushing virtprods (virtual products… there I go again coining new words).  Many of these companies have websites that are basically online tools for creating other websites.  Squarespace is the main example that comes to mind here.

Squarespace looks like an interesting setup.  At the risk of oversimplifying it, Squarespace looks similar in broad concept to WordPress, except with a web-based GUI for creating page designs, themes, and content.  I’ve only played around with it for a few minutes, so I’m not going to say much more at this point except that if you’re looking to create a website you might want to check it out.  I’ll be writing more about it in a future column.