Theawaykid Corp...'s profileMicrosoft® Theawaykid Co...PhotosBlogListsMore Tools Help

Microsoft® Theawaykid Corporation Live

Theawaykid Corporation company powered by Microsoft

Theawaykid

Occupation
Location
Interests
I am Theawaykid Live Bot.

Weather

Loading...

Wellcome to Theawaykid Space in live. if you have any comments to post, then post here it's our guestbook.


www.theawaykidforum.net.tf - register this forum theawaykid official forum.

Please wait...
Sorry, the comment you entered is too long. Please shorten it.
You didn't enter anything. Please try again.
Sorry, we can't add your comment right now. Please try again later.
To add a comment, you need permission from your parent. Ask for permission
Your parent has turned off comments.
Sorry, we can't delete your comment right now. Please try again later.
You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
Complete the security check below to finish leaving your comment.
The characters you type in the security check must match the characters in the picture or audio.

Radio

Loading...

Windows Vista Countdown

Loading...

Windows Vista Countdown

Loading...

i'm making a difference

Loading...

Get Vista Transformation Pack

Loading...

BBC Online Front Page.

Loading...Loading...

Xbox Live GamerCard

An error occurred loading this module.

Xbox Live Recent Games

An error occurred loading this module.

Photo 1 of 5
More albums (1)
Theawaykid Official blog.
No list items have been added yet.
No list items have been added yet.
July 08

MDP's "Vote Parliamentary System" campaign gining momenturn in Addu

 MDP's "Vote Parliamentary System" campaign gaining momentum in Addu
Addu - A localised campaign has begun in the Atoll yesterday to educate people about the two system of governments and to promote MDP's "Vote Parliamentary System" campaign. Organised and coordinated by MDP members in Addu, the campaign is set to continue until the polling day and the group hopes to obtain 90% turn out and around 80% of the votes in favour of the Parliamentary System, organisers say. The group aims to visit every single household in the island to ensure that they achieve the desired result. A senior delegation from MDP head office led by party chairman visited the Atoll last week. Photos from Addu. Dictator Gayyoom wants to maintain a Presidential System of government, so he can continue to rule as a dictator. Dictator's own party (DRP) is campaigning for that.

Theawaykid Forums News.

Watch out for our new desing and colour full forums. Our Applications have been published and licensed to our company by Microsoft, Nivida, Intel Core2, Windows Vista and also Microsoft OS Vista Developers.
Our Applications works only in Microsoft Vista and Microsoft Windows Xp 2003/Xpnet/2000.
This programm is a Windows Genuine Licensed Programm.For Validating ur system please mail to validategenuine@microsoft.com. and also register to Theawaykid Corporation International Forum (HandhuVaru Forum Entertainment). Here is the link
 
Download Licensed Project.
 
May 09

Spider Man 3 Opening Season

Theawaykid has spent over at $3,000 USD Dollars to be an partner of spider man 3
April 24

Writing Plugins For Windows Live Writer - Adding An Icon

Ok, so now that we have the basis for our Live Writer plugin, we need to start adding things to it to make it look and feel better. The best way is to add an image to the plugin that will appear in the Insert section of Writer.
This is actually very easy, but there are things that you need to remember other wise you will get runtime errors when Live Writer starts up. So first of all, we need to create our little icon, which is what the end user will see in the options and on the right in the Insert field. The thing you have to remember when making this, is its size: it has to be exactly 20x18 pixels. For this demo, I'm going to be using this image: .
The image that I am using I have called icon.gif, and to put it into our project, we can just drag and drop into Visual Studio Express:
This next part is very important otherwise you will be getting an error saying that the image can't be found and you will be wondering why as you can see it in your project. Right click on the image in the solution explorer, select properties; in the properties, you have a section called Build Action, and you want to set it to Embedded Resource:
So going back to the code from the previous article, we need to add in an extra attribute to the plugin, with the resulting code looking like this:
[WriterPlugin("8638eda4-6533-4d19-9da7-ff92ff5a7590","My First Plugin",
Description="This is my first plugin",
HasEditableOptions=false,
Name="My First Plugin",
PublisherUrl="http://scottisafool.spaces.live.com",
ImagePath="icon.gif")] // This line is where we put the image in the code
The part that we are looking at here is the ImagePath="icon.gif" part. This filename has to correspond to what you have put into the project; now, if that file is in a folder, for example "images", then the ImagePath would be "images.icon.gif". Notice we use a full stop instead of a slash. Once you have put that in, you're ready to rock and roll; so hit F6 in Visual Studio and let it compile.
Now when we load Live Writer up, we have our link as before, but now it has the image we have assigned to it:
As before, the source code is available here.
SL

Create Your Own Search Engine

A few years ago, if you wanted your own search engine, you would have had to work very hard in a garage creating algorithms and all sorts of crazy stuff. Now, thanks to Live Search you can create your own search engine with ease, without having to know anything about programming. Zachary Gutt over at the Live Search Blog has written an article on just how to do this. You can create a search engine to look at a particular site and search on that site, like the LiveSide one I created which will let you search through the LiveSide site. Or you can tell it to search multiple sites for a specific thing, like Andy Edmund's Windows Live search macro.

Macros of this kind are becoming increasingly popular, and increasingly useful with over 5000 searches already having been created on Live Search, even more useful is a search like my LiveSide search, if you go to it in Internet Explorer 7 in either XP or Vista, you will notice that you get the following orange button next to your search box:
 

What does this mean? It means you can search using this macro, just click on the drop down arrow and select LiveSide (or whatever the macro is called, it will have a * next to it), and you're good to go. You will also notice in the middle you have a link:
 

This will add that macro as a permanent search to your IE7 searches. So not only can you create your own search engines, but there are now the facilities to easily use them in your everyday use.

Links:
Andy Edmund's Blog - http://blogs.msdn.com/andyed
Live Search Macros (where you can create your own) - http://search.live.com/macros
Live Search Blog - http://livesearch.spaces.live.com/
LiveSide Search on Gallery - http://gallery.live.com/liveitemdetail.aspx?li=fad1526a-4fab-4e3c-b1ad-1872542ffac7&l=4
Live Search Macros on Gallery - http://gallery.live.com/macros/

SL

Writing Plugins For Windows Live Writer - Working With Forms

Most plugins for Live Writer will have a form appear when you click on the Insert link within Live Writer, this form will perform the functionality of the plugin and return the code or text that will be put in the blog entry. Within this form, you can do whatever you want the plugin to do, but for this example I will be keeping it simple and showing the basics, letting you code the rest of the plugin and change whatever settings for your form that you want.

Open up your project (I will be continuing with the "MyNewPlugin" example from the previous posts), and create a new form in your project (for this example I will be calling the form frmMyForm). For this example, my form will have only a text box, an insert button and a cancel button, and all it will do is allow the user to enter some text and have it appear in the blog entry when you press insert. In your form, add a textbox and two buttons (I have also added a label to describe what the textbox does), you should have something like this:

Any other properties of this form can be changed as you wish. Except for the textbox which I have called txbxText, I have kept all the original names that get given when the form items are created.

Now we need to tell the buttons what they are going to be done. We'll start with the cancel button; in the properties of the form, there is a property called CancelButton, just set that to be the cancel button (in this case Button2). For the Insert button, double click it and Visual Studio will create the method for you, we can then add our code into that method. Before we do this though, at the top of the Class (before the initializing method), we need to declare a string variable, so just put in string text;.

In this plugin, all we need to do for the Insert button is assign the DialogResult value, set the text and close the form. So the code we need to put in is:

            DialogResult = DialogResult.OK;
text = txbxText.Text;
this.Close();

Note how we are assigning the text string to equal the text from the textbox. The last thing we need to do for this plugin is just create a string method that returns the text string, this will be called later from the main plugin class.

        public string getText
{
get { return text; }
}

Now, in the main class where we overrode the CreateContent method, we need to add in a new section, so before we had just newContent = "Some text"; we now need to tell the plugin that we want to use our new form:

using (frmMyForm form = new frmMyForm())
{

Now, you might remember in the last post that I mentioned about the DialogResult section (and I also touch upon it above), this is where it actually comes in to play. Once we have told the plugin to use the form, we need to create a new DialogResult that opens up our newly called form, so we insert the next line:

                DialogResult result = form.ShowDialog();

In the form when we click on the Insert button, we set the DialogResult to equal DialogResult.OK, this signifies that an OK was pressed in a dialog, so we can check for this by using an if statement. Within that if statement, we are going to set the newContent value to equal the getText string from the form:

                if (result == DialogResult.OK)
{
newContent = "You entered: " + form.getText + ".";
}

We now need to close off all open sections (using a } ) . Hopefully you can see where everything falls into place, form.getText is the public string that we set to return the text string in the form, and the text string gets the value of the textbox, which is what finally gets inserted into the blog entry.

Any questions about this post please feel free to leave a comment, as this one is a little more involved that the previous two steps.

Download Source Code: here.

SL

Microsoft's Gadget Gallery features non-Microsoft gadgets

Live Clock gadget by LiveGadgets.net

Microsoft's Gadget Gallery today made their "featured gadgets" section open to third party gadgets. Up to now, this space had been populated by Microsoft authored gadgets.

Bruce Kasrel, Senior Product Manager at Microsoft said "We are really energized  by contributions from the community and wanted to feature a few popular, interesting, and unusual 3rd party Web and Windows Sidebar Gadgets."

And what is the #1 featured gadget, you ask? Why it's nothing other than my very own Live Clock.

Working with the Virtual Earth Map Control

The Virtual Earth map control is the power behind Windows Live Local. Using the Virtual Earth 3.1 map control (VE) APIs, you too can create some amazing location based applications of your own. I've worked with VE on a few projects now and have a new tips that I thought I'd pass along. Some of these can be found scattered on the Internet, while others I figured out on my own. In any case, here are some of tips that may help you on your next Virtual Earth project. A word of caution: some of the ideas presented here are undocumented and therefore could change in future versions of the VE API.

Route not showing up?

If you are using map.GetRoute() and are having problems with the route showing up on the map, make sure your web page is encoded with UTF-8. This can be done by adding the a meta tag to the HTML in the <head> section, as show here:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

You can also set the encoding in ASP.NET like this:

Response.ContentType = "text/html";
Response.ContentEncoding = Encoding.UTF8;

Roll your own alerts messages

Some of the VE APIs will cause VE to display a visual error message on the screen. Your application may not want this as VE's default formatting (to some) may leave something to be desired. Here is an example of what is displayed on the map when you use the API function Find() to locate "movie theater".

As you can see, it is asking if we really meant "movie theatre" (note the difference in spelling). While this may be a perfectly acceptable thing to do if the search query came from user input, ours came from hard coding, so of course we meant "movie theater". We don't want to bother the user with unneeded visuals.

Well, lucky for us, there is an undocumented public method of the map control that is called when VE displays an error message. It's called ShowMessage(txt). As you can see in the code below, we can easily override this method to do something else. In this case we simple take the passed parameter (i.e. the error message) and display it within a div element.

When you run the code, click on the button on the left to see what happens natively (i.e. you will get the built-in error message popup). Clicking the button on the right will override the built-in ShowMessage and instruct VE to call our code instead (which simply ignores the error message). We put things back to normal when we're done.

The complete code is shown below. You can run the sample here (or right click and select "Save Target As..." to get the source code).

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>My VE Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body, html, .map {
position:relative;
width:100%;
height:100%;
margin:0;
overflow:hidden;
}
.plotControl {
position:absolute;
right:5px;
top:5px;
width:220px;
padding:5px;
border:solid 1px #cccccc;
background-color:white;
filter:alpha(opacity=90);
-moz-opacity:0.9;
opacity:0.9;
}
</style>
<script type="text/javascript" src="http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js"></script>
<script type="text/javascript">
var vemap; //our map object
var saveShowMessage; //pointer to the original ShowMessage function

function onLoad() {
vemap = new VEMap("map"); //create the map
vemap.LoadMap();
saveShowMessage=vemap.ShowMessage; //save original function pointer

var plotControlEl = document.getElementById("plotControl"); //add our custom control
vemap.AddControl(plotControlEl);
plotControlEl.style.top = "";
plotControlEl.style.left = "";
}
function ourShowMesage(txt) {} //do nothing

function plotDefault() {
vemap.Find("movie theater", "", 1);
}
function plotNoAlert() {
vemap.ShowMessage=ourShowMesage; //redirect alert messages to our code
vemap.Find("movie theater", "", 1, callback);
function callback() {
vemap.ShowMessage=saveShowMessage; //restore original value
}
}
window.onload=onLoad;
</script>
</head>
<body>
<div class="map" id="map"></div>
<div class="plotControl" id="plotControl">
Plot Theaters:
<button onclick="plotDefault();">Default</button>
<button onclick="plotNoAlert();">No Alert</button>
</div>
</body>
</html>

Custom Control positioning with CSS

Like many of you, I prefer to leave much of my formatting up to CSS. But when I added my first custom control to a VE map using AddControl(), I found that the CSS positioning that I specified was being overridden by VE and set to 0,0. After a while, I determined that VE was setting the position of the element itself to style.left="0" and style.top="0". So all you have to do is clear these values after adding the custom control and the values you have in the style sheet will dictate the custom control's position as you would expect.

var plotControlEl = document.getElementById("plotControl"); //add our custom control
vemap.AddControl(plotControlEl);
plotControlEl.style.top = "";
plotControlEl.style.left = "";

Longitude and Latitude encoding

Another little know VE class is VELatLongEncoding. It contains 2 methods, Encode and Decode. Encode takes 2 floating point numbers representing a coordinate latitude and longitude and returns a encoded string 12 characters long. Decode takes an encoded string and returns an array with 2 elements. The first element is a float represents latitude and the second longitude.

Below is a little "do nothing" code that retrieves the current map position, encodes it into a string, decodes it and repositions the map. You will notice some rounding error during the encoding/decoding process if you use a debugger to step through the code.

var enc = new VELatLongEncoding(); //create an instance of the Encoding class
var latlong = vemap.GetCenter(); //get the current map center
var str = enc.Encode(latlong.Latitude, latlong.Longitude); //encode it into a string
var ll_array=enc.Decode(str); //decode the string into an array
vemap.SetCenter(new VELatLong(ll_array[0], ll_array[1])); //reposition the map (to the same place)

I'm going to leave the "why" behind the need to encode/decode a latitude/longitude up to you. I'm sure some of you will find this useful.

Conclusion

There are many resources available for working with Virtual Earth, but the best place to start my be Virtual Earth's home on dev.live.com. There you will find the Virtual Earth Interactive SDK which is a fun way to learn how to use the Microsoft Virtual Earth map control APIs. The Interactive SDK shows you how the map control works and provides the complete code you need to implement the task on your own page.

Also on dev.live.com you will find sample mashups that use the Virtual Earth map control, along with articles explaining how they were written

  • Show Your Contacts on a Map - This demo uses the Windows Live Contacts control and Virtual Earth to (yes, you guessed it) show your contacts on a map.  see article | run demo
  • Start a Party - Takes this approach one a step further by using the Virtual Earth's Find feature to locate restaurants, bars, bowling alleys etc and emails personalized driving directions to your friends.   see article | run demo
  • Crash a Party - Yet another step further by adding events (such as those from eventful.com) and Virtual Earth's "collections".   see article | run demo

You will find that Virtual Earth is relatively simple to start using and, as you dive in deeper, very powerful. Hopefully some of these tips will help you write better Virtual Earth web applications.

Virtual Earth in MOSS 2007

I was tasked with a dual problem the other day and with the help of the Virtual Earth interactive SDK, managed to complete the task in only a matter of a couple of hours.
The first thing to do was to try and get the Virtual Earth map displayed within a web part.  That should be easy enough, just get a Site Viewer web part and point to local.live.com.  Unfortunately this doesn't actually work, all you get is a blank web part.
OK so what now?  Well since we want to eventually manipulate the map ourselves, we really want to host the Virtual Earth map on our own server (kindof), so the next thing I tried was to simply create a new website on the MOSS (Microsoft Office Server Systems - the new name for Sharepoint Server) server, assign it a unique port number and then create a new web application in there that simply uses the VE SDK and displays a map onto an aspx page.
This was no problem to create.  Went back into my MOSS server and pointed the Site Viewer webpart to my now internally hosted page and the Virtual Earth map displayed.
Onto Stage 2.  Virtual Earth is a great technology and database however there are certain things that it obviously doesn't hold.  Things like local people will call buildings perhaps by a name rather than the street address and the VE database won't hold the local name.  This is the same situation my problem falls under, if we want a map of the university I work for with all the local building names so that students/faculty etc. can simply type in the local building names to get directions then we need to create our own database holding the names of the local buildings along with the latitude and longitude of those buildings.
So off to SQL Server to create a very simple database that simply lists the local names of the buildings and the latitude and longitude of each building.
Now back in our web app, we simply add a couple of text boxes below the VE Map for people to type the names of the buildings in and a submit button to show the directions.  Once the submit button is clicked, it should go off to the database, retrieve the longitude and latitude of the two buildings and create a new VELatLong object for each. This can then be used with the GetRoute function to display the route.  In the spirit of VE the calls to the backend to retrive the information from the database was done using XMLHttp so that the page wouldn't need to refresh.

Here's the code for the Virtual Earth WebPart page.
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Map</title>
<script type="text/javascript" src="http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js"></script>
<script type="text/javascript" language="javascript">
      var map = null;
      var XMLHttp = null;
      var BuildingCoords = null;
           
      function GetMap()
      {
         map = new VEMap('map');
         map.LoadMap(new VELatLong(33.504114945297374, -86.79941654205322), 17 ,'h' , false);
      }  
     
      function GetCoords()
      {
    var coords = document.getElementById("Buildng1");
    coords.value = map.GetCenter();
      }
     
      function GetDirs()
      {
    var build1 = document.getElementById("txtFrom");
    var build2 = document.getElementById("txtTo");
    var url = "GetCoords.aspx?Building1=" + build1.value + "&Building2=" + build2.value;
    getXMLHttp();
    if(XMLHttp != null)
    {
     XMLHttp.open("GET", url);
     XMLHttp.onreadystatechange = stateChanged;
     XMLHttp.send(null);
    }
      }
     
      function stateChanged()
      {
    if(XMLHttp.readyState == 4 && XMLHttp.status == 200)
    {
     BuildingCoords = XMLHttp.responseText;
     var brk = BuildingCoords.indexOf("|");
     var Building1 = BuildingCoords.substr(0, brk);
     var Building2 = BuildingCoords.substr(brk + 1);
/*     var bld1 = document.getElementById("Buildng1");
     bld1.value = Building1;
     var bld2 = document.getElementById("Buildng2");
     bld2.value = Building2; */
     var bld1brk = Building1.indexOf(", ");
     var bld1lat = Building1.substr(0, bld1brk);
     var bld1lon = Building1.substr(bld1brk + 2);
     var bld2brk = Building2.indexOf(", ");
     var bld2lat = Building2.substr(0, bld2brk);
     var bld2lon = Building2.substr(bld2brk + 2);
     var point1 = new VELatLong(bld1lat, bld1lon);
     var point2 = new VELatLong(bld2lat, bld2lon);
     map.GetRoute(point1, point2);
    }
      }
     
      function getXMLHttp()
      {
    if(window.ActiveXObject)
    {
     try
     {
      XMLHttp = new ActiveXObject("Msxml2.XMLHTTP");
     }
     catch(e)
     {
      try
      {
       XMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch(e)
      {
      } 
     }
    }
    else if(window.XMLHttpRequest)
    {
     try
     {
      XMLHttp = new XMLHttpRequest();
     }
     catch(e)
     {
     } 
    }
      }
</script>
<style type="text/css">
.map {
   position: absolute;
   top: 20;
   left: 10;
   width: 400px;
   height: 400px;
   border:#555555 2px solid;
}
</style>
</head>
<body onload="GetMap();">
   <div id="map" class="map" onclick="GetCoords();"></div>
   <br />
   <div id="coords" style='position:absolute; top:420px;'>
    From : <input type="text" id="txtFrom" value="" size="20" />
    <br />
    To : <input type="text" id="txtTo" value="" size="20" />
    <br />
    <input type="submit" onclick="GetDirs();" value="Get Directions" />
<!--    <input type="submit" onclick="GetCoords();" value="Get Coords" />
    <br /><br />
    Build1: <input type="text" id="Buildng1" value="" size="20" />
    <br />
    Build2: <input type="text" id="Buildng2" value="" size="20" /> -->
   </div>
</body>
</html>
The commented out sections were simply used to get the latitude and longitude co-ordinates of the various places to store in the database alongside the local name.
And here is the web page that the XMLHttp request calls to return the co-ordinates of the places.
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class GetCoords : System.Web.UI.Page
{
  private string connString = "your connection string goes here";
    protected void Page_Load(object sender, EventArgs e)
    {
   string Building1 = Request["Building1"].ToString();
   string Building2 = Request["Building2"].ToString();
   string latlong1 = GetLatLong(Building1);
   string latlong2 = GetLatLong(Building2);
   string latlong = latlong1 + "|" + latlong2;
   Response.Write(latlong);
   Response.End();
    }
 public string GetLatLong(string Building)
 {
  string latlong = string.Empty;
  SqlConnection conn = new SqlConnection(connString);
  string sql = "SELECT * FROM Campus WHERE Building LIKE '" + Building + "';";
  SqlCommand cmdSQL = new SqlCommand(sql, conn);
  SqlDataReader dr;
  try
  {
   conn.Open();
   dr = cmdSQL.ExecuteReader();
   while (dr.Read())
   {
    latlong = dr["Latitude"].ToString();
    latlong += ", ";
    latlong += dr["Longitude"].ToString();
   }
   dr.Dispose();
  }
  catch
  {
   return String.Empty;
  }
  finally
  {
   conn.Close();
  }
  return latlong;
 }
}
The first page (default.aspx - the one that actually displays the map) has no code behind.
The second page (GetCoords.aspx) really only has code behind.  I didn't touch the .aspx page itself.
And that's it.  Compile the pages, publish them off to your site on the MOSS server and simply use the Page Viewer webpart within MOSS to point to your site.

Windows Vista Countdown Gadgets

Windows Vista Countdown GadgetThis is a re-print of a post that I did on my blog. I thought I'd post it here in case you missed it. Look for my companion article in the next few days about how to write one gadget that runs on Sidebar and Live.com. - Donavon


Windows Vista is almost here! (January 30, 2007 to be exact.) Help celebrate the arrival date of the most anticipated OS release in history with the Windows Vista Countdown gadget.

The gadget can go on your Windows Vista Sidebar, on your Live.com web page and your Windows Live Space! Put it on one or all of these spots to display your excitement.

It's easy to get. Just click on the individual links below to install the gadget.

Windows Vista Countdown shown on Live.com

learn more Add to Live.com

Add the Windows Vista Countdown web gadget to your Live.com homepage.

Windows Vista Countdown shown on Windows Live Spaces

learn more Add to Spaces

Do you have a Windows Live Space? Add the Windows Vista Countdown Gadget to your page. It is designed to fit perfectly in the narrower left and/or right hand columns of a Windows Live Space.

Windows Vista Countdown shown on Windows Vista Sidebar

learn more Add to Sidebar

If you are already running Windows Vista, you can add the Windows Vista Countdown Gadget to your Windows Sidebar. You'll know, with just a quick glance, how long until Windows Vista is released!

Sidebar Installation Instructions:

  1. Click "Add to Sidebar" above to start the download
  2. Save to your local hard drive.
  3. After the file is downloaded, double-click the file to install onto the Sidebar.

*** UPDATE ***

Windows Vista Countdown gadget running on Google As much as Microsoft doesn't like to admit it, people do use Google from time to time.  Not only can you add the Windows Vista Countdown gadget to Live.com, Spaces, Sidebar and your own web page (via a code snippet), but now you can also add it to your Google home page.

Ahh... The miracle of modern technology!

Gadgets: Write Once, Run Everywhere

In this article, I will show you how to develop a web gadget (i.e. a gadget designed to run on Live.com or Windows Live Spaces) that will run on Windows Vista Sidebar without modification to the JavaScipt or CSS! This is something that Microsoft has hinted at ever since Sidebar gadgets were first announced. Using techniques described in this article, that dream could become a reality.

Of the two environments, a web gadget places the most requirement on your JavaScript. You must design your code to be encapsulated into a JavaScript class and use Atlas bindings, etc. So lets start off by first writing a simple web gadget.

Come on Donavon, another clock gadget?

As my example gadget, I chose to write a simple digital clock that displays the time using the current locale's conventions. It's very basic, but actually makes quite a good looking gadget. 

Let's walk through each of the web gadget's components; first the XML manifest:

<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0" xmlns:binding="http://www.live.com">
    <channel>
        <title>Sample Gadget</title>
        <description>A sample web gadget</description>
        <language>en-us</language>
        <generator>Gadget Project Template by LiveGadgets.net</generator>
        <pubDate>Tue, 19 Nov 2006 00:00:00 GMT</pubDate>
        <binding:type>SampleNamespace.SampleGadget</binding:type>
        <item>
            <link>SampleGadget.js</link>
        </item>
        <item>
            <link binding:type="css">style.css</link>
        </item>
    </channel>
</rss>

Nothing crazy here. It's a pretty standard web gadget manifest. A web gadget manifest nothing more than an standard RSS feed with some special binding elements. The gadget framework will each if the item elements relative the the manifest URL. After all items are loaded, the frmework will instantiate the class specified in the element binding:type and call its initialize() function.

The RSS purists reading this will notice that our item elements are incomplete. The RSS 2.0 Specification states "All elements of an item are optional, however at least one of title or description must be present". The gadget framework is forgiving of this omission.

Now for a look at the JavaScript code:

registerNamespace("SampleNamespace");

SampleNamespace.SampleGadget = function(p_el, p_args, p_namespace) {
SampleNamespace.SampleGadget.initializeBase(this, arguments);

var timer;

this.initialize = function(p_objScope) {
SampleNamespace.SampleGadget.getBaseMethod(this,
"initialize", "Web.Bindings.Base").call(this, p_objScope);

var lastSecs = 0;

function displayTime() {
var now = new Date().getTime(); //get the current time in msecs
var nowSecs = Math.floor(now/1000); //round to nearest second
if (nowSecs > lastSecs) { //don't display if same as last time
lastSecs = nowSecs;
p_el.innerHTML = new Date(now).toLocaleTimeString();
}
}
timer = setInterval(displayTime,100);
displayTime();
};
SampleNamespace.SampleGadget.registerBaseMethod(this, "initialize");

this.dispose = function(p_blnUnload) {
SampleNamespace.SampleGadget.getBaseMethod(this,
"dispose", "Web.Bindings.Base").call(this, p_blnUnload);
clearInterval(timer);
timer = null;
};
SampleNamespace.SampleGadget.registerBaseMethod(this, "dispose");


};
SampleNamespace.SampleGadget.registerClass("SampleNamespace.SampleGadget",
"Web.Bindings.Base");

Again, standard web gadget JavaScript. If you are familiar with Microsoft web gadgets (and you probably are if you're reading this article) then this should be petty basic stuff for you. Even so, let's review.

Encapsulation

We start by registering a namespace that we will use. This was Microsoft's attempt to encapsulate each gadget's code into a relatively unique class so that if multiple gadgets from multiple vendors appeared on the same page, the the code would not override on another. C# developers are very familiar with namespaces, but this is something rather new concept to JavaScript developers. Let's look at what could happen if namespaces weren't used. 

Consider this: Company A has written a calculator gadget and named the class "Calculator". Company B has also written a calculator gadget and guess what.. they named their class "Calculator" too. Gee. What do you suppost the odds of that happening were?

But... what if both companies had used namespaces to create their calculator gadgets? Company A would then likely have used the class "CompanyA.Calculator" and Company B would have use "CompanyB.Calculator". This time there are no conflicts. Both companies' calculator gadgets will live in harmony on the same HTML page.

The Windows Live Gadget Developer's Guide puts it this way:

The namespace you use in the registerNamespace() call for your Gadget is used to uniquely identify your Gadget on the platform. To avoid collision with other Gadgets, you should follow the guidelines below: 

  • Use Pascal casing, no underscores.
  • Namespace should be in the following format: CompanyName.TeamName[.Feature][.SubFeature]
  • For independent developers, namespace should be in the following format: FirsNameLastName.MiddleName[.Feature][.SubFeature]
  • Some examples of namespaces following these conventions are: "Microsoft.Live.GadgetSDK", "eBay.Auction.Search", "TimSullivan.George.Weather"

It should be said that this is less of an issue than it was, say a year ago. Microsoft now sandboxes each "non-approved" gadget within its own iframe, so the only thing you may interfere with is the framework itself and not another gadget.

Enough ranting about encapsulation. Lets get back to our example.

Initialize

This is what the framework calls immediately after the class is instantiated. This is normally where you put meat of your gadget code. In our case, we simply setup a timer to periodically call displayTime(), the function that actually outputs the time.

Dispose

dispose() is called by the framework when the gadget exits (i.e. you close the gadget or navigate to another web page). Our code doesn't have to do much here by shut down the timer.

Making it work on Sidebar

How can we take the code you see above and make it work on the Windows Vista Sidebar? Well the first thing you will need is a Sidebar XML manifest.

<?xml version="1.0" encoding="utf-8" ?>
<gadget>
<name>Sample Gadget</name>
<namespace>SampleNamespace</namespace>
<version>1.0.0.0</version>
<description>A sample Sidebar gadget</description>
<hosts>
<host name="sidebar">
<base type="HTML" apiVersion="1.0.0" src="gadget.htm" />
<permissions>full</permissions>
<platform minPlatformVersion="0.3" />
</host>
</hosts>
</gadget>

Unlike a web gadget, a Sidebar gadget must specify an HTML file. This is because web gadgets are simple snippets that run on someone else's page (i.e. Live.com or Spaces). When running on the Sidebar, your gadget is the entire web page.

Notice that unlike a web gadget, a Sidebar gadget's class is not specified in the manifest. We'll do that in the HTML file itself.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<link href="style.css" rel="stylesheet" type="text/css" />
<script src="WebGadgetEmulation.js" type="text/javascript"></script>
<script src="SampleGadget.js" type="text/javascript"></script>
<style type="text/css">
html, body {
margin:0;
padding:0;
}
</style>
</head>
<body>
<div id="application" class="SampleNamespace_SampleGadget"></div>
</body>
</html>

You should all recognize this rather simple HTML. There are however, two things I would like to point out. The first is the value of the class attribute of the application div and the other is the script tag that loads the JavaScript file WebGadgetEmulation.js.

The value you specify for the application class is the JavaScript class of our gadget; the same value set in the binding:type of the web gadget manifest shown earlier. Notice, however, that instead of periods, we use underscores. This is because this is a CSS class which can not contain underscores. All underscores in the class name will be converted to periods to determine the JavaScript class. Remember that Microsoft's first recommendation for naming your namespace stated that it does not contain any underscores? This is why.

The Brains of the Operation

WebGadgetEmulation.js is the magic behind the whole operation. When running as web gadget on Live.com or Spaces the Atlas framework is provided for us. We could package up the entire Atlas framework but this would severely add unnecessary bloat to our gadget. Instead, I've decided to emulate the half dozen or so functions associated with Atlas bindings.

Now lets go through each section of WebGadgetEmulation.js.

registerNamespace()

First we emulate the registerNamespace() function that the web gadget performs. It seperates the passed namespace string into an array using "." as a seperator. Each iten in the array is tested to see if a class (i.e. object) exists starting under the base class "window". If not, am empty object is created. The base class is set to this current class and this process continues untill all classes are created.

function registerNamespace(ns){
var base=window;
var nss=ns.split(".");
for (var i=0; i < nss.length; i++){
if (!base[nss[ i ]]){
base[nss[ i ]]={};
}
base=base[nss[ i ]];
}
}

Inheritence Functions

Next we "stub out" all of the inheritence functions provided bt Atlas Runtime. Unless you specifically use this functionality in your gadget, you won't need these. If you're curious as to what each of these functions actually do, take a look at the Atlas Runtime Reference.

Function.prototype.registerBaseMethod=function(){};
Function.prototype.initializeBase=function(){};
Function.prototype.registerClass=function(){};
Function.prototype.getBaseMethod=function(){
return function() {
return;
};
};

Kicking it all off

Next is the page load function and the corresponding attachment. Being the nice citizens that we are, we don't just want to name our page load function something like "page_load". This could be used by someone else (even though we are the only code in town, but play along). To accomplish this we create a singleton class LiveGadgets.WebGadgetEmulation and within it the method onPageLoad().

First up within onPageLoad() is  to define our "exit strategy" (i.e. setup a function to call when the gadget exits). Obviously George Bush didn't write this code. ;)

registerNamespace("LiveGadgets");
LiveGadgets.WebGadgetEmulation = new function() {

this.onPageLoad = function() {

var tmp, app, appEl, AppFn;

//this is called as the page is unloading
function onPageUnload() {
//call the gadget's dispose() function
try {app.dispose(true);} catch(ex){}
window.detachEvent("onunload", onPageUnload);
app = appEl = AppFn = tmp = null; //clean up
LiveGadgets.WebGadgetEmulation = null;
}

onPageUnload() is a private function that will be setup so that it is called when the page (i.e. the Sidebar gadget) unloads.

Next we get a pointer to the DIV elements where our gadget will live. This is the application DIV from the HTML. As Sidebar gadgets need to define the height, width and background image, we copy these attributes of the application element's currentStyle to the body's style.

        //this is where our gadget will "live"
appEl = document.getElementById("application");

//transfer the background image, height and width
//from the application DIV to the body of the HTML
tmp = appEl.currentStyle.backgroundImage;
appEl.style.backgroundImage = "none";
document.body.style.backgroundImage = tmp;
tmp = appEl.currentStyle.height;
document.body.style.height = tmp;
tmp = appEl.currentStyle.width;
document.body.style.width = tmp;

Here is where we actually call the gadget's initialize() method for he first time. But before we do, we get a pointer to the class in the variable AppFn. If you remember, I said that the JavaScript class is derived from the CSS class specified in the HTML. We convert all underscores inthe CSS class name to periods as CSS names can not contain periods. This is why the Windows Live Gadget Developer's Guide said we can't use underscores in namespaces. After we have a pointer to our gadget class, we instantiate an instance of the class and then call initialize().

        //create an instance of the gadget
AppFn=eval(appEl.className.replace(/_/g,"."));

//app = new SampleNamespace.SampleGadget(appEl, {}, null);
app = new AppFn(appEl, {}, null);

//call the gadget's initialize() function
app.initialize(null);

Next we detatch from the onload function and attache the page unload function. And last but not least, we attach our page load function to window.onload.

        window.detachEvent("onload", LiveGadgets.WebGadgetEmulation.onPageLoad);
window.attachEvent("onunload", onPageUnload); //so we can tear down
};
};

window.attachEvent("onload", LiveGadgets.WebGadgetEmulation.onPageLoad);

Design Considerations

When designing a cross platform gadget, here are some thing to keep in mind.

  • Size - A Sidebar gadget has a maximum width of 130 pixels when docked. It appears to also have a minimum height of 57 pixels, although I haven't found this officially documented by Microsoft. Web gadgets normally have a floating size that varies with the width of the area that they are on. This could be anything, but generally web gadgets are wider than 130 pixels. A good cross platform gadget must be able to adapt. It should be noted that Sidebar gadgets also have an undocked mode that allows them to be larger that 130 pixels wide.
  • Background - A Sidebar gadget sits atop of an unknown background (i.e. your desktop) and you must specify a background image for the body. Most web gadgets simply inherit the background or don't specify one at all. You will need to specify a background image to create a cross platform gadget.
  • Alpha layer PNG - Sidebar run on Windows Vista, thus it uses Internet Explorer 7. Web gadget can be ran on many different web browsers including IE7  and Firefox (both have native support for alpha layer PNG files). Earlier versions of Internet Explorer do not and will display the image against a gray background.
  • Use of Start.* classes - Live.com loads a set of classes in the Start namespace. Although they expose a function rich set of classes, Microsoft warns people about using said classes as they are undocumented and could change at any time. Obviously if you've written a web gadget that uses one of these classes, it will not port over to Sidebar as easily.
  • Web.* and other Atlas Framework classes - The WebGadgetEmulation code presented on this article is really just a bootstrap. If you use any of other Atlas classes, including the Web classes, you will need to emulate those yourself.

Get the Code and/or Install the Gadget

You can download the complete source code and/or insall the gadget on your Sidebar or Live.com or Spaces (of course).

Conclusion

Obviously this won't work for complex web gadget unless WebGadgetEmulation.js is expanded dramatically to provide support for other Altas functions. But, if you must abide by certain restrictions when designing your web gadget, it will go a long way to writing a gadget that runs on Live.com, Spaces and Windows Vista Sidebar.

Vista Countdown for Windows Live Messenger

Donavon wrote a gadget for Live.com, Spaces, and the Vista sidebar that counts down to when Vista officially ships to the general public. So I thought I would continue this using the Messenger Add-In APIs and write the same thing but for Windows Live Messenger and have it display the countdown in your Personal Message area. Now, due to the limitations of the APIs themselves, I found no way to actually have the countdown flow like you would expect, but I have countered that by setting it so that whenever a message is received or sent, or your status is changed, it updates.

So: how do you add this add-in to Messenger? Well, there is no simple way at the moment, but I will give instructions on how to do this. First off, we need to tell Messenger that we want to be able to use Add-ins as Messenger by default doesn't have this option turned on. There is an entry in the Windows registry that we need to add, but for your ease I have a reg file that will do this for you. Just run this registry file and it will make the necessary changes; you will need to fully exit Messenger for this change to take effect.

Once done, you will have your Messenger options looking like this:

Next you will need to download the actual Add-in itself, which you can get here. Unlike the plugins for Live Writer, the add-in DLLs can go wherever you like as we will be telling Messenger where the file resides. So, extract the DLL to a place on your computer and from the Messenger options, go to the Add-ins section and press Add to Messenger.... Point to the DLL we just extracted and load it into Messenger, your options pane will now look like this:

Then just OK out of the options. So our add-in is now loaded into Messenger, now all we need to do is turn it on. To do this, on your main contact list window, click your Display Name, and you will now see an extra option:

Turn on the add-in and you will see your Personal Message change to the countdown:

As an added feature, I have also set it so that if any of your contacts asks "When is Vista released?" (case sensitive), it will automatically reply with that countdown message:

So what are you waiting for, let everyone know when Vista is going to be launched smile_party. One important note though, the filename must be WLMVistaCountdown.VC.dll otherwise the add-in simply will not load.

Downloads
Registry file - www.scottisafool.co.uk/addin.reg
Add-In - www.scottisafool.co.uk/WLMVistaCountdown.zip

SL

Windows Live Writer Plug-in Template

As you all may remember, I wrote a guide on creating your own basic plug-in for Windows Live Writer, well I have now created a template that you can use within Visual Studio and Visual Studio Express so when you create a new project it will put the base code and add in all the references for you, so all you need to do is get cracking and program smile_regular.

The template can be downloaded from here. It is a zip file, and it needs to remain as a zip file, it doesn't need extracting at all. Now, you need to find the folder that Visual Studio is checking for your templates. To do this, open up Visual Studio and click on Tools > Options . Now, in Visual Studio, you will automatically have all the options available to you, in Visual Studio Express, you will need to tick "Show all settings" at the bottom. Once done, click on Projects and Solutions and the directory we are after is the second one down. This is where you need to save the zip file to.

When you start Visual Studio, click on new project and you will see in the "My templates" section that you will have the LiveWriterPlugin template available. If you're in the full Visual studio, you will need to click on the Visual C# to see it.

Using this plugin also means you don't need to worry about putting in the GUID into the writer properties, it all gets put in for you. There are some things that you will need to change, like the class name, and the link that appears on the right, but other than that it is your basic plugin smile_regular. Note: The template does assume that Live Writer is installed on the C: drive on your computer.

Download: http://www.scottisafool.co.uk/LiveWriterPlugin.zip

Any problems with it, please let me know.

SL

The Vista Bus invades Washington DC

I got a chance to meet up with the Vista Bus earlier this morning as it rolled through our nation's capital. In case you haven't heard, Microsoft took a sweet "rock star" bus, loaded with Vista laptops and set out on an 8 day trek along the east coast of the United States, stopping along the way to give demonstrations of Windows Vista (and if you're luck, maybe even a free mouse pad). Head on over to WindowsVistaBlogs.com to read all about the journey.

You can follow the progress of the Vista Bus for yourself with the Where's the Vista Bus gadget.

Pictured below (L-R) are Brandon LeBlanc of MSTechToday, Donavon West of LiveGadgets.net (me) and Nick White of Microsoft.

Vista Bus - Brandon LeBlanc, Donavon West, Nick White

Windows Live Spaces and Videos, finally together

Last night the Windows Live Spaces team blog announced that they had released a new version of Spaces (link). According to the post there are a few backend changes, but the main change is something that people have been waiting for for a long: Embedding Videos. That's right folks, you can now embed your favourite videos into your Live Space blog post, as long as the video supplier uses a flash based player.

So how do you add a video then? Well you need to get the embed html code from the video website, most have it in an easy to find box on the video page, then go to your Live Space and add a new blog entry, you will now see an extra option at the bottom of the page:
 
Click on the Embed videos link and paste your embed code in the given space and you're done.

The other main change is you can now subscribe to someone's blog with Windows Live Alerts:

Coming back to the video embedding, don't forget you can also use Windows Live Writer to post your blog entries, complete with video. Speaking for myself though, I have tried using my video plugin to embed the video and at the moment it still puts in screenshot rather than the embed code. I will be working this one out with the Spaces team and/or Live Writer team so expect a new release of that soon.

SL

Windows Live Search SDK Releazed

The Windows Live Dev site has just posted that the Windows Live Search SDK is now available on MSDN (link). So what's new in this release? According to the blog post it includes:

  • Lots more sample code!
  • Weather and Movie Time queries
  • Support for keyword/placename queries (ex: coffee seattle)
  • Increased number of results returned (from 250 to 1,000)
  • Easier to write paging algorithms
  • Support for file type filtering
  • Support for the zh-CN market for Web and News queries
  • Local query support in additional markets
  • Enhanced functionality for SearchTags (ex: filtering)

So what do you need to know for making an application that utilises Live Search? Well, a good knowledge of the SOAP Protocol really, the rest can be done in C#. First off though, you will need to get yourself an Application ID, which you can get by following the instructions on the Getting Started with the Windows Live Search API page. There's also a pretty good example on the Code Samples page that is exactly as it says, a Comprehensive Windows Forms Application (C#).

Go take a look and see what kind of apps you can make, how you can integrate it into your own existing apps. If you do go ahead and use this, leave a comment on this entry and if I get enough apps, I might do a write up on them.

SL

Windows Live SDKs

Over the last year, we've had all sorts of different SDKs released for Windows Live products and services, but yesterday saw the announcement of not another seperate SDK, but the collective Windows Live SDKs. I think this has been a given all along, but we have the "official" status now. So what SDKs are bound by the WL SDK? Taken from the Windows Live SDK page on MSDN, it includes all the following:

Microsoft adCenter API - The Microsoft adCenter application programming interface (API) enables you to create applications that create and manage adCenter campaigns, orders, keywords, and ads; obtain the status on orders, keywords and ads; pause and resume orders; generate keyword estimates; generate reports about campaign performance; and perform order targeting.

Windows Live™ Search Web Service API - The Windows Live™ Search Web Service is an Extensible Markup Language (XML) Web service with a SOAP API. The Search Web Service enables you to submit queries to and return results from the Windows Live Search Engine. The Search section also features articles that cover a variety of technical topics and coding techniques for the Windows Live Search developer.

Messenger Activity SDK - The Messenger Activity software development kit (SDK) contains technical information about how to develop and test single-user and multi-user applications by using the Activity object model. The SDK also provides detailed information about development and testing requirements that your Activity must meet and how to increase the usage of your Messenger Activity application.

Windows Live™ Messenger Add-In API - By creating add-ins for the Windows Live™ Messenger 8.0 client, you can add new abilities to the client. This document explains how you can create add-ins and make them available to customers. This release of the Messenger Add-in API relies on the Microsoft .NET Framework as the hosting platform. Using the Code Access Security feature of the .NET Framework, you can isolate add-ins from the system on which they run.

Windows Live™ Spaces MetaWeblog API - The MetaWeblog API programming interface enables external programs to get and set the text and attributes of Weblog posts. The API uses the XML-RPC protocol for communication between client applications and the Weblog server.

Virtual Earth Map Control SDK, Version 4.0 - Virtual Earth provides the power behind Live Maps, an online mapping service that enables users to search, discover, explore, plan, and share information about specific locations. By using traditional road maps, labeled aerial photo views, low-angle high-resolution aerial photos, and proximity searching capabilities, Virtual Earth provides unique opportunities for developers to incorporate both location and local search features into their Web applications. The Virtual Earth map control software development kit (SDK) consists of a set of conceptual topics about Virtual Earth and a complete set of reference topics that cover the Virtual Earth map control application programming interface (API). Version 3.2 of the Virtual Earth Map Control SDK is also provided to support those developers who are using the earlier version of the map control and have not yet migrated to version 4.0. In addition, the Virtual Earth section features articles that cover a wide variety of technical topics and coding techniques for the Virtual Earth developer.

Windows Live™ Alerts SDK - The Windows Live™ Alerts SDK, version 2.5, enables developers familiar with Simple Object Access Protocol (SOAP) to programmatically integrate with the Alerts notification service and perform administrative tasks that are not available using the Windows Live Alerts web site.

Windows Live™ Custom Domains SDK - The Windows Live™ Custom Domains software development kit (SDK), version 1.2, enables developers to programmatically manage their Windows Live Custom Domains user base by means of a Web service. This SDK is intended for customers and partners who want to programmatically accomplish many of the administration tasks that are available on the Windows Live Custom Domains Web site in addition to tasks that are not available on the Web site, such as importing and exporting user lists.

Windows Live™ Expo (Beta) API - The Expo API defines a set of Web services enabling customers to programmatically access the Expo classifieds listings database, a collection of location-tagged classifieds listings in categories like merchandise, real estate, autos, jobs and commercial services.

Windows Live™ ID Service - Read all about the evolution of Microsoft Passport into Windows Live™ ID and how it helps make life online better for both users and developers in this white paper, which describes the technology behind an upcoming release of a new service offering for Windows Live developers.

Windows Live™ Toolbar Custom Button SDK - The Windows Live™ Toolbar Custom Button Software Development Kit (SDK) shows how you can extend Toolbar with custom buttons. This SDK provides a quick overview of how users can install publicly available buttons and create their own simple buttons. Most of this SDK, however, shows how you can use XML to create more sophisticated custom buttons, and how you can distribute those buttons to users.

Windows Live™ Writer SDK - Two sets of APIs are provided in this beta version of the SDK: The Application API, for launching Writer to create new posts or "Blog This" items for links, snippets, images, and feed items; and the Content Source Plugin API, for extending the capabilities of Writer to insert, edit, and publish new types of content. The SDK documentation contained in this beta version of the SDK is preliminary. The documentation will be extended and improved in a subsequent release of the SDK.

That enough for you smile_wink. Thanks to AndyD for the tip on this one.

SL

Windows Live ID SDK (Alpha)

Brian Kramp today announced the availablitiy of the Windows Live ID SDKs in its alpha version. The Windows Live ID SDK basically means that you can add the security and ease of Windows Live into your own applications. If you have a program that requires the user to log in, you can now use Windows Live ID to do so.

To download the SDK, go to https://connect.microsoft.com/site/sitehome.aspx?SiteID=347 and click on the download now link. You will then need to sign in using your Windows Live ID (if you have never used Connect, you might need to quickly register too). So what does the SDK include? There are three main things that are included, the documentation for the SDK, including all the API calls etc, then there is a sample application that demonstrates how this can all be applied, and finally the source code for the sample application, so you can see how it works and apply that to your own programs.

Just for your viewing pleasure, here is a screenshot of the sample application:

As you can see, the sign in interface for this application looks remarkably like the Live Messenger sign in screen, and uses the same data store for the email addresses it shows, complete with display picture.

There could be great scope for this in third party applications, and will be interesting to see what companies adapt this into their programs.

Update: The SDK has just been announced on the Windows Live ID Team blog here. In which it also gives the link for the MSDN forums that you can go to with queries/feedback regarding the SDK. Still nothing from http://dev.live.com though.

SL

Beta Testers Required

As you may or may not know, I have a video plugin for Windows Live Writer which will allow you to insert a video from sites such as MSN Soapbox and Youtube into your blog entries. This week I have decided to do a full rewrite of the plugin, literally starting from scratch, loading up my Live Writer Plugin template and writing a brand new video plugin. with improved performance, a new interface, new site support, and biggest of all, the ability to resize your videos on the fly.

Version 3 is almost complete now, but I need some real users to try the plugin out and give me their feedback. So if you often post videos on your blog, then please email me at wlm[at]scottisafool.co.uk and let me know of your interest.

Anyway, I shall leave you with a screenshot of the new GUI smile_regular

SL

Soapbox Gadget For Vista

The Soapbox Team Blog have posted about a new gadget created by ToddOs that will allow you to browse videos on MSN Soapbox.

"This gadget allows you to easily search Soapbox Videos. Search results are displayed 9 thumbnails at a time, organized by page.
Background color is customizable, by selecting the settings option."

So if you like Soapbox and want to easily search through the videos from your sidebar, then download the gadget from Live Gallery.

Source: Soapbox Team Blog

SL

REMIX MIX contest announced

Calling all designers. Win one of 3 trips to MIX07 in Las Vegas in a prize package worth over $3000.  Just head over to http://www.visitmix.com/remix/contest/ to find out more and to download the REMIX zip file. 10 honorable mentions will win a Zune!

Last year I was one of the winners. This year it's your turn as I'll be judging the contest on a panel with four other distinguished judges.

Good luck!

"Live In A Box" - A Way To Learn Live SDKs

The Windows Dev blog posted last week about a new project that has appeared on CodePlex called "Live In A Box". First thing to note about this project is that although it's been made by people who work at Microsoft, it's not actually an official offering from the software company. So, what exactly is this project about? Well basically it's a way to learn some of the different Live API offerings, quickly showing you pre-existing code and allowing you to modify it and get to learn what exactly is going on.

The project itself is an ongoing project and is continually being built upon and new things added; currently it shows you an example of the following:

  • Search Application (using the Live Search SDK) 
  • Map Application (using the Virtual Earth SDK)
  • Messenger Activity
  • Web Gadgets (live.com/Spaces)
  • Windows Live Contacts Control
  • WPF/e

The project itself is a good place to start off if you're thinking of doing something using any of the above mentioned technologies as it gives you a basis that you can improve upon and get to grips with some of the Windows Live platforms.

Notes: The installer requires you to have IIS installed, if you don't, the Live In A Box files won't be installed; If you're using Vista, please make sure you read the instructions on the project page on CodePlex otherwise the installer won't install.

SL

Writing A Quick Application That Uses Windows Live ID

With the release of the Windows Live ID SDK comes the ability to add the trusted security of Windows Live to your application, but how much work is needed to actually get this functionality into your program? Turns out, not a lot. In fact, for just getting a working sign in window and a message to show that the user is authenticated, it only requires about 5 lines of code that you need to write. Here I will show you how to add basic functionality to your program to give you a quickstart with using the SDK.

I'll assume at this point that you have already downloaded and installed the SDK. So we first of all need to add the reference to our project to let Visual Studio know what to use, the reference we need to add is Microsoft.WindowsLive.Id.Client:

We will also need to put the using code in:

using Microsoft.WindowsLive.Id.Client;

Now, I mentioned that you only really need just 5 lines of code for this so I'll quickly show you those lines of code and then expand upon that and show a small sample program. Now, first off create yourself a Windows Form in Visual Studio, something like the following:

The code for when button1 is pressed is simply as follows:

        private void button1_Click(object sender, EventArgs e)
{
IdentityManager idmgr = IdentityManager.CreateInstance("My App ID",
"My Own Sample Program");
Identity id = idmgr.CreateIdentity();
id.Authenticate();
if (id.IsAuthenticated)
MessageBox.Show("User authenticated");
}

And that's it, that will bring up the familiar Windows Live sign in window, once signed in, it will pop up with a message saying you're logged in. That is the real basics of using the Windows Live ID SDK. Now I'll show you a quick example that will allow the user to sign out, too, and also have part of the form be changed by the fact that you've signed in.

Create yourself a Windows Form, and put in a button (btnSignIn) and a label (lblInfo), mine looks like this:

We start off with declaring the two main objects which are the IdentityManager and Identity Objects:

namespace LiveIDApp
{
public partial class frmMain : Form
{
IdentityManager idmgr;
Identity oID;

public frmMain()
{
InitializeComponent();
idmgr = IdentityManager.CreateInstance("ScottIsAFool;wlm@scottisafool.co.uk;Scøtt's Test App",
"Scøtt's Windows Live ID Test App");
oID = idmgr.CreateIdentity();
}

Now, you'll notice that when we use the CreateInstance method we have a string that is the AppID. This should typically be made up of CompanyName;EmailAddress;ApplicationName, followed by the ApplicationName string in its own field, this is what will be shown in the Live ID window when the user signs in.

This time when the button is clicked, we're going to do just a little bit more than in the quick example above:

        private void btnSignIn_Click(object sender, EventArgs e)
{
// Check if a user is already signed in
if (!oID.IsAuthenticated)
{
// Opens the Sign in window. On successful sign in, oID.Authenticate()
// will return true.
if (oID.Authenticate())
{
// Change the label text to show we're signed in and as whom
lblInfo.Text = "Signed in as: " + oID.UserName;
btnSignIn.Text = "&Sign Out";
}
else
{
MessageBox.Show("Authentication failed");
}
}
// If a user is signed in, then we are assuming that they want to sign out
else
{
// This closes the active connection to the server
oID.CloseIdentityHandle();
// Resets the label and button text
lblInfo.Text = "Not signed in";
btnSignIn.Text = "&Sign In";
}

}

And that's it, so now when we click on the button, we will get the Windows Live sign in window:

And then once we have successfully signed in, our application will now look like this:

So there we have a basic example of how to use the Windows Live ID SDK. There are more uses of this, and they can be seen in the SDK documentation, and if you really want to utilize this SDK, I would recommend looking through it and seeing what else can be done.

Note: With this example I have put in no error handling.

Download Example Source Code

SL

1 in 3

What is 1 in 3? Your odds of winning a one of 10 Zunes or 3 trips to Las Vegas in the Remix MIX contest. Right now there are about 35 entries in the Remix MIX Gallery. Of those, 5 are ineligible as they were posted by judges and/or employees. So, even if you have only heard the word CSS and can only draw stick men, you have a good shot a winning (taking nothing away from the great entries already submitted of course). Your odds go up dramatically if you have talent. :)

Here are a few examples of remixes that I've done (I didn't want to show favoritism by showing other's remixes).

Boooooring Remix     pure|simple Remix     Spot On Remix

I'm judging the competition and would like to hear what hear from you as to what your favorites are. It probably won't sway my decision, but it can't hurt. Leave a comment below with the name of your favorite from the Remix MIX Gallery, along with why you think it should win.

And good luck if you decide to enter a remix of your own. You'll need to hurry though, as you last chance to submit a remix is midnight PDT on April 10th!

*** UPDATE ***

There was a snafu that resulted in the submission form shutting down 24 hours too early; midnight April 10th instead of 11:59pm April 10th as the legal page described. This caused quite a bit of panic with the last minute remixxers. I'm happy to announce that Beth at Microsoft has corrected the situation and submissions have been re-opened.

*** UPDATE 2 ***

In an 11th hour surge, over 30 remixes were submitted. Now that your work is done, the judges work is just beginning. We must sort through the plethora of remixes to find the 3 gems along with 10 "runners up". I have a few in mind but have by no means finalized my list.

The names of all of the judges were released yesterday. They include Ryan Freitas, Ryan Stewart, Forest Key, Adam Kinney and myself. You can red more about the judges, including their bios, on the Mix blog at http://www.visitmix.com/Blogs/News/remix-contest-ends-tonight-meet-the-judges/
 
*** LAST UPDATE ***
 

Writing Plugins For Windows Live Writer - Using Settings In Your Plugin

So far I've shown you how to create basic plugins for Windows Live Writer, in this next guide I'm going to show you how you can use settings in your plugin to make things easier for your end user, you can create default options (that they can customise if you allow them). I'm going to show you how to do exactly that, have the user be able to change the default settings that are applied everytime the plugin is called. I will be carrying this on from my last guide so if you haven't got that already, download the source now.

First thing's first, what options does your plugin need? This is still going to be a simple plugin, so anything you put in can't be changed once inserted, so the options and settings need to be something that the user would want. The simple plugin we have been using so far in this series has been to insert some simple text into the blog entry, so the option I'm going to use is to make it default to use a bold style for the text.

For the settings, we need to create a new Class that will contain all the settings' properties. In this example, I have called it PluginSettings.cs. Before we call the constructor, we need to just declare an instance of the IProperties Interface:

 

        private IProperties m_properties;
private const string DEFAULTBOLD = "DEFAULTBOLD";

At this point, I also like to declare constants for the setting properties, these will be used in a bit, I will note that you don't need to put these in, this is more a personal preference for me.

The settings class needs to be passed an IProperties instance so that it has a point of reference, then you need to set the IProperties instance you just declared to be the one that gets passed to the class. So your constructor should look like this:

 

        public PluginSettings(IProperties properties)
{
m_properties = properties;
}

Next we write the properties for the settings class, you will need one of these for each of the settings you use in your plugin and they can be one of five different types: int, string, boolean, decimal or float. For this plugin, I'm going to use a boolean type as I want it to either be yes (true) or no (false) for whether the text should be bold or not. This plugin only requires one property, and mine looks like this:

 

        public bool DefaultBoldOption
{
get { return m_properties.GetBoolean(DEFAULTBOLD, true); }
set { m_properties.SetBoolean(DEFAULTBOLD, value); }
}

You'll see that this is where we used the constant value I mentioned earlier, this is the property name that tells the plugin which setting to get, and you'll see that there are two sections, a get section, and a set section. The get section must return a value of whatever type you're using, in this case, a boolean value, so we use the IProperties' GetBoolean method and put in the property name that we want. The set section is where we assign what the property's value is going to be. This will all become clearer a bit further on. And that's the settings class done with.

Now we move back to the plugin's main class. To start off with, declare a PluginSettings object (I've called it m_defaultoptions), this will be set next. To do this, we need to override the Initialize method so that we can get the IProperties object for that plugin. Declaring the settings originally outside of this method means that the default options are available to the rest of the plugin. It should look like this:

 

        public override void Initialize(IProperties pluginOptions)
{
base.Initialize(pluginOptions);
m_defaultsettings = new PluginSettings(pluginOptions);
}

Notice how we pass the PluginSettings class the IProperties object so that it knows where it's reading/writing from.

You might remember in the previous parts to this guide, in the WriterPlugin section we had HasEditbleOptions set to false, well now we're going to set it to true, this will enable the Options button in the plugins part of the preferences. Before we tell the plugin about the options window, let's create the form first. So add a new Windows form to the project (I called mine frmOptions.cs) and make your form look something like this:

Now, hit F7 and go into the code for the form and you will need to add the using WindowsLive.Writer.Api; namespace again. At the top, declare a new instance of the PluginSettings class, and in the constructor we need to then set that to be the PluginSettings that is being passed to the form, then apply the default settings. So your code should look like this:

        public frmOptions(PluginSettings settings)
{
InitializeComponent();
m_settings = settings;
// This sets the checkbox to be whatever the default option was
chBoldOption.Checked = m_settings.DefaultBoldOption;
}

Now these settings are only basic, so when we press the save button, there's only one setting that needs to be saved, which we do with the following line:

        private void btnSave_Click(object sender, EventArgs e)
{
// This actually sets the option to be whatever the checkbox is currently at
m_settings.DefaultBoldOption = chBoldOption.Checked;
this.Close();
}

Right, back to the main plugin class. Now that we have our options form, we need to tell the plugin what to do when the options button is pressed; so we need to override the EditOptions method. In this method, we are literally just going to create a new instance of the PluginSettings and use the stored options for that plugin, then pass that to the form, as follows:

        public override void EditOptions(IWin32Window dialogOwner)
{
PluginSettings options = new PluginSettings(this.Options);
frmOptions op = new frmOptions(options);
op.ShowDialog();
}

Now, the final thing to do is actually apply these settings to the text that is put into the blog entry. For this plugin, this is simple as there is only one setting. So in the CreateContent method, we had the if statement to say that if (result == DialogResult.OK) then we make newContent = form.getText. All we will do for this plugin is add an extra if statement after that which checks whether the setting is to be applied or not, and as we have made this setting a boolean value, it makes it even easier to check. So the if statement we want is basically this:

                    if (m_defaultsettings.DefaultBoldOption)
newContent = string.Format("<b>{0}</b>", newContent);

And that's it, you should be done smile_regular

As always, the source code that I have used can be downloaded here.

Any problems, please leave a comment.

SL

April 20

Windows Live Hotmail Plus mailboxes go to 4GB

Along with recent news of Windows Live Hotmail being updated to M10 and talk of it being released in the coming weeks,the latest news is that Hotmail Plus users will now notice the storage meter showing 4GB. As usual the Mail team is rolling this out in stages, however you can at least feel slightly superior to your Gmail friends now. Just don't mention it to anybody with a Yahoo! Mail beta account though.

Further information on the rollout is available on the Hotmail Support blog and there are some more Windows Live Hotmail Plus features if you are interested. Here's a shot in the dark - anybody heard what will be happening to MSN Premium?

 

Feed

The owner hasn't specified a feed for this module yet.

Theawaykid Corporation Feed

Loading...Loading...

Horoscopes

Loading...