Goodbye, Maryland. Welcome back, Butler: the tiny Indiana school that clinched its second trip to the round of 16 in four years with a 62-59 win over the Terrapins on Saturday.
read more
Butler beats Maryland
17 03 2007Comments : No Comments »
Categories : Personal
python runtime class creation
17 03 2007I needed a way to dynamically create a class at runtime in python, similar to the following Java code:
clazz = Class.forName("Image")
obj = clazz.newInstance()
python has similar capabilities:
clazz = eval("Image")
obj = clazz()
But python takes it a step further. In Java, newInstance() requires a default constructor to be present, where in python I can have any constructor. For example,
class Image:
def __init__(self, name, type):
self.name = name
self.type = type
clazz = eval("Image")
obj = clazz("foo", "JPG")
Another feature is that in python I can define a class dynamically, but I haven’t tried that yet.
UPDATE
Michael Dehaan corrected my eval faux pas with the following code for loading classes. I wanted to get it formatted in the blog instead of in the comments:
# if just searching one module
# module = __import__(modname)
# or ...
for x in list_of_modules_to_search:
try:
classobj = getattr(module, classname)
return classobj
except AttributeError, ae:
pass
if classobj is not None:
inst = classobj(...)
else:
# boom
Comments : 4 Comments »
Categories : Java, Technology
Car Show
17 03 2007Today the boys & I took the Rodriguez annual trip to the car show. I have attended a car show for the past 20 years. Thirteen of them were in Washington, DC, the last 7 were at the NC Auto Expo here in Raleigh, NC.
The NC Auto Expo has gotten better since the moved it to the NC State Fairgrounds which is much bigger than the old Raleigh Convention Center which had one measly floor of cars.
The boys had a BLAST running from car to car, truck to truck. It’s one of the few times they get to sit in the front of the cars, and opening and closing the doors is always a big treat for them (though scary for me).
Since I started taking the boys, I don’t get to get in the cars as much but I did manage to get in a select few, but the car I really wanted to see was the new Pontiac G8. Once again Pontiac disappoints with a small display of their lame vehicles.

I also saw my two favorite Mazda’s, the Mazda 3 and MazdaSpeed6. Sometimes I tell myself to get a Mazda 3 take the money saved and fix up the Trans Am. But I know I’ll probably never get around to it, so I think I should get a sporty fun car like the MazdaSpeed6.

But my favorite car of the day was a tie between two cars, the Infiniti G35 sedan and the Subaru Impreza WRX STI.

The G35 had grown up + fun written all over it. It had a front and back seat that could hold the family, plus it was rear wheel drive with plenty of horsepower. The seats were leather and supportive, important features in a sports sedan. The G35 had an automatic with the paddles behind the steering wheel like an Indy car. I would probably get a manual as I’m old school and like to shift myself.

But the COOLEST car of them all was the Subaru WRX STI. It looked fast and fun. Though I’m not a fan of the blue plus gold rims, it still rocked. The boys loved this car. Checkout the STI’s engine:

That’s it for this years auto show, until next year.
Comments : No Comments »
Categories : Cars, Family



