<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ioan Lazarciuc&#039;s Weblog &#187; Beginnings</title>
	<atom:link href="http://www.lazarciuc.ro/ioan/category/beginnings/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lazarciuc.ro/ioan</link>
	<description>I program, therefore I exist.</description>
	<lastBuildDate>Mon, 19 Dec 2011 06:24:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Creating a Windows Vista Sidebar Gadget</title>
		<link>http://www.lazarciuc.ro/ioan/2007/11/01/creating-a-windows-vista-sidebar-gadget/</link>
		<comments>http://www.lazarciuc.ro/ioan/2007/11/01/creating-a-windows-vista-sidebar-gadget/#comments</comments>
		<pubDate>Wed, 31 Oct 2007 23:39:20 +0000</pubDate>
		<dc:creator>cretz</dc:creator>
				<category><![CDATA[Beginnings]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Gadget]]></category>
		<category><![CDATA[Sidebar]]></category>
		<category><![CDATA[Vista]]></category>

		<guid isPermaLink="false">http://www.lazarciuc.ro/ioan/2007/11/01/creating-a-windows-vista-sidebar-gadget/</guid>
		<description><![CDATA[I think this post should begin with a few sayings: "Never say never", "When hell freezes over", "Once in a blue moon", "I would rather shoot myself", "Over my dead body", but the best suited one for this post comes from Ciprian Jichici, the Microsoft Regional Director from Romania: "In this line of business, there's [...]]]></description>
			<content:encoded><![CDATA[<p>I think this post should begin with a few sayings: "Never say never", "When hell freezes over", "Once in a blue moon", "I would rather shoot myself", "Over my dead body", but the best suited one for this post comes from <a TITLE="Ciprian Jichici's Website" HREF="http://www.ciprianjichici.ro/" TARGET="_blank">Ciprian Jichici</a>, the <a TITLE="Microsoft Regional Director Website" HREF="http://microsoftregionaldirectors.com/" TARGET="_blank">Microsoft Regional Director</a> from Romania: "In this line of business, there's no room for talibanisms".</p>
<p>I will be talking about developing Sidebar gadgets. These Sidebar gadgets are small applications that offer useful information, do frequent tasks more easily, or just offer a good laugh for the Windows Vista user. Until recently, I've been trying very hard to stay away from technologies like JavaScipt and PHP because it is my personal opinion that they fall miles away from a proper programming language (C#, VB.NET, C++). I won't go into the details of why I dislike these languages.</p>
<p>Microsoft launched a <a TITLE="Gadget Competition Website for Romania" HREF="http://www.gadgetcompetition.com/" TARGET="_blank">competition</a> for Sidebar gadget developers with some very nice prizes. The competition takes place in several countries, including Romania. So, I decided to participate. The only problem is that the only fully supported programming model for developing Sidebar gadgets is HTML application + JavaScript.</p>
<p><span id="more-14"></span></p>
<p>I've spent several weeks trying to find another way to develop gadgets. I found out that by using <a TITLE="A site for information aobut XBAP" HREF="http://www.xbap.org/" TARGET="_blank">XBAP</a>(XAML Browser Application), one can obtain a gadget that can be programmed using <a TITLE="MSDN WPF Site" HREF="http://msdn2.microsoft.com/en-us/library/ms754130.aspx" TARGET="_blank">WPF</a> (Windows Presentation Foundation) - more information on that <a TITLE="How to Create a Sidebar Gadget using XBAP" HREF="http://blogs.msdn.com/jbeavers/archive/2007/05/30/creating-the-simple-xbap-sidebar-gadget.aspx" TARGET="_blank">here</a>. There are real drawbacks to this approach: no flyouts, no access to the gadget settings API, no access to the Gadget API, which are all accessible from JavaScript. Also, <a TITLE="Silverlight Website" HREF="http://www.microsoft.com/silverlight/" TARGET="_blank">Silverlight</a> can be used to create a Sidebar gadget. While this significantly improves access to the JavaScipt API's, there are still drawbacks. More on creating gadgets using Silverlight <a HREF="http://blogs.msdn.com/charles_sterling/archive/2007/05/14/writing-a-windows-sidebar-gadget-in-silverlight-dead-simple.aspx" TARGET="_blank">here</a> and <a HREF="http://blog.benhall.me.uk/2007/05/vista-sidebar-gadget-using-silverlight.html" TARGET="_blank">here</a>. The decision was tough to make, but unavoidable: JavaScript won, due to the fact that my gadget needed settings, flyouts and a standard installation experience (no dependencies on Silverlight).</p>
<p>Now the phrase "there's no room for talibanisms" makes sense: you never know when you will be forced to do things you don't particularly enjoy (such as JavaScript). All these being said, I shall move on the the task at hand. The best place to start when learning to develop gadgets is the <a TITLE="Basic Tutorial for Sidebar Gadget Development" HREF="http://microsoftgadgets.com/Sidebar/DevelopmentOverview.aspx" TARGET="_blank">Overview Site</a> from Microsoft. The ABCs of developing gadgets are covered there. Tim Heuer has made a project template for Visual Studio in order to help people getting started in gadget development. The template is available <a TITLE="Visual Studio Project Template for Gadget Development" HREF="http://www.timheuer.com/blog/archive/2007/03/11/14010.aspx" TARGET="_blank">here</a>.</p>
<p>From here, the purpose of the new gadget has to be formulated. It can be as simple as "Hello World", or as complicated as interfacing with your Windows Media Player. The first step is to go over to the <a TITLE="Live Gallery for Sidebar Gadgets" HREF="http://vista.gallery.microsoft.com/vista/SideBar.aspx" TARGET="_blank">Live Gallery</a> dedicated to Vista Sidebar Gadgets and have a look at what's out there. I settled on creating a gadget that would display the postal code (ZIP) for a given address from Romania. I chose this because I had been searching too many times for postal codes on websites. The gadget is a very welcomed shortcut. The data is to be obtained from one of the many sites that offer Romanian ZIP search. The only requirement is to be able to pass the search string as a query string directly in the URL to keep things simple. I settled on <a HREF="http://coduri-postale.ro">http://coduri-postale.ro</a>.</p>
<p>The next step is to get up to date with some basic <a TITLE="JavaScript Tutorial" HREF="http://www.w3schools.com/js/default.asp" TARGET="_blank">JavaScript</a>: <a TITLE="HTML DOM" HREF="http://www.w3schools.com/htmldom/dom_reference.asp" TARGET="_blank">HTML DOM</a>, <a TITLE="CSS Refference" HREF="http://www.w3schools.com/css/css_intro.asp" TARGET="_blank">CSS</a>, <a TITLE="Regular Expressions" HREF="http://www.devarticles.com/c/a/JavaScript/Regular-expressions-in-JavaScript/" TARGET="_blank">Regular Expressions</a>, the <a TITLE="Sidebar Gadget API Refference" HREF="http://msdn2.microsoft.com/en-us/library/aa965853.aspx" TARGET="_blank">Sidebar Gadget API</a>. Now it's time to take a look at the structure generated by the Visual Studio template.</p>
<p>A Sidebar gadget has at least 2 files: a HTML file which defines the look of the gadget and an XML file which defines information about the gadget such as the name, version, author, description. However, usually, a gadget contains more files such as: HTML files for various flyouts, JS files for the JavaScript functions that are called and CSS files for defining styles in a civilized manner.</p>
<p>The main file of the gadget is called by default, gadget.html. It contains 2 div tags, one with the ID "docked" and one "undocked". As you can imagine, one holds the contents while docked, the other while undocked. In JavaScript, the events System.Gadget.onDock and System.Gadget.onUndock are defined in order to handle the switch between modes. The event handlers are set in the Init function found in the utils.js file.</p>
<p STYLE="border-right-color: #808080; border-right-width: 1px; border-right-style: solid; padding-right: 4px; border-top-color: #808080; border-top-width: 1px; border-top-style: solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin-top: 20px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; overflow: auto; border-left-color: #808080; border-left-width: 1px; border-left-style: solid; width: 97.50%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom-color: #808080; border-bottom-width: 1px; border-bottom-style: solid">&nbsp;</p>
<p STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px">&nbsp;</p>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"><span STYLE="color: #0000ff">&lt;</span><span STYLE="color: #800000">body</span> <span STYLE="color: #ff0000">onload</span><span STYLE="color: #0000ff">="init();"</span><span STYLE="color: #0000ff">&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">&lt;</span><span STYLE="color: #800000">div</span> <span STYLE="color: #ff0000">id</span><span STYLE="color: #0000ff">="docked"</span><span STYLE="color: #0000ff">&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> Gadget Docked</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">&lt;</span><span STYLE="color: #800000">br</span><span STYLE="color: #0000ff">/&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">&lt;</span><span STYLE="color: #800000">input</span> <span STYLE="color: #ff0000">type</span><span STYLE="color: #0000ff">="button"</span> <span STYLE="color: #ff0000">value</span><span STYLE="color: #0000ff">="Flyout"</span> <span STYLE="color: #ff0000">onclick</span><span STYLE="color: #0000ff">="flyout();"</span> <span STYLE="color: #0000ff">/&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">&lt;/</span><span STYLE="color: #800000">div</span><span STYLE="color: #0000ff">&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">&lt;</span><span STYLE="color: #800000">div</span> <span STYLE="color: #ff0000">id</span><span STYLE="color: #0000ff">="undocked"</span><span STYLE="color: #0000ff">&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> Gadget Undocked</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">&lt;/</span><span STYLE="color: #800000">div</span><span STYLE="color: #0000ff">&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"><span STYLE="color: #0000ff">&lt;/</span><span STYLE="color: #800000">body</span><span STYLE="color: #0000ff">&gt;</span></pre>
<p>The gadget.xml file contains the name, author, description of the gadget, but also it specifies the main source file for the gadget in the &lt;base&gt; node from &lt;hosts&gt;. The file also contains the path to an icon which represents the gadget and an image to display (defaultImage in &lt;hosts&gt;) while dragging the gadget (only when dragging it from the "Add Gadgets" window).</p>
<p STYLE="border-right-color: #808080; border-right-width: 1px; border-right-style: solid; padding-right: 4px; border-top-color: #808080; border-top-width: 1px; border-top-style: solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin-top: 20px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; overflow: auto; border-left-color: #808080; border-left-width: 1px; border-left-style: solid; width: 97.50%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom-color: #808080; border-bottom-width: 1px; border-bottom-style: solid">&nbsp;</p>
<p STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px">&nbsp;</p>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"><span STYLE="color: #0000ff">&lt;?</span><span STYLE="color: #800000">xml</span> <span STYLE="color: #ff0000">version</span><span STYLE="color: #0000ff">="1.0"</span> <span STYLE="color: #ff0000">encoding</span><span STYLE="color: #0000ff">="utf-8"</span> ?<span STYLE="color: #0000ff">&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"><span STYLE="color: #0000ff">&lt;</span><span STYLE="color: #800000">gadget</span><span STYLE="color: #0000ff">&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #008000">&lt;!-- The name will appear on the Gadget Tile and settings window --&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">&lt;</span><span STYLE="color: #800000">name</span><span STYLE="color: #0000ff">&gt;</span>[ YOUR GADGET NAME ]<span STYLE="color: #0000ff">&lt;/</span><span STYLE="color: #800000">name</span><span STYLE="color: #0000ff">&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">&lt;</span><span STYLE="color: #800000">namespace</span><span STYLE="color: #0000ff">&gt;</span>[YOUR CUSTOM NAMESPACE]<span STYLE="color: #0000ff">&lt;/</span><span STYLE="color: #800000">namespace</span><span STYLE="color: #0000ff">&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">&lt;</span><span STYLE="color: #800000">version</span><span STYLE="color: #0000ff">&gt;</span>1.0.0.0<span STYLE="color: #0000ff">&lt;/</span><span STYLE="color: #800000">version</span><span STYLE="color: #0000ff">&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">&lt;</span><span STYLE="color: #800000">author</span> <span STYLE="color: #ff0000">name</span><span STYLE="color: #0000ff">="[AUTHOR NAME]"</span><span STYLE="color: #0000ff">&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">&lt;</span><span STYLE="color: #800000">info</span> <span STYLE="color: #ff0000">url</span><span STYLE="color: #0000ff">="[URL FOR INFO]"</span> <span STYLE="color: #0000ff">/&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #008000">&lt;!-- The logo file will display on the more details window of the Gadget Tile window --&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">&lt;</span><span STYLE="color: #800000">logo</span> <span STYLE="color: #ff0000">src</span><span STYLE="color: #0000ff">="logo.png"</span> <span STYLE="color: #0000ff">/&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">&lt;/</span><span STYLE="color: #800000">author</span><span STYLE="color: #0000ff">&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">&lt;</span><span STYLE="color: #800000">copyright</span><span STYLE="color: #0000ff">&gt;</span>© [COPYRIGHT INFO]<span STYLE="color: #0000ff">&lt;/</span><span STYLE="color: #800000">copyright</span><span STYLE="color: #0000ff">&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #008000">&lt;!-- The description displays in the Gadget Tile window when the Gadget is selected --&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">&lt;</span><span STYLE="color: #800000">description</span><span STYLE="color: #0000ff">&gt;</span>[YOUR DESCRIPTION]<span STYLE="color: #0000ff">&lt;/</span><span STYLE="color: #800000">description</span><span STYLE="color: #0000ff">&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">&lt;</span><span STYLE="color: #800000">icons</span><span STYLE="color: #0000ff">&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">&lt;</span><span STYLE="color: #800000">icon</span> <span STYLE="color: #ff0000">height</span><span STYLE="color: #0000ff">="48"</span> <span STYLE="color: #ff0000">width</span><span STYLE="color: #0000ff">="48"</span> <span STYLE="color: #ff0000">src</span><span STYLE="color: #0000ff">="icon.png"</span> <span STYLE="color: #0000ff">/&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">&lt;/</span><span STYLE="color: #800000">icons</span><span STYLE="color: #0000ff">&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">&lt;</span><span STYLE="color: #800000">hosts</span><span STYLE="color: #0000ff">&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">&lt;</span><span STYLE="color: #800000">host</span> <span STYLE="color: #ff0000">name</span><span STYLE="color: #0000ff">="sidebar"</span><span STYLE="color: #0000ff">&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">&lt;</span><span STYLE="color: #800000">base</span> <span STYLE="color: #ff0000">type</span><span STYLE="color: #0000ff">="HTML"</span> <span STYLE="color: #ff0000">apiVersion</span><span STYLE="color: #0000ff">="1.0.0"</span> <span STYLE="color: #ff0000">src</span><span STYLE="color: #0000ff">="gadget.html"</span> <span STYLE="color: #0000ff">/&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">&lt;</span><span STYLE="color: #800000">permissions</span><span STYLE="color: #0000ff">&gt;</span>Full<span STYLE="color: #0000ff">&lt;/</span><span STYLE="color: #800000">permissions</span><span STYLE="color: #0000ff">&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">&lt;</span><span STYLE="color: #800000">platform</span> <span STYLE="color: #ff0000">minPlatformVersion</span><span STYLE="color: #0000ff">="1.0"</span> <span STYLE="color: #0000ff">/&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">&lt;</span><span STYLE="color: #800000">defaultImage</span> <span STYLE="color: #ff0000">src</span><span STYLE="color: #0000ff">="drag.png"</span> <span STYLE="color: #0000ff">/&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">&lt;/</span><span STYLE="color: #800000">host</span><span STYLE="color: #0000ff">&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">&lt;/</span><span STYLE="color: #800000">hosts</span><span STYLE="color: #0000ff">&gt;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"><span STYLE="color: #0000ff">&lt;/</span><span STYLE="color: #800000">gadget</span><span STYLE="color: #0000ff">&gt;</span></pre>
<p><a HREF="http://11011.net/software/vspaste"></a><a HREF="http://11011.net/software/vspaste"></a></p>
<p>The size of the gadget (or the flyout) can be changed by changing the size of the body of the html, either from CSS, HTML or JavaScript.  If the gadget has two different size when docked or undocked, then one should change the size of the html body using JavaScript in the event handlers for the Dock and Undock events. The utils.js file contains a function ShowOrHide that takes an HTML element and a boolean and hides(or shows) the element, along with any of its children. The function flyout() from utils.js creates a new flyout by specifying the file property of System.Gadget.Flyout, and then setting show to true.</p>
<p>One can specify a settings HTML page by setting the settingsUI property of System.Gadget. The settings page cannot be opened programmatically, only by the user's action (the settings button that the runtime creates for each gadget that supports settings automatically). The event onSettingsClosed is raised whenever the settings page closes, either by pressing ok or cancel. The onSettingsClosing event can be handled in order to save settings. It's handlers have a parameter which has a property closeAction. If this property is event.Action.commit, where event is the parameter passed to the handler, then the ok button was pressed. In order to write settings, one calls the write method and for reading, the read method of System.Gadget.Settings.</p>
<p STYLE="border-right-color: #808080; border-right-width: 1px; border-right-style: solid; padding-right: 4px; border-top-color: #808080; border-top-width: 1px; border-top-style: solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin-top: 20px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; overflow: auto; border-left-color: #808080; border-left-width: 1px; border-left-style: solid; width: 97.50%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom-color: #808080; border-bottom-width: 1px; border-bottom-style: solid">&nbsp;</p>
<p STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px">&nbsp;</p>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px">SystemGadget.Settings.write(<span STYLE="color: #006080">"settingname"</span>,settingvalue);</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px">System.Gadget.Settings.read(<span STYLE="color: #006080">"settingname"</span>);</pre>
<p>When loading the settings page, it is the responsibility of the page (through JavaScript) to read its settings and update the fields in the settings html in order to reflect the current values of the settings. This is the purpose of the loadSettings function available in the settings.html file from the template.</p>
<p>This covers all the main aspects in the template for Sidebar gadgets. Another very useful thing to master is the XMLHttpRequest object in JavaScript. This is used in order to obtain the contents of another page (any webpage) asynchronously. This object is part of the AJAX web programming paradigm. Unfortunately, like CSS, HTML and JavaScript, each browser has its own way of looking at this object. There are at least 3 methods of constructing the XMLHttpRequest  object, the bad news being that only one will work for a browser. So you have to try each method, catching exceptions along the way, until the object creation does not throw an exception or all the methods are exhausted, in the worst case. The good news is that for Sidebar gadgets, only Internet Explorer has to be taken into account. Sample code for creating the request object can be found below.</p>
<p STYLE="border-right-color: #808080; border-right-width: 1px; border-right-style: solid; padding-right: 4px; border-top-color: #808080; border-top-width: 1px; border-top-style: solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin-top: 20px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; overflow: auto; border-left-color: #808080; border-left-width: 1px; border-left-style: solid; width: 97.50%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom-color: #808080; border-bottom-width: 1px; border-bottom-style: solid">&nbsp;</p>
<p STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px">&nbsp;</p>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"><span STYLE="color: #0000ff">var</span> xmlhttp = <span STYLE="color: #0000ff">false</span>;</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">try</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> {</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> xmlhttp = <span STYLE="color: #0000ff">new</span> ActiveXObject(<span STYLE="color: #006080">"Msxml2.XMLHTTP"</span>);</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> }</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">catch</span> (e)</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> {</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> xmlhttp = <span STYLE="color: #0000ff">new</span> ActiveXObject(<span STYLE="color: #006080">"Microsoft.XMLHTTP"</span>);</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> }</pre>
<p>The simplest usage scenario involves using the GET http verb in order to simply retrieve a page.</p>
<p STYLE="border-right-color: #808080; border-right-width: 1px; border-right-style: solid; padding-right: 4px; border-top-color: #808080; border-top-width: 1px; border-top-style: solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin-top: 20px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; overflow: auto; border-left-color: #808080; border-left-width: 1px; border-left-style: solid; width: 97.50%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom-color: #808080; border-bottom-width: 1px; border-bottom-style: solid">&nbsp;</p>
<p STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px">&nbsp;</p>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"><span STYLE="color: #0000ff">var</span> ret;</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px">xmlhttp.open(<span STYLE="color: #006080">"GET"</span>, url, <span STYLE="color: #0000ff">true</span>);</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px">xmlhttp.onreadystatechange=<span STYLE="color: #0000ff">function</span>()</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px">{</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">if</span> (xmlhttp.readyState==4)</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">if</span> (xmlhttp.status==200)</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> {</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> ret=xmlhttp.responseText;</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #008000">//do something with ret;</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> }</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">else</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> {</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #008000">//anything other than success can </span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #008000">//be treated as an error</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> }</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px">}</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px">xmlhttp.send(<span STYLE="color: #0000ff">null</span>);</pre>
<p>The open method takes as parameters the HTTP verb (GET, POST, etc.), the URL for the page to fetch and a boolean that when set to true allows JavaScript to launch the request asynchronously, meaning it keeps on processing the code. If set to false, the execution of JavaScript code stops until the data is fetched or an error occurs. The send method sends the request to the specified web server. If working asynchronously, you can define an event handler for the onreadystatechange event defined by the XMLHttpRequest object to monitor progress. The readyState property indicates the state of the object (4 mean request completed, response available). The status property holds the HTTP status of the response, 200 meaning OK. The actual response can be accessed using the responseText property. When fetching an ordinary webpage, this string will contain the actual HTML of the page.</p>
<p>Sometimes it's useful to do a POST request in order to get to a page that cannot be accessed through an URL. For example for filling out a form in order to obtain some search results (that are not accessible through URL query string parameters). Besides changing the GET into POST, you must also specify the form parameters just as you would query string parameters,only without "?" ('par1=val1&amp;par2=val2') and pass the resulted string to the send method of the request object. Also, some HTTP header have to be set: Content-Type to "application/x-www-form-urlencoded" in order to pass the parameters of the form, Content-length to the length of the string of parameters and Connection to "close" in order to specify that the connection is to be closed once the response is obtained.</p>
<p STYLE="border-right-color: #808080; border-right-width: 1px; border-right-style: solid; padding-right: 4px; border-top-color: #808080; border-top-width: 1px; border-top-style: solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin-top: 20px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; overflow: auto; border-left-color: #808080; border-left-width: 1px; border-left-style: solid; width: 97.50%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom-color: #808080; border-bottom-width: 1px; border-bottom-style: solid">&nbsp;</p>
<p STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px">&nbsp;</p>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px">xmlhttp.open(<span STYLE="color: #006080">"POST"</span>, url, <span STYLE="color: #0000ff">false</span>);</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px">xmlhttp.setRequestHeader(<span STYLE="color: #006080">"Content-type"</span>, <span STYLE="color: #006080">"application/x-www-form-urlencoded"</span>);</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px">xmlhttp.setRequestHeader(<span STYLE="color: #006080">"Content-length"</span>, parameters.length);</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px">xmlhttp.setRequestHeader(<span STYLE="color: #006080">"Connection"</span>, <span STYLE="color: #006080">"close"</span>);</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"><span STYLE="color: #0000ff">var</span> ret;</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px">xmlhttp.onreadystatechange=<span STYLE="color: #0000ff">function</span>()</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px">{</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">if</span> (xmlhttp.readyState==4)</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">if</span> (xmlhttp.status==200)</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> {</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> ret=xmlhttp.responseText;</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #008000">//do something with ret</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> }</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #0000ff">else</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> {</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> <span STYLE="color: #008000">// error occurred</span></pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px"> }</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px">}</pre>
<pre STYLE="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; overflow: visible; width: 100%; color: #000000; border-top-style: none; line-height: 12pt; padding-top: 0px">xmlhttp.send(parameters);</pre>
<p>This concludes a basic, but comprehensive article on developing Sidebar gadgets. Even though I was not very specific, I hope you will have no problem stating your own gadget after reading this post.</p>
<p>Currently I have developed 2 gadgets: one to display postal codes from Romania and one to search for schedule and route information for urban transportation in a few major cities from Romania. The source code for these gadget can be obtained by installing them, then by getting the contents of the "C:\Users\%YourUser%\AppData\Local\Microsoft\Windows Sidebar\Gadgets\GadgetName" folder. Also, these two gadgets are competing in the Romanian edition of <a TITLE="International Gadget Competition website" HREF="http://www.gadgetcompetition.com" TARGET="_blank">Gadget Competition</a>. You can download and vote for my gadgets by clicking the two screenshots below.</p>
<p><a TITLE="Romanian Postal Codes" HREF="http://www.gadgetcompetition.ro/ro/ro/GadgetDetail.aspx?g=3990b9c3-c0b3-4695-a7ce-215c5391ac0a" TARGET="_blank"><img ID="id" SRC="http://www.lazarciuc.ro/ioan/wp-content/uploads/2007/Gadgets/RPC.JPG" /></a> <a TITLE="Romanian Urban Transportation Guide" HREF="http://www.gadgetcompetition.ro/ro/ro/GadgetDetail.aspx?g=44cf1503-baaf-44c3-998d-640cae10086a" TARGET="_blank"><img ID="id" SRC="http://www.lazarciuc.ro/ioan/wp-content/uploads/2007/Gadgets/RUTG.JPG" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lazarciuc.ro/ioan/2007/11/01/creating-a-windows-vista-sidebar-gadget/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Microsoft Student Partner</title>
		<link>http://www.lazarciuc.ro/ioan/2007/09/11/microsoft-student-partner/</link>
		<comments>http://www.lazarciuc.ro/ioan/2007/09/11/microsoft-student-partner/#comments</comments>
		<pubDate>Mon, 10 Sep 2007 22:15:09 +0000</pubDate>
		<dc:creator>cretz</dc:creator>
				<category><![CDATA[Beginnings]]></category>

		<guid isPermaLink="false">http://www.lazarciuc.ro/ioan/2007/09/11/microsoft-student-partner/</guid>
		<description><![CDATA[Yesterday I received the invitation email to create an account on the MSP website. This means I got accepted in the program It also means I have to keep up working on making Microsoft more accessible and easier to understand to students at my university and to anyone else who is willing to listen. Wish me [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I received the invitation email to create an account on the<a HREF="http://www.student-partners.com" TITLE="Microsoft Student Partners portal" TARGET="_blank"> MSP website</a>. This means I got accepted in the program <img src='http://www.lazarciuc.ro/ioan/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  It also means I have to keep up working on making Microsoft more accessible and easier to understand to students at<a HREF="http://www.utcluj.ro/english/index.php" TITLE="Technical University of Cluj Napoca" TARGET="_blank"> my university</a> and to anyone else who is willing to listen.</p>
<p>Wish me luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lazarciuc.ro/ioan/2007/09/11/microsoft-student-partner/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Microsoft Community Bootcamp</title>
		<link>http://www.lazarciuc.ro/ioan/2007/09/06/microsoft-community-bootcamp/</link>
		<comments>http://www.lazarciuc.ro/ioan/2007/09/06/microsoft-community-bootcamp/#comments</comments>
		<pubDate>Wed, 05 Sep 2007 21:39:20 +0000</pubDate>
		<dc:creator>cretz</dc:creator>
				<category><![CDATA[Beginnings]]></category>
		<category><![CDATA[Community]]></category>

		<guid isPermaLink="false">http://www.lazarciuc.ro/ioan/2007/09/06/microsoft-community-bootcamp/</guid>
		<description><![CDATA[&#160; During 30.08.2007 and 02.09.2007 I attended the 4th edition of Microsoft's Comunity Bootcamp as a MSP wannabe. All members of the MSP and MVP programs from Microsoft were invited. In addition, several employees from Microsoft Romania were present there. The location for the event was the Fantanita Haiducului Inn (The Outlaw's Fountain) near Sibiu. [...]]]></description>
			<content:encoded><![CDATA[<p><a HREF="http://www.flickr.com/photos/12744616@N08/1322652217/"><img ALIGN="left" STYLE="width: 150px; height: 200px; margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; margin-top: 2px; margin-bottom: 2px; margin-left: 5px; margin-right: 5px" HEIGHT="200" WIDTH="150" HSPACE="5" VSPACE="2" TITLE="Fantanita Haiducului" ALT="Fantanita Haiducului" SRC="http://farm2.static.flickr.com/1368/1322652217_2139f010e4.jpg?v=0" /></a></p>
<p ALIGN="left">&nbsp;</p>
<p ALIGN="left"> During 30.08.2007 and 02.09.2007 I attended the 4th edition of Microsoft's Comunity Bootcamp as a <a HREF="http://student-partners.com" TITLE="Microsoft Student Partners" TARGET="_blank">MSP</a> wannabe. All members of the MSP and <a TARGET="_blank" TITLE="Microsoft Most Valuable Professional" HREF="http://mvp.support.microsoft.com/">MVP</a> programs from Microsoft were invited. In addition, several employees from Microsoft Romania were present there. The location for the event was the <a TARGET="_blank" TITLE="Fantanita Haiducului" HREF="http://www.cfh.ro/en_index.php">Fantanita Haiducului Inn</a> (The Outlaw's Fountain) near Sibiu. Myself, <a HREF="http://www.cornelrat.ro" TITLE="Cornel's Blog" TARGET="_blank">Cornel</a> and <a HREF="http://adimuresan.wordpress.com/" TITLE="Adi's Blog" TARGET="_blank">Adi</a> shared a car (Cornel's) to get there.</p>
<p>We arrived 15 minutes before dinner, just enough time to check-in. The first thing we noticed was the excellent service from the hotel. At check-in, each of us received a gift bag from Microsoft containing a bootcamp T-shirt, a pc game from Microsoft Game Studios(Halo 2, Rise of Nations or Age of Empires 3), the <a HREF="http://www.microsoft.ro/ark" TITLE="Microsoft Academic Resource Kit" TARGET="_blank">Microsoft Academic Resource Kit</a>, and the schedule for the 4 days spent there. During dinner we met some of the many people there(less than 5 out of about 80). We already knew the MSP's from MAP (Microsoft Academic Program) center of our university and spent most of the time talking to them.<span id="more-7"></span><br />
<a HREF="http://www.flickr.com/photos/12744616@N08/1322647381/"><img SRC="http://farm2.static.flickr.com/1342/1322647381_f9341c5713.jpg?v=0" ALT="Me in front of hotel" VSPACE="2" HSPACE="5" WIDTH="200" HEIGHT="150" STYLE="width: 200px; height: 150px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; margin-left: 5px; margin-top: 2px; margin-bottom: 2px; margin-left: 5px; margin-right: 5px" ALIGN="left" /></a><br />
Friday from 08:00 to 13:00 I attended presentations held by members of Developer &amp; Platform Evangelism team from MS Romania on marketing and strategy and a presentation on the status of the MSP program in Romania held by <a HREF="http://weblogs.studentclub.ro/todi/default.aspx" TITLE="Todi Pruteanu's Blog" TARGET="_blank">Todi</a>.</p>
<p>Todi's presentation really touched me. He showed that MSP members are just a big family that is passionate about technology, pursues its goals and has a lot of fun along the way. I then realized that I would not regret choosing to be a member of this family.</p>
<p>After lunch, the fun part of the day began. Paintball, bow and arrow and paintball gun target practice awaited us not too far from the hotel. Because there were many of us, we split into 2 big groups of people. Each group had about 2 hours for these activities.<a HREF="http://www.flickr.com/photos/12744616@N08/1322648243/"><img STYLE="width: 200px; height: 150px; margin-top: 2px; margin-right: 5px; margin-bottom: 2px; margin-left: 5px" HEIGHT="150" WIDTH="200" TITLE="Blue Team" ALT="Blue Team" SRC="http://farm2.static.flickr.com/1281/1322648243_b057079253.jpg?v=0" VSPACE="2" HSPACE="5" ALIGN="bottom" /></a><a HREF="http://www.flickr.com/photos/12744616@N08/1322649063/"><img STYLE="width: 200px; height: 150px; margin-top: 2px; margin-right: 5px; margin-bottom: 2px; margin-left: 5px" HEIGHT="150" WIDTH="200" HSPACE="5" VSPACE="2" TITLE="Brown Team" ALT="Brown Team" SRC="http://farm2.static.flickr.com/1343/1322649063_54ef494497.jpg?v=0" ALIGN="bottom" /></a><br />
Paintball was played in a death-match championship mode between the 3 teams created. I ended up in the <strong><font COLOR="#0000ff">blue</font></strong> team. You can probably guess how the championship ended... Long story short, I got owned by a head-shot in the first round, and shot ridiculously in the leg the second. Not to complain or anything, but I think the <font COLOR="#0000ff"><strong>blue</strong></font> suits we wore had something to do with the outcome...</p>
<p>Paintball was heaps of fun for all: Ciprian Jichici got blasted by several rounds after making a screaming kamikaze run towards the enemy when he ran out of bullets,  a member of the brown team got a real taste of the paint balls through the mask (guess  I was lucky  I only got hit in the visor).</p>
<p><a HREF="http://www.flickr.com/photos/12744616@N08/1323544436/"><img TITLE="Me Hard at work" SRC="http://farm2.static.flickr.com/1008/1323544436_bb15eca0bf.jpg?v=0" ALT="Hard at work" VSPACE="2" HSPACE="5" WIDTH="150" HEIGHT="200" STYLE="width: 150px; height: 200px; margin-top: 2px; margin-right: 5px; margin-bottom: 2px; margin-left: 5px" ALIGN="left" /></a><a HREF="http://www.flickr.com/photos/12744616@N08/1322651571/"><img TITLE="Presentation" SRC="http://farm2.static.flickr.com/1336/1322651571_9418272aea.jpg?v=0" ALT="Presentation" VSPACE="2" HSPACE="5" WIDTH="266" HEIGHT="200" STYLE="width: 266px; height: 200px; margin-top: 2px; margin-right: 5px; margin-bottom: 2px; margin-left: 5px" ALIGN="right" /></a>Immediately after returning to the hotel I had to continue work on the demo for Saturday. This night was the longest I've had in many months. The project involved using <a HREF="http://msdn2.microsoft.com/netframework/aa904594.aspx" TITLE="LINQ Project Homepage" TARGET="_blank">LINQ</a> to query .NET assemblies. I was responsible for the flashy <a TARGET="_blank" TITLE="Windows Presentation Foundation" HREF="http://msdn2.microsoft.com/en-us/netframework/aa663326.aspx">WPF</a> user interface, but just kept hitting walls in reaching my objective. After finally giving up for the night at 4:30 in the morning, I had 2 hours of sleep and then skipped the morning presentations on MS's technology focus for 2007-2008 in order to continue the demo. I managed to finish the code 15 minutes before we were up for DemoThis!, short demos that got graded by the public to win the grand prize: an XBOX 360. I am proud to say that our project, RLINQ, got 3rd place out of 5. Second place was awarded to a demo on <a HREF="http://msdn.microsoft.com/robotics/" TITLE="Microsoft Robotics Studio" TARGET="_blank">Microsoft Robotics Studio</a> and first place went to a showcase of an <a HREF="http://www.imaginecup.com" TITLE="Imagine cup Homepage" TARGET="_blank">Imagine Cup</a> project on alternative user input using a motion sensor on the wrist. There were two more demo's on .NET Framework internals and a dependency explorer for dlls. I will write a post about my project once I'm satisfied with the outcome (UI still not finished).</p>
<p>After lunch and a couple of hours of much needed R&amp;R, we visited the city of Sibiu. I missed the Bruckenthal Museum, but got to visit the Astra Museum. We also had dinner at the museum's restaurant.<a HREF="http://www.flickr.com/photos/12744616@N08/1332406874/"><img ALIGN="left" STYLE="width: 300px; height: 225px" HEIGHT="225" WIDTH="300" ALT="Group picture at Astra Museum" SRC="http://farm2.static.flickr.com/1400/1332406874_3b9bdd0bac.jpg?v=0" /></a><a HREF="http://www.flickr.com/photos/12744616@N08/1332406288/"><img ALIGN="bottom" STYLE="width: 300px; height: 225px; margin-top: 2px; margin-bottom: 2px; margin-left: 5px; margin-right: 5px" HEIGHT="225" WIDTH="300" HSPACE="5" VSPACE="2" TITLE="Lake at Astra museum" ALT="Lake at Astra museum" SRC="http://farm2.static.flickr.com/1411/1332406288_60ce8aae6f.jpg?v=0" /></a></p>
<p>Sunday morning was the time for presentations on business opportunities. A few members of the MSP program presented their businesses and the Microsoft's Global Technical Support Center presented its offer.</p>
<p>All in all the bootcamp was an unforgettable experience. I've met a lot of people that share my interests and had a lot of fun.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lazarciuc.ro/ioan/2007/09/06/microsoft-community-bootcamp/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Hello world! (V2)</title>
		<link>http://www.lazarciuc.ro/ioan/2007/08/21/hello-world/</link>
		<comments>http://www.lazarciuc.ro/ioan/2007/08/21/hello-world/#comments</comments>
		<pubDate>Tue, 21 Aug 2007 18:00:39 +0000</pubDate>
		<dc:creator>Cretz</dc:creator>
				<category><![CDATA[Beginnings]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I guess I am just starting to become a person since I just started my first blog. I created this blog at the recommendation of Tudor Salomie and Tudor Vlad. My main topics on this blog will be technology and programming. Here are a few things to know about me: MANY people call me Cretz [...]]]></description>
			<content:encoded><![CDATA[<p>I  guess  I  am  just  starting  to  become  a  person  since  I  just  started  my  first  blog.  I  created  this  blog  at  the  recommendation  of  <a  HREF="http://salomie.ro/tudor/">Tudor  Salomie</a>  and  <a  HREF="http://www.tudorvlad.ro/">Tudor  Vlad</a>.  My  main  topics  on  this  blog  will  be  technology  and  programming.</p>
<p>Here  are  a  few  things  to  know  about  me:  MANY  people  call  me  Cretz  (all  my  friends,  professors  I  have  research  projects  with,  my  boss,  etc.)  even  though  my  name  is  Ioan  (John  in  English).  I  am  a  student  in  Computer  Science  at  the  Technical  University  of  Cluj  Napoca,  Romania,  expecting  to  graduate  in  2009.  I  currently  work  at  a  company  that  develops  solutions  for  securities  firms  based  on  Microsoft  technology.  My  main  interests  are  technology,  3D  art  and  music  (more  on  what  kind  of  music  I  enjoy  you  will  find  in  the  about  page).</p>
<p>This  concludes  my  introductory  statement  and  I  hope  to  come  back  soon  with  another  post.</p>
<p>PS.  The  post  is  in  V2  because  I  previously  had  a  blog  on  www.wordpress.com  but  I  switched  to  a  hosted  blog,  but  could  not  manage  to  import  the  old  blog.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lazarciuc.ro/ioan/2007/08/21/hello-world/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

