Summer Movies

May 3rd, 2009

I’ve been boycotting the movies for about a year now. I don’t really like… well, people in general, so the prospect of sitting in my family room watching a movie three months after it was out in crowded, noisy theaters is really appealing. And with the recent flood of pure crap in the theaters, at the end of the day I’m still just watching Fight Club rather than renting the new releases anyway.

I do love the feeling of a good summer movie and was happy to realize that this summer shows promise. After poking around IMDB for a while, I came up with a quick list of potential summer movies to get me out of the house. Maybe.

  • X-Men Origins: Wolverine – Actually, I’m already behind on this list. I just got back from seeing it. Surprisingly better than I expected. It had the cool explanation aspect that is usually reserved for the first movie in a comic book series with enough foreshadowing that you can pick up on because you know the story. Really excited to see what they do with the next ones about Magneto and Xavier. Though I have to admit, I’m pissed they didn’t get Sawyer from Lost to play Gambit. That would have rocked.
  • Star Trek – Over the course of my life I’ve watched approximately 6 minutes of Star Trek. I’ve just never been into it. This one, however, has me pretty excited. It’s got the guy from Heroes, the guy from Harold and Kumar, and the guy from Shaun of the Dead (too damn lazy to look up any of their names). How can it not be good?
  • Transformers: Revenge of the Fallen – I have virtually no doubt in my head that this is going to suck. I loved the first one, it was the epitome of summer blockbusters. Sure, the plot made about as much sense as the ramblings of my 21 month old daughter, but seeing giant robots throwing each other through buildings kinda negates the need for a plot. That said, I’m afraid they are going to try to really out do the first one in this one, in the end producing a disaster of a sequel. Let’s just hope it doesn’t do to Pirates of the Caribbean (the first one was amazing) what its abominations they called sequels did.
  • Harry Potter and the Half-Blood Prince – Anyone reading this site for longer than 3 minutes will realize I’m enough of a geek that this shouldn’t come as a surprise. This was my favorite book in the series and I’ve been pretty happy with the movies so far, so I’m hoping it doesn’t disappoint.
  • G.I. Joe: The Rise of Cobra – A Transformers and a G.I. Joe movie in the same summer. I think part of my excitement is that it makes me feel young again in a year where I turned 30. Whatever the motivation, this has the potential to completely rock (like the first Transformers) or be a complete failure (like Spiderman 3 — someone needs to be publicly flogged for that one).
  • Inglourious Basterds – Ok, so Quentin completely dropped the ball with Death Proof. It would have sucked on its own but was made all that much worse by having to follow Planet Terror which was simply awesome. But I’m still a big Quentin fan and this looks like it has some real promise. In short, it’s Brad Pitt kicking the shit out of Nazis in graphic gore. It’s like Fight Club 2. Except with Nazis.
  • Ghosts of Girlfriends Past – A cookie cutter romantic comedy that is the theatrical equivalent of stabbing yourself in the eyes with a spoon. Anyone who thought for even a second that I was going to see this, please send me your IP address so I can add you to my firewall. And then go find the nearest person and ask them to slap you for me.

Moving

May 3rd, 2009

I’m a bit late on posting this. Two weeks ago, after signing our names a few hundred times, we finished with the initial batch of contracts for our new house:

Millstone

… at least, that’s what it will look like when it’s actually built (exact model, orientation, side car garage, and siding/shutters). For now, however, this is what we actually own:

Future House

A big pile of dirt. More accurately, an expensive pile of dirt. I’m pretty sure somewhere on the land where the house should be is a pile of dog shit.

Once it’s actually built, it will be a 4 bedroom, living room, family room, dining room, study, basement, gourmet kitchen, and two car garage full of pure awesome.

The process sounds like it’s going to be… long. Really long. We’re past the phase of selecting options and just today selected the colors for the granite counter tops, outside siding and shutters, carpets, hardwood floors… and so on. If it sounds intimidating, it is. Thankfully, my wife and I have virtually identical tastes, so we literally didn’t run into a single problem selecting any of those details.

Amazingly, this is still just the beginning. We haven’t even had our “pre-build orientation” yet. I’m not sure what that is, but if it involves any ice breakers or having to learn goofy songs (a la Villanova’s orientation), I’ll be downright creeped out. After that, we have a bunch of walkthroughs at various points. The one I’m most interested in is when the frame is set up but without drywall, at which time I’m going to show up with about 500 feet of CAT5 and wire up pretty much every square foot of the house with internet access (including the toilet, thereby fulfilling one life goal of one day taking a dump on a toilet with an IP address).

Outside of the house itself, the location is freaking great. We’re in a cul-de-sac (I’d love to know why I actually know how to spell that). Across the street — er, circle — they are putting a park with a “tot lot”, so assuming my daughter doesn’t inherit my allergies to everything outside, she’ll have the opportunity to spend a lot of time outside. We’re number 144 in the development layout:

Amherst Meadows

Now we just need to decide if we’re going to sell our current house or rent it out. Anyone want a place in scenic NJ?

Java Preferences

May 2nd, 2009

I’m totally addicted to the Java preferences framework.

For a while, I’ve wanted to add user preferences to CodeTurtle. My motivation was less letting the user explicitly set certain values and more about adding in polish to the UI. For instance, I wanted to remember the last position and size of the UI if the user moved it (rather than always starting maximized or something like that). Little things like that are somewhat taken for granted until you use a UI that doesn’t have them, at which time phrases like “This sucks” tends to come out. Besides, it seemed like a fun challenge.

I thought I was going to have to choose between using a simple key/value pair serialized to disk or actually adding in an XML framework for more flexibility and dealing with that headache (or some other unholy third option). What I found out was how little I actually knew. The Java preferences framework gives you both for pretty much free.

Java will keep track of storing the preferences in wherever it makes sense based on the native operating system (for instance, they are stored in a directory named .java in the user’s home directory on Linux). The format is XML, but it’s actually not necessary to know that since I don’t have to do squat to actually interact with it.

To load the preferences, it’s a one line call:

Preferences preferences = Preferences.userNodeForPackage(this.getClass());

After that, it’s simple getters to get your values. The Preferences object even has some really nice polish on the API letting you use type specific getters (getString, getBoolean, etc) and specify a default value. Setting values uses a put notation that functions like the Map interface.

int windowWidth = preferences.getInt("window.width", 800);
...
preferences.putInt("window.width", frame.getWidth());

That’s it. That’s all you need to cover reading/writing the file, determining the proper home directory location, and serializing/deserializing the XML store of the data. My daughter could write code to use this if she could stop drooling long enough to not short circuit the keyboard.

You technically don’t even have to worry about saving, it will periodically do that for you. However, if you want to explicitly trigger a save, simply call the flush() method on the preferences object.

I even built in a command line option to CodeTurtle to clear the user preferences, which is in itself a simple call:

preferences.removeNode();

I was happy to see that my design of having a central data manager passed throughout the GUI came in handy here as I was able to stuff the preferences object into it and access it from virtually anywhere else in the UI. At that point, it was just a matter of figuring out what I wanted to store. In the beginning it was things like the window placement, window size, and tab placement. Tonight I decided to add a flag indicating if it’s the first time the user is running CodeTurtle. If it is, I enter a bit of a “demo mode” where the sample project included with the CodeTurtle distribution is automatically loaded to more easily show off its complete awesomeness.

I still have other (reasonable) ideas on things I want to stuff into user preferences. Rather than requiring an environment variable to indicate the compiler path (i.e. TURTLE_JDK_HOME, JAVA_HOME), I’d like to move that to the user preferences to make it easier to see where the value came from. The real challenge at this point is trying to not abuse this new found power and stuff every imaginable value into it. :)

My annoyingly over-engineered (and pretty much completely unnecessary) wrapper on top of the Java preferences framework can be found in CodeTurtle’s SourceForge repository.

I just found out that Hugo Weaving is the voice of Megatron in both Transformers and its upcoming sequel. That’s in addition to playing Elrond in the Lord of the Rings Trilogy, Agent Smith in The Matrix Triology, and V in V for Vendetta. If it somehow came out that he was in Empire Strikes Back he’ll legally be declared a god among geeks.

UPDATED: Damnit

May 1st, 2009

Last night was the last lecture of the semester. I now send my kids off into the wild with hopes they won’t fall into darkness (read: become a C# programmer).

And sure enough, after a semester of my code snippets of pure genius on this blog, I find the WP-Syntax plugin that offers really sweet syntax highlighting for multiple languages. Just in time for a three month break from being able to force students to read my blog.

This also means at some point, I should go back and reformat all my code posts to use the plugin. What a bitch, but really, the syntax highlighting is pretty damn sweet. Here are a few examples taken from the plugin site itself.

Java

1
2
3
4
5
public class Example {
  public static void main(String[] args) {
    System.out.println("Hello World");
  }
}

PHP

1
2
3
4
5
6
7
<div id="foo">
<?php
  function foo() {
    echo "Hello World!\\n";
  }
?>
</div>

Ruby

1
2
3
4
5
class Example
  def example(arg1)
    return "Hello: " + arg1.to_s
  end
end

Python (ok, Hello World isn’t a great example for Python, come with me on this one)

1
print "Hello, World!"

Bash (again, shitty example, but I’m really excited bash is supported)

1
echo 'Hello World'

Even SQL and Scala are supported. This rocks.

So I apologize to anyone who needs to look at my old code snippets. I had to yank out the CSS style that formatted the background with the white and green line highlighting and numbers, so they aren’t quite as apparent as they used to be. I’ll try to convert the most relevant ones to next weeks’ final first, then eventually (read: annoyingly slowly) convert the rest.

UPDATE: HA. I ghetto hacked the plugin to default my old code indication tags to the plugin based tags (defaulting to Java since 95% of the stuff I post here is Java). It’s not the most ideal situation and I’ll eventually write a script to run through my posts making the changes, but for now at least my OCD isn’t completely pegged by the fact that all my code posts looked like shit.