New Site Hosting

In the interests of better site availability and less Comcast AUP-breaking, I’ve finally gotten around to outsourcing my website hosting.  I’m currently at NearlyFreeSpeech.net, a webhost committed to the twin goals of free speech and affordable web hosting.

How free is their speech?  Read their Abuse page:

“A NearlyFreeSpeech.NET member site is defaming me or otherwise injuring me civilly.”

Please forward a copy of your legal finding from a court of competent jurisdiction to our contact address. If you have not yet obtained such a finding, a preliminary injunction or court order is also sufficient.

If you are not able to obtain the above, you will need to work directly with the site operator to resolve your differences. We will have to fall back on our members’ contractual assertion that the content they upload is legitimate and therefore we will not be able to get involved

How affordable is their hosting?  You pay only for the bandwidth and storage that you actually use: $1 per gigabyte of bandwidth and $0.01 per megabyte-month of storage.  (Plus the bandwidth cost goes down the more you use.)

They support a variety of CGI scripting languages, including C, PHP, Perl, Python, and Ruby.  Oh, but also Fortran, Tcl, Lisp, Scheme, OCaml, and Haskell.

We’ll see how it goes, but I think I’ll like it here.


Java Reflection

I’m only a few weeks into my Java class and I’m already annoyed at the language.  I’m completely willing to ascribe this to newbieness, where I’m just not working with what the language gives me, but the metaobject stuff in Java seems a bit painful.

I’m working on a project for the class where I have to accept input in several different units of heat (BTUs, calories, and joules) and output the measurement in joules.  I’ve made an abstract base class for the various units and created concrete classes for each unit the program has to read.  I’d like to just have a list of available classes and have my program enumerate them automatically (rather than hardcoding the behavior for each), but the way I would normally think about doing this is painful in Java.

In Delphi, I’d do something like this:

type
  THeatUnits = class
   public
    constructor Create(Value : Real); virtual;
    class function GetUnitsName : String; virtual; abstract;
    function ConvertToJoules : Real; virtual; abstract;
  end;
    
  THeatUnitsClass = class of THeatUnits;

  TBTUs = class(THeatUnits);
  TCalories = class(THeatUnits);
  TJoules = class(THeatUnits);

const
  availableUnits : array [1..3] of THeatUnitsClass
                 = (TBTUs, TCalories, TJoules);

... 

procedure DoStuff(Index : Integer; Value : Real);
  var
    Units : THeatUnits;
begin
  Units := availableUnits[Index].Create(Value);
  // Now do things polymorphically with Units. 
end;

Delphi’s class types often seem like a quick hack to me, but they beat what Java does in the same situation.  For one thing, there doesn’t seem to really be a class type in the same way that Delphi does it.  There are instead objects of type Class.  As far as I can tell, the best way to get one of those is to call Class.forName("ClassName").  But the painful part is that there’s no specialization of class types at compile time, so the Java code equivalent to my Units := availableUnits[Index].Create(Value); above would be something like this:

static final AVAILABLE_UNITS = new String[] ("BTUs", "Calories", "Joules");

public void doStuff(int index, double value) {
  Class unitClass = Class.forName(AVAILABLE_UNITS[index]);
  Constructor unitConstructor = unitClass.getConstructor(new Class[] (double.class));
  HeatUnits units = (HeatUnits)unitConstructor.newInstance(new Object[] (new Double(value)));
  // now do things polymorphically with units. 
}

(Common Lisp, of course, would be more succinct than Delphi, because everything is first-class; I would probably do something like this:

(defclass heat-units () ())

(defgeneric get-units-name (unit-class))
(defgeneric convert-to-joules (unit-class))

(defclass btus (heat-units) ())
(defclass calories (heat-units) ())
(defclass joules (heat-units) ())

(defparameter +available-units+ #(btus calories joules))

(defun do-stuff (index value)
  (let ((units (make-instance (svref +available-units+ index)
                              :value value)))
    ;; Now do things polymorphically with units. 
    ))

)

As I said, though, I think this is just an artifact of not thinking in Java to the appropriate degree.  Most of Java’s reflection stuff seems set up to be useful at run-time while Delphi’s run-time reflection is much uglier than Java’s.  And I think I’m going to approach my Java problem from a different direction, with an enum and a factory method.  I was still struck by how annoyingly wordy (and not entirely typesafe) my first approach turned out to be in Java.


Pumpkin Pie

This is from smakelijke gerechten, a cookbook assembled by the First Reformed Church in Oak Harbor, Washington in 1971.  My grandmother’s sister belonged to the church, and the cookbook was a gift for my grandmother’s birthday.

  • 2 eggs, slightly beaten
  • 1-3/4 cups pumpkin puree (1 can)
  • 3/4 cup sugar
  • 1/2 teaspoon salt
  • 1 teaspoon cinnamon
  • 1/2 teaspoon ground ginger
  • 1/4 teaspoon ground cloves
  • 1-2/3 cups evaporated milk (1 12-oz can)
  • 1 9" pie crust, unbaked

Preheat oven to 425°F.  Mix all ingredients.  Pour into pie crust.  Bake at 425°F for 15 minutes, then reduce temperature to 350°F and bake for 45 more minutes or until a toothpick inserted in center comes out clean.


Grandma's Potato Salad

While I was down in Texas for Thanksgiving, I got my grandmother to give me a couple of her recipes.  Unfortunately, she was so familiar with the ingredients that she didn’t have any measurements more specific than “‘Til it tastes right,” so that’s all I can provide at the moment.  I plan to make the recipe a few more times myself and figure out what measurements work well.

  • 3-4 lb. potatoes
  • 4 eggs
  • 1 medium white onion, diced
  • mayonnaise
  • pickle juice
  • curry powder
  • salt
  • pepper
  • yellow mustard
  • paprika

Scrub and boil the potatoes.  Hard boil the eggs.  When the potatoes are done, let them cool then peel them—the skins should rub right off.  Cut the potatoes into roughly 1" pieces.  Dice the eggs.  Mix together potatoes, eggs, and onion.

In a separate bowl, mix the mayonnaise and pickle juice until the mixture is the right consistency.  Add the curry powder, salt, pepper, and mustard to taste.

Mix the dressing with the potatoes, then sprinkle paprika over the salad.


Grandma's Parker House Rolls

While I was down in Texas for Thanksgiving, I got my grandmother to give me a couple of her recipes.  She portions many of the ingredients by feel or taste, though, so this recipe assumes some familiarity with yeast breads.  I plan to make them a couple of times and get some more exact measurements.

  • 2 cups milk
  • 4-6 tablespoons sugar
  • 1 teaspoon salt
  • 8 tablespoons butter (one stick), divided
  • 2 packets yeast
  • flour

In a small saucepan, mix the milk with the sugar, salt, and 6 tablespoons of butter.  Heat to just below a boil, then allow to cool to room temperature.

Proof the yeast in some water with a little sugar.  Mix the yeast into the milk, then add enough flour to get the right consistency.

Knead the bread, then allow it to rise until doubled in size, about an hour.

Preheat the oven to 375°F.

Melt the remaining 2 tablespoons of butter.  Flatten the dough, then roll it out to about 1/4" thick.  Cut circles in the dough with a biscuit cutter or the opening of a glass.  For each circle, dip half of one side in the butter, then fold it in half with the butter on the inside.  Place the rolls on baking sheets and allow to raise until increased in size by roughly 50%.

Bake at 375°F until done, roughly 8-10 minutes.