Author Archive

2Paths Bonspiel

Friday, March 23rd, 2007

Tuesday March 20th saw the 2Paths team pack up their Java code and MacBooks, and head to the Marpole Curling Club in south Vancouver for an afternoon of rocks, brooms, pebbles, and yelling.

Photographic evidence of the exploits was collected for insurance purposes:


Peter and Judi try to blind everyone with the whiteness of their teeth, while Trevor proves to us that moonwalking is still a relevant dance move.


This curling rock was both red and blue and moved and spoke occasionally. We decided to never trust the spoils of Lorill’s wild mushroom picking ever again.


Trevor and Gord take a break from the high-society sporting event to discuss sailing.


Judi and Tricia take a break from the high-society sporting event to discuss why Garrett ate all the onion rings.


Chico contemplates why Canadians are impressed by such strange activities, while Gord reminisces about Nova Scotian donairs.


The ladies laugh at their only male team member and his lululemon curling pants. Shan screams “the west-coast was supposed to be more tolerant”, then disappears into the bathroom for 10 minutes of cathartic sobbing.


Garrett passionately gets into the game. I didn’t have the heart to tell him that he was actually on the red team.


We suspected that this kid had a little too much to drink, so we made him “walk the line” - but it turned out that he was ok to drive.


Fed up with team incompetence, Trevor tries to move rocks using the power of his mind.

In fine curling tradition, the team finished off the day with indian fushion cuisine at a trendy Vancouver eatery on south Granville.

Fun was had by all, and we managed to damage the ice only once.

Advice for the new Vancouverite

Friday, March 2nd, 2007

You know that corner of your apartment that, due to convection and warm currents and static and whatnot, attracts all the dust bunnies from the rest of the floor? Vancouver is sort of like that.

I’m not saying that Vancouver is full of refuse, it’s not; it’s full of wonderous people and things, but it seems that most people you come across are from somewhere else in Canada.

As a newly initiated Vancouverite (within the space of a week I made it up to a mountain and managed to get punched in the head; I feel like I’ve finally been accepted). I thought I’d collate some of my observations to help anyone who’s newly arrived here or is thinking of making the move. I’ll expand this list as more things happen to me.

  • The Bus - It costs $2.50 to take the bus - but you can get this little booklet thing from 7/11 and other stores that contains 10 rides for $18. So that’s a savings of $4.50, which over time adds up and can be spent on one of the many wonderous vices this city offers (a Guide to Vancouver’s intersections will be posted one day). After months of breaking $20 bills by buying superfluous packs of Big Red, I figured this out and have been a lot happier since.
  • Eastern Delights - If you don’t like japanese food or have some kind of sushiphobia, this is the place to get over it. The way people talk about it and make plans, you’d think it’s not a meal, it’s an occult ritual of some sort. There is a lot of sushi here that ranges from traditional to totally made-up stuff that only exists in Vancouver. When the Olympics swing through town I can’t wait to try a Two-Man Luge Roll (don’t read deeply into that).
  • Scenes and Cliques - There are quite a few established social groups here, so usually what happens is new Vancouverites form their own, or if you’re lucky you end up wedging yourself into one like a bloodthirsty tick. A lot of these groups are based on some kind of music, art, activity, sport, or illegal leafy substance. Choose wisely because these are the people you will form lasting bonds with and possibly whose floors you will pass out on.
  • Coffee shops - There are coffee shops everywhere. Coffee culture is serious business here. At any given time if you peek into one of these caffeine-dens you’ll see armadas of Macbooks and interesting people who’ve parallel parked their shopping carts in front of the shop. These places are great to take a date because if things go bad you can make a quick getaway down the street in one of these carts and make quite a killing down at the bottle-return too. Don’t worry Romeo, things are looking up!
  • Neighbourhoods - Kits, The Drive, the West-End, Yaletown, etc… You’ll hear these names a lot and all you have to remember is that they all contain at least one Starbucks.
  • London Drugs - This store has nothing to do with London. It’s a pharmacy that sells giant TVs. I’m not trying to promote them or anything, just warning you of their schizophrenic nature. Oh yeah, pharmacies here in BC still sell tobacco products, which is shocking if you’re from other Provinces.
  • City Ambassadors - You see them out on the street especially in the downtown area. They are extremely friendly and are there for you if you need some help or information.
  • Snow - If there’s at least 1/2 an inch of snow on the ground when you wake up in the morning, you don’t have to go to work.
  • Stuff - Outside of work/school, most people are “into” something. There are a lot of athletic and artistic activities going on, and it’s good to get involved in at least one thing. Don’t get cable, you’ll regret it.
  • Relaxing - Vancouver is relaxing. Just let yourself fall gently into the pile of dust bunnies, and you’ll be fine.

One Headache to(o) Many: Hibernate’s beef with multiple bags

Thursday, March 1st, 2007

Relationships are hard. Especially when there’s One that’s intimately connected to a whole list of others.
But go figure, it’s totally acceptable in software. And you don’t have to wear silk robes and grease your hair.

For some reason I encountered this funky error when starting up two web applications on the same Tomcat:

org.hibernate.HibernateException: cannot simultaneously fetch multiple bags
at org.hibernate.loader.BasicLoader.postInstantiate(BasicLoader.java:66)
at org.hibernate.loader.entity.EntityLoader.(EntityLoader.java:75)
at org.hibernate.loader.entity.EntityLoader.(EntityLoader.java:43)
at org.hibernate.loader.entity.EntityLoader.(EntityLoader.java:33)

I wouldn’t see this error if either web application was started independently.

Why? Who knows. I’m sure it had to do with the seemingly isolated processes fighting over some shared piece that’s not totally intuitive.

Anyhow, after minutes of making a bowl of cereal, firing off rounds of Nerf ammunition, and trying to fit my head into the dishwasher, searching around the internet lead to discussions of this error occurring during migrations from one minor-release of Hibernate to another.
It has something to do with Hibernate becoming more pedantic (apparently for our own good) with how it manages OneToMany relations when using Lists as “bags”.
There is a complex answer that comes with pictures of grids and numbers along with words like “cartesian” and “sledgehammer”, but the point is something I was doing sucked.

So the solution is to either use Sets when order isn’t an issue, or to explicitly manage indexes in your Hibernate setup.

This is the solution I went for because it seemed the least invasive:

In your parent class (i.e. the one that has a List), annotate the accessor this way:

@OneToMany(mappedBy=”*whatever parent field*”)
@IndexColumn(name=”INDEX_COL”)
public List<*whatever child class*> get*whatever child class*() {
return *your list*;
}

In your child class (i.e. the class that is the owning side of the relationship), add the following bean methods and property:

private int position; // is this really required? who knows

@Column(name=”INDEX_COL”)
public int getPosition() {
return this.question.get*parent class*().indexOf(this);
}

public void setPosition(int index) {
}

This should be all that’s required.
But note, the column name (in my case INDEX_COL) is totally up to you; “position” is a reserved keyword in the database we use, but if it works for you, hey - go wild.

You might not see the direct impact of managing order explicitly like this, but I gather it’s somewhere close to the root of strange lazy-loading errors and duplicate results in Lists. It never hurts to be a little more explicit.
Except in situations where silk robes are involved, keep that to yourself.

Snow Frolic

Tuesday, February 27th, 2007

A few images of the recent 2paths mountain outing à la snowshoe.


An odd unintentional effect.


Ravens were circling, waiting for one of us to drop - no doubt to steal the snowshoes and get the deposit back at MEC.


Near the peak we actually came face to face with the great universal power; turns out he didn’t know where the snackbar was either.


Nick caught mid-chew.


Out of no where, Lorill pulls a conspicuously looking pipe out of her pack and exclaims “Time to get this party started right”.


A giant radiation flash happened when one of us received a work-related call.


We encountered this man on the mountain who’s been living there so long that he actually has a layer of permafrost growing on his face. We traded him some turkey sausage for a bit of alpine wisdom and a chance to use his bathroom bucket.