How to embed JRuby 1.9 into a Java class

20
Aug/09
0

It took awhile longer to figure this out than I would have liked, due to no on-line JavaDocs for JRuby (what’s up with that!?).

But here’s how to embed JRuby 1.9 into a Java class:


import org.jruby.Ruby;
import org.jruby.RubyRuntimeAdapter;
import org.jruby.javasupport.JavaEmbedUtils;
import org.jruby.RubyInstanceConfig;
import org.jruby.CompatVersion;

import java.util.ArrayList;

public class JRubyEmbedded {
  public static void main(String[] args) {
    RubyInstanceConfig ric = new RubyInstanceConfig();
    ric.setCompatVersion(CompatVersion.RUBY1_9);
    Ruby ruby = JavaEmbedUtils.initialize(new ArrayList(), ric);
    RubyRuntimeAdapter rra = JavaEmbedUtils.newRuntimeAdapter();

    System.out.println(rra.eval(ruby, "\"Ruby #{RUBY_VERSION}\""));

    JavaEmbedUtils.terminate(ruby);
  }
}
Filed under: Code

Evening of Day 4: St. Mary Lodge and Resort, St. Mary, Montana (near Glacier National Park)

11
Jul/09
1

After our tour of the Going-to-the-Sun Road on June 30, 2009, we went to the St. Mary Lodge and Resort in St. Mary, Montana. Calling this place a “Lodge and Resort” is a misnomer. It’s really just a multi-room hotel with some cabins, a store, a gas station, a decent restaurant, a gift shop, all surrounded by blacktop parking. (What you can’t see from this picture of their cabins is that these buildings are right on the road, and it’s a pretty busy one.)

We had a decent meal at the lodge’s restaurant. I had whitefish supposedly fished from the nearby St. Mary’s lake, and Julie had elk medallions. The wine was pretty bad, as was the service. And it was damn expensive, but I guess that’s to be expected given how far we were from normal distribution circuits.

In addition, they have teepees (oops, I should be more politically-correct: tipis). There were seven or eight of them. Each one is quite large, perhaps 20 feet tall, and large enough to accommodate two queen-sized beds, a couch, and a table. There is no power in the tipi, so you are issued a battery-powered lantern. You also get a key to a small building next to your tipi that has a shower/hot-tub, toilet, sinks, and power.

Upon being told the number of our tipi (#2), we walked across the street to take a look. On examination of the tipis, they seemed to be made by a company from British Columbia. They were made of very heavy fabric, that was, I think, decoratively painted (from the inside, you could see something like brush-strokes). The poles were sturdily planted into the ground with industrial-strength fittings. Looking closely at this particular tipi, a lot was off. For one thing, the flap on the front had no means to secure it. There was a pole on the ground that was (from looking at the other tipis) supposed to be in place to hold open the top of the tipi. This particular tipi was also right off of the road. People would stop their cars and take a look inside. In general, it seemed kind of lousy, and made me kind of nervous: With that proximity to the road, there would be noise, as well as the possible intrusion from nosy passers-by. So we asked for a tipi change.

The new tipi (#3) had a flap that could be secured, as well as all of its poles in the right place, and it was off the road. Better.

The tipis are not particularly air-tight; there was a noticeable gap at the bottom between the bottom edge of the tipi fabric and the ground. Julie and Caroline are very tasty for mosquitoes (I’m not, for whatever reason), so the whole thing seemed like kind of a bad idea to me. Also, here we are briefly in “civilization,” and . . . no wifi in the tipi? Plus, the cost was by far the most expensive option at the Lodge.

Having said all that, it was pretty neat on the side (see the pictures below). After the pictures, though, I have a bit of a tale to tell.
day4-tipis

day4-tipi-1

day4-tipi-2

day4-tipi-3

After getting settled for bed, we fell asleep. At about 1:30 AM, I woke up with a start. Outside I could hear a huge wind bearing down from over the mountain. What’s more, the poles were rattling, and you could sense that the entire tipi was being significantly stressed by the wind. A lot of nightmare scenarios floated through my mind, mostly along the lines of “how could I put my six-year old in a fragile structure in the wilds of Montana?” I stepped outside the tipi, and the night sky was illuminated by a nearly-full moon. Clouds had set in, which was too bad because I had wanted to see the starry sky without the light pollution. I could see that the clouds were being blown rapidly by the wind. I would guess that the gusts were at maybe 35 mph: It really seemed like too much for the tipi. I woke up Julie and we wondered if we should ask to be transferred to the “Lodge.” We talked for awhile, but didn’t come to a decision. Julie fell back asleep. I stayed awake, staring at the top of the tipi, wondering when the whole thing would come crashing down. While I was lying there frozen with fears, I could hear people from the neighboring tipis partying noisily at the outdoor jacuzzi — who were these people? Eventually I, too, fell asleep. Julie tells me that she woke up again at 3:30 AM, and heard the rattling and crazy winds all over again.

Meanwhile, Caroline slept through the whole thing.

The upshot of this is that I wouldn’t recommend the tipis. They are too exposed to the elements (if not to passers-by); when you’ve had a long road trip, I think you need a quiet locked room and the amenities of a real hotel.

Filed under: Travel

Day 4 (Tues., 30-June-2009): Going-to-the-Sun Road

8
Jul/09
0

It sure was nice to sleep in a stationary bed! We got up and went down to the restaurant in the Glacier Lodge, and had a buffet-style meal. We ate a lot because we thought we might skip lunch. The breakfast at Glacier Lodge wasn’t very special, but it was filling, and they had cereal for Caroline.

The main event of the day was the Going-to-the-Sun Road. The road was completed in the early 30s. Vehicle lengths are restricted to 21 feet. If you ever drive the road, you may recognize it from the movies: Among other shots, it is used at the start of “The Shining.”

When planning our trip, we had read that the road at Logan’s Pass still had 70 feet of snow on it, and even after snow removal there might be road work that would prevent people from using the road. But as it turned out, it had just been cleared. If you get to Glacier on July 1 or later, you can take a shuttle bus for the Going-to-the-Sun Road, which I think I would recommend; but we drove. Another way to do it is to pay for a tour in a so-called “jammer” tour bus, which are also from the 30s, and have been recently retrofitted to run on propane. Some parts were fairly hair-raising, but it was really no worse than other mountain driving I’ve done.

day4-going-to-the-sun

Along the way there are a number of places to park and walk around. At one stop, we saw a fine mountain goat.

day4-goat

At another, we took a short one mile hike (round trip) through a glade of cedar and hemlock trees.

day4-hemlocks-and-cedars

I was able to use the macro lens on my digital camera to get some shots of some flowers.

day4-flowers-blue

day4-flowers-green

day4-flowers-yellow

Also in this same glade, there were opportunities to peer down into a pristine gorge, filled with water from the glacier runoff.

day4-small-gorge

Caroline was a good sport on this part of the trip, though of course she got tired while walking, and also took some key naps during the drive.

Filed under: Travel

Day 3 (Mon., 29-June-2009): North Dakota; Montana; Glacier N.P.

7
Jul/09
0

Monday the 29th (Day 3) was all about finding things to do as we cruised through Western North Dakota and Eastern Montana. We woke up with the sunrise:

day3-north-dakota-sunrise

Caroline, the 6-yr. old, and John, the 40+ yr. old, were fighting it out for who could be more bored. Train travel with a soon-to-be-first-grader is tough. But we brought along a lot of surprises for Caroline, such as a magnetic knock-off of Battleship called SeaBattle:

day3-battleship

I should say that Caroline was quite content to read at long stretches from her books about Fairies, which we doled out slowly.

day3-julie-and-caroline-reading

I finished on my Kindle the novel One Second After (Amazon), which is about the impact of an EMP (electromagnetic pulse) on everyday life in North America and a small town in North Carolina in particular. Besides being a pretty ripping yarn, the novel is plausible agit-prop for the notion that the federal government should harden many more resources against the effects of EMP. After reading the book, I read up a bit on EMP, and if you’re concerned about, oh, the end of life as we know it, I would recommend that you read it. (It’s better than the TV series “Jericho,” but not as good a novel as World Made by Hand (Amazon).)

In the mid-morning, our sleeping car attendant told us that there would be a wine-tasting at 3 PM. Now that sounded fun. However, there were to be no kids! So I did the one on this leg, with the expectation that Julie would do the tasting on the way back. It was a lot of fun. Here’s a pic of one of the dining car managers reading about the wine:

day3-wine-tasting

The wine wasn’t bad. All bottles in the $10 to $15 range; probably the best was a 2006 cab from Castle Rock. During the tasting, there were some trivia questions: I answered enough of them to win a bottle of the Castle Rock, which Julie and I saved for a later meal.

The train rolled into East Glacier at around 6:45 PM. The approach to Glacier became somewhat more lively, but was, for the most part, more of the flat prairies of the eastern part of Montana and North Dakota, along with some badlands-style mesas:

day3-montana-big-sky

And more grain elevators . . .

day3-montana-grain-elevator

But there was one big change: Mountains! I’ll be posting some pics in the next post.

We walked with our luggage from the train station right across Highway 49, and into the Lodge. The Lodge is reminiscent of the other big National Park lodges, such as the one at the North Rim of the Grand Canyon, but supported with gigantic logs, i.e., tree trunks, with what seemed to be their original bark. In the hotel is a nice restaurant, a lounge, a gift shop. We got our keys and visited our room, which was spare but big. Once in our room, Julie ran back across the highway to get our rental car. We were on the second floor right behind the front desk, with our own door onto a porch above the front entrance. We found it very quiet — we observed on tripadvisor.com that many people complained about the noise, but, frankly, it was just fine (this was the first of many times when the advice on tripadvisor.com from other travelers seemed to be quite off).

We grabbed a couple of beers from the lounge — the best was a Blackfoot River Gold, an organic pale ale. Caroline got a shower, and then we all faded and went to sleep in anticipating of the big event for Day 4: Driving the Going-to-the-Sun Road.

Filed under: Reading, Travel

Day 2 (Sun., 28-June-2009): Chicago to the Dakotas on the Empire Builder

2
Jul/09
0

In our last installment, recall that we went to bed on board the Lake Shore Limited expecting to arrive in Chicago at around 9:45 AM. And we did.

As sleeping car ticket holders for the Empire Builder, we were allowed to use the Metropolitan Lounge at the Chicago Amtrak Station. This is no big honor, because there are many overnight trains that depart from Chicago. Still, it was nice to have a resting spot where we could check our bags. Our train wasn’t to leave until 2:15 PM, which gave us plenty of time to roam around the Loop. We checked out the Sears Tower, which was closed due to wind (or so they said . . .)


day2-caroline-under-sears-tower

We walked over to Millennium Park and looked at the fountains and at Anish Kapoor’s “Cloud Gate.” Why doesn’t Boston have any world-class outdoor art spot right downtown?


day2-c-and-j-under-sculpture

As luck would have it, on arrival we discovered that it was the first day of Taste of Chicago in Grant Park. This isn’t like a “Taste of Cambridge,” which is an outdoor (and expensive) event catered by the finer restaurants in town; this is an outdoor munch fest hosted by the fried and fat segment of Chicago’s fooderies. Caroline and Julie split a nice waffle, and I ate potato- and saurkraut-filled pirogies, which were delightful. Oh, and then some ice cream. After all that, we were tired and went back to the station.

Sleeper car ticket holders were called to the front of the lounge to meet with the conductor. Julie was told that we didn’t have a train! Uh oh. There was much concern among the passengers-to-be, but in the end we left right on time.

We got on our train and proceeded to a “family room.” This is a sleeper with four beds, one of them wide enough for two skinny parents to cohabitate. We picked it for the extra room, though a downside was that it didn’t have its own bathroom — the shower was done the hall. In general, the sleeper seemed newer, cleaner, and not dingy. One thing, however: The cars on the Empire Builder are “Superliners,” and have two levels on each car. Because of this, the headroom is somewhat limited. It’s not much of an issue for standing in the sleeper, but if you’re sleeping in the top bunk, it’s a bit like being in a coffin. Claustrophobes beware.

Once on the train we proceeded through Wisconsin. There was a “Rails and Trails” guide on board in the lounge car (observation car) to provide geographical and anthropological points of interest regarding the people from America’s Dairyland.


day2-wisconsin

But for the most part, it a flat and green Midwest to behold, with which I am much familiar. I thought I had gotten some pics of the Wisconsin Dells, but apparently not; maybe they’re on Julie’s camera.

After settling down in our sleeper, we made reservations for the dining car. We were only 3, and one may be seated with strangers to fill out the full table of 4. I ordered catfish; Julie ordered lamb shank; and Caroline had penne with meatballs. It was pretty good!

There was also a half-bottle of some mediocre wine; more about train wine in the post for Day 3.


day2-john-catfish

day2-julie-lamb

After dinner there was more window-gazing at dairy country, which lulled us into a sleepy state, and back to the sleeping car.

I woke up at around 10:30 PM because I wanted to observe the entry into St. Paul, where I had gone to high school. At this time of night, the lounge car was pretty deserted. I was still a bit buzzed from dinner so I grabbed a root beer and went up to watch. I got out my iPhone and observed the approach with Google Maps and the built-in GPS. To my surprise, the tracks into St. Paul go right below Linwood Park:



View Larger Map

When I played Little League at Linwood and was waiting to bat, I would surreptitiously walk over to the fence on the edge of the park, and look down at the tracks (perhaps some 50 feet below and 100 yards distant). Frequently a freight train would go by, and I would count the cars and think about hopping a train so as to “light out for the Territory,” if you know what I mean.

Now I was on those very tracks, looking up into the dark as Linwood passed by.

After that, the approach to Midway Station was uneventful; I did see the Cathedral of St. Paul, but not much else of great notice. Weary, I went back to the sleeper, to dream of lighting out for the Territory . . .

Filed under: Travel

Day 1 (Sat., 27-June-2009): Lakeshore Limited, Boston to Chicago

28
Jun/09
3

Day 1

The first day on the train was all about getting used to the idea of hours on the train, exploring the sleeper, reading, eating, and hanging out. We departed on time.


lakeshore-boston-john-caroline

The sleeper was small and a bit dingy. The windows could have been a lot cleaner. I lowered the upper bunk to check it out, and there was a mattress in there for the bottom bunk, as well as a ladder. I closed that up. Later on we opened it up and I set up the ladder and put the mattress for the bottom bunk into a luggage storage section that was over the door. One thing I would say about these sleepers is that if you’re elderly and a bit shaky, you probably don’t want to use the upper bunk, or you would only want to navigate the ladder when the train is stopped. The bathroom was a combination toilet/shower, which I’ll discuss in tomorrow’s post.


julie-and-caroline-lakeshore

Western Massachusetts was beautiful as always but somewhat monotonous. We followed the Westfield River.


lakeshore-berkshires-westfield-river

Didn’t see any wildlife. Getting a bit bored with the window, we all read: I read: One Second After; Julie read: The Girl with the Dragon Tattoo; and Caroline read Ruby the Red Fairy, a real page-flipper by the looks of it.

The dining car hadn’t been attached for lunch, so, as sleeper-car passengers, we got a free lunch from the Cafe car: pesto-chicken sandwiches for Julie and me (flavorless), but accompanied with a pretty good salad with chickpeas, cucumbers, etc.; for Caroline an over-microwaved hotdog. The dessert was pre-fab as well, but tasty: a chocolate mousse.

The stop in Albany was two hours; at this stop, cars were added from a New York train, including a dining car. At the Albany Station (which is actually in Rensselaer) we asked if there was a playground nearby; and, sure enough, there was one just a brief walk away, right on the river separating Rensselaer and Albany. This was underneath the Interstate leading out of Albany, and seemed to be one of those guilty-ish parks built after urban renewal. The families at the park seemed pretty poor, but they loved their park: There were kids playing tennis, throwing the baseball, playing on the jungle gym, etc. I walked down to the Hudson River, and people were fishing. Caroline got some sillies out.


lakeshore-albany

lakeshore-albany-caroline

Then we returned to the train, boarded, and shortly afterwards had supper in the Dining Car, which was surprisingly good. Julie and I both had the train’s version of beef burgundy, and Caroline had penne with sauce. And we drank two half-bottles of “wine” which was ok.

Caroline really was too shy to socialize with anyone. There were two families with kids of somewhat similar disposition to ours, and we talked with them a bit, but there was little resonance. (Though one dad laughed at my lame joke when he said we were in the boonies and I quibbled that we were actually in the sticks.)

Then back to the sleeper. While we were in the dining car our sleeping car attendant set up the beds for sleep. Caroline konked out fast;


lakeshore-sleeper-caroline

Julie and I kept reading; and before long we were all asleep. I think I woke up some ten times during the night, always due to the strange noises and slowdowns and speedups of the train. Also, the train was blowing its horn at seemingly every crossing, which surprised me. Still, I did get sleep.

Cambridge to South Station

27
Jun/09
1

Free bandwidth at the Acela Lounge . . . so I can upload some pics.

The train to Chicago is completely sold out.

Our entire trip is courtesy of Julie’s frequent rider miles on Amtrak — she commutes to/from the University of New Hampshire in Durham, NH, two or three times per week. Had we purchased these tickets (including sleepers and meals the whole way), it would have cost about $4,700.

Julie with tickets

Julie with tickets


Julie told Caroline not to wear her flip-flops for the walk to the Kendall T; but she insisted. And, sure enough, they started to hurt, so she needed to switch to her sneakers.


Caroline changing shoes

Caroline changing shoes

Caroline reading the comics at South Station

Caroline reading the comics at South Station

Filed under: Uncategorized

Train to Oregon via Glacier National Park: Itinerary

27
Jun/09
0

Here’s our itinerary for those who’d like to follow along:

Saturday June 27:
Leave Boston 11:55 a.m.

Sunday June 28:
Arrive Chicago 9:45 a.m.
Leave Chicago 2:15 p.m.

Monday June 29:
Arrive East Glacier Park 6:45 p.m.
Pick up rental car 7:30 p.m.
Night at Glacier Park Lodge

Tuesday June 30:
Drive around Glacier Park
Night at St. Mary’s Lodge (in a Teepee!!)

Wednesday July 1:
Drive around Waterton Park
Leave East Glacier Park 6:45 p.m.

Thursday July 2:
Arrive Portland 10:10 a.m.
Night at Nine’s Hotel

Friday July 3:
Leave Portland 4:45 p.m.

Sunday July 5:
Arrive Chicago 3:55 p.m.
Leave Chicago 9:00 p.m.

Monday July 6:
Arrive Boston 9:10 p.m.

Filed under: Travel

Trip on the Empire Builder: What I’m Taking

25
Jun/09
0

So I’ve just finished the majority of my packing for the big train trip, and here’s what I’m taking:

  • Change of clothes for 4 days (we should be able to wash our clothes in Glacier National Park).
  • Nice pair of pants and a shirt so we can go out to something more than casual if need be.
  • A sweater. I’m not taking a jacket, which I may end up regretting. No umbrella, either.
  • Laptop (MacBook Air), and very light external DVD drive.
  • Earphones. Rechargers. Cords.
  • iPhone (set up for tethering).
  • Digital camera. Adapter to get photos off of the camera.
  • Kindle.
  • Passports.
  • Sunglasses.
  • Toys and entertainment for Caroline: E.g., portable “Battleship” game, deck of cards, MadLibs, etc.

Am I forgetting anything?

Filed under: Travel

Books for the train trip

23
Jun/09
0

So as I’ve said, I’m going to be taking a long train ride with my family coast-to-coast: To Chicago, then Chicago to Portland, Oregon on the Empire Builder via Glacier National Park . . . and then back.

So there will be a lot of time for reading.

Here’s what I have on my Kindle in sample form, in the order in which I will probably read them:

Reynolds Price, Ardent Spirits: Leaving Home, Coming Back. Price is one of the most distinguished old-school “men of letters,” and this is his book about his time at Oxford, coming of age. Not sure if it gets up to his shift to the wheel chair.

Colson Whitehead, Sag Harbor: A Novel. About an upper-middle-class African-American teen, somewhat younger (in the time period of the novel) than I was, dealing with the social contradictions of his milieu.

William R. Forstchen, One Second After. This is a novel about how a small town deals with life after North America’s technology is wrecked by an electromagnetic pulse. Forstchen has co-written some novels with Newt Gingrich. I won’t hold that against him. I’m not a big fan of the politics, but I’m a sucker for a good end-of-the-world novel (my recent favorite being World Made by Hand).

Clancy Martin, How to Sell: A Novel. About . . . well, I don’t know what it’s really about, but the setting seems to be the diamond district in NYC.

Joseph Findler, Paranoia. Everyone deserves a good corporate thriller.

Christopher Buckley, Losing Mum and Pup: A Memoir. I’ve loved everything I’ve read by Buckley, especially, of course, Thank You for Smoking. The extract of this memoir in the New Yorker was a great read, and it would seem that it’s also great at this length.

I’m also thinking about this new chick-lit book called Commencement about a group of Smith College grads. And there are books people have recommended to me such as the Kite Runner, Wikinomics, In Defense of Food. We’ll see.

And why these books? Dunno. A lot are memoir or memoir-esque; some are about places; they all seem to be page-turners, and none are horribly serious.

More suggestions welcome!

Filed under: Reading, Travel