Thursday, February 26, 2009

Fixing the banking mess: Tell me why this is a bad idea

Background

We all know the banking system is a mess. However, no one (maybe not even the banks) has a good idea if they're solvent. As someone that watched the mortgage market over the last 5 years, my guess is that most of them are insolvent, at least any of the ones that dealt in sub-prime or were repackaging their loans for aftermarket sale via crazy derivatives.


Essentially the entire mortgage crisis is due to a giant financial scam. Loans were generated by one party that knew the loans were unlikely to perform; they were then passed through a financial whitewashing which, while it did redistribute risk to different piles of securities, had no effect on the riskiness of the underlying assets. These still-risky products were then sold to other people that were told they weren't that risky (by ratings agencies! nice job btw), and the middle-man got to wring profits out today for a loan that wouldn't be paid back tomorrow. Wimpy would be oh-so-proud.


But the banks didn't sell all of the loans, they kept some. So here we are today, with banks that have on their books all of these non-performing loans. The cash-flow is gone, and with the housing bubble burst (it wasn't real - just over-inflated due to cheap money - oops! the Fed staved off broad inflation but boy did they forget to look at housing) and loan payments behind, the real value of all of those craptastic mortgages is dropping, causing the banks to effectively become bankrupt.


What can we do?

It seems to me that it's just silly to try to "shore up" the banks. They took a risk, and it bit them. I am a big fan of free (but well-regulated) markets, and frankly the losers should be made to lose.


But I'm a realist, too. The losers in this case are so big and so important to a functioning economy that we can't just let them fail au naturale. Productive free-market de-leveraging and disassembly of the banking industry would not likely happen; it's too hard to value the assets. Left unaided, the banks would collapse into the ground and take the economy with it.


An outside actor is needed to help get the industry to a new stable and sustainable equilibrium, and that is a great role for the government to play. The government's role should be to implement a solution that will definitively solve the problem of insolvent banks without putting significant taxpayer money at risk, all while avoiding moral hazard.


So far, the only government action seems to be injecting taxpayer money into the banks to try to shore up balance balance sheets and cause lending to resume. Predictably, that isn't working, and now there's talk of nationalization, which is an even worse solution.


How about this?


We need to figure out a way to let the banks fail without destroying the banking system itself. The government should turn all currently troubled banks into zombie loan servicers; let their current bond/equity holders make/lose whatever will come of their current assets. They would not be allowed to issue any new credit.


The government then helps start new banks using the existing industry infrastructure and employees that aren't needed by the zombie loan servicers, with fresh capitalization in a public/private partnership. Taxpayers can help capitalize the new banks, but since they'll be small investments in new banks with clean books, there won't be as much taxpayer risk compared to buying the toxic assets directly; just initial investment in new, well-regulated banks. Plus it's a short-term investment; the government would get their money out in a short timeframe and not be involved in running the banks.


Everyone else gets what they deserve -- that is, whatever value the underlying assets deliver until they "expire" over the next 30 years. Then the zombie loan servicers can all be shut down.


Real banking and lending can now resume under new institutions that aren't hamstrung by old toxic assets, without anyone being forced to sell them at fire-sale prices or in particular making taxpayers buy them.


What do you think?

Tuesday, February 10, 2009

How to vertically center images in a div

I really like this layout for displaying a set of images.
 
Trouble is, I'd always found it impossible to do without using Javascript or really nasty tricks.

Now of course if you know your image dimensions it's easy, but I never liked the idea of storing that info in the database just to make this layout possible. I also don't like the idea of reading the dimensions in at runtime, because it's a horrible idea.

Here's a list of the constraints I have always had in trying to implement this:
  • Don't know the image dimensions
  • Images in the "set" are different proportions
  • Need labels with each image
  • Images should be clickable
  • Image should automatically wrap inside of the containing block
  • We do know that all images "fit in a box" of a fixed dimension
Today I was implementing yet another site with this layout need, and decided to try to figure it out again. Thanks to this forum thread I was turned on to the idea of doing this by making the image a background image and using background-position: center to get the job done.

So, how'd I do it?

<div id="thumbBox">
    <div class="thumbUnit">
        <div class="thumbContainer" style="background-image: url(thumb1.jpg);">
            <a class="thumbLinkOverlay" href="/thumb1-link">&nbsp;</a>
        </div>
        <div class="thumbLabel"><div>Label 1</div></div>
    </div>
    <div class="thumbUnit">
        <div class="thumbContainer" style="background-image: url(thumb2.jpg);">
            <a class="thumbLinkOverlay" href="/thumb2-link">&nbsp;</a>
        </div>
        <div class="thumbLabel"><div>Label 2</div></div>
    </div>
</div>

The "thumbBox" is the containing block for the image set. Each "image" has an area blocked out for it by the "thumbUnit" div, which is given a FIXED width/height that is big enough to hold the largest image.

The "thumbContainer" has the desired image as a background image, since "background-position: center" works, whereas "vertical-align: middle" never does...

Since background images aren't clickable, we use absolute positioning to create a link tag that covers the entire "thumbUnit" area, making our image clickable.

The "thumbLabel" allows us to have a centered caption.

What's also great about this setup is that we can easily make the image set sortable with Scriptaculous, and make the image labels edit-in-place. I'll cover that in future post.

Downsides
There are a couple of downsides to this approach:
  • Images won't print in some browsers
  • Not all that semantic
However, in my case I am usually using this in an admin area where neither of these things matter. It might be possible to specify a print media css file to override the printing problem, but there isn't much you can do about the semantic problem.

If you really want good semantic markup for this situation, I suppose the best way is to just set up a Javascript function to "center" all of the images once loaded.

Below are the style definitions used with the markup.

<style type="text/css">
#thumbBox {
    float: left;
    width: 500px;
}
.thumbUnit {
    float: left;
    position: relative;
    margin: 5px;
}
.thumbContainer {
    width: 100px;
    height: 75px;
    background-repeat: no-repeat;                         
    background-position: center;                          
    position: relative;                                   
}                                                         
.thumbLinkOverlay {                                       
    width: 100px;                                         
    height: 75px;                                         
    position: absolute;                                   
    top: 0;                                               
    left: 0;                                              
}                                                         
.thumbLabel {                                             
    height: 1em;                                          
    text-align: center;                                   
}                                                         
</style>