Happy Halloween!

Today, I start my new job. All Souls' Day. Should be a good time. Yesterday, I was watching football, and I noticed that you can't really watch a football game, and see a crowd sweep, and be reminded that the day after is Halloween, because people are always dressed up, or have face paint on, or a mask. It's just sports :)

My Hobby

Although more of an obsession nowadays...



Those are games I've bought in the last month. Well, I don't remember when I bought Fable. Rise of Nations : Thrones and Patriots came out a while ago though. It's an expansion pack for Rise of Nations. It's a good game. I'll have more about each game as they slowly take over my life, and I get hooked to each one.

Those cover the spectrum of video games, as pretty much every major genre is represented. I like my video games like I like my music. Varied. Just like in music though, I have a favorite. It's Strategy. Civilization IV, Rise of Nations, and Age of Empires III are all strategy. Fear, Brothers in Arms, and Call of Duty 2 are all first person shooters, and in the genre "Action". That's my second favorite. See, you need more FPS to keep you interested for a while, whereas one strategy game will usually keep you interested for a long time. Well, me anyway. However, FEAR is the best game I've ever played in that genre. Fable is an RPG, and it has the potential to be awesome, but it takes a really long time. Except Fable, which was awesome, but it was too short!! 10-12 hours on a RPG is way too short. You need them to last at least 40 hours.

Games not pictured that I bought in the last month : Serious Sam 2 (sorry Zatko!) and Dragonshard.

Chicago Wins in 4

I knew it would happen. I said it a few times (not on this site...) that Chicago would sweep the Astros in four but I honestly didn't think it would be that close of a series. Tonight's game was 0-0 through seven innings. Both pitchers played incredibly, then were both taken out at the seventh. Backe for the Astros, Garcia for the White Sox. Jermaine Dye batted in the only run of the game. 1 - 0 final. Great game. Exciting plays to end it, however only five hits for either team. Very boring for non-baseball fans. The other games had more runs. Last night's game went five hours and forty one minutes, a World Series record.

Awesome coding

Here's a function I just wrote that basically copies one object's data to another...

private void copy(Object src, Object dest) throws Exception {
  if (src.getClass().equals(dest.getClass())){
    Method []methods = src.getClass().getMethods();
    for (int i = 0; i < methods.length; i++){
      if (methods[i].getName().startsWith("get")){
        String setname = methods[i].getName().replaceFirst("get","set");
        Method setmethod = dest.getClass().getMethod(setname, new Class[]{methods[i].getReturnType()});

        Object value = methods[i].invoke(src,new Object[]{});
        Method clone = value.getClass().getDeclaredMethod("clone",new Class[]{});
        if (clone != null && clone.isAccessible()){
          value = clone.invoke(value,new Object[]{});
        }
        setmethod.invoke(dest,new Object[]{value});
      }
    }
  }
}


It's in Java, and it imports the java.lang.reflect package. It's wicked. Obviously not the most complete function. It could be in a BeanUtils class as a public static function. I could also specify whether or not I want "clone" to be used, instead of just checking if it's implemented and using it. One last thing, if the destination class is a subclass of the source class, it should still work, because the destination is guaranteed to have the same functions as the source in that case. This, of course, assumes that the objects are "beans".