Home
About
Color Tool
 

Share Wonders is proudly powered by WordPress
Entries (RSS) and Comments (RSS).
9 queries. 0.339 seconds.
Valid XHTML

Archive for May, 2006

This web log has been discontinued.

Monday, May 29th, 2006

Thanks for reading it. I will leave the content up. The entry page will remain as it is until I can think of something better to do with it. Comments have been disabled, and images are no longer available. The feedburner feed has been deleted.

Thank you,

Bjorn

XSLT: tAsc 1.0 - An AJAX Powered JavaScript XSL Transformation Script

Wednesday, May 17th, 2006

I made tAsc 1.0 today. It is an AJAX powered JavaScript XSL Transformation (XSLT) script for Gecko browsers and Internet Explorer (6 & 7). I have made it very easy to use. Just follow the instructions in the beginning comments. All you need is a blank HTML page, and a preexisting XML file and its accompanying XSL stylesheet. There may be something like this out there already, probably better, but I wanted to learn how to do this and so I made this script and it works well.

Here is an example of tAsc 1.0. It works well in recent Gecko browsers (FireFox 1.5, Camino, Epiphany, etc) and IE6. It should also work in IE 7, but I haven’t tested it there yet. Let me know if you see any bugs or have any concerns. This script does not require any other libraries of any sort. It comes with an MIT License.

Here is the code:

/***********************************************
************************************************
NAME: tAsc v 1.0

DESCRIPTION:
An AJAX powered JavaScript XSL Transformation script
for Gecko browsers and Internet Explorer (6 & 7).

AUTHOR: Bjorn Tipling

EMAIL: bjorn (at) ambientchill (dot) com
Please use this email for bugs.

WEBSITE: https://sharewonders.com

LICENSE: MIT
http://www.opensource.org/licenses/mit-license.php

USAGE:
Create a basic HTML page with nothing within
the body tags. Link to this javascript file by
placing this in the header:

The tag should look like this:
with the same
id and and onload values.
Give xslFile and xmlFile the names of the xsl file
and the xml file respectively.

NOT ALL BROWSERS ARE CAPABLE OF JAVASCRIPT XSL
TRANSFORMATIONS. WILL ONLY WORK WITH LOCAL FILES.

************************************************
************************************************/

//Change these to the correct values:
var xslFile = ‘test.xsl’;
var xmlFile = ‘test.xml’;

var xmlGlobal;
var xslGlobal;
var xsltProcessorGlobal = new XSLTProcessor();

function start(){

var IE = document.all?true:false;

if(IE){
// Load XML
ieGetXML(’test.xml’);
}else{
// load the xslt file, test.xsl
ffGetXSL(xslFile);
}
}

function ffGetXSL(filename){
var httpRequest = new XMLHttpRequest();
httpRequest.open(”GET”, filename, true);
httpRequest.send(null);
httpRequest.onreadystatechange = function(){
if (httpRequest.readyState==4) {
xslGlobal = httpRequest.responseXML;
xsltProcessorGlobal.importStylesheet(xslGlobal);
// load the xml file, test.xml
ffGetXML(xmlFile);
}
}
}

function ffGetXML(filename){
var httpRequest = new XMLHttpRequest();
var fragment;
httpRequest.open(”GET”, filename, true);
httpRequest.send(null);
httpRequest.onreadystatechange = function(){
if (httpRequest.readyState==4) {
xmlGlobal = httpRequest.responseXML;
//do the transformation:
fragment = xsltProcessorGlobal.transformToFragment(xmlGlobal, document);
document.getElementById(”myBody”).innerHTML = “”;
document.getElementById(”myBody”).appendChild(fragment);
}
}
}

function ieGetXML(filename){
if (window.XMLHttpRequest)
{
var httpRequest = new XMLHttpRequest;
httpRequest.open(”GET”, filename, true);
httpRequest.send(null);
}else{
try {
httpRequest = new ActiveXObject(”Msxml2.XMLHTTP”);
} catch (e) {
try {
httpRequest = new ActiveXObject(”Microsoft.XMLHTTP”);
} catch (e) {}
}
}
httpRequest.onreadystatechange = function(){
var string;
if (httpRequest.readyState==4) {
xmlGlobal = httpRequest.responseXML;
ieGetXSL(xslFile);
}
}
httpRequest.open(”GET”, filename, true);
httpRequest.send(null);
}

function ieGetXSL(filename){
if (window.XMLHttpRequest)
{
var httpRequest = new XMLHttpRequest;
httpRequest.open(”GET”, filename);
httpRequest.send();
return httpRequest.responseXML.xml;
}else{
try {
httpRequest = new ActiveXObject(”Msxml2.XMLHTTP”);
} catch (e) {
try {
httpRequest = new ActiveXObject(”Microsoft.XMLHTTP”);
} catch (e) {}
}
httpRequest.onreadystatechange = function(){
var piece;
var string;
if (httpRequest.readyState==4) {
xslGlobal = httpRequest.responseXML;
piece = xmlGlobal.transformNode(xslGlobal);
document.getElementById(”myBody”).innerHTML = piece;
}
}
httpRequest.open(”GET”, filename, true);
httpRequest.send(null);
}
}

Government proposes to ban Social Networking Sites in Schools and Libraries

Friday, May 12th, 2006

House Republicans are proposing a new bill that will block social networking sites from schools and libraries. I recommend reading the entire proposal (in PDF format). First librarians have had to succumb and install filters on the computers within our library walls, and now this. This an egregious assault on the freedom of speech. Give an inch and they will want to bite off your entire arm. Will ‘blog people’ hating ALA elites care about this? Will newly graduated library school students understand the implications? Surprisingly, there is little to be seen on this issue in library news journals.

Here is the killer:

…prohibits access to a commercial social networking website or chat rooms…
COMMERCIAL SOCIAL NETWORKING WEBSITES.�The working term �commercial social net website� means a commercially operated Internet website that�
��(i) allows users to create web pages or profiles that provide information about themselves and are available to other users; and ��(ii) offers a mechanism for communication with other users, such as a forum, chat room, email, or instant messenger.

What will be affected: blogs, sites like digg, friendster, myspace.com, the potential for harm has no bounds.

JavaScript: Easing Animation Formula

Thursday, May 11th, 2006

This page is an example of easing with JavaScript. Easing is slowing the transition of a moving object as it nears its intended destination. It looks much nicer than just a consistent rate of movement and a sudden and hard stop. When you put the breaks to your car as you near a red light, you slow down gradually. Imagine just going all the way to the stopline at the same speed you were driving and then just suddenly halting. Easing with JavaScript is more subtle than not slamming your breaks, but it is noticable.

The formula for easing is somewhat simple in Javascript, but you may have to tweak it a bit. With ActionScript in Flash it is much more straightforward: the speed of movement is half the distance. So if you’re 500 pixels away from your destination, you’re moving at 250 pixels per transition, at 499 you’re moving at (499/2):
rate = (distance - currentPosition)/2
currentPosition += rate

I still haven’t gotten it to look just the way I want it to, and I’m still using setTimout, and I am only experimenting, but here is my code:

distancePerInterval = Math.ceil((destination - parseInt($('mover').style.left))/32);

Not quite the same thing. It also does not move at the same speed in all browsers. In Firefox it is too fast, in IE it is too slow.
I will keep playing with it to see if I can get it to be just the way I want it.

Libraries are being changed by DRM

Wednesday, May 10th, 2006

Groklaw has a great article about how DRM is changing libraries in the US and in the UK. It is a lengthy deconstruction of usage requirements of the NY Public Library and (mostly) the British Library’s digital services. Libraries once were an active force preserving equitable access for all people regardless of their economic status but things are changing. Even I have noticed in library school an all too eager adoption of DRM technologies by vendors of subscription services with restrictive licensing obligations. The Groklaw article points out some bizarre requirements in order to use library services such as requiring users to install anti-virus software on their personal computers (What about Linux users? what if you don’t want this software?) and the new habit of charging fees to users so copyright owners can collect royalty payments. The author predicts:

…the death of public libraries as we have known them, and the world’s knowledge will be available only DRM’d and for a price.

I am not so sure about any ‘death’, but I do see a lot of ignorance when it comes to DRM and libraries in library school. As a library student, I am most concerned about other students that do not know the difference between a browser and an operating system, who will graduate without knowing this and become librarians. I am not joking. I have taught HTML to library students, and I was surprised to find out the extent of their ignorance. How are they going to be guardians of information when they can not understand the basic technology that is changing information content, distribution, and access?

Some of my professors have explained to me that librarians and the profession are well informed on DRM issues when I challenged them on it. It does not appear to me that way, however, and in fact it seems that librarians are all too eager to sign whatever dotted line vendors require them to whenever they adopt a new database or other form of digital service. Groklaw is right, libraries are changing for the worse, and I believe that the reasons for this stem from deeply rooted ignorance of the technology, of the basics, of the jargon, and how much technology is out there that is in opposition to fundamental library values. My library school, SIRLS, doesn’t do enough to ensure admitted library students have an understanding of basic information technology. It does not do enough to educate them on it through out the program. Information technology and DRM ought to be a required component of the curriculum, and the ALA accreditation should include it as a fundamental requisite. The library profession sometimes seems excessively compulsive about its self-image, and frightened to death of Internet search. Yet neither of these factors seem to serve as jarring enough wake-up call to change the nature of librarianship at a pace fast enough to catch up with what is happening in the outside world.

Links for 05-10

Wednesday, May 10th, 2006

Net Neutrality, a simple video explanation
AutoComplete, Windowing, Menu and More: A Second Beta Release for the YUI Library
abazab.com - new Social Networking Site [via]
10 Reasons Why the Internet Is No Substitute for a Library [via]

CSS3 Preview
Corporate Usability Maturity in Stages

 

Share Wonders

Look out honey, because I’m using Technology