Archive for March, 2007

Dramatic proof that God killed Elvis

Friday, March 30th, 2007

For a good time, play both videos at the same time.

Thought for the day (nerd edition)

Friday, March 30th, 2007
Though the debates will forever rage about which JVM dynlang should carry us into the future, the same facts that have guided programming for half a century still apply today: No one language will be enough to carry us forward; no languages will survive indefinitely; and the language you’ll use in ten years you’ve probably not even heard of yet

From Ruby on Grails? Why the hell not?

Nerd Type

Thursday, March 29th, 2007

Memefollowing from Stephanie, Heidi and Jill.

What Be Your Nerd Type?

Your Result: Literature Nerd

 

 

Does sitting by a nice cozy fire, with a cup of hot tea/chocolate, and a book you can read for hours even when your eyes grow red and dry and you look sort of scary sitting there with your insomniac appearance? Then you fit this category perfectly! You love the power of the written word and it’s eloquence; and you may like to read/write poetry or novels. You contribute to the smart people of today’s society, however you can probably be overly-critical of works.

It’s okay. I understand.
Science/Math Nerd

 

 

Social Nerd

 

 

Gamer/Computer Nerd

 

 

Drama Nerd

 

 

Musician

 

 

Artistic Nerd

 

 

Anime Nerd

 

 

What Be Your Nerd Type? Quizzes for MySpace

The one thing that sort of puts me out about this quiz is that it lumps “Gamer” and “Computer” in to one category. I like the computers plenty, but can’t much stand the computer games. Why must they be combined?

Make Money Fast with Yahoo! Mail

Wednesday, March 28th, 2007

Holy mail wars, Batman! The ‘Hoo is offering $10/head for new mail users. From Jay-Z’s blog:

Oh, I should also mention that if you build the next kill application and convince people to use it and upgrade to the premium version of Yahoo! Mail, we’ll pay you $10 per user. The sky’s the limit on how cool your mail front-end can be. We’ll handle the infrastructure.

So, first off: Damn. That’s a lot of cash. Says something about their belief that somebody out there can build the better mail trap. Although I’d hate to be on the Yahoo mail client team right about now.

Build Your Ultimate Superhero Team Quiz

Wednesday, March 28th, 2007

Following the meme from CLV and Pat, here’s my “Ultimate Superhero Team.”

First, the rules:

The Challenge: Assemble a superteam from your favorite books, films, TV shows, etc. Your team must consist of the following: (1) Team Leader (1) Warrior (1) Smartypants (1) Hottie (1) Comic Relief All your superteam members must be from DIFFERENT sources.

Here’s what I’d go with:

Team Leader: Frylock Warrior: John Shaft Smartypants: Nick Charles Hottie: Agent 99 Comic Relief: Irwin Fletcher

If you’re putting together a super-team, obviously you’re doing it to fight crime. Who better to fight crime than a group of the best detectives modern American media has ever seen?

He’s not a detective, but Irwin “Fletch” Fletcher plays one on TV, or in the hospital records room or the aviation maintenance shop or at the country club on the Underhill account. Aside from his acerbic wit, his mastery of disguise would be a boon to the group. Also considered: Master Shake, Axel Foley. Spy. Detective. Same thing. Above and beyond the hot, she solves mystery and has the ability to contend with 86. Braggable I’ll note that it’s the Barbara Feldon 99 that I’m talking about. None of this Anne Hathaway nonsense. Also considered: Veronica Mars, Nora Charles, Master Shake.

The ultimate smart alcek, Nick Charles none the less knows what time it is when there’s crime solving to be done. He’s never short of a deft observation or logical reasoning, and he would make sure that the group doesn’t go dry. Nobody else was considered for this position.

He’s one bad mother SHUT YOUR MOUTH. Did I choose Shaft just so I could make that joke? Probably. Would he kick your ass anyway? Yes. Also considered: B.A. Baracus, Master Shake.

To lead this group of superstars, you need somebody who knows how to get the best out of a group. Somebody who knows how to manage big egos. Somebody who can shoot freaking explosion beams out of his eyes. Frylock is the man here. He has the science chops to keep up intellectually, and his physical might — witness his triumph over the Quad Laser — is second to none. Also considered: Master Shake.

So there you have it. It’s my bad ass superhero team. Criminals beware.

Best Worst apparel idea, ever.

Wednesday, March 28th, 2007

Reef Dram Sandal - Men's I can’t think of enough good things to say about the Reef Dram Sandals sold on Amazon. I’ve seen lots of ideas for hidden flasks: books, golf bags, binoculars, etc. These definitely take the cake, though. There’s a flask in the heel, so not only does your whisky stay hidden: it stays warm. Double bonus?

Testing Java with JRuby

Tuesday, March 27th, 2007

Chris chided me in the Java only gets 10mpg comments for not giving Groovy or Rhino a go. Chris has a fondness for busting my chops equaled by few. However, he does it because he cares, so I thought a bit about using non-Java languages on the JVM.

I still think that in general, I have little use for the Java platform. If I want to write code in something like Ruby or Python, I’ll just use Ruby or Python or whatever as they’re originally distributed. Bolting them on to the JVM really doesn’t do anything for me. That said, if I can use them to get out of ugly, tedious work, maybe they’re worth my time.

As it happens, I recently inherited about a quarter million lines of Java code. There are chunks of it that are somewhat lacking in terms of unit tests, and I’m one of those mutants who really doesn’t like to fix code without exerciseing the problem with a test first. With this project, I’ve been having to write hundreds and hundreds of lines of test code to make very simple changes. It’s safe, but it’s not exactly efficient or fun.

So I took Chris up on his suggestion and gave JRuby a look for writing tests. It works surprisingly well. There’s not that much setup work that you need to do to get the environment up and running, and once you do it’s rather nice to not have to slog through the ugly world that is Java the language to get your tests written.

Here’s a very brief sample. What I wanted to do is have a very traditional ant-based project with the standard init->compile->test->dist dependency chain, but sub JUnit out for JRuby and Ruby’s unit test framework. First, the silly little Java class that I used for testing:

src/java/org/obfsucated/example/Overbearing.java

package org.obfuscated.example;

public class Overbearing {
    /** Javaize a string.
     **
     ** Everybody knows that Java people can't stand data unless
     ** it's XML or some sort of proprietary binary format that
     ** you have to pay Sun $10,000/seat to use.  Our Overbearing
     ** class should be able to take any pedestrian string and
     ** turn it in to something that any Java programmer would
     ** love and cherish forever.
     **
     ** @param original an ugly, non-Enterprise-compliant string.
     ** @returns a String that you could put in some sort of bean.
     */
    public String javaize(String original) {
    if(null == original)
        return null;
    StringBuilder sb = new StringBuilder();
    sb.append("<java-is-rad>< ![CDATA[");
    sb.append(original);
    sb.append("]]></java-is-rad>");
    return sb.toString();
    }
}

And here are the relevant Ruby source files:

src/jruby/test_all.rb

require 'test_overbearing'

src/jruby/test_overbearing.rb

require 'test/unit'
require 'java'

Overbearing = org.obfuscated.example.Overbearing

class TestOverbearing < Test::Unit::TestCase
  def setup
    @overbearing = Overbearing.new
  end

  def teardown
    @overbearing = nil
  end

  def test_creation
    assert_not_nil @overbearing, "We should be able to create an Overbearing object"
  end

  def test_simple_string
    original = "Hello World"
    expected = "<java-is-rad><![CDATA[Hello World]]></java-is-rad>"
    resultant = @overbearing.javaize(original)
    assert_equal resultant, expected
  end

  def test_nil_string
    original = nil
    expected = nil
    resultant = @overbearing.javaize(original)
    assert_equal resultant, expected, "Nil strings should stay that way"
  end
end

It’s all pretty staraightforward stuff. I like to run unit test suites by requiring all of my tests in one file and just calling that with the interpreter. (Thus the “test_all.rb” file.) There are without doubt better ways to do this. You get the general idea, though.

One gotcha is that if you have a package with calital letters, you can’t alias it as above. So let’s say you have a class with a fully-qualified name of org.obfuscated.BadPackageName.Whatever. JRuby — or Ruby itself, if I had to guess based on the way identifiers are usually handled — will not be able to find it if you just say

Whatever = org.obfuscated.BadPackageName.Whatever

Instead, use the include_class function to make sure it’s loaded.

include_class('org.obfuscated.BadPackageName.Whatever')

Long story short, though: don’t use capital letters in package names.

The Ant setup isn’t too difficult, either. Assume the following properties are available:

jruby.dir
The directory where JRuby is installed
jruby.test.dir
The directory where you keep your test scripts (testall.rb and testoverbearing.rb in this case)
The relevant parts of the build.xml file look like this:

  <path id="jruby.classpath">
    <fileset dir="${jruby.dir}/lib">
      <include name="*.jar"/>
    </fileset>
  </path>

  <target name="test" depends="compile">
    <java classname="org.jruby.Main" fork="true" failonerror="true">
      <classpath refid="project.classpath"/>
      <classpath refid="jruby.classpath"/>

      <sysproperty key="jruby.base" value="${jruby.dir}"/>
      <sysproperty key="jruby.home" value="${jruby.dir}"/>
      <sysproperty key="jruby.script" value="jruby"/>
      <sysproperty key="jruby.shell" value="/bin/sh"/>

      <arg value="-I"/>
      <arg value="${jruby.test.dir}"/>
      <arg value="${jruby.test.dir}/test_all.rb"/>
    </java>
  </target>

Type “ant test” and away you go. Now you now longer have to slog through things with Java, and you’ve removed the compile phase from your test cycle. Bonus.

So thanks, Chris. That was a fine idea.

Beginner’s Guide to Quicksilver

Tuesday, March 27th, 2007

Quicksilver.Lifehacker is currently running a beginner’s guide to Quicksilver. Quicksilver is an amazing utility. It completely changes the way you use your computer, replacing tons of mousing with a few keystrokes. If you depend upon your wrists for your livelihood, I can’t recommend getting to know Quicksilver quite enough.

Raymond Chandler’s Los Angeles

Tuesday, March 27th, 2007

A recent email from the 1947project tipped me off to Esotouric, offering “Bus Adventures into the secret heart of LA.” Stephanie and I went on their Black Dahlia tour last winter and it was amazing. Kim and Nathan put on an exceedingly entertaining and informative tour.

As it turns out, they now have a tour called Raymond Chandler’s Los Angeles: In A Lonely Place. Chandler is the definitive author of Los Angeles hard-boiled crime fiction. Getting the lowdown on his view of the city sounds nothing short of fascinating.

Thought for the day

Monday, March 26th, 2007

RUN TESTICLES, RUN!

Originally uploaded by deleteyourself. Testicular cancer isn’t funny. This, however, is.