While Amanda Silver of Microsoft demonstrates code separation through partial types in a clip on Channel 9, I remain convinced that this is solely of use to those creating development tools and frameworks.
Updated 23-Jul-06: This topic is now out of date.
Perhaps the biggest challenge facing organizations and those seeking to facilitate systems within them is complexity. And that complexity has two facets:- content and process.
Update: you can download the script here and the script engine here. If your Gmail account name contains a 'dot', you should use the /a command line switch e.g. axscript /a:myaccount,mypassword gmail.csx
Transforming the Atom feed XML returned from Gmail to HTML and displaying the result in your web browser - makes the previous example somewhat more useful.
One way is to create a small transformation function (using a XSLT document like that provided by manalang.com) say in C#, and save it as xml.cs ...
public class XML
// an atom 0.3 transformation style sheet
public static string AtomXsl =
// transform xml using a transformation document
public static string Transform(string xmlDoc, string xslDoc)
XmlDocument doc = new XmlDocument();
XslTransform transform = new XslTransform();
StringWriter writer = new StringWriter();
transform.Transform(doc, null, writer, null);
Then replace the print(feedAsXML) line at the bottom of gmail.vb with the following code ...
' transform the atom xml feed to html
feedAsHtml = XML.Transform(feedAsXml, XML.AtomXsl)
' write the html to a temporary file
tempOutputFile = Path.GetTempFileName() & ".htm"
writer = new StreamWriter(File.Open(tempOutputFile, FileMode.Create))
' display file in browser
Now if you add xml.cs to the command line, your unread gmail should be displayed in your web browser e.g. ...
ax[w]script [username] [password] gmail.vb xml.cs
For the record, here is the gmail.vb file in C#
// gmail.cs - gets unread mail from a gmail account as an atom feed
// for Alintex Script - www.alintex.com
// usage: ax(w)script [username] [password] gmail.cs
// check commandline arguments
if (args.Length < 2)
print("gmail.cs - gets unread gmail as an atom feed");
print("Usage: ax(w)script [username] [password] gmail.cs");
WebClient client = new WebClient();
byte bytes = Encoding.ASCII.GetBytes(args + ":" + args);
client.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(bytes));
const string gmailURI = @"https://gmail.google.com/gmail/feed/atom";
StreamReader reader = new StreamReader(client.OpenRead(gmailURI));
string feedAsXml = reader.ReadToEnd();
// transform the atom xml feed to html
string feedAsHtml = XML.Transform(feedAsXml, XML.AtomXsl);
// write the html to a temporary file
string tempOutputFile = Path.GetTempFileName() + ".htm";
StreamWriter writer = new StreamWriter(File.Open(tempOutputFile, FileMode.Create));
// display file in browser
Gmail currently provides a list of unread emails in a subscriber's inbox as an Atom feed. While that may change in the future, the following Alintex Script code will retrieve and print the returned XML given a username and password.