Archive for September, 2006

the moment when you stop fighting the tool

Friday, September 29th, 2006

When using a new software tool, I love that the moment that you reach that ‘ahh’ point.

You know when you have reached that moment when you stop fighting the tool and the tool really starts working for you rather than against you. I just have reached that moment with hibernate and the discovery of its event system.

This event system will save a great deal of effort in trying to make my object model conform with the database table structure. Registering for a PostLoadEvent is all that is needed for most of my remaining work with the persistence layer. This will allow an entity’s internal structure to be completely restored after being retrieved. Very, very nice.

September Coast Daylight report

Tuesday, September 26th, 2006

The Coast Rail Coordination Council met at the Paraiso Winery in Soledad on Fri 9/22.

Meeting in Soledad was mainly a good-will gesture, and to familiarize the council members of the growth and potentials of the area persuant to a Coast Daylight stop in Soledad.

After the normal opening business (minute approval etc) was over a lively discussion commenced on getting the Daylight started. Tom Mulligan of UP stated that they would need a formal request from Amtrak (on behalf of DoR) to start service. This request “shall include a start date”. A joint evaluation of the road would also be required as the last capacity study has a “limited shelf life”.

Jonathan Hutchison of Amtrak stated that lease (Amtrak) rolling stock is available from Beech Grove (both single level and Superliner). This equipment would need refurbishing and would fill the need till new cars come online. Chair Dave Potter emphasized how we all have to get behind Prop 1B [The Sierra Club after much arguing is neutral on this ballot measure, mostly because of the excessive highway components. -Pat] and that CRCC is striving to get local support from cities and counties. 1B would yield $450 M for transit, $125M needed for rolling stock and $50M required for track and signals. [In other words a small token percentage goes to transit] Art Lloyd emphasized that key persons from the counties make appeals to Bill Bronte (DoR) to persue the Amtrak cars.

Art Lloyd will make a Daylight presentation to the Peninsula Joint Powers Bd (Caltrain) on Oct 5th persuant to obtain a “Bullet” slot in their 96 train schedule.

Hutchison (Amtrak) reported that “The Starlight” has been badly bruised by the On-time Performance (OTP) [1 train on time in January - see this post for more information] with ridership and revenue plummeting and in name (e.g “Starlate”). Amtrak and UP are now in “High Level” meetings addressing the OTP.

Mulligan (UP) stated that track gangs have now moved to the Zephyr route and UP is striving to keep a max 90 minute “down” time on #11 and 14 north of Sacramento.

frustrations with tapestry (or is it hivemind?)

Tuesday, September 26th, 2006

Now don’t get me wrong, I really like tapestry in many ways but I have to admit that it is a little frustrating the spottiness of the documentation and here is the biggest beef the way it is scattered all over the place and not cross-referenced!

But also most importantly a lot of knowledge only exists in email archives. The most recent example of this is how to initialize a service that depends on Tapestry’s infrastructure.

I originally tried to use just the HiveMind EagerLoad feature:

  <contribution configuration-id="hivemind.EagerLoad">
    <load service-id="testData"/>
  </contribution>

But I quickly got this error:

java.lang.IllegalStateException: The Infrastructure service has not yet been initialized.
org.apache.tapestry.services.impl.InfrastructureImpl.getProperty(InfrastructureImpl.java:292)
org.apache.tapestry.services.impl.InfrastructureImpl.getApplicationStateManager(InfrastructureImpl.java:116)
$Infrastructure_10de95366c1.getApplicationStateManager($Infrastructure_10de95366c1.java)
$Infrastructure_10de95366c0.getApplicationStateManager($Infrastructure_10de95366c0.java)

This is because Hivemind is running my service initialization before Tapestry is doing it’s initialization. Now as a research point it may be possible to indicate to Hivemind some dependency ordering here, but the hivemind docs can be just as scattered as the tapestry documentation. Because Tapestry 4.x is so dependent on Hivemind it is not always clear where to look on these configuration issues.

Going out the email lists I found that there is a tapestry ‘contribution’ that to make in your hivemodule.xml file that is supposed to work.

  <contribution configuration-id="tapestry.init.ApplicationInitializers">
    <command after="*" id="myInitializer" object="service:testData"/>
  </contribution>

Unfortunately while the tapestry infrastructure is now available there is no WebRequest object for the session to attach to.

java.lang.NullPointerException: Property ‘webRequest’ of <OuterProxy for tapestry.globals.RequestGlobals(org.apache.tapestry.services.RequestGlobals)> is null.
at $WebRequest_10deb12def2._targetServiceProperty($WebRequest_10deb12def2.java)
at $WebRequest_10deb12def2.getSession($WebRequest_10deb12def2.java)
at $WebRequest_10deb12dec3.getSession($WebRequest_10deb12dec3.java)
at $WebRequest_10deb12dec2.getSession($WebRequest_10deb12dec2.java)
at org.apache.tapestry.engine.state.SessionScopeManager.getSession(SessionScopeManager.java:48)
at org.apache.tapestry.engine.state.SessionScopeManager.get(SessionScopeManager.java:64)
at $StateObjectPersistenceManager_10deb12deed.get($StateObjectPersistenceManager_10deb12deed.java)
at $StateObjectPersistenceManager_10deb12deec.get($StateObjectPersistenceManager_10deb12deec.java)
at org.apache.tapestry.engine.state.StateObjectManagerImpl.get(StateObjectManagerImpl.java:50)
at org.apache.tapestry.engine.state.ApplicationStateManagerImpl.get(ApplicationStateManagerImpl.java:60)

So back to email lists..

San Joaquin Rail Committee meeting report

Wednesday, September 20th, 2006

The meeting started with several local (Merced, Mariposa) speakers advocating service to/from Yosemite. One speaker from Mariposa Cnty was endeavoring to gain a seat on the committee (being considered) . A visual presentation was made entitled “Blueprint for San Joaquin Valley” which includes all the counties. The big pitch was control of air polluton and need for improved public transit. This was a good lead into the “Resolution for Rail” on the UP line in Tulare Cnty (Holscher). This could be “dovetailed” into “The Blueprint”. The “Resolution” was tabled and will be on the next mtg agenda. In the interim, there will be dialogue with UP, Division of Rail, SJVRC (as suggested by UP rep Jerry Wilmoth who was in attendance).

Rick Depler of BNSF stated that OTP was up to 88 to 92% and they predict 95% soon. Asked how the OTP was improved, he replied “thru dispatcher stabilization”, i.e. utilizeing dispatchers familiar with the territory and keeping them there. A tie (85k) and rail (120k ft) replacement program between Stktn and Bkrsfield will commence Jan 14 and finish Feb 15. Work scheduled to minimize slow orders . Electronic Train Management System (ETMS) moving along (in Tx) Expect FRA approval shortly.

Bill Bronte, Chief, Division of Rail reported that the San Joaquins surpassed the Capitols in ridership gain last month (7 1/2%). Fuel prices are cutting into fare box return bigtime. Plans for a joint mtg of all Bds (CCJPB, SJVRC, LOSSAN, CRCC, SANDAG etc) to coincide with APTA in San Jose in Oct. to gin up support and sign a letter of support of S1516 (80/20 Capital Grants).

Chair Hall, who is also Mayor of Bakersfield, reported that he had held successful meetings in his office with BNSF, DoR and SJVRC members to gain a good understanding of problems and to achieve solutions. It is this writers opinion that Mayor Hall is a definite asset and makes a very positive contribution to this committee.

Bad News: Chair Hall announced that Eric Schatmeier of Division of Rail is leaving and will join Marin County where he will lead a new Transportation Planning Group. Eric has been the Marketing Group leader for the San Joaquins these past years. Prior to coming to DoR he was with Caltrain.

BART Trivia

Tuesday, September 19th, 2006

I found out that the reason BART has the non-standard guage is because back when BART was first being conceived, Southern Pacific didn’t want BART competing with them for freight business, so they got BART to go with the 5 foot guage instead of the standard 4′8″.

Also, the airports around here, pariticularly San Jose, don’t want people to take public transit ( light rail or BART) because they would lose the revenue they get from parking, which is a significant portion of their income. So if anyone wondered why both VTA and BART don’t go to SJC, that’s it. I got this straight from a from a former member of the SJ airport commisision.

Ed

hibernate messages … nice and unhelpful

Wednesday, September 13th, 2006

One of the reasons why I recommend Tapestry as a web framework is the helpfulness of its error messages. Hibernate is just the opposite.

Current annoying hibernate error message :”Null index column for collection” when trying to examine a previously saved collection.

This seems to be caused by a mysterious IDX column on the class that is to be placed into the map. This column is null for whatever reason. Inserts would succeed but examining the collection would fail.

It turns out this was caused because I was missing a column attribute in the map-key element.

I had this:

<map-key type="long"/>

not this:

<map-key type="long" column="ID"/>

some notes on hibernate-annotation

Thursday, September 7th, 2006

I am now implementing my persistence layer with a vengence. I decided to take a chance with using the hibernate-annotation to define my persistence objects because of all the work with Seam and Trails that is happening to leverage those annotations.

Unfortunately, I got to experience the joys of being a trailblazer with CR code as opposed to released code. These are some of the issues I ran into with the hibernate-annotation 3.2.cr1 release:

The biggest problem so far is with compound primary keys. (keys that are composed of multiple fields). I wanted to create a @Entity class that had a compound field that was partially generated using the @GenerateValue flag and partially supplied with an application-defined value.

These are the problems I ran into:

  1. If you have a @Entity that has two or more fields annotated with @Id *and* @IdClass is not used,  then only the first one is respected. So the primary key is only the first field. However, all such fields are labeled as requiring a value (as if @NotNull specified). I filed this report about this problem.
  2. If using you do use @IdClass then the @Ids are respected with regards to the primary key definition. However, @GenerateValue is ignored when placed on @Embeddable’s (supplied in the @IdClass) fields. This makes sense for a bunch of reasons. The best one being that the @Embeddable may be used by multiple @Entity classes. Unfortunately, @GenerateValue is also ignored when placed on the @Entity class’s id fields.
  3. Using @EmbeddedId doesn’t have any mechanism for specifying a @GeneratedValue. And once again, @GenerateValue is ignored when placed on the @Embeddable class’ fields.
  4. When using @EmbeddedId, if @Id is used on the @Embeddable class’ fields this causes an error message that is completely wrong. 3.2.0.cr1 reports that the @Embeddable doesn’t have id fields. The problem is solved by removing the @Id’s, not by using them. I filed this report.

Now that I am passed these issues, I still don’t know how to create a compound key with part of it generated. So I posted this on the hibernate forums.

maven 2 dependencies

Tuesday, September 5th, 2006

I discovered this neat feature of maven2 that allows a project to specify the minimum version of a dependency but accept any higher version. This allows project writers to not have to hard-coded version dependencies to other projects.

This allows users of those projects to use newer versions of the project’s dependencies automatically. For example, “transparent-politics” depends on “tapestry” which depends on “commons-httpclient”.

If tapestry’s pom.xml specifies its commons-httpclient dependency as:

<dependency>
  <groupId>commons-httpclient</groupid>
  <artifactId>commons-httpclient</artifactId>
  <version>[3.1-alpha1,)</version>
</dependency>


Then when a newer version of commons-httpclient comes out, say 3.1-alpha1, the transparent-politics build will pick that up automatically.

if we are at the brink of climate failure

Monday, September 4th, 2006

I read BBC regularily. The amount of climate news provided by this service is excellent.

This is positively scary:

Carbon dioxide levels are substantially higher now than at anytime in the last 800,000 years, the latest study of ice drilled out of Antarctica confirms.

The “scary thing”, Dr Wolff added, was the rate of change now occurring in CO2 concentrations. In the core, the fastest increase seen was of the order of 30 parts per million (ppm) by volume over a period of roughly 1,000 years.

“The last 30 ppm of increase has occurred in just 17 years. We really are in the situation where we don’t have an analogue in our records,” he said.

At this rate it is not inconcievable that we are looking at climate failure (not just change) within our lifetime.