Saturday, March 12, 2005

BAT 3 UAV


Looking for a personal UAV you can launch from your car? These guys have one they want to sell you, starting at $40k. The software is most interesting.

OS X 10.4

Dear Apple User,

Your semi-annual lifetime installment payment of $129.00 is due on April 1st, 2004. Please make check or money order out to:

Steven Paul Jobs
1 Infinite Loop
Cupertino, CA 95014


To make this payment, you may also visit our online store, or any of our 102 international store locations.

AIM TOS

This guy's blog was linked from slashdot for his writeup on AOL's new terms of service for AIM. The section in question is "Content You Post" on the AIM Terms Of Service Page (about half-way down) which states:

Although you or the owner of the Content retain ownership of all right, title and interest in Content that you post to any AIM Product, AOL owns all right, title and interest in any compilation, collective work or other derivative work created by AOL using or incorporating this Content. In addition, by posting Content on an AIM Product, you grant AOL, its parent, affiliates, subsidiaries, assigns, agents and licensees the irrevocable, perpetual, worldwide right to reproduce, display, perform, distribute, adapt and promote this Content in any medium. You waive any right to privacy. You waive any right to inspect or approve uses of the Content or to be compensated for any such uses.

I wonder if they're going to print a book or produce a new tv series, "World's Funniest IM's"? Fortunately OTR comes to the rescue. Looks like I made the switch just in time. Only problem is, both ends of the conversation have to use it in order for it to work.
0 64 1458 12288 62500 233280 705894 1835008 4251528 9000000

Thursday, March 10, 2005

OVER THE LINE!


Joe... that creep can roll, man.

First ever pre-season game for our new semi-pro league. Five people showed up: Joe, M, Kishan, "Camera-stuffin'" Muffin, and me. Somebody post the official scores in the comments.

Monday, March 07, 2005

0 126 2184 16380 78120 279930 823536 2097144 4782960 9999990

Sunday, March 06, 2005

Crypto Challenge II Clue

r fsd dl fdn lbsf st htsn htsn s rsf s g m hs htsf s v rpp s r msts ms hs n s bs r htsf s s c bsd gs sf s cn ts x s htsn v sss ndl bsht wsn ts qsn n p syr v stc fsyr v sr fsl n b rtsr hsn sll csdn st ssr hsn sylmr fsn s rsx fsd hc rcsyl l vr ss r ssdn msk wshc hwsr dn ss c d j rps l vr ssf ssr fs htsll sff s k hs

Look at yourself, then look at the cipher text. It's the only way the computer will make sense of it.

Scripting Java is Groovy

I've been thinking about Java and scripting lately for work and other projects and finally got down to messing with Groovy this weekend. I'm not far along into it but already it seems to do what I want in terms of extending applications without recompiling or giving up source. This is great for advanced users who want to do more than the original application allowed.

I wanted to see if I could create a simple program that would evaluate a Groovy script and return its result. I've found the documentation and examples about embedding Groovy somewhat lacking. There are plenty of examples and tutorials on how to use it like you would perl or python but very few about using it within an application framework. So I started with:

package com.fortunemegastore.groovy.tests;

import groovy.lang.GroovyShell;
import groovy.lang.Binding;
import groovy.lang.Closure;
import org.codehaus.groovy.control.CompilationFailedException;

import java.io.File;
import java.io.IOException;

public class GroovyTest {
public static void main(String[] args){
GroovyShell shell = new GroovyShell(new Binding());
try {
shell.setVariable("g", new Double(9.8));
shell.setVariable("m1", new Double(10));
shell.setVariable("m2", new Double(20));
shell.setVariable("d", new Double(2));
shell.evaluate(new File("equation.groovy"));

Closure solve = (Closure) shell.getVariable("foo");
System.err.println(solve.call());
} catch(IOException ioe){
ioe.printStackTrace();
} catch(CompilationFailedException cfe){
cfe.printStackTrace();
}
}
}

This class intiliazes a GroovyShell to interpret scripts, sets up some variables for the script, then evaluates the script. Within the script, the result is stored in the variable "foo". The evaluated script is:

foo = { f = (g*m1*m2)/(d*d); return f; }

Simple huh? The beauty of this is that any string can be evaluated by the parser. If you had a number of different equations to solve a problem, you could plug any one of them into this script and get a result. This is great but the example above has to set variables and depends on a specific variable being present to process the result. I'd rather do this in an object oriented way. For that, I created a second experiment:

package com.fortunemegastore.groovy.tests;

import java.io.File;

import groovy.lang.Binding;
import groovy.lang.GroovyShell;

public class GroovyTest2 {
public static void main(String[] args){
GroovyShell shell = new GroovyShell(new Binding());
try {
NameInterface ni = (NameInterface) shell.evaluate(new File("class.groovy"));
System.err.println("Name: " + ni.getName());
System.err.println("Foo Result: " + ((FooInterface) ni).foo(5,6));
} catch(Exception e){
e.printStackTrace();
}
}
}

Which processes the script:

import com.fortunemegastore.groovy.tests.NameInterface;
import com.fortunemegastore.groovy.tests.FooInterface;

class Thing implements NameInterface, FooInterface {
String name

int foo(int a, int b){
return a + b;
}
}

return new Thing(name:"The Thing");

Here I have defined a new class in Groovy that implements interfaces defined in Java.
The two interfaces are extremely simplistic:

package com.fortunemegastore.groovy.tests;

public interface NameInterface {
public void setName(String name);
public String getName();
}


package com.fortunemegastore.groovy.tests;

public interface FooInterface {
public int foo(int a, int b);
}

The Thing class is evaluated in Groovy with the resulting object returned to GroovyTest2's control. I have implemented foo(int a, int b) to return the sum of its parameters. Another class implemented through Groovy scripting could return some other value. Neither affects the source of the java program! The output of the program is:

Name: The Thing
Foo Result: 11