2007 Oct 10, 9:21Howto on signing your FoaF documents.
pgp security signing web trust foaf rdf semanticweb xml encryption howto 2007 Oct 9, 4:41Notes on using XSLT on FOAF XML files. Apparently its not super simple due to the various equivalent ways of representing the same RDF in XML.
xml foaf xslt xsl reference rdf semanticweb 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);
}
}
js xml jscript windows xslt technical xsltproc wscript xsl javascript 2007 Oct 3, 9:34How to do XML parsing and XSL transforms via Window's jscript shell.
microsoft script xml xslt jscript howto 2007 Oct 3, 10:21Tim Berners-Lee writes about principles for new technology in the context of the evolution of HTML and the development of namespaces and XML.
architecture article tim-berners-lee w3c internet history evolution html namespace xml web mmm multimedia-mesh humor test-of-independent-invention 2007 Sep 27, 2:17Starting on a new simple project I wanted to get the history of my Delicious links. Delicious has an export tool available via the settings section so I thought I'd try that. However, the links
aren't exported in XML not even in XHTML but rather in HTML. Shocking. An example:
"Don't Tase Me, Bro!" (UF Student Tasered Remix)
Remix of the 'Don't tase me, bro!' guy getting tasered.
At this point I'm already not going to use this file because its in HTML but I'm even more disgusted by those date time values.
Raymond Chen of the Old New Thing posted about recognizing timestamps and timestamp sentinel values. From the first blog post and with the use of a calculator for base conversion one can tell that
those are UNIX style timestamps counting the number of seconds since 1970.
It reminds me of my hatred for the MIME date time format I developed working on my webpage's server side parsing of atom and RSS. Atom is
of course my favorite as Atom uses the Internet date time format described in the following documents. Here's an example of one
2007-09-27T020:50:00.000-08:00
On the other hand the evil and villainous RSS uses the MIME date time format now described in the more
recent IETF MIME standard. Here's an example Thu, 27 Sep 2007 20:50:00 -0800
The Internet date time format has the advantage of being so easy to sort. An alphabetic sort with normal C-style collation rules of strings containing Internet date times will also sort them
chronologically. This is not the case for the MIME date time due to the preceding day of the week and the spelled out month name. This also means that when producing these you have to figure out
the day of the week and when parsing them you have to match month names rather than just parsing out numbers. Anyway now days if I see mention of a date time in a new proposed standard or spec I be
sure to point out the numerous advantages of the Internet date time format.
date xml html feed time technical date-time code atom rss 2007 Sep 27, 12:01Another open effort to produce an XSLT library that does some standard things you might want like string manipulation, URI combining, etc etc
xsl xslt reference library xml xpath proramming api 2007 Sep 26, 11:57Free XSLT Extension libraries to support things like date/time conversions, string manipulation, etc.
xslt xsl api xpath xml library extension programming free development 2007 Sep 11, 1:46The XML spec. Info on setting the default namespace including how to remove a default namespace once its been set.
specification reference w3c xml namespace 2007 Aug 21, 4:04Seeing
ErrorZilla I realized I could easily do a similar thing to the IE7 404 page using the same
technique I used for the
XML view and the
feed view.
So that's what I did: I made
a new 404 page for IE7. There's not much new here technically if you've read the previous blog
entries to which I linked. My 404 page change adds links to the
Internet Archive, the
Coral Cache, and
Whois Tool.
archive personal res cache resource ie7 technical browser whois 404 error extension 2007 Aug 6, 5:40I was messing with the
XSLT to XSL Converter source which is a
javascript file that can be run with cscript.exe. I've changed it to be like a very basic version of
xsltproc that simply runs an XML file through
an XSLT. I also wanted to run this from the command prompt without writing "cscript ..." everytime. I decided to make like perl programmers I've seen and make a JS file that works as a batch file and
a JS file at the same time.
Here's a basic version of what I ended doing applied to a 'hello world' script named helloworld.cmd:
/* 2> NUL
@echo off
cscript /e:javascript /nologo "%~f0" %*
@goto :eof
Hello World
Says 'Hello world.' when you run it.
*/
var outText = 'Hello world.';
WScript.Echo(outText);
Running this on a command prompt gives the following:
C:\Users\davris>helloworld
C:\Users\davris>/* 2>NUL
Hello world.
However, after a little more experimentation I found this was slightly overkill for my purposes since if I rename the file to helloworld.js and just type its name like a command it is
run by cscript:
C:\Users\davris>helloworld
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.
Hello world.
So this time I didn't need all that but if ever in the future I need to run a batch file then a JS file I can do it with one file...
cmd js technical cscript batch xslt xsl javascript 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.
personal translate second-life technical translator sl code google php llhttprequest 2007 Jun 21, 2:38Unspun is a social list creation website from Amazon. For instance, you could create a list named '
Most Desired Features for Next Version of Internet Explorer' and users of Unspun fill in and
rank the answers. There's a mix of serious answers that are excellent suggestions, fan-boy answers that are lame, uninformed answers that are already implemented, and hilarious answers that are
awesome. The following is the very short unsorted list of the awesome suggestions.
-
Innovative Anti-Phreaking Technology
-
Given the work done in IE7 on anti-phishing, subsequent work on anti-phreaking just makes sense.
-
AXELROD 2.8 Acceleration with XML Bindings
-
I'm not sure what AXELROD 2.8 is but accelerating it sounds good. Also I enjoy binding things to XML so...
-
Larger Buttons for My Mighty Fingers
-
For maximum humor this should be read by Richard Horvitz as Zim of Invader Zim. This
one makes me laugh every time I read it.
amazon personal ie humor nontechnical 2007 Jun 7, 5:29The other day I had the best idea for my Wii remote. Clearly I should use it to control the rotation of Tetris pieces in my
N-dimensional
Tetris game Polytope Tetris. One of the
issues I described with Polytope Tetris is user input. Given a Wii remote the
user could rotate a piece through 3 dimensions in a manner that's much easier to adjust to than particular keys on the keyboard.
Anyway, I did a little
research into how this might work. I knew that the Wii remote used infrared for absolute positioning and
Bluetooth for everything else (LEDs, speaker, accels.) I bought a
Bluetooth adapter for my PC after realizing that none of my
computers had one already. I used
GlovePIE to ensure that my Wii remote could connect and successfully communicate with my computer.
GlovePIE is actually pretty cool -- it provides a simple script layer over the Wii remote to control things like your mouse.
Since Polytope Tetris is in Java I looked for and found a
Java library for operating with the Wii remote and a long
forum thread discussing its use. I then read up on
Bluetooth in Java. Apparently JSR 82 is the name of the standard that describes the API a Bluetooth stack should expose
in Java. That is, to get Bluetooth working in Java one needs an additional package for Java that actually implements the Bluetooth Java API. This package would depend on the system so I suppose I
can't fault Sun for not including it... Where to find such a package? I found a
comparison list of implementations and tried the ones
that support javax.bluetooth.
None of them worked for me because none can address USB devices it seems or they cost money and I couldn't get the trial version working. I also tried
bluesock (not listed on the previous list) which seemed promising and could produce an address for my Wii remote as a connected device but couldn't use
that address.
And I thought that after I found the Wii remote Java library it would be easy... Oh well...
java bluetooth wii technical remote jsr82 tetris polytopetetris wiimote 2007 Jun 5, 5:51Draft document on the parameter extension to OpenSearch in order to support POSTs from the OpenSearch description.
opensearch search browser specification xml 2007 May 22, 10:12Digg RSS extension that includes submitter, digg count, and comment count.
digg rss extension xml feed 2007 May 22, 3:22I've created an
update to the IE7 feed display.
After working on my
update to the XML source view I tried running my resourcelist program on other IE DLLs including ieframe. I found that
one of the resources in ieframe is the XSLT used to turn an
RSS feed into the IE7 feed display.
My first thought for this was that I could embed enclosures into the feed display. For instance, have controls for youtube.com videos or podcast audio files directly in the feed display. However, I
found that I can't use object or embed tags that rely on ActiveX controls in the page or in frames in the feed display.
With that through I decided I could at least add support for some RSS extensions. Thanks to
IE7's RSS platform which provides a
normalized view of RSS feeds it was really easy to do this. I went to several popular RSS feeds and RSS feeds that I like and took a look at the source to see what extensions I might want to add
support for.
For
digg.com I added support for
their RSS extension which includes digg count, and submitter name and icon. I
added the digg count in a box on the right and tried to make it fit in stylistically. For the
iTunes RSS extension
I add the feed icon, feed author, and descriptions. I was surprised by how much of the podcasts content was missing from the feed view. I also added support for a few other misc things: the
slash RSS extension's section and department, the feed description to the top of the feed display, and the atom author icon.
I wonder what other goodies lurk in IE's resources...
feed res slashdot digg resource itunes technical browser ie rss extension 2007 May 18, 1:14Documentation on adding custom functions to XSLTs run with MSXML3.DLL.
msdn xml script extension programming code microsoft windows reference 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.
resource technical xml xpointer res xpath xslt