Coding

A reasonable XML RPC envelope protocol, and asynchronous calls

Published · 11min

Note

This is juvenile, but it’s still better than XML-RPC. Here is the original post.

Sometimes something you do as a joke can yield interesting results.

About a year or so ago, I was feeling bored and decided to see how much of a diet I could put …

Coding

Messing with Standard ML and Moscow ML, part one: The core language

Published · 8min

Note

A cache of the original post is here.

I was playing with Moscow ML because I’ve wanted to give Standard ML a bash for a while now, but I could never get SML/NJ to play nice for me back when I tried it first on Windows. That …

Coding

A RELAX NG compact schema for RSD

Published · 1min

I was feeling a bit bored last night and decided to write a schema for RSD in RELAX NG compact syntax. RSD is about five years old at this point, and nobody ever seems to have got around to writing one, so this might help somebody who wanted to make …

Coding

Moving from SVK to Bazaar-NG

Published · 3min

I exported my projects from SVK‘s hidden Subeversion repository on Saturday using tailor. I was expecting it to be simple, but it was anything but! Mind you, this is probably my fault.

I just wanted to get it working, so I read the documentation accompanying tailor to figure out …

Coding

Formkeys

Published · 2min

Formkeys are something I first discovered when snooping around the source for Slashcode many, many moons ago. The idea is to embed a hidden field in a form that can be later used to check if a form has been submitted twice, or if somebody’s attempting to use it …

Coding

How Syncope Works

Published · 4min

[Note from 2020: Syncope eventually ended up as AFK]

Here’s how Syncope, the kinda-but-not-really-a-framework I mentioned before, works. It’s really just a library with a bunch of canned request lifecycles. Those are the only parts of it that vaguely resemble a framework. It’s made to be as …

Coding

XP and Big Design Upfront

Published · 1min

Joel Spolsky posted on his site about several instances where where he needed to modify the Project Aardvark (Copilot) Functional Specification.

It was all fine, and stuff I agree with myself, up until close to the end where he wrote:

I can’t tell you how strongly I believe in …

Coding

A Java HTML Scrubber

Published · 2min

In preparation for possibly adding a WYSIWYG editor to the site—mainly because people don’t seem to read the formatting instructions—I’ve written the best part of a HTML scrubber to ensure that the HTML markup returned from the poster’s browser doesn’t contain anything dodgy and …

Coding

Demystifying the GridBagLayout Layout Manager by Peter Haggar

Published · 1min

This is an excellent explaination about what must be one of the most puzzling parts of AWT/Swing development: the GridBagLayout layout manager.

The original was an MS Word file. I converted it to LaTeX for my own use, but I think others might find it useful too. I redid …

Coding

Memoization in JavaScript

Published · 2min

About a fortnight ago, I was poking around the copy of Perl sitting on my laptop. I came across Memoize.pm. Having read the article that inspired it a few years back, I thought I’d take an attempt at implementing something to do the same in JavaScript.

Memoization is …

Coding

The World’s Simplest (decent) PHP Templating Engine…

Published · 1min

…is PHP, so why not use it?

function include_view($view, $vars=null) {
    # Start buffering the generated text.
    ob_start();

    # Process the view.
    if (!is_null($vars)) {
        extract($vars, EXTR_OVERWRITE | EXTR_REFS);
    }
    include("views/$view.php");

    # Grab the generated content and clean up.
    $content = ob_get_contents();
    ob_end_clean();

    return $content;
}
Coding

My C++ wrapper for the Expat XML parser

Published · 1min

Last year when I was writing Orpheus, I knocked out a C++ wrapper around Expat to make using it easier.

It consists of two classes. XMLParser is the Expat wrapper and sets up the event handlers and automates setup and teardown of the parser itself. XMLEvtHandler consists of a set …

Coding

The DOM HTMLFormElement Interface Should Have a getElementsByName() Method

Published · 1min

While useful on the HTMLDocument interface, getElementsByName() would be much more useful if it was included in HTMLFormElement interface. Every time I want to look up elements by their names, it’s usually on form elements rather than the document as a whole. Come to think of it, I don …

Coding

Fixing JavaScript memory leaks for good

Published · 3min

Note

I’ve edited this down a little bit. A snapshot of the original post is here.

I’m a fan of unobtrusive JavaScript and I’ve strove to make my JavaScript code as unobtrusive as possible for years now.

However, I discovered something about IE a while ago when …

Coding

Detecting broken images with JavaScript

Published · 2min

Note

A cache of the original can be found here.

I hit an annoying problem with a project at work. It’s not my fault, there’s nothing wrong with the code, but sometimes things will happen: people will delete images out of the backend, not upload the image they …

Coding

I want StringTemplate for PHP

Published · 1min

Ever since reading Terence Parr’s Enforcing Strict Model-View Separation in Template Engines (PDF), I’ve wanted something like StringTemplate for PHP.

Maybe not something exactly the same, but a templating system that would perform similarly as far as the person developing the templates would be concerned, but the coder …

Coding

I’ve finally found an excuse to use reflection in Java

Published · 1min

I’ve a project here at work. I need to write a ColdFusion custom tag in Java to talk to a remote server. This tag needs to handle a bunch of different requests and responses, but putting all that code in the one class would be a bit messy, and …

Coding

Listening for file updates on Windows

Published · 1min

I’d really like to know if there’s a way to set up a callback of some kind that would allow a program to be informed of when a certain file is updated. Not just any file, but a particular file.

I’ve taken a look through MSDN, disorganised …

Coding

Google Code Jam 2004, The Middle

Published · 2min

Coding’s finished, and I’m not happy with myself.

I was in group 8 and only got one of the problems done. I spent about 30 minutes staring at the problem, trying to understand what they were asking, but for some reason my brain failed to comprehend anything.

Queue …

Coding

Martin Fowler on Closures

Published · 1min

Martin Fowler’s talking about closures on his blog. I was rather disappointed that he didn’t bring up JavaScript when he was talking about it.

Why do I mention it, besides the fact that I like JS as a language? It’s because it’s given far less credit …

←   newer