Saturday, September 12, 2009

Trouble in Paradise

I just read a report on how the median income of people in the united states dropped over the last 10 years. This implies that the median income in 1998 was more than it is today. How is this possible when the Fed has been ensuring us all of a steady inflation of 2/3% per year? Hmmm, so if over the last 10 years $1 in 1998 is now worth 70c, how are people getting by? This implies that if our spending habits of 1998 are the same today, then 30% of the average cost of living today is derived entirely from credit. Are you fucking kidding me? So let me get this straight, we just experienced one of the most massive bubbles in the history of the universe and the average income in this country actually dropped! How is this possible? Clearly the difference has been made up entirely on credit. And we are now witnessing that credit in massive contraction across the board. Meaning, the cost of living will now have to be made with just income and not credit. So the P/E ratio on the S&P 500 being 145 is justified where exactly? Yeah, the markets are a great indicator that everything is perfectly fine, right.

Saturday, May 30, 2009

Mortgage Rate Conundrum

As many of you have already heard mortgage rates spiked substantially this week, and for an economy made up like ours this is not good. The reason why this is bad is because the mortgage lending arm of a every bank in the country essentially froze. The reason for this is quite simple, the number of people who could afford or desired to take out a loan at 4.25%, can not or will not take one out at 5.5%. This means all those escrow signs need to be taken down and its back to square one for the sellers. Almost all the loans that were in the pipelines are going to be dead. Weeks or months worth of work for brokers, worthless.

This goes to show that home prices across the country are still much too high. Home prices only seem affordable because rates are so low. Lets say you are trying to get a loan for $100,000 and the rate is 4.25%, this puts your monthly bill at $491.94. Now if rates go up to 5.5%, your payment is now $567.79. That's a 14% increase we saw happen in one day this week. The days of 4.25% rates are gone, they are not coming back, and most likely only going up from here. What happens when rates go up to 8.00%, which is the more in line with historical norms, your payment would be $733.76 or 35% higher. This means that house prices would have to drop this much just to keep the current pool of buyers in the game. This is why I always say it is better to buy at a good price then a good interest rate. A good price will provide greater flexibility when the time comes to sell. This is the reason you see so many defaults right now, and should expect to see more as rates go higher.

Why can't we keep rates at 4.25%? Well the Fed is sure trying their best to do just that. The problem is no one can control the rates, it is up to the forces of the market to determine what the rates should be. So, even though many people think the Fed has this power, they do not. Which brings us to our next topic. What the hell was the Fed thinking?

Mortgage rates are based off the interest rates on the 10 year Treasury note. Back in March of this year the Fed introduced a plan to try and control the interest rates of 10T notes. This plan, called 'Quantitative Easing', is quite simple. The Fed would flood the market(print money) with 10T notes to try and drive down the interest rates on these notes. The thinking goes, if there is a crap load of any one thing it becomes really cheap(air, water). Well, the problem here is that two things determine an interest rate, the risk of default, and inflation. Let's discuss both of these issues.

First, the problem of risk. If I were to loan someone $1000 dollars that was in severe debt. I would absolutely charge a high interest rate because I fear that person may never pay me back. Which is essentially what we have with the US government. People may not know this, but when people buy 10T notes, they are essentially loaning money to the US government. Now the US government is in extreme debt, so it would only make sense to charge a higher interest rate to make that loan to the government.

Now, the issue with inflation. Printing money buy itself does not cause inflation to rise. The money actually has to circulate for that to happen. But it does put that much more money in the system that will be available eventually. It is this point that is also driving up interest rates on 10T notes. Currently, a 10T note will pay you, say, 2% interest for 10 years. Now, if I know that by year 3,4,5 of my 10 year note that inflation is going take off with a vengeance due to all the printing, then I better offset any chance of loss due to inflation by charging a higher interest rate now.

So you can see why the Fed has absolutely no control over the rate of interest on its 10 year notes. The market, and only the market decides what the rate should be. It calls all bets. You can also probably guess where interest rates are going in the future. They will never be at 4.25% again, not with the current policies in place. This is a dangerous game the Fed is playing, and it looks like they lost.

Stay sexy.

Sunday, May 24, 2009

That's a Bike Lane?

Ok, I have to agree with Gary over at Gary Rides Bikes about Class III bike lanes. There are some rules as to what can be a Class III bike lane, but this is ridiculous. Lincoln Blvd, has got to be the worst street ever to want to use as a bike route.
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

I wrote a JSP tag called Tagx Paginator awhile ago, but since now I have some free time to start up a blog and post some entries, I thought I would share it.

Essentially this was done out of necessity, since the requirements were based on the Digg Style plugin for a Ruby on Rails application, which in turn, was based off of the PHP version written by Stranger Studios.

Enjoy!

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.

x

Monday, May 11, 2009

Testing Standalone GORM

Setting up GORM(Groovy ORM) in a web app without grails is not a terribly hard task to do and is well documented. However, figuring out how to write unit test for your GORM classes was a bit more challenging. Now, I am not saying this is the end all, be all way of doing this and I am sure there are other ways, but this is what I came up with in my research. Feel free to comment if there is a better way. The approach going into this was that GORM is hibernate under the hood. So in order to write a test for this we just need to setup our test as if it was hibernate. This seemed like a good way to start, so here goes.

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:
  1. Since GORM is hibernate under the hood, we need our test to extend AbstractTransactionalDataSourceSpringContextTests
  2. 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.
  3. 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.
  4. 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.