New ASF Machines

March 23rd, 2004

Apparently, the ASF took delivery of a few new machines today. I just can’t get the image of Sam Ruby sitting around ASF head office and suddenly there’s a knock on the door and he finds a pile of orphaned servers wrapped in a blanket.

Then again, I always was weird…

Google Wars

March 22nd, 2004

It appears the war of the Adrian Sutton’s is hotting up on Google. (Hint for those that just read the RSS feeds: take a look at the main page) The once unstoppable Professor Adrian Sutton who ruled supreme as number one search result for “Adrian Sutton” has dropped significantly down to third place, though he now has two entries in the top five with his surprise appearance in some meeting minutes.

The new kid on the block Adrian Sutton has roared up the charts to take the number one spot just ahead of my own Randomness which held the top spot less than two days ago. I also hold the fifth spot with my appearance in a CVS commit message for FreeCard

Stay tuned as this pathetically geeky race continues to unfold!

URL Escaping is Evil

March 22nd, 2004

I have come to the conclusion that URL escaping is evil and must be banished from the face of the earth. I’ve got no idea how it manages to work at all - every implementation seems to be different and the support for different character sets is a major hit and miss affair.

Take for instance the string:

© Adrian Sutton

It looks like a pretty simple string and all. It should be encoded as:

%C2%A9%20Adrian%20Sutton

assuming UTF-8 character encoding (and I literally mean assuming since there’s no possible way to know for sure). If however you were to use the javascript escape() function you could get any one of:

%u00A9+Adrian+Sutton

%C2%A9%20Adrian+Sutton

%u00A9%29Adrian%20Sutton

It’s impossible to tell if the + sign in the first two is an encoded space or an actual plus sign (there’s no requirement for + to be escaped in URIs so many implementations leave it as is). Then you have to deal with the rather odd %u00A9 syntax which seems to be half URI escaping, half HTML entity and finally you get to worry about which character set was in use.

For the record, here’s what your browser makes of it:

MarchFest Wrap-up

March 21st, 2004

Wow, what a fantastic day. MarchFest was yesterday and for those who didn’t make it, you missed a sensational day. While there’s always a few things that go wrong when you put on a big production like MarchFest is, things went exceptionally smoothly and all the reports coming back have been really positive.

It was particularly good to see the number of people who offered to help out and did so with such talent and energy. We even had a few people email us completely out of the blue offering to help out.

Anyway, I’m going to bed as I haven’t had much sleep this weekend and I spent most of my waking time either lugging around heavy staging, PA systems or lighting or running madly between the two venues to make sure that the next band at each venue got set up quickly with all the sound stuff they need. The life of a stage manager and sound engineer in one is never easy. Good fun though.

Hopefully now I’ll have some more time to do some recording with Soul Purpose and finish writing my musical.

JavaScript Fun

March 18th, 2004

Nick Chalko talks about setting onsubmit dynamically. The solution he received from Alan Gutierrez which is good, but overly complicated. Since I work for a company that just so happens to do some amazingly funky stuff with JavaScript, here's some fun you can have with it. Firstly, lets take the original solution:

<form name='CDiceComponent_0' id='findApplication'
    action='/cdiceWebApp/custom/component/bridge.jsp' method='post'>
<script>
  document.findApplication.onsubmit = function() {return checkForm();}
</script>

and simplify it to:

<form name='CDiceComponent_0' id='findApplication'
        action='/cdiceWebApp/custom/component/bridge.jsp' method='post'>
<script>
  document.findApplication.onsubmit = checkForm;
</script>

JavaScript functions are just string variables so you can pass them around by just dropping the () at the end. Here's how you could store the existing onsubmit function:

var oldOnSubmit;
oldOnSubmit = document.findApplication.onsubmit;

Then you can execute it later with:

oldOnSubmit();

Cool huh? Why stop there? Lets say the old handler contained a call to form.submit() that you wanted to remove. You could do it with:

oldOnSubmit = eval(String(oldOnSubmit).replace(/form\.submit\(\)/gi, ""));

Then execute oldOnSubmit like before, or set it back as the current form onsubmit handler. Note the use of String() to convert the function to a string and the use of eval() to convert it back to a function. Here's an example of this coming together (probably without the typos and omissions in the above snippets).

<script language="JavaScript">
function change() {
  var oldOnClick;
  oldOnClick = document.findApplication.doStuff.onclick;
  oldOnClick = String(oldOnClick);
  var newOnClick;
  newOnClick = oldOnClick.replace(/form\.submit\(\)/gi,
    "alert('Submitting the form.');");
  document.findApplication.doStuff.onclick = eval(newOnClick);
}
</script>
<form name="findApplication" id="findApplication">
  <input type="button" name="doStuff" id="doStuff" value="Submit"
      onclick="form.submit();"/>
  <input type="button" name="preventSubmit" value="Prevent Submit"
      onclick="change();"/>
</form>

Note: This entry has been reformatted as a previous blog migration seems to have messed it up.