function page 4 - Dave's Blog

Search
My timeline on Mastodon

Chris Harrison - Rethinking the Progress Bar

2008 Mar 3, 3:32Research paper on progress bar UI improvements counters my thoughts on progress bar demanded for case where we only know when we're done: set progress as function of time where function has asymptote at %100. Zeno's progress bar.PermalinkCommentsdesign gui hci interface paper progress progress-bar usability research

Global Positioning System - Wikipedia, the free encyclopedia

2008 Jan 18, 7:00Overview article on the functionings of GPS.PermalinkCommentsgps reference wikipedia article electronics radio

Summary of data visualisation utilities measured by functionality - Swivel

2008 Jan 3, 12:30This just in from Swivel: Swivel is the best!PermalinkCommentsswivel data visualization website

Brief Miscellany

2007 Oct 29, 7:07Two brief updates to previous posts:

  1. I noted that I had a new entry on the IE blog. Some comments on the IE blog have recently been rude in their request for information on future versions of IE. For example see the first two comments responding to my post. Feeling bad about that I looked at my posts entry on delicious and saw the following:

    "This is the first blog from the IE team that I have found rigorous and informative. I skipped to the bottom to find it was written by one of the TA's from my first class at Cal Poly."

    That made me feel a bit better and I was able to catch up with someone from college. Thanks Kris!

  2. I previously had my GPS set with an Australian accent. When it encountered 'WA', as in the abbreviation for Washington in freeway exits, it pronounced it 'Western Australia'. Now I've got it with a British accent and WA is just 'W.A.' but when I tell it to drive to 'MS', the name of my saved location for work, it pronounces it 'Manuscript'.
PermalinkCommentsmicrosoft blog gps personal nontechnical

IEBlog : URI Comparison Functions

2007 Oct 24, 1:19My blog post on unmanaged Win32 URI comparison functions.PermalinkCommentsie blog me uri microsoft win32 windows

IEBlog: URI Comparison Functions

2007 Oct 24, 6:20I have a new post on the IE Blog on the topic of Win32 URI Comparison Functions.
I've blogged there previously on the topics of IPv6 URIs in IE7, International Mailto URIs in IE7, File URIs in Windows, and CreateURLMoniker Considered Harmful. Hooray for URIs!PermalinkCommentsmicrosoft technical blog url win32 ie windows uri

XSL Transforms in JavaScript

2007 Oct 7, 4:12In a previous post I mentioned an xsltproc like js file I made. As noted in that post, on Windows you can write console script files in JavaScript, name them foo.js, and execute them from the command prompt. I later found that MSDN has an XSLT javascript sample which looks similar to mine, but I like mine better for the XSLT parameter support and having a non-ridiculous way of interpreting filenames. The code for my xsltproc.js follows. The script is very simple and demonstrates the ease with which you can manipulate these system objects and all it takes is opening up notepad.
var createNewXMLObj = function() {
   var result = new ActiveXObject("MSXML2.FreeThreadedDOMDocument");
   result.validateOnParse = false;
   result.async = false;
   return result;
}

var args = WScript.arguments;
var ofs = WScript.CreateObject("Scripting.FileSystemObject");

var xslParams = [];
var xmlStyle = null;
var xmlInput = null;
var inputFile = null;
var outputFile = null;
var error = false;

for (var idx = 0; idx < args.length && !error; ++idx)
   if (args.item(idx) == "-o") {
      if (idx + 1 < args.length) {
         outputFile = ofs.GetAbsolutePathName(args.item(idx + 1));
         ++idx;
      }
      else
         error = true;
   }
   else if (args.item(idx) == "--param" || args.item(idx) == "-param") {
      if (idx + 2 < args.length) {
         xslParams[args.item(idx + 1)] = args.item(idx + 2);
         idx += 2;
      }
      else
         error = true;
   }
   else if (xmlStyle == null) {
      xmlStyle = createNewXMLObj();
      xmlStyle.load(ofs.GetAbsolutePathName(args.item(idx)));
   }
   else if (xmlInput == null) {
      inputFile = ofs.GetAbsolutePathName(args.item(idx));
      xmlInput = createNewXMLObj();
      xmlInput.load(inputFile);
   }

if (xmlStyle == null || xmlInput == null || error) {
   WScript.Echo('Usage:\n\t"xsltproc" xsl-stylesheet input-file\n\t\t["-o" output-file] *["--param" name value]');
}
else {
   var xslt = new ActiveXObject("MSXML2.XSLTemplate.3.0");
   xslt.stylesheet = xmlStyle;
   var xslProc = xslt.createProcessor();
   xslProc.input = xmlInput;

   for (var keyVar in xslParams)
      xslProc.addParameter(keyVar, xslParams[keyVar]);

   xslProc.transform();

   if (outputFile == null)
      WScript.Echo(xslProc.output);
   else {
      var xmlOutput = createNewXMLObj();
      xmlOutput.loadXML(xslProc.output);
      xmlOutput.save(outputFile);
   }
}
PermalinkCommentsjs xml jscript windows xslt technical xsltproc wscript xsl javascript

Second Life Translator

2007 Jul 4, 10:58Hackdiary
I really enjoy reading Matt Biddulph's blog hackdiary. An entry some time ago talked about his Second Life flickr screen which is a screen in Second Life that displays images from flickr.com based on viewers suggested tags. I'm a novice to the Second Life scripting API and so it was from this blog post I became aware of the llHTTPRequest. This is like the XMLHttpRequest for Second Life code in that it lets you make HTTP requests. I decided that I too could do something cool with this.

Translator
I decided to make a translator object that a Second Life user would wear that would translate anything said near them. The details aren't too surprising: The translator object keeps an owner modifiable list of translation instructions each consisting of who to listen to, the language they speak, who to tell the translation to, and into what language to translate. When the translator hears someone, it runs through its list of translation instructions and when it finds a match for the speaker uses the llHTTPRequest to send off what was said to Google translate. When the result comes back the translator simply says the response.

Issues
Unfortunately, the llHTTPRequest limits the response size to 2K and no translation site I can find has the translated text in the first 2K. There's a flag HTTP_BODY_MAXLENGTH provided but it defaults to 2K and you can't change its value. So I decided to setup a PHP script on my site to act as a translating proxy and parse the translated text out of the HTML response from Google translate. Through experimentation I found that their site can take parameters text and langpair queries in the query like so: http://translate.google.com/translate_t?text=car%20moi%20m%C3%AAme%20j%27en%20rit&langpair=fr|en. On the topic of non US-ASCII characters (which is important for a translator) I found that llHTTPRequest encodes non US-ASCII characters as percent-encoded UTF-8 when constructing the request URI. However, when Google translate takes parameters off the URI it only seems to interpret it as percent-encoded UTF-8 when the user-agent is IE's. So after changing my PHP script to use IE7's user-agent non US-ASCII character input worked.

In Use
Actually using it in practice is rather difficult. Between typos, slang, abbreviations, and the current state of the free online translators its very difficult to carry on a conversation. Additionally, I don't really like talking to random people on Second Life anyway. So... not too useful.PermalinkCommentspersonal translate second-life technical translator sl code google php llhttprequest

<msxsl:script> Element

2007 May 18, 1:14Documentation on adding custom functions to XSLTs run with MSXML3.DLL.PermalinkCommentsmsdn xml script extension programming code microsoft windows reference

XPointer Framework - IE7 XML Source View Upgrade Part 3

2007 May 17, 5:16Previously I created some resource tools and then I used them to overwrite msxml3's XML source view. In this update I've added support for the XPointer Framework.

This time around I've started to add support for the XPointer Framework to my XML source view and I've added installation instructions. The framework consists of a series of pointer segments each of which has a scheme name followed by data in parenthesis. For example 'scheme1(data1)scheme2(data2)scheme3(data3)'. A pointer segment resolves to a portion of the XML document based on the data and the scheme name. The whole pointer resolves to the first segment that successfully resolves. That is, from the example, if scheme1 resolves to nothing and scheme2 resolves to something then that's used and scheme3 is ignored. In addition to the framework I've added support for the xmlns scheme which binds namespace prefixes to a namespace URI and the element scheme which is a simple way to resolve to particular elements in an XML. I also have limited support for the xpointer scheme the content of which is resolved as an XPath with some extra functions (which I don't support -- hence the limited). I've also thrown in schemes for the two SelectionLanguage values supported by msxml3.

Next time I might try to support the xpointer functions that aren't in xpath using msxml script. But I think I'm losing steam on this project... we'll see.PermalinkCommentsresource technical xml xpointer res xpath xslt

New XSLT - IE7 XML Source View Upgrade Part 2

2007 May 11, 8:55Last time, I had written some resource tools to allow me to view and modify Windows module resources in my ultimate and noble quest to implement the XML content-type fragment in IE7. Using the resource tools I found that MSXML3.DLL isn't signed and that I can replace the XSLT embedded resource with my own, which is great news and means I could continue in my endevour. In the following I discuss how I came up with this replacement for IE7's XML source view.

At first I thought I could just modify the existing XSLT but it turns out that it isn't exactly an XSLT, rather its an IE5 XSL. I tried using the XSL to XSLT converter linked to on MSDN, however the resulting document still requires manual modification. But I didn't want to muck about in their weird language and I figured I could write my own XSLT faster than I could figure out how theirs worked.

I began work on the new XSLT and found it relatively easy to produce. First I got indenting working with all the XML nodes represented appropriately and different CSS classes attached to them to make it easy to do syntax highlighting. Next I added in some javascript to allow for closing and opening of elements. At this point my XSLT had the same features as the original XSL.

Next was the XML mimetype fragment which uses XPointer, a framework around various different schemes for naming parts of an XML document. I focused on the XPointer scheme which is an extended version of XPath. So I named my first task as getting XPaths working. Thankfully javascript running in the HTML document produced by running my XSLT on an XML document has access to the original XML document object via the document.XMLDocument property. From this this I can execute XPaths, however there's no builtin way to map from the XML nodes selected by the XPath to the HTML elements that I produced to represent them. So I created a recursive javascript function and XSLT named-template that both produce the same unique strings based on an XML node's position in the document. For instance 'a3-e2-e' is the name produced for the 3rd attribute of the second element of the root element of the XML document. When producing the HTML for an XML node, I add an 'id' attribute to the HTML with the unique string of the XML node. Then in javascript when I execute an XPath I can discover the unique string of each node in the selected set and map each of them to their corresponding positions in the HTML.

With the hard part out of the way I changed the onload to get the fragment of the URI of the current document, interpret it as an XPath and highlight and navigate to the selected nodes. I also added an interactive floating bar from which you can enter your own XPaths and do the same. On a related note, I found that when accessing XML files via the file URI scheme the fragment is stripped off and not available to the javascript.

The next steps are of course to actually implement XPointer framework parsing as well as the limited number of schemes that the XPointer framework specifies.PermalinkCommentsxml xpointer msxml res xpath xslt resource ie7 technical browser ie xsl

Functional Requirements for Uniform Resource Names (RFC 1737)

2007 Feb 21, 6:30Standard describing the requirements of URNs.PermalinkCommentsurn standard reference rfc ietf uri

CreateUri (MSDN)

2007 Feb 20, 11:41Documentation for one of the main functions I worked on in IE7.PermalinkCommentsme projects professional createuri iuri msdn microsoft api help documentation reference internet web uri urlmon

Representing vCard Objects in RDF/XML

2006 Nov 28, 5:15This note specifies a Resource Description Framework (RDF) encoding of the vCard profile defined by RFC 2426 and to provide equivalent functionality to its standard format. The motivation is to enable the common and consistent description of persons (usinPermalinkCommentsrdf reference semanticweb specification standards w3c xml vcard schema example

Larry Osterman's WebLog : Should I check the parameters to my function?

2006 Mar 27, 1:12PermalinkCommentslarry-osterman blog programming isbadreadptr isbadwriteptr c++ c windows security validation

Vroom

2004 Sep 10, 12:04I got my driver's license today. Imagine that. I lost all of the points that I could on the parallel parking portion of the test. You know in California they don't test you on parallel parking ability. With my new license my functional impairment level has moved from minor to non-existent. Hoo-raw. Incidentally if you search for the phrase "stealth geriatrics" on google, the first link is to a power point presentation entitled "stealth geriatrics." I just thought that was a funny phrase.PermalinkComments
Older EntriesNewer Entries Creative Commons License Some rights reserved.