Saturday, September 12, 2009
Trouble in Paradise
Saturday, May 30, 2009
Mortgage Rate Conundrum
Sunday, May 24, 2009
That's a Bike Lane?
It seems a bit too easy for the city to meet its bike lane quota, by simply making the street green on the Metro Bike Map. It pains me to think of all the transportation projects implemented over the years and see how flawed they have become. It appears that LA will continue to be in the dark ages compared to the rest of the world when it comes to transportation.
Tuesday, May 19, 2009
Digg Style Pagination for JSPs
Special Election Day
Let us talk about the ridiculousness of the ballot measures up for vote today. All of them including the pay hike one, are all jokes.
First, this special election is the result of our elected officials not doing their damn jobs. What this election says is, if they can't figure it out they want us to do it for them.
Second, the fact that these measure are touted as temporary and will be the end all fix is a joke. If anyone believes for one second that these measures, if passed, will be temporary, should have their head examined. They will not end our problem either. These measures are like trying to fix leaks in a severely leaky damn with band aids. The only way this will be fixed is to rebuild the damn. At the end of the day, the same hard choices are going to have to be made, and our elected officials will need to make them.
I have to say that part of the blame should be on the voting public as well, considering they voted for all the propositions that put hard numbers on pieces of our budget, giving little wiggle room when cuts are needed.
A lot of people, won't like what will happen when the cuts start coming down, but anyone who can't see why they are needed, needs to go back to school.
xMonday, May 11, 2009
Testing Standalone GORM
class MyGormTest extends AbstractTransactionalDataSourceSpringContextTests { SessionFactory sessionFactory /** * Turn off dependency injection. */ def MyGormTest() { super.setDependencyCheck(false) } /** * Load the spring configuration files. */ @Override protected String[] getConfigLocations() { return ["applicationContext.xml"] } /** * Manually set the sessionFactory. */ @Override protected void onSetUp() throws Exception { this.sessionFactory = (SessionFactory) super.getApplicationContext().getBean("sessionFactory") } /** * Write your test. */ void testSave() { assertEquals(0, User.count()) User user = new User(name: 'Test User').save(flush:true) assertEquals(1, User.count()) user.delete(flush: true) assertEquals(0, User.count()) } }A few things to go over here:
- Since GORM is hibernate under the hood, we need our test to extend AbstractTransactionalDataSourceSpringContextTests
- All your test will need to turn off the dependency checking. We do this in the constuctor of the test with, super.setDependencyCheck(false). This is done as a work around from getting an Unsatisfied Dependency 'metaClass' error when using groovy classes in the ApplicationContext. View this thread for more details.
- Now, because we are turning off the dependency check we will need to manually set the session factory, we do this before we run each test in the onSetUp() method.
- Obviously in order to manually set the sessionFactory we need to get the sessionFactory bean from the config files. These config files are loaded using the getConfigLocations() method. Once they are loaded you can obtain the bean from the ApplicationContext.