Nothing But Words

Mike Toppa’s Blog

About | Contact | Archives | Photos | WP Plugins

The Quiet Coup

The best and most comprehensive assessment I’ve seen yet of our current financial crisis is Simon Johnson’s article in the latest issue of The Atlantic, The Quiet Coup. Here’s the summary:

The crash has laid bare many unpleasant truths about the United States. One of the most alarming, says a former chief economist of the International Monetary Fund, is that the finance industry has effectively captured our government—a state of affairs that more typically describes emerging markets, and is at the center of many emerging-market crises. If the IMF’s staff could speak freely about the U.S., it would tell us what it tells all countries in this situation: recovery will fail unless we break the financial oligarchy that is blocking essential reform. And if we are to prevent a true depression, we’re running out of time.

I’ve been very disappointed with the Obama administration’s handling of the crisis – they are letting the banks continue to run the show. As Johnson’s article makes clear, the financial sector wields preponderant influence in both political parties. Josh Marshall at Talking Points Memo explains the current politics of the situation well, as the extent of malfeasance in the financial sector becomes known, and public anger rises:

The problem is what appears to be the president’s mortifying impotence in the face of bankers and financiers who created the problem… I think the American people have demonstrated over the last six months that they’re willing to expend vast sums of money and endure great economic hardship without holding the damage against their political leaders. Effectiveness, in the sense of how long it takes to turn the economy around, is something they seem willing to be flexible on. But not on who’s in charge… From Geithner and Summers, and indirectly from Obama, we keep hearing financial-legal versions of ‘It’s bigger than the both of us’. Like we’re along for the ride, still taking dictates from the people who got us into the mess we’re in.

And Johnson, in the conclusion of his Quiet Coup article, is very clear about the economics of the situation:

At the root of the banks’ problems are the large losses they have undoubtedly taken on their securities and loan portfolios. But they don’t want to recognize the full extent of their losses, because that would likely expose them as insolvent. So they talk down the problem, and ask for handouts that aren’t enough to make them healthy (again, they can’t reveal the size of the handouts that would be necessary for that), but are enough to keep them upright a little longer. This behavior is corrosive: unhealthy banks either don’t lend (hoarding money to shore up reserves) or they make desperate gambles on high-risk loans and investments that could pay off big, but probably won’t pay off at all. In either case, the economy suffers further, and as it does, bank assets themselves continue to deteriorate—creating a highly destructive vicious cycle.

To break this cycle, the government must force the banks to acknowledge the scale of their problems. As the IMF understands (and as the U.S. government itself has insisted to multiple emerging-market countries in the past), the most direct way to do this is nationalization. Instead, Treasury is trying to negotiate bailouts bank by bank, and behaving as if the banks hold all the cards—contorting the terms of each deal to minimize government ownership while forswearing government influence over bank strategy or operations. Under these conditions, cleaning up bank balance sheets is impossible.

Nationalization would not imply permanent state ownership. The IMF’s advice would be, essentially: scale up the standard Federal Deposit Insurance Corporation process. An FDIC “intervention” is basically a government-managed bankruptcy procedure for banks. It would allow the government to wipe out bank shareholders, replace failed management, clean up the balance sheets, and then sell the banks back to the private sector. The main advantage is immediate recognition of the problem so that it can be solved before it grows worse.

To give credit where it’s due, Robert Reich (Clinton’s Labor Secretary) had it figured out back in January:

Back in the banking crisis of 1907, J.P. Morgan got all the major bankers into one room and forced a kind of reorganization on all of them. We need the same today — a giant reorganization of the banks, in which their shareholders lose what little value they have left, their creditors get paid 20 cents or so on the dollar, and their assets are written down to about 20 percent of their face value. In effect, it’s an industry-wide reorganization under bankruptcy. This way, bank balance sheets are cleared up, there’s no run on any one bank, everyone starts anew, and taxpayers aren’t left holding the bag.

Reich also emphasizes the urgency of the situation:

Six months ago it may have made sense for the government to buy up so-called “toxic assets,” based on home mortgages that should never have been issued. Three months ago it may have made sense to establish a “bad bank” to store them in, until they could be resold.

But as the Mini Depression worsens, “toxic assets” are no longer all that distinct from a vast and growing sea of non-performing or endangered loans on the banks’ balance sheets. Toxicity has spread to loans made to people and companies that were good credit risks as recently as early last year but are now bad risks. You don’t have to be an honest financier (no oxymoron intended) to figure this out: Ten percent of Americans are behind on paying their mortgages. Millions more are behind on paying their credit-card bills. Hundreds of thousands of small businesses are behind on paying their own bills. Auto suppliers can’t pay their bills. And so it goes.

A “bad bank” collecting all these non-performing or in-danger-of-becoming non performing loans might well become larger than the rest of the banking system — nationalization through the back door of lemon socialism, where the government (and taxpayers) own and control this vast sea of junky loans.

The current Treasury plan doesn’t force any transparency on the banks – it doesn’t require any honest accounting of the value of their assets. Instead it’s essentially an offer by the government to underwrite all the risk for anyone who will invest in banks, leaving the government (taxpayers) to absorb the losses if the investments fail. It’s a plan that again leaves the banks holding all the cards, serving no one’s interests but their own. If, for example, a bank owns a mortgage with a face value of $300K, and the home is foreclosed, the bank still has a $300K asset on its books. The home currently may be worth only $200K, but what incentive does the bank have to sell it at that price? Sales like this would bring in cash, but would dramatically reduce the value of what’s on the bank’s balance sheets. Enough such sales would likely push them into insolvency. The bank’s incentive is to instead find a way to persuade the government and investors to pay far more than what the assets are worth, or to just not sell them at all, and hold out for another bailout. (Credit for the observations in this paragraph goes to Maria, who understands the financial sector at a much deeper level than I do).

In the end, I’m forced to agree with this cynical observation from the comment section on a post about the possibility of banks gaming the plan (i.e. through proxies, bidding up the sale price of their own assets and leaving taxpayers on the hook for the difference):

As far as I can tell, the endless succession of plans offered up over the last six months has had one goal: come up with something complicated enough to provide political cover for foisting the huge losses of the banks off on taxpayers. Even assuming no cheating/gaming, best-case scenario – isn’t that the whole point of the plan?

Another voice worth hearing on the economic crisis is Paul Krugman at the New York Times (scroll down to the “columns” section). And to avoid ending on too depressing a note, give a listen to the song Hey Paul Krugman:

Hailstorm!

A sudden hailstorm - 15 minutes before this it was sunny and 73 degreesA sudden hailstorm – 15 minutes before this it was sunny and 73 degrees
A sudden hailstorm – 15 minutes before this it was sunny and 73 degrees30-Mar-2009 12:00
The largest hailstones were about the size of a nickelThe largest hailstones were about the size of a nickel
The largest hailstones were about the size of a nickel30-Mar-2009 08:01SONY DSC-W55, 2.8, 6.3mm, 0.01666666 sec, ISO 100

We had a freak hailstorm yesterday, unlike any I’ve experienced before. I don’t think it measured up to the stories you’ve probably heard about baseball sized hail in the Midwest, but for the mid-Atlantic and Northeast, nickel-sized hail is very rare. By the time I grabbed the camera, the worst of it had passed, but the video should still give you a sense of it (not to mention a sense of my lovely garage, which I can’t wait to tear down). I’ve also never seen such a downpour – it usually takes a full day of steady rain to produce the kind of standing water in my yard that this storm generated in less than 10 minutes. What’s even stranger is that 15 minutes before the storm hit, it was sunny and 73 degrees.

The NBC Philadelphia site has a good slideshow of viewer-contributed photos.

So I can cross “major hailstorm” off my storm and natural disasters list, along with hurricanes, blizzards, and big earthquakes. So still to go is forest fire, tornado, flood, erupting volcano, and a rain of frogs.

Practical XSLT Examples: Transforming an XML Document to XHTML

Having been involved with only one significant XSLT project using PHP (the PennMed Clinical Trials project), I don’t consider myself an expert. I did run into some issues, however, that required me to go beyond what was available in the online tutorials I found, and to dig into discussion forums, as well as figure out some things on my own. I’ll share some of those experiences here, with practical examples of transforming an XML document to XHTML. This is not a general introduction or tutorial. For that, I recommend the w3schools.com XSLT Tutorial.

  1. Should you perform the transformation on the client side or server side? Unless you have some special reason not to, I recommend transforming on the server side. Why make yourself deal with possible cross-browser compatibility issues in your XSL code, when you can instead have the server do the transformation, and send the browser nice, tidy XHTML instead?
  2. Using PHP’s XSLTProcessor: the PHP portion of the transformation is straightforward. The 7 lines of code in the example on the php.net site is very similar to the code I used in my application.
  3. The XML file: here’s a sample XML file from my project. It’s a document describing a clinical trial. My examples below will come from this document.
  4. Your XSL stylesheet’s outermost template match: everything I read said the outermost template match in your XSL file should be:
    <xsl:template match="/">

    which indicates the root of the document tree, therefore giving you access to all the document’s content. I disagree with this recommendation, at least as far as my project goes. The clinical trials XML documents have all their content contained in a single “clinical_study” tag. Therefore my outermost template match is:

    <xsl:template match="clinical_study">

    This way, I don’t have to repeat “clinical_study/” in every child XSL tag.

  5. Tags that appear only once: it’s vital to fully understand the XML documents you’re processing, so you know which tags might appear multiple times, and whether they have child tags. Tags that appear only once are the easiest to process. Here’s an example of how to display the value of such a tag; this is from a list of eligibility criteria for a clinical trial:
    <li>Gender: <xsl:value-of select="eligibility/gender"/></li>
  6. Tags that appear multiple times, without children: A clinical trial can address one or more medical conditions. They are listed in the XML like this:
    <condition>Metastatic Anaplastic Thyroid Cancer</condition>
    <condition>Metastatic Differentiated Thyroid Cancer</condition>

    Looping through them requires applying a separate xsl template tag. At the point in the XSL stylesheet where we want the conditions to be displayed, we apply the template like this:

    <ul>
    <xsl:apply-templates select="condition"/>
    </ul>

    Then near the end of the XSL stylsheet, after we close the main “clinical_study” template, we define this template:

    <xsl:template match="condition">
        <li><xsl:value-of select="."/></li>
    </xsl:template>

    The “.” indicates that we want to select the value of the tag itself (analagous to a “.” when listing the contents of a directory, which refers to the directory itself).

  7. Tags that appear multiple times, with children: the clinical trials XML documents can have one or more “location” tags (the example here happens to have only one). In our transformation, we want to display the contact information for the studies where the location is the University of Pennsylvania or the Children’s Hospital of Pennsylvania. As before, we indicate the template tag to apply, but this time with a conditional test which I’ll explain below:
    <xsl:if test="location/facility[contains(name,$upenn) or contains(name,$chop)]">
        <h3>Local Contact</h3>
        <xsl:apply-templates select="location" mode="contact"/>
    </xsl:if>

    …And the template:

    <xsl:template match="location" mode="contact">
        <xsl:if test="contains(facility/name, $upenn) or contains(facility/name, $chop)">
            <p>
            <xsl:choose>
              <xsl:when test="contact/last_name">
                <xsl:value-of select="contact/last_name"/>
                <xsl:if test="contact/phone">, <xsl:value-of select="contact/phone"/></xsl:if>
                <xsl:if test="contact/phone_ext"><xsl:text> </xsl:text>x<xsl:value-of select="contact/phone_ext"/></xsl:if>
                <xsl:if test="contact/email">, <a href="mailto:{contact/email}"><xsl:value-of select="contact/email"/></a></xsl:if>
              </xsl:when>
              <xsl:otherwise>
                A local contact person has not been assigned yet.
              </xsl:otherwise>
            </xsl:choose>
            <br />
            <xsl:value-of select="facility/name"/><br />
            <xsl:value-of select="facility/address/city"/>, <xsl:value-of select="facility/address/state"/><xsl:text> </xsl:text><xsl:value-of select="facility/address/zip"/><br />
            </p>
        </xsl:if>
    </xsl:template>

    There’s a lot going on here…

  8. Variable scope: You can define your own variables in XSL:
    <xsl:variable name="chop">Children's Hospital of Philadelphia</xsl:variable>

    It’s important to note that they are scoped tightly. If you define or alter the value of a variable within a loop, that value will be gone when the loop ends. In this case I defined my variables near the top of the document, before the “clinical_study” template, so they are available for use in any template in the stylesheet.

  9. Testing for a condition in multiple tags: The use of XPath predicates allows us to search through all of the “location” tags in the XML document. Note that this:
    <xsl:if test="location/facility[contains(name,$upenn) or contains(name,$chop)]">

    is not equivalent to:

    <xsl:if test="contains(location/facility/name,$upenn) or contains(location/facility/name,$chop)">

    The former searches all the “location” tags in the document for Penn or CHOP, and we’re using it to determine whether we should show the “Local Contact” section. We use code similar to the latter within the “location” template, as we check each location (if we tried to use it in the main clinical_study template, it would check only the first “location” tag in the document).

  10. The template “mode” attribute: in my XSL I need to loop through the “location” tags more than one time, and for more than one purpose. I loop through them once to get contact information, which is what this template is for. I loop through them again later in the stylesheet to extract information on the Investigators leading the trials. For that I have a different “location” template with mode=”investigator”.
  11. Handling quotes: the reason I defined a variable for CHOP instead of running the “contains” test on a plain string is that the XSL processor will throw an error on the apostrophe in “Children’s”. Unlike XHTML, it’s not valid syntax to put single quotes within a double quote delimited string.
  12. Referencing XML values within an XHTML tag: To get the contact person’s email address in a “mailto” link, we delimit the value in curly braces – <a href="mailto:{contact/email}">. The curly braces extract the value of the tag.
  13. Adding spaces: ther XSL parser aggressively strips spaces. It will honor spaces between words in your stylesheet, but it will strip spaces between tags. To force a space, use <xsl:text> </xsl:text> (this one took a while for me to track down, as discussion forum posts I found on this topic focused on using entities as the solution, but that is not an elegant approach, as &nbsp; is not a native XML entity, and this wouldn’t be a semantically correct use of it anyway). The parser doesn’t do this just to be annoying. If you were using it to create, for example, a PDF document, you would be glad it aggressively strips spaces, as stray spaces could cause major headaches in that context.

I’m on FriendFeed Now

Inspired by my co-worker Andrew, I’ve joined FriendFeed:

FriendFeed enables you to keep up-to-date on the web pages, photos, videos and music that your friends and family are sharing. It offers a unique way to discover and discuss information among friends.

See my feed.

It’s different from Facebook and other social networking sites in that it’s primarily an aggregator of feeds from other places (your own blog, Flickr, Twitter, Facebook, etc), but it does let you make Twitter-like posts. I’m also happy to find an alternate to Facebook, without all the ads and without the attempts to own me for life.

Two New WordPress Plugins: Koumpounophobia and Post-to-Post Links II

Update: Koumpounophobia is now at wordpress.org and so is Post-to-Post Links II. I’ve updated the download links below.

I’m releasing beta versions of two new WordPress plugins: Koumpounophobia and Post-to-Post Links II. I’ll create documentation pages for them soon. In the meantime please see the readme.txt files that come with them for details. Here’s the overview:

Koumpounophobia

Koumpounophobia is powered by jQuery, and enhances the WordPress HTML Editor button bar in 5 ways:

  1. It replaces the anchor and image buttons with new versions that provide input dialogs with more options (image width, height, etc.)
  2. It adds two new buttons: div and span, each with their own input dialogs (for class, style, etc. attributes)
  3. It lets you add your own buttons and create custom input dialogs for them
  4. It provides an API for other plugins to add buttons and custom input dialogs
  5. You have total control over which Koumpounophobia-based buttons will appear in the button bar

This is a beta release, and since it involves some fairly intricate JavaScript code, browser compatibility is an issue. In my testing so far it works beautifully in Firefox 3 and Google Chrome. It does not work well in IE 6, 7, or 8 (even without Koumpounophobia installed, the HTML Editor has some problems in IE8). I’d appreciate feedback on how it works in other browsers (please leave a comment on this post – let me know your operating system too).

If you’re wondering about the name, Koumpounophobia is a phobia of buttons. I learned about it because my 3 year old has a mild case of it (he won’t wear anything with buttons, and he won’t let you hold him if you’re wearing buttons). I thought the name was appropriate since there haven’t been any improvements to the WordPress HTML Editor in years – someone must be afraid of the buttons ;-)

This plugin was a real challenge to create because the WordPress “quicktags” code that creates the HTML Editor’s button bar was not written with customization in mind. It has no hooks for runtime access. This is why so few plugins add buttons to the HTML Editor, while the Visual Editor, with its well documented API, is lavished with attention. Those of us who like to work directly with the HTML deserve some nice buttons too!

Download Koumpounophobia

Post-to-Post Links II

Using the Post-to-Post Links II shortcode in your posts and pages, you can create links to other posts, pages, or categories on your WordPress site. You use the ID number or the slug to identify the post, page, or category for your link. The link will use its title as the link text, or you can supply your own link text. See the readme.txt file for examples of the shortcode syntax.

It makes linking within your site more convenient, and it means your links won’t break if you ever change your permalink structure or re-arrange your categories.

This plugin was inspired by the Easy Post-to-Post Links plugin written (but no longer maintained by) Scott Reilly. Unfortunately though, it cannot interpret the old Easy Post-to-Post Links tags. Post-to-Post Links II uses WordPress’ robust Shortcode API, which is not compatible with the syntax Scott used in Easy Post-to-Post Links. (Update: but you can convert them – see here)

I’m releasing it at the same time as Koumpounophobia because it uses the Koumpounophobia API to register a new button for the HTML Editor. So if you want a handy button for its shortcode, install Koumpounophobia too. Or if you’re a plugin developer, it’s a good working example of how to add buttons to the HTML Editor using Koumpounophobia.

Download Post-to-Post Links II

Shashin 2.3.5 Now Available

I had hoped to finish version 2.4 by now, but I’ve been busy with other projects and haven’t had enough time for it. So I’m releasing 2.3.5, which will be the final patch for version 2.3. There were a few bugs that people discovered since the last patch, and I don’t want to delay getting the fixes out. You can download it from wordpress.org, or if you already have a previous version installed, your plugin menu should give you a link within the next 24 hours to automatically upgrade.

Patches aren’t supposed to have new features, but this has a couple small ones, since I had already finished working on them.

  1. In addition to floating left or right, you can use “center” as an option for positioning your shashin tags and widgets. For example:
    [simage=600,576,y,center]

    This gives the picture with key 600 a width of 576, shows the caption, and centers the picture. Shashin uses the CSS “margin-left: auto; margin-right: auto;” technique to center the picture. This means you can leave out the “clear” argument if you’re centering, as the subsequent content will be automatically pushed below the picture.

  2. The simage tag has a new, optional 6th argument, which lets you specify an alternate thumbnail image. This is particularly useful for videos, as sometimes Picasa is unable to generate a thumbnail (I’ve run into this with a couple of mp4 videos, where the Picasa-generated thumbnail is just a solid black image). You can see it in this post, featuring a video about my son's school in Japan a couple of years ago. The thumbnail is a still frame from the middle of the video. The syntax looks like this:
    [simage=432,288,y,left,none,433]

    The number at the end is the photo key for the thumbnail image to use. Note this option is available only for the simage tag.

These are the bug fixes:

  • Fixed incomplete localization code for widget menus
  • In the album photo admin menu, now correctly saves whether photos should be included in random display
  • The salbumphotos tag can now handle sort order options with spaces (e.g. “pub_date desc”)
  • The salbumphotos tag no longer shows a “go back” link, as there’s nothing to go back to

Kai’s Karate Birthday Party

Mayhem at Kai's karate party for his 8th birthdayMayhem at Kai’s karate party for his 8th birthday
Mayhem at Kai’s karate party for his 8th birthday08-Mar-2009 06:21SONY DSC-W55, 2.8, 6.3mm, 0.025 sec, ISO 320

The big lesson Maria and I learned from Kai’s birthday last year was to never, ever have his birthday parties in our house again. Once there’s a critical mass of small boys in one place, utter chaos ensues. So this year we held the party for his 8th birthday at his karate studio: a big padded room, with lots of padded weapons for the kids to pummel each other with. What more could a gang of 8 year old boys want? The instructor – who goes by “Mr. A” – did a good job of providing structure to the mayhem, so things didn’t get out of control. Eidan was there too, and he was right in the thick of the battles (he’s the little guy in the Flash costume). He wasn’t the least bit intimidated by all the much bigger boys, and he definitely gave as good as he got.

Video - cutting Kai's birthday cake with a swordVideo – cutting Kai’s birthday cake with a sword
Video – cutting Kai’s birthday cake with a sword08-Mar-2009 10:45
Kai shows off the frosting on the sword after cutting his cake with itKai shows off the frosting on the sword after cutting his cake with it
Kai shows off the frosting on the sword after cutting his cake with it08-Mar-2009 06:46SONY DSC-W55, 2.8, 6.3mm, 0.025 sec, ISO 100

Happy St. Patrick’s Day

The Shamrock Maria made for Kai to wear to school on St Patrick's DayThe Shamrock Maria made for Kai to wear to school on St Patrick’s Day
The Shamrock Maria made for Kai to wear to school on St Patrick’s Day17-Mar-2004 17:53Canon Canon PowerShot S230, 2.8, 5.40625mm, 0.125 sec,

I’m not sure what the required waiting period is on recycling blog content, but I’m going to guess it’s about 5 years. That means I can re-post this picture from 5 years ago. Maria made this paper shamrock for Kai to wear to pre-school in 2004, right after he turned 3. It’s hard to believe he’s 8 now.

Kai and I spent last weekend in Newport, for my father’s 70th birthday. While driving around on Saturday I had to dig deep into my memories of Newport’s back streets, to avoid the all-day drunken revelry that spills out onto the main streets, both preceding and following the St. Patrick’s Day parade. Kai and I barely escaped from the Dunkin’ Donuts on Broadway at 9AM, as it was already crowded with sailors looking for girls, and girls advertising themselves in outfits such as “Erin Go Braless” green t-shirts. I have to say I don’t remember girls acting like that when I was younger (and there’s no surer sign of my age than my making that statement: “Kids today! When I was a boy…”).

Anyway, we had a fun get together with the extended family for brunch to celebrate my Dad’s birthday. I’m glad we made the trip.

Family brunch for my dad's 70th birthday (Terry Toppa)
Family brunch for my dad’s 70th birthday (Terry Toppa)16-Mar-2009 01:55SONY DSC-W55, 2.8, 6.3mm, 0.025 sec, ISO 160
Terry and Pat
Terry and Pat16-Mar-2009 02:12SONY DSC-W55, 2.8, 6.3mm, 0.025 sec, ISO 100

Change We Can Believe In?

Senator Grassley, on the AIG executives and their bonuses:

“I suggest, you know, obviously, maybe they ought to be removed,” Grassley said. “But I would suggest the first thing that would make me feel a little bit better toward them if they’d follow the Japanese example and come before the American people and take that deep bow and say, I’m sorry, and then either do one of two things: resign or go commit suicide.

“And in the case of the Japanese, they usually commit suicide before they make any apology.”

It’s a shame Senator Grassley hasn’t ever shown any interest in having us replicate other aspects of Japanese society, like their amazing and wonderful mass transit system. With their ubiquitous and reliable railways, jumping in front of a train is definitely a dependable way to go in Japan. If we had had a rail system like that, then the AIG executives would have their pick of modern, high speed trains to throw themselves in front of.

Where Did the Candy Go?

Democratic dolls with Obama candies, by Teana AllenDemocratic dolls with Obama candies, by Teana Allen
Democratic dolls with Obama candies, by Teana Allen

Shutting down a business is almost as much work as starting one. We just finished up the taxes for Kai’s Candy Co. I auctioned off our shipping boxes and other mailing supplies on ebay, and I gave the McCain candies to a local food bank (as they have absolutely no market value at this point). I sold our remaining Obama candies to Ms. Teana Allen, who has incorporated them into her custom doll designs. I updated the Kai’s Candy Co website to show off her dolls, and you can contact her through her myspace page if you’d like one.

Democratic dolls with Obama candies, by Teana Allen
Democratic dolls with Obama candies, by Teana Allen
Democratic dolls with Obama candies, by Teana Allen
Democratic dolls with Obama candies, by Teana Allen
Democratic dolls with Obama candies, by Teana Allen
Democratic dolls with Obama candies, by Teana Allen

You are currently browsing the Nothing But Words blog archives for March, 2009.