Archive for June, 2007

A personal apology to Julie Amero

Wednesday, June 6th, 2007

There was great news today on the insanity that is the Julie Amero conviction:

A judge has granted a new trial to Julie Amero, a former substitute teacher in Norwich, Connecticut who was convicted in January on four felony counts of risking injury to minors after she was unable to prevent pornographic pop-ups from showing up on a computer in a classroom in 2004.

The city’s prosecutors did not oppose the motion for a new trial, raising the possibility that Amero will not be tried again.

It’s about time. Her original conviction was one of the most insane things I had ever heard about. However, further down in the article, the computer forensics firm that analyzed the computer in question came up with something that really makes me cringe:

Sites analyzed a copy of the hard drive provided to him by Amero’s first expert witness, and found that computer was infected.

“There was definitely adware called new.net,” Sites said. “It was downloaded by a screensaver installed for Halloween by the teacher Amero was subbing for.”

Argh! If this is the same New.net that schleps domains in bogus TLD’s, then I worked for them back in the day. It’s the only job I ever walked off of, (I honestly hated every hour that I put towards their efforts) but still: I feel bad for having any part in them existing if their software in fact played a part in causing this to happen. So if this is the case: I’m sorry for not letting new.net die on my watch.

(Note: I have no idea if that particular New.net actually deals in Spyware. I sure hope that they don’t.)

Calling Java applets from JavaScript

Monday, June 4th, 2007

I ran in to a situation recently where I had a big mess of code written in Java that I really wanted to call from a client-side web application. I could wrap said code up in a servlet, but that would be a lot of work. As it turns out, you can call methods on Applets directly from JavaScript, so all I have to do is wrap my code in one of those. Bonus!

Here’s a brief example

DoublerApplet.java

package org.obfuscated.example;

import java.applet.Applet;

public class DoublerApplet extends Applet {
    public double f(double x) {
        return x + x;
    }
}

Nothing special there. Note that I’ve not yet tried passing classes or the like to an applet. I imagine that they might be trouble.

index.html

<html>
  <head>
    <title>Applet Test</title>
    <script src="prototype.js"></script>
    <script src="doubleit.js"></script>
  </head>
  <body>
    <object id="doubler"
       classid="java:org.obfuscated.example.DoublerApplet.class" 
       type="application/x-java-applet"
       archive="DoublerApplet.jar" 
       height="1" width="1" >
      <param name="scriptable" value="true"/>
    </object>

    <b>Double me!</b>
    <br/>
    2 * <input size="5" type="text" id="x"/> = <span id="answer">???</span>
    <br/>
    <input type="submit" id="go"/>
  </body>
</html>

The important part is the “scriptable” parameter. It tells the applet to listen to the JavaScript.

doubleit.js

var init = function() {
    Event.observe('go', 'click', function() {
        var x = Number($('x').value);
        var applet = $('doubler');
        $('answer').innerHTML = applet.f(x);
        return false;
    });
};

Event.observe(window, 'load', init);

The “$” magic that makes the JavaScript code quite so terse is Prototype, which I can’t quite recommend enough.

Anyway, I’m quite pleased that I’m able to use this technique, as dragging out Tomcat, keeping it running, etc., would be a whole lot of work just to be able to call one function. (Which is all I need to do in this particular case.) I’m sure the server-based solution would be more correct if I needed to do more in Java-land, but for quick and dirty things or one-off’s, JavaScript to Applet communication is nice.

A recent conversation with my computer

Sunday, June 3rd, 2007

OPTION-SPACE firefox

ENTER

APPLE-L

tv.yahoo.com

ENTER

/listings

ENTER

/mythbusters

donk

/goddamn mythbusters

donk

/i hate you

donk

/futureweapons

ENTER