Saturday 19 June 2010

Interpolation source code

A comment on my last post requested the source code. I've made it available as a google hosted project.

MUDBytes and post bloat

The most active MUD-related forum is currently MUDBytes. One of the good things is that the team there maintain their own forum software, and as the idea or need arises, it gets extended to support new features. However this is both good and bad, as the amount of feature "cruft" that decorates each displayed post increases.


Finding the "cruft" distracting, I decided to write a greasemonkey script to remove as much as possible. Here's the result:


And the greasemonkey script:

// ==UserScript==
// @name MUDBytes Page Cleaner
// @namespace http://disinterest.org
// @description Makes the pages less cluttered.
// @include http://www.mudbytes.net/topic-*
// @include http://www.mudbytes.net/index.php*
// ==/UserScript==

var tds = document.getElementsByTagName("td");
var posterInfoTD = null;
var classNames = "";
for(var i = 0; i < tds.length; i++){
classNames = tds[i].className;
if (classNames == "posterinfo") {
posterInfoTD = tds[i];
} else if (classNames == "posttop") {
for (var j = 0; j < tds[i].childNodes.length; j++) {
var topElement = tds[i].childNodes[j];
if (topElement.className == "button butright") {
topElement.className = "butright";
topElement.innerHTML = " ["+ topElement.innerHTML +"]";
}
}

// Remove the arrows.
var divs = tds[i].getElementsByTagName("div");
divs[0].innerHTML = "";
// Inject the poster name.
var posterText = document.createTextNode(" -- ");
var posterNameB = document.createElement("b");
var as = posterInfoTD.getElementsByTagName("a");
if (as.length > 0) {
posterNameB.appendChild(as[0].cloneNode(true));
} else {
var posterNameText = document.createTextNode("Guest");
posterNameB.appendChild(posterNameText);
}
divs[divs.length-1].appendChild(posterText);
divs[divs.length-1].appendChild(posterNameB);
// Remove the LHS poster info area.
posterInfoTD.parentNode.removeChild(posterInfoTD);
} else if (classNames == "postbottom") {
tds[i].innerHTML = "";
}
}

// Reduce the reading area width to make it more readable.
var tableElements = document.getElementsByTagName("table");
for (var i = 0; i < tableElements.length; i++) {
if (tableElements[i].className == "stand")
tableElements[i].style.width = '700px';
}

As cluttered as MUDBytes posts are getting, at least they haven't added header and footer frame areas like The MUD Connector.

Friday 18 June 2010

Interpolation

A link about interpolation tricks was recently posted to reddit. I found myself using Pyglet to write a simple user interface to play with the different algorithms, screenshots of which are shown below.

Linear:

Smooth step:

Hermite:

I should really use the Tk bindings that come with Python to do something like this, or better yet do it as a web page.

Wednesday 16 June 2010

Reddit

Reading reddit is becoming too costly in terms of time spent and value gained. Most of the comments littering each link only serve to drown out those that add the detail that would comprise value. A long time ago, someone used to summarise posts to the Linux Kernel mailing list as Kernel Traffic. More often than not when reading reddit, I wish someone was doing a "Reddit Traffic" and just close the tab for the given submitted link giving up on it.