<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type='text/xsl' href='http://everythingandnothing.spaces.live.com/mmm2008-07-24_12.50/rsspretty.aspx?rssquery=en-US;http%3a%2f%2feverythingandnothing.spaces.live.com%2fcategory%2fComputers%2band%2bInternet%2ffeed.rss' version='1.0'?><rss version="2.0" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:msn="http://schemas.microsoft.com/msn/spaces/2005/rss" xmlns:live="http://schemas.microsoft.com/live/spaces/2006/rss" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:cf="http://www.microsoft.com/schemas/rss/core/2005" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Tales of a Gadget Developer: Computers and Internet</title><description /><link>http://everythingandnothing.spaces.live.com/?_c11_BlogPart_BlogPart=blogview&amp;_c=BlogPart&amp;partqs=catComputers%2band%2bInternet</link><language>en-US</language><pubDate>Sun, 03 Aug 2008 15:58:17 GMT</pubDate><lastBuildDate>Sun, 03 Aug 2008 15:58:17 GMT</lastBuildDate><generator>Microsoft Spaces v1.1</generator><docs>http://www.rssboard.org/rss-specification</docs><ttl>60</ttl><cf:parentRSS>http://everythingandnothing.spaces.live.com/blog/feed.rss</cf:parentRSS><live:type>blogcategory</live:type><live:identity><live:id>8475505343921084160</live:id><live:alias>everythingandnothing</live:alias></live:identity><cf:listinfo><cf:group ns="http://schemas.microsoft.com/live/spaces/2006/rss" element="typelabel" label="Type" /><cf:group ns="http://schemas.microsoft.com/live/spaces/2006/rss" element="tag" label="Tag" /><cf:group element="category" label="Category" /><cf:sort element="pubDate" label="Date" data-type="date" default="true" /><cf:sort element="title" label="Title" data-type="string" /><cf:sort ns="http://purl.org/rss/1.0/modules/slash/" element="comments" label="Comments" data-type="number" /></cf:listinfo><item><title>Sidebar gadgets and resuming from sleep</title><link>http://everythingandnothing.spaces.live.com/Blog/cns!759F0B3484575700!249.entry</link><description>&lt;p&gt;In the process of updating my &lt;a href="http://gallery.live.com/liveItemDetail.aspx?li=10f027c7-8153-48f6-bffb-b1846bd52d76"&gt;Soapbox&lt;/a&gt; sidebar gadget, I ran into a little problem with timers and resuming from sleep.  I had a timer setup to make a network call every 30 minutes, but upon resume the network call would fail and the timer would not be reset into its proper failure state (on failure, the timer switches to 2.5 minute updates, in case your network connection comes back).  After poking around for a bit, I found that if I listened for &lt;a href="http://msdn2.microsoft.com/en-us/library/bb267257.aspx"&gt;System.Gadget.visibilityChanging&lt;/a&gt; to stop and restart the timers, everything started working correctly.  Just wanted to share that bit of info in case others are having the same problem.&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=8475505343921084160&amp;page=RSS%3a+Sidebar+gadgets+and+resuming+from+sleep&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=everythingandnothing.spaces.live.com&amp;amp;GT1=everythingandnothing"&gt;</description><comments>http://everythingandnothing.spaces.live.com/Blog/cns!759F0B3484575700!249.entry#comment</comments><guid isPermaLink="true">http://everythingandnothing.spaces.live.com/Blog/cns!759F0B3484575700!249.entry</guid><pubDate>Mon, 24 Sep 2007 05:45:02 GMT</pubDate><slash:comments>1</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://everythingandnothing.spaces.live.com/blog/cns!759F0B3484575700!249/comments/feed.rss</wfw:commentRss><wfw:comment>http://everythingandnothing.spaces.live.com/Blog/cns!759F0B3484575700!249.entry#comment</wfw:comment><dcterms:modified>2007-09-24T05:46:03Z</dcterms:modified></item><item><title>Upcoming Favorite Xbox 360 Games gadget changes</title><link>http://everythingandnothing.spaces.live.com/Blog/cns!759F0B3484575700!153.entry</link><description>&lt;p&gt;&lt;strong&gt;Edit 2&lt;/strong&gt;:  Apparently the gadget did update, but recent changes to Gallery means that the new code was uploaded to a different URL than the old.  You'll have to go back to Gallery (link below), click &amp;quot;Add to my space&amp;quot; again, and remove the old one.  The gamertag configuration you set with the old code will continue to work with the new.
&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;:  Well, Gallery accepte my submission but didn't prop my new code, so version 1.4 on the Gallery doesn't have the updates below.  I'm following up on this to see if I can get the update fixed, and may have to resubmit the gadget.
&lt;p&gt;The next update to my Favorite Xbox 360 Games gadget should be uploaded on &lt;a href="http://gallery.live.com/liveItemDetail.aspx?li=33e9aed1-bd31-43b6-aaff-b8d9a1f39719&amp;amp;l=1"&gt;Gallery&lt;/a&gt; soon.  You'll know it's there when the version number is 1.4.  Here's a sneak preview:
&lt;p&gt;&lt;a href="http://tk1.storage.msn.com/x1pGHpas_o48lnJWyfj-tJ5-e_z8MiGsVa8nW0ypXctkJHhe1T3y0pbnr5F12O-shA6gD-xvxrg-efDoe3iCYaIdRc7Lp-_4tKR3b1Z9XyfJNQuKI5oRie5XJWghVGlQ5mmOYPyZVrZ5xu1JP4llnYf3Q"&gt;&lt;img height=272 src="http://tk1.storage.msn.com/x1pGHpas_o48lnJWyfj-tJ5-e_z8MiGsVa8nW0ypXctkJEmIe_BNI-QdCmBNlLrclyckgBoNXk7TEeaSTBlR54XqSiL1aRCD5XUZUs75FPWlGU8LRi_rLSRXMQuql2rnX9dfb2oNLKUMaTcC9TepoU3rg" width=311&gt;&lt;/a&gt; 
&lt;p&gt;Can you spot the differences?  (Ignore the broken images.  Xbox.com was down while I was working on this, so game tiles failed to load.)
&lt;ol&gt;
&lt;li&gt;Rounded corners.  This makes the gadget look a bit better on dark-themed Spaces.  Technique &amp;quot;borrowed&amp;quot; from &lt;a href="http://www.html.it/articoli/niftycube/index.html"&gt;Alessandro Fulciniti's Nifty Corners Cube technique&lt;/a&gt; (the Nifty code was not used, just the idea).  If you use a white background on your Space, the corners are essentially invisible, but they're still there.
&lt;li&gt;Icons!  FamFamFam's lovely &lt;a href="http://www.famfamfam.com/lab/icons/silk/"&gt;Silk&lt;/a&gt; icon set makes another appearance in one of my gadgets (previously used in my &lt;a href="http://gallery.live.com/liveItemDetail.aspx?li=cfbe8911-313d-4025-a755-948e75c5de08&amp;amp;l=1"&gt;Similar Artists&lt;/a&gt; gadget).  This time, the wrench replaces the old &amp;quot;Edit&amp;quot; text and the refresh arrows are added for ...
&lt;li&gt;Refresh functionality.  Not all that useful, since 360Voice only updates once a day, but the functionality is there and may be useful if the gadget fails to retrieve data for some reason.  Edit will still only be available to Live.com users and while in Author mode on Spaces.  Refresh will be available to all users at all times.&lt;/ol&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=8475505343921084160&amp;page=RSS%3a+Upcoming+Favorite+Xbox+360+Games+gadget+changes&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=everythingandnothing.spaces.live.com&amp;amp;GT1=everythingandnothing"&gt;</description><comments>http://everythingandnothing.spaces.live.com/Blog/cns!759F0B3484575700!153.entry#comment</comments><guid isPermaLink="true">http://everythingandnothing.spaces.live.com/Blog/cns!759F0B3484575700!153.entry</guid><pubDate>Wed, 18 Oct 2006 06:04:31 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://everythingandnothing.spaces.live.com/blog/cns!759F0B3484575700!153/comments/feed.rss</wfw:commentRss><wfw:comment>http://everythingandnothing.spaces.live.com/Blog/cns!759F0B3484575700!153.entry#comment</wfw:comment><dcterms:modified>2006-11-14T07:29:13Z</dcterms:modified></item><item><title>Gadget ideas</title><link>http://everythingandnothing.spaces.live.com/Blog/cns!759F0B3484575700!150.entry</link><description>&lt;p&gt;I enjoy writing gadgets.  What I don't enjoy is writer's block when I'm out of ideas for gadgets to write.  I've added a list to my Space here to track gadget ideas I'm thinking about.  If you have cool gadget ideas, please leave a comment.  I won't guarantee that I'll implement your idea (even assuming that your idea is feasible), but it'll help get my creative juices flowing.&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=8475505343921084160&amp;page=RSS%3a+Gadget+ideas&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=everythingandnothing.spaces.live.com&amp;amp;GT1=everythingandnothing"&gt;</description><comments>http://everythingandnothing.spaces.live.com/Blog/cns!759F0B3484575700!150.entry#comment</comments><guid isPermaLink="true">http://everythingandnothing.spaces.live.com/Blog/cns!759F0B3484575700!150.entry</guid><pubDate>Wed, 11 Oct 2006 08:42:02 GMT</pubDate><slash:comments>1</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://everythingandnothing.spaces.live.com/blog/cns!759F0B3484575700!150/comments/feed.rss</wfw:commentRss><wfw:comment>http://everythingandnothing.spaces.live.com/Blog/cns!759F0B3484575700!150.entry#comment</wfw:comment><dcterms:modified>2006-11-14T07:29:04Z</dcterms:modified></item><item><title>Implementing a storage mechanism for Spaces gadgets</title><link>http://everythingandnothing.spaces.live.com/Blog/cns!759F0B3484575700!142.entry</link><description>&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;:  This is no longer necessary, as Windows Live Spaces now supports get/setProperties on the Module object.  The article is still interesting from a technical perspective, but you no longer need to implement your own preference storage mechanism for Spaces gadgets.
&lt;p&gt;Donavon's LiveSide.net &lt;a href="http://www.liveside.net/blogs/developer/archive/2006/10/03/Live-Spaces_3A00_-The-challenges-facing-gadget-developers.aspx"&gt;article&lt;/a&gt; on building gadgets for Spaces mentions one of the main problems remaining for gadget developers trying to target Spaces, namely how to store preferences for a gadget and reference them in such a way that the gadget can be both configurable for the author and yet show what the author wants to visitors.  Since he didn't go into detail about how to build such a mechanism, I thought I'd do a quick run through of the solution I used.
&lt;h2&gt;Prerequisites&lt;/h2&gt;
&lt;p&gt;To do this, you'll need a couple resources up front that you may or may not have.
&lt;ul&gt;
&lt;li&gt;A web hosting site that allows you to use some sort of server-side language.  I used PHP because that's what my provider made available, but you could do this with ASP, ASP.NET, Perl, Ruby, Python, or even good old C/C++ (as a CGI). 
&lt;li&gt;A database or other storage mechanism.  I went with MySQL, again because that's what my host provides (I'll not get into my biases against MySQL here ...).  You could do this with file-based storage if you really want to, though I'm going to present a SQL-based solution here. 
&lt;li&gt;A hosting plan that has adequate bandwidth limits and reliability.  The last thing you want is to have your gadgets stop working because your hosting provider cut you off.  Keep in mind that if your gadget gets popular, what you initially feel is adequate may ultimately be too little to support the load.&lt;/ul&gt;
&lt;p&gt;Expect to have to pay money for a hosting service that will provide you what you need.  Geocities is not going to cut it.
&lt;h2&gt;Storage&lt;/h2&gt;
&lt;p&gt;While I built my storage service for a single gadget, I looked at what I would need to make it work for multiple gadgets.  I ended up with two tables:
&lt;ol&gt;
&lt;li&gt;spaces_author, to track the combination of Space + gadget id (where &amp;quot;gadget id&amp;quot; is a string I made up for my gadget, and must be unique for each gadget you use with this service). 
&lt;li&gt;spaces_pref, to map name/value pairs to the ID from spaces_author.  This table holds the actual preferences you're going to store.&lt;/ol&gt;
&lt;p&gt;Here's the schema for spaces_author.  This is from MySQL, so you will need to adjust it for other databases like SQL Server, PostgreSQL, or Oracle.
&lt;blockquote&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;CREATE TABLE `spaces_author` (&lt;br&gt;    `id` bigint(20) NOT NULL auto_increment,&lt;br&gt;    `host` varchar(250) NOT NULL default '',&lt;br&gt;    `gadget` varchar(250) NOT NULL default '',&lt;br&gt;    PRIMARY KEY (`id`),&lt;br&gt;    UNIQUE KEY `host_2` (`host`,`gadget`)&lt;br&gt;) TYPE=MyISAM COMMENT='Spaces author mapping';&lt;/font&gt;&lt;/blockquote&gt;
&lt;p&gt;&amp;quot;id&amp;quot; is the unique id of the host + gadget (herein referred to as &amp;quot;author&amp;quot;).  &amp;quot;host&amp;quot; is a unique value to identify the Space.  I used the first part of the URL, or &amp;quot;everythingandnothing&amp;quot; from this page's full URL of &amp;quot;everythingandnothing.spaces.live.com&amp;quot;.  &amp;quot;gadget&amp;quot;, as mentioned before, is a made-up unique key for a gadget.  You can use whatever you like here, change it to an integer, or whatever.
&lt;p&gt;And here's the schema for spaces_pref.
&lt;blockquote&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;CREATE TABLE `spaces_pref` (&lt;br&gt;    `authorId` bigint(20) NOT NULL default '0',&lt;br&gt;    `name` varchar(64) NOT NULL default '',&lt;br&gt;    `value` varchar(255) NOT NULL default '',&lt;br&gt;    PRIMARY KEY (`authorId`,`name`)&lt;br&gt;) TYPE=MyISAM COMMENT='Spaces preference storage';&lt;/font&gt;&lt;/blockquote&gt;
&lt;p&gt;&amp;quot;authorId&amp;quot; is a link back to the &amp;quot;spaces_author&amp;quot; table (in a better database, I'd actually make this a foreign key; for MySQL, I just didn't bother).  &amp;quot;name&amp;quot; is the name of the preference you're storing, and &amp;quot;value&amp;quot; is the value.  Note the size limitations.  You can adjust those as appropriate for what you want to store and your database's capabilities.
&lt;h2&gt;The Web Service&lt;/h2&gt;
&lt;p&gt;Once you have your storage mechanism in place, you need a way to store and retrieve that data.  This is where the web service comes in.  Since you'll be calling this with the gadget framework's Web.Network.createRequest() method, you're limited to either JSON or REST XML (if you choose to use SOAP, make sure you enable HTTP-GET or you won't be able to call this from your gadget!).  I chose to work with XML as it's simple, I know it, and I've not worked much with JSON.  In the long run JSON is probably a better choice, but I'm not going to cover that here.
&lt;p&gt;I wrote my web service using PHP, and created two different files, one to set preferences and the other retrieve them.  You could do this with a single interface if you like, but it was simpler for me to do it as two separate files.  I'm not going to provide code here, but the idea is simple.  I've omitted some error checking in the workflow here, but you should check for errors at every step and return useful information in an XML or JSON format so your gadget can figure out what went wrong.
&lt;ol&gt;
&lt;li&gt;Pass in host, gadget, name, and value as GET parameters. 
&lt;ol&gt;
&lt;li&gt;Make sure you validate your parameters!&lt;/ol&gt;
&lt;li&gt;For Set 
&lt;ol&gt;
&lt;li&gt;Check if the host + gadget key exists in spaces_author 
&lt;ol&gt;
&lt;li&gt;If it does, retrieve the authorId 
&lt;li&gt;If it doesn't, insert host + gadget into spaces_author and retrieve the newly created authorId.&lt;/ol&gt;
&lt;li&gt;Check if authorId + name exists in spaces_pref 
&lt;ol&gt;
&lt;li&gt;If it does, update spaces_pref and set value to the new value. 
&lt;li&gt;If it doesn't, insert authorId, name, and value into spaces_pref&lt;/ol&gt;
&lt;li&gt;Return some indicator that Set succeeded.&lt;/ol&gt;
&lt;li&gt;For Get, check if the host + gadget key exists in spaces_author 
&lt;ol&gt;
&lt;li&gt;If it does, retrieve authorId 
&lt;ol&gt;
&lt;li&gt;Check if authorId + name exists in spaces_pref 
&lt;ol&gt;
&lt;li&gt;If it does, retrieve the value and return it wrapped in XML 
&lt;li&gt;If it doesn't, return an error&lt;/ol&gt;&lt;/ol&gt;
&lt;li&gt;If it doesn't, return an error&lt;/ol&gt;&lt;/ol&gt;
&lt;p&gt;And a few tips for those who plan to use PHP:
&lt;ul&gt;
&lt;li&gt;Before you echo or print anything, make sure you set your content to application/xml (for XML).  You really should do this first thing in your PHP file, because you may include other files that do some sort of output that you're not aware of. 
&lt;ul&gt;
&lt;li&gt;&lt;font face="Courier New"&gt;header('Content-Type: application/xml');&lt;/font&gt;&lt;/ul&gt;
&lt;li&gt;Make sure you protect yourself against SQL injection. 
&lt;ul&gt;
&lt;li&gt;&lt;font face="courier new"&gt;if (get_magic_quotes_gpc() == 1)&lt;br&gt;{&lt;br&gt;    $foo = $_GET[&amp;quot;foo&amp;quot;];&lt;br&gt;}&lt;br&gt;else&lt;br&gt;{&lt;br&gt;    $foo = addslashes($_GET[&amp;quot;foo&amp;quot;]);&lt;br&gt;}&lt;/font&gt;&lt;/ul&gt;&lt;/ul&gt;
&lt;h2&gt;Putting it all together&lt;/h2&gt;
&lt;p&gt;Now you have a storage backend and a web service to access it.  How do you use this in a gadget?  To reduce load, you should only use this storage mechanism for gadgets running on Spaces, and continue to use module.[set|get]Preference() for Live.com gadgets.  I'm going to make a couple assumptions here:
&lt;ul&gt;
&lt;li&gt;You've defined a variable m_isSpace that is true if the gadget is running on a Spaces page. 
&lt;li&gt;You've defined a variable m_isAuthor that is true if the gadget is running in author mode. 
&lt;li&gt;If m_isSpace is true, you've populated a variable m_host that contains a unique key to identify this Space (I suggest you parse window.location like Donavon suggests).&lt;/ul&gt;
&lt;p&gt;Saving is easy.  Here's a sample function:
&lt;blockquote&gt;
&lt;p&gt;&lt;font face="courier new"&gt;function SetData()&lt;br&gt;{&lt;br&gt;    if (!m_isSpaces)&lt;br&gt;    {&lt;br&gt;        // Not on a Space.  Use the normal preference mechanism&lt;br&gt;        m_module.setPreference(&amp;quot;tag&amp;quot;, m_tag);&lt;br&gt;    }&lt;br&gt;    else&lt;br&gt;    {&lt;br&gt;        if (!m_isAuthor)&lt;br&gt;        {&lt;br&gt;            // On a Space, but as a visitor.  No saving for you!&lt;br&gt;            return;&lt;br&gt;        }&lt;br&gt;        else&lt;br&gt;        {&lt;br&gt;            // On a Space as an author.  We need to kick off a web request to do the save&lt;br&gt;            var url = // TODO:  Build your URL here, with your host key, gadget key, etc&lt;br&gt;                + &amp;quot;&amp;amp;f=&amp;quot; + Math.random(); // Break the cache, since we want to make sure we do save &lt;/font&gt;
&lt;p&gt;&lt;font face="courier new"&gt;            var req = Web.Network.createRequest(&lt;br&gt;                Web.Network.Type.XML&lt;br&gt;                , url&lt;br&gt;                , null&lt;br&gt;                , OnSetData); &lt;/font&gt;
&lt;p&gt;&lt;font face="courier new"&gt;            req.execute();&lt;br&gt;        }&lt;br&gt;    }&lt;br&gt;}&lt;/font&gt;&lt;/blockquote&gt;
&lt;p&gt;OnSetData doesn't actually do anything, because saving is best-effort 
&lt;blockquote&gt;
&lt;p&gt;&lt;font face="courier new"&gt;function OnSetData(response)&lt;br&gt;{&lt;br&gt;    // Don't much care what happens here!&lt;br&gt;}&lt;/font&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;font face=verd&gt;Retrieving data is a bit more involved.&lt;/font&gt; 
&lt;blockquote&gt;
&lt;p&gt;&lt;font face="courier new"&gt;function GetData()&lt;br&gt;{&lt;br&gt;    if (!m_isSpaces)&lt;br&gt;    {&lt;br&gt;        // Not on a Space.  Use the proper getPreference call&lt;br&gt;        m_tag = m_module.getPreference(&amp;quot;tag&amp;quot;);&lt;br&gt;    }&lt;br&gt;    else&lt;br&gt;    {&lt;br&gt;        // On a Space, so kick off a web request&lt;br&gt;        var url = // TODO: Build your URL here, wit your host key, gadget key, etc &lt;/font&gt; 
&lt;p&gt;&lt;font face="courier new"&gt;        var req = Web.Network.createRequest(&lt;br&gt;            Web.Network.Type.XML&lt;br&gt;            , url&lt;br&gt;            , null&lt;br&gt;            , OnGetData); &lt;/font&gt;
&lt;p&gt;&lt;font face="courier new"&gt;        m_retrievingData = true;&lt;br&gt;        req.execute();&lt;br&gt;    }&lt;br&gt;}&lt;/font&gt;&lt;/blockquote&gt;
&lt;p&gt;Note &amp;quot;&lt;font face="Courier New"&gt;m_retrievingData = true;&lt;/font&gt;&amp;quot;.  I'll get to that later. 
&lt;p&gt;OnGetData does the actual work of pulling out the retrieved value. 
&lt;blockquote&gt;
&lt;p&gt;&lt;font face="courier new"&gt;function OnGetData(response)&lt;br&gt;{&lt;br&gt;    if (response.readyState == 4 &amp;amp;&amp;amp; response.status == 200 &amp;amp;&amp;amp; response.responseXML != null)&lt;br&gt;    {&lt;br&gt;        var error = response.responseXML.selectSingleNode(&amp;quot;//error&amp;quot;); &lt;/font&gt;
&lt;p&gt;&lt;font face="courier new"&gt;        if (!error)&lt;br&gt;        {&lt;br&gt;            // Whee!&lt;br&gt;            m_yourValue = response.responseXML.selectSingleNode(&amp;quot;//get_pref&amp;quot;).text;&lt;br&gt;        }&lt;br&gt;        else&lt;br&gt;        {&lt;br&gt;            // uh ...&lt;br&gt;            m_yourValue = null;&lt;br&gt;        } &lt;/font&gt;
&lt;p&gt;&lt;font face="courier new"&gt;        m_retrievingData = false;&lt;br&gt;    }&lt;br&gt;}&lt;/font&gt;&lt;/blockquote&gt;
&lt;p&gt;In this example, I'm assuming that &amp;quot;&amp;lt;error /&amp;gt;&amp;quot; (with some information inside it) is the root of the returned document if something went wrong, and &amp;quot;&amp;lt;get_pref /&amp;gt;&amp;quot; (with a value inside) is the root of the returned document if everything went right. 
&lt;p&gt;Now, about that m_retrievingData variable.  These calls run asynchronously, but you may need the returned data to finish initialization of your gadget.  The m_retrievingData variable indicates that you're still waiting on this data to return, so you need to wait for that.  The simplest thing to do is to kick off a timer and check the state of m_retrievingData. 
&lt;p&gt;In this.initialize, add &amp;quot;setTimeout(OnLoadingWait, 100);&amp;quot; after you've completed all initialization that can be done without the retrieved data.  Here's OnLoadingWait: 
&lt;blockquote&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;function OnLoadingWait()&lt;br&gt;{&lt;br&gt;    if (m_retrievingData)&lt;br&gt;    {&lt;br&gt;        // Still waiting on data&lt;br&gt;        setTimeout(OnLoadingWait, 100);&lt;br&gt;    }&lt;br&gt;    else&lt;br&gt;    {&lt;br&gt;        if (m_yourValue != null)&lt;br&gt;        {&lt;br&gt;            DoSomethingWithData();&lt;br&gt;        }&lt;br&gt;        else&lt;br&gt;        {&lt;br&gt;            if (m_isSpaces &amp;amp;&amp;amp; !m_isAuthor)&lt;br&gt;            {&lt;br&gt;                // No tag, but we can't let the viewer do anything about it&lt;br&gt;                // A failure message would be good&lt;br&gt;            }&lt;br&gt;            else&lt;br&gt;            {&lt;br&gt;                // No tag, but we're in author mode.  Give the author a way to set preferences&lt;br&gt;            }&lt;br&gt;        }&lt;br&gt;    }&lt;br&gt;}&lt;/font&gt;&lt;/blockquote&gt;
&lt;p&gt;And you're done! 
&lt;h2&gt;Caveats&lt;/h2&gt;
&lt;p&gt;This approach works for me, but it may not work for you.  The Spaces team will surely heed the cries from the gadget developer community and provide a standard storage mechanism soon enough.  The code is not guaranteed to be bug free.  The code was written with the assumption that you're only storing or retrieving a single value at a time.  You could certainly modify your web service to handle multiple name/value pairs to minimize the number of web calls you have to make.  Code and ideas are provided as-is, and I'm in no way responsible for any bandwidth overage charges you may incur by using this method with a popular gadget.&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=8475505343921084160&amp;page=RSS%3a+Implementing+a+storage+mechanism+for+Spaces+gadgets&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=everythingandnothing.spaces.live.com&amp;amp;GT1=everythingandnothing"&gt;</description><comments>http://everythingandnothing.spaces.live.com/Blog/cns!759F0B3484575700!142.entry#comment</comments><guid isPermaLink="true">http://everythingandnothing.spaces.live.com/Blog/cns!759F0B3484575700!142.entry</guid><pubDate>Tue, 10 Oct 2006 04:02:29 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://everythingandnothing.spaces.live.com/blog/cns!759F0B3484575700!142/comments/feed.rss</wfw:commentRss><wfw:comment>http://everythingandnothing.spaces.live.com/Blog/cns!759F0B3484575700!142.entry#comment</wfw:comment><dcterms:modified>2006-11-14T07:30:31Z</dcterms:modified></item><item><title>Building Gadgets for Spaces</title><link>http://everythingandnothing.spaces.live.com/Blog/cns!759F0B3484575700!140.entry</link><description>&lt;p&gt;&lt;strong&gt;Edit 2:&lt;/strong&gt;  The gadget finally got approved!  &lt;a href="http://gallery.live.com/liveItemDetail.aspx?li=33e9aed1-bd31-43b6-aaff-b8d9a1f39719&amp;amp;l=1"&gt;Go get it&lt;/a&gt;!
&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;:  The gadget's not yet approved, and it turns out that gadgets hosted anywhere besides the Windows Live Gallery are not publicly viewable.  That sucks.  The screenshots below give an idea of how the gadget looks.  Hopefully it'll get approved soon so others can see and use the gadget.
&lt;p&gt;Donavon, of &lt;a href="http://www.livegadgets.net/#home"&gt;LiveGadgets.net&lt;/a&gt; fame posted an &lt;a href="http://www.liveside.net/blogs/developer/archive/2006/10/03/Live-Spaces_3A00_-The-challenges-facing-gadget-developers.aspx"&gt;article&lt;/a&gt; up on &lt;a href="http://www.liveside.net/"&gt;LiveSide&lt;/a&gt; today covering issues we gadget developers face when targeting our gadgets for Spaces.  This was the kick in the butt I needed to finally write my own preference storage mechanism so &lt;a href="http://gallery.live.com/Author.aspx?a=e3befa48-3a1e-44b4-86ed-798746fbbb60&amp;amp;l=1"&gt;my own gadgets&lt;/a&gt; would be more useful here.  The first Spaces-targeted gadget is &amp;quot;&lt;a href="http://gallery.live.com/liveItemDetail.aspx?li=33e9aed1-bd31-43b6-aaff-b8d9a1f39719&amp;amp;l=1"&gt;My Xbox 360 Favorite Games&lt;/a&gt;&amp;quot;.  As of this writing, the gadget is still in the approval queue.  You'll know it's available when the &amp;quot;Add to your space&amp;quot; button is available and the version number reads &amp;quot;1.3&amp;quot;.  You can see the gadget running from my development server above.
&lt;p&gt;Previously, the gadget used Live.com's standard preference storage mechanism.  That doesn't work on Spaces, so the gadget would load up to a screen asking you to input a gamertag.  Now only the page author (me, in this case) can set the gamertag, and viewers will either see what the author set (&amp;quot;Osty&amp;quot;, in this case), or a note saying that the page author hasn't yet configured the gadget.  Of course, if you're running the gadget on Live.com it will continue to use Live.com's preference storage mechanism.
&lt;p&gt;My main concern with the approach I've taken is that my storage solution may not scale if the gadget becomes popular.  Hopefully Spaces will step up and provide some sort of preference storage for gadgets soon.  Then again, I may be worried about nothing and it'll work flawlessly as currently implemented.
&lt;p&gt;Viewer mode.  Note the lack of an &amp;quot;Edit&amp;quot; link:
&lt;p&gt;&lt;a href="http://tk1.storage.msn.com/x1pGHpas_o48lnJWyfj-tJ5-e_z8MiGsVa8nW0ypXctkJGk4HkQYESeKLlj-0t254rPxeRItl40fHryjc-Vt0cld3xw503c4GkrpcsrIXyvlni9v6gOVJVfQ0QnBehVBjHZiBdU9zZR_w8P1IpqTiT9Gw"&gt;&lt;img height=243 src="http://tk1.storage.msn.com/x1pGHpas_o48lnJWyfj-tJ5-e_z8MiGsVa8nW0ypXctkJH_cIUjatvQiiRryAigjuB1jYM59YdC-fqN8CA0mfLt9foNO0J_yWwzouAQhbzmMoF_iFUT23Mo637xxfbm6EXTjld0AV-YwThYTp6L2vWNDA" width=402&gt;&lt;/a&gt; 
&lt;p&gt;Author mode.  The &amp;quot;Edit&amp;quot; link is back, which is how the author determines what Gamertag to show:
&lt;p&gt;&lt;a href="http://tk1.storage.msn.com/x1pGHpas_o48lnJWyfj-tJ5-e_z8MiGsVa8nW0ypXctkJE6h5oBfXqMAYfuJuK5JtYYKRHzdKfN_wskwVCCtSm9zwsSgj0qHHrY4ZVyFrdsPlZCVHwFoG2CbKB14VSJqr8Eo_wJ7Rn4eJIxEgLBqmuVHQ"&gt;&lt;img height=244 src="http://tk1.storage.msn.com/x1pGHpas_o48lnJWyfj-tJ5-e_z8MiGsVa8nW0ypXctkJENJyI1PX5CmKWg1LUDQjKWVk_KR0JSLnqPmAGshkhJwg3gz-yQioeu1znPPr_MO-jtR_wlukltGdIckiDamqlWK17nj2S3SSXmbJoOtvCrSQ" width=402&gt;&lt;/a&gt; 
&lt;p&gt;And finally, the edit view, where the author can change the Gamertag:
&lt;p&gt;&lt;a href="http://tk1.storage.msn.com/x1pGHpas_o48lnJWyfj-tJ5-e_z8MiGsVa8nW0ypXctkJGCeVDv9QLlIMhXjflPIBMA14l36V1kZYpUmdbj_-nyLqlMFLZNtzTfVv4350nbb2Lb0D_0eytLz4X8IROS-bh7ZU2oQe_C2FoaMQuba34Kuw"&gt;&lt;img height=112 src="http://tk1.storage.msn.com/x1pGHpas_o48lnJWyfj-tJ5-e_z8MiGsVa8nW0ypXctkJG5pWw4KJ-1zX8kXTaQWPJKLn2HDEIAMmi6v8gxzwrD2w49e1KjiVPof5uCj26J9EuEmwjE4DeaW-6oSVyX26rOO9m8powK-1AyEmoBP3mULQ" width=402&gt;&lt;/a&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=8475505343921084160&amp;page=RSS%3a+Building+Gadgets+for+Spaces&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=everythingandnothing.spaces.live.com&amp;amp;GT1=everythingandnothing"&gt;</description><comments>http://everythingandnothing.spaces.live.com/Blog/cns!759F0B3484575700!140.entry#comment</comments><guid isPermaLink="true">http://everythingandnothing.spaces.live.com/Blog/cns!759F0B3484575700!140.entry</guid><pubDate>Thu, 05 Oct 2006 05:45:50 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://everythingandnothing.spaces.live.com/blog/cns!759F0B3484575700!140/comments/feed.rss</wfw:commentRss><wfw:comment>http://everythingandnothing.spaces.live.com/Blog/cns!759F0B3484575700!140.entry#comment</wfw:comment><dcterms:modified>2006-10-10T02:51:27Z</dcterms:modified></item></channel></rss>