Monday, July 21, 2008

Kirk vs Subversion

So we are merging the branch and trunk. This is kind of a normal thing to do. Why is it so hard? Once you get done, why do the conflicted files come out in such a mess? Because subversion hates me. I have file fragments scattered all across my screen, in such a fashion that I can't tell what belongs where. If I were a merge program, I think even if I were trying to mess up, I couldn't make it look that bad. I can get past that. That's fine. How about Subclipse taking like 2 hrs to show the commit dialog? Sweeeeet. How about random errors thrown when trying to take a file out of the list:
If a folder delete and a folder property change are both committed, then all files beneath the folder property change must also be committed
I don't think that's the case here, but whatever, I can remove that too. What's that? Subclipse doesn't show you when files are in conflict with an icon? Sweet. That would be an awesome feature, but I suppose that one wasn't in the cards. Another nice feature would be for Subclipse to actually tell me what is happening instead of my Mac just showing me the little pinwheel that makes me think nothing much is happening.

This process has made us realize that we need to buy Perforce - even though it has its warts as well, this stuff is A LOT EASIER using Perforce.

In other news, I survived my bachelor party. We can't drink as much as we used to, but we gave it a pretty good run for a couple days, and we only drank Natural Light, which is the way life should be. Thanks to all my awesome friends for giving me a great few days that I'll always have to look back on and smile about.


Had a great time guys. But I was ready to get back to Jena and work. But I didn't miss you, Subversion.

Wednesday, July 16, 2008

Vegas, Baby

That's where I would be if I still worked at Blackboard. In a ridiculous attempt to kill all its employees' virtue (and livers), my former employer is holding its annual convention in Vegas. Ridiculous. I went to the one in Boston last year. Not quite as awesome, though I was able to go to Australia in 2006, so all in all I think I made out pretty good! I hope all my former compadres are enjoying their time there in Sin City. I am off to my bachelor party today. 3-4 days of ridiculousness, Natural Light, reminiscing, and pretending I am 19 years old will culminate in a week-long hangover, I am sure. Should be awesome.

This weekend, Jena and I went out to San Francisco. Her friend Zeena got married. It was a beautiful ceremony in Hillsborough at her parents very nice house, overlooking the bay. The weather was beautiful and breezy. It was also a pretty interesting ceremony - a combined Hindu/Zoroastrian celebration. We sandwiched the wedding with a couple days of R&R, spending Friday exploring Santa Cruz and Capitola, and then Sunday we headed up to Wine Country in Sonoma, drinking and eating until we couldn't anymore. A great time. Monday was a long day of travel, but we made it back and now I am off again...

As usual, travel time afforded me the ability to polish off a couple of the books I have been working on. I polished off the book I was reading about the first crusade, aptly titled "The First Crusade". I found it to be an incredibly interesting and easy read. I was not at all informed on the subject so it was pretty fascinating, although the attack and occupation of Jerusalem seemed to receive short shrift, whle the siege of Antioch got about 75 pages. Still, a great introduction to the First Crusade. I also finally finished The World Without Us. I thought it was a bit unfocused, but still quite entertaining. It was not as doom and gloom as it could have been given the title - it was mostly a broad swath picture of different man-made things that would not persist if man didn't. It was also a rather uplifting picture of how our planet could, if given the chance, bounce back and recuperate. Interesting book - I'd recommend it as a quick read that could get you interested in a few different topics.

Wednesday, July 9, 2008

Requiem for a Hulu

Inspired by a colleague of mine, I checked out Hulu.com a couple of weeks ago, and was really delighted by the selection of movies and television there, and have been telling everyone I know how cool it is. I should be a paid huluvangelist. Anyway, I am sitting around today, and decided to watch Requiem for a Dream. Jesus, what a mistake. I can remember watching it for the first time after a lot of beers, and feeling sick to my stomach, and sick to my soul. The way the film was shot, in concert with the haunting score just evoke desperation and loss of control, and it's a scary film. I think rehab centers should just make people watch that movie in a loop. That would be way more effective than any 12-step deal. As someone who has seen friends and family go through crap like the characters in this movie, it makes me so thankful that those people snapped out of it before it progressed as far as the poor folks in this film. Yikes. I feel unsettled.

On a lighter note, my buddy Eric sent this a week or two ago:

Requiem for a Day Off

Anyone who has seen both Ferris Bueller's Day Off and Requiem for a Dream will truly appreciate this.

Man The Nats Are Hard To Watch

I am sitting here watch the Nats, and they have 1 run in the last 2 games or so now - the guys are discussing how wild the opposing pitcher is, but interestingly, the hitters just keep on coming up and swinging at the first pitch. Man, if I did that in high school, my coach would have berated me in front of the whole crowd, then taken me out of the game. These guys just continue to do it over and over and over and no repercussions. Oh by the way, can Austin Kearns please do something so someone will be dumb enough to trade for him???

Tuesday, July 8, 2008

Eclipse Ganymede Revisited

Well, I continue to greatly enjoy the new features of Eclipse 3.4, especially as I toil through a rather painful refactoring process, but I must admit, there are a few gotchas:

1) Subclipse is not good in the new version - it really seems to have devolved (new update came out today and hopefully this will change my mind.

2) The software is still kind of buggy (odd NPEs, and other weird dialogs that come up to tell me something happened). As far as I can tell they are all pretty harmless, but it's still annoying.

3) How can I setup full-text searching to ignore certain directories (I would love to have my build directory in my directory tree, but not to see the jsps and xml files that live there)? I get an error on every search about out-of-date files in build, which is going to happen since they change every time I build, which I do from a shell, and not in Eclipse.

AND, last but not least, this morning, I completely fried my instance of Eclipse. This was your basic Catch 22:

I fire up my IDE, and I am notified that there are Subclipse updates available. Because of my aforementioned lack of satisfaction with Ganymede's Subversion interface, I was excited - maybe they listened to me! I installed the updates, and restarted Eclipse. This is what greeted me:

Hmmm. That log file had a bunch of gobbledygook, and as far as I can tell there is no way to rollback. Starting Eclipse with the clean option had no effect. I have a lot of work to do, so I just figured that Eclipse instance was dead, and I would go back to Eclipse 3.3. I fire it up, and thank goodness it starts, no problem, but then I go to update my project thru Subclipse, and it tells me that I can't update because I have an out-of-date SVN client. I figured, hmm, I guess I will try to update this Eclipse subclipse plugin. So I try, and guess what! It fails with a mysterious network connection error - the same one that forced me to move up to Eclipse 3.4 in the first place. Fortunately the mirror at Virginia Tech is nearby and fast - I have reinstalled Eclipse 3.4 with the new Subclipse plugin and I am back online.

Just wanted to note that my immediate positive response to Eclipse Ganymede has been tempered somewhat by my frustrations...sigh. Still amazing free stuff!

Monday, July 7, 2008

Holy Ruby Deliciousness!

So I am mucking about with Ruby, Rails, Groovy, Grails, and whatnot. I find them all pretty incredible and the more I use scripting languages, the more I decide that unless you really NEED a precompiled piece of code, this is the only way to fly. I just took results from a database and did some string replaces and wrote a new file in Ruby. It went a little like this:

file = File.new("/awesomedirectory/mylist.TXT", "r")
out_file = File.new("/awesomedirectory/mylist-formatted.TXT","w")
while (line = file.gets)
newline = line.gsub(/ /, '')
out_file.puts( newline )
end
file.close
out_file.close

Now that is silly easy. Anyone who has used Java IO knows it's cumbersome and kinda annoying - not hard - but definitely kinda annoying. This is sweet. I am going to do more with this. When you spend 7-10 hrs a day programming, even a 10% increase in productivity that can be gained from the faster feedback loop and the terseness of the scripting syntax can really add up, and let's face it, much of what we do doesn't REALLY need to be precompiled code - it's okay if it compiles on the fly!

Thursday, July 3, 2008

Software is Weird

So we recently upgraded from Hibernate 2.1 to Hibernate 3.2. It was a good exercise in understanding how the code in this incredible ORM library really works. In fact, I had to actually make a chance to the Hibernate source code to support an odd case of a left outer join with multiple join criteria, so I had to step through an entire query's lifecycle in Eclipse (what did people do before debuggers?!!), and figure it out. I saw that there is a lot of automagical stuff happening throughout the code. Most of this is okay. We as users of these libraries, open source and proprietary, just take for granted the behavior, because it's right, about 99.5% of the time. Good work Hibernate developers. You are true champions of software. Here's a weird one though. Pretend for a moment that you ran a program like this:

Session s = openSession();

User u = UserManager.loadUser( 1 );

u.setName ( "fakeName" );

s.flush();
s.close();

This is the equivalent of opening a hibernate session, loading an object, updating it but not saving it, and then closing it. I think the intuitive interpretation of this is that when you flush and close, nothing CRUD-related would happen, since I never called save or update on that User object. To the contrary, that object did get updated - flush() actually took that change and automagically formed an update statement like

update user set name = 'fakeName' where id = 1

for us, and executed and committed the query. That's weird to me, but it is what it is.

As some background, we use the "Session in View" pattern, which has been great. Most of the recommended settings on the interwebs recommend FlushMode.AUTO to be used in the ServletFilter that sets up the session. We figured that the wisdom of crowds was good here, so we rolled with that. We deployed to production and started seeing bizarre data corruption, that was traced the problem to an instance like the one above.

So when you want to avoid this sort of unexpected data modification, you have a couple choices:

1) Use FlushMode.AUTO, and

a) Write the app from scratch and make sure you never update a hibernate-managed object with data you don't want to be persisted to the database.

b) Scour the app to make sure you don't do anything silly like change an object and not persist it yourself

2) Use FlushMode.COMMIT, and wrap all your CRUD calls with

Transaction t = session.beginTransaction();

DAO.saveStuff( object );

t.commit();

We went with option two, and since we have a pretty clean DAO layer, there was minimal work involved, and so far it has worked like a charm. This may be pretty self-evident to many of you, but it was weird to me, so I thought I'd write about it.