Monday, January 28, 2008

The Fed's big 75 point mistake

This article in the Motley Fool is, IMNSHO, spot-on. The Fed's recent 75 point cut in interest rates is a crazy mistake.

Remember that the Fed's job is to tame inflation, not try to correct the economy. The economy simply cannot be corrected by central planning like this -- time has shown again and again that this produces results counter to the effect desired.

What does reducing the interest rate do? It makes the dollar a less attractive investment for foreigners -- who wants to buy dollars when the return is lower? Then basic supply and demand kicks in: a decrease in demand means the price (or exchange rate) goes down. Since a lot of our goods are imported -- including and especially oil -- their prices will go up.

The net result? Stagflation.

Thursday, January 24, 2008

OOXML bad? Try iTunes.

Technical folks like to wail about how defective OOXML (Microsoft's "open" format for Office) is. I agree -- with instructions like "render this table in the quirky way Word 95 did it", it's an impossible standard to implement.

However, that is nothing compared to the travesty that is iTunes. I've been having problems with my iPod; whenever I plug it in, iTunes spits up a DOS-like dialog box: "There is no disk in the drive. Please insert a disk into drive E:. Abort/Try Again/Continue." Googling suggests a possible fix: delete your iTunes preferences and reinstall.

Ugh. I'd rather not delete my license key and preferences, thankyouverymuch. So I decided to see what was in this file and if I could fix it myself.

I open up iTunesPrefs.xml in XEmacs and am presented with:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EQ Preferences</key>
<dict>
<key>EQPresets:129</key>
<data>
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
....
</data>
</dict>
<key>HTTP</key>
<dict>
<key>Cookies</key>
<data>
PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NU
WVBFIHBsaXN0IFBVQkxJQyAiLS8vQXBwbGUgQ29tcHV0ZXIvL0RURCBQTElT
...
</data>
</dict>
<key>Keychain</key>
<dict>
<key>Keychain</key>
<data>
WqtWpl9/8NLX0QgFWU4ogEh/7aKP4SbSBd7LRQZ6G8NBJ8dt+AjSv4fs6UOK
qZQ1PkuO6SqRct7r67XozEPbT8LIyXCZsHZe3w5qcvBQyWOzOTUVOJXT74ZC
...
</data>
<key>iTunes Library XML Location:1</key>
<data>
QwA6AFwARABvAGMAdQBtAGUAbgB0AHMAIABhAG4AZAAgAFMAZQB0AHQAaQBu
AGcAcwBcAGMAdQB0AGgAYgBlAHIAdABcAE0AeQAgAEQAbwBjAHUAbQBlAG4A
...
</data>
</dict>
</dict>
</plist>

And so forth.

Ok, so I can understand wanting to obfuscate things like my DRM keys (presumably what's behind the Keychain bit). But equalizer settings? Application paths? Huh?

If you're going to store things in a locked down, proprietary format, why go through the lengths to format and parse it in an interchange format like XML?

Thursday, January 17, 2008

Ah, PL/SQL

Ah, the idiocies of Oracle's database language, PL/SQL.

Let's say you're trying to fix things for a few thousand customers who have managed to create duplicate accounts. You want to delete the duplicate accounts, which are listed in a driver table called DUPLICATE_ACCOUNTS. Knowing that committing a few rows at a time is a good thing on a running database, you might try something like the following:

DECLARE
    CUSTOMER_ID NUMBER;
    CURSOR CDEL_CUR IS SELECT CUSTOMER_ID
        FROM ADMIN.DUPLICATE_CUSTOMERS;
BEGIN
    OPEN CDEL_CUR;
    LOOP
        FETCH CDEL_CUR INTO CUSTOMER_ID;
        EXIT WHEN CDEL_CUR%NOTFOUND;
        DELETE FROM CUSTOMERS
         WHERE CUSTOMERS.CUSTOMER_ID = CUSTOMER_ID;
        COMMIT;
    END LOOP;
    CLOSE CDEL_CUR;
END;

Note the boldfaced delete clause. One might expect this to find the row where the CUSTOMER_ID is the same as the CUSTOMER_ID we just fetched from the driver table. But no! Oracle interprets this the same as:
    DELETE FROM CUSTOMERS
     WHERE CUSTOMERS.CUSTOMER_ID = CUSTOMERS.CUSTOMER_ID;


In other words, those rows whose CUSTOMER_ID is equal to itself -- which (since there are no null CUSTOMER_IDs) is every single freaking row in the database!

Yes, I did this (well, something similarly disasterous) at work today. Yes, it was a production database. No, thankfully nothing crashed -- our databases are so busy that this immediately got hung up waiting for locks that we were able to kill it once we realized what was happening.

I'm not a DBA. I just play one on TV.

Tuesday, January 15, 2008

I don't *want* to drool...

First off, I don't like Apple, the company. Steve Jobs is rather arrogant and his company reflects this character flaw.

But their products? Oooh. A laptop that's 0.16 inches (40 mm) thick? Yes, please.

I also acquired an iPod Shuffle over Christmas. It usually lives in a waterproof housing and goes swimming with me, though I'm still tweaking the headphones -- you need to prevent water from getting between the headphones and your eardrums to keep the music going. Apparently, the shape and size of my ears is at the tail end of some bell curve; I end up having to stuff massive amounts of silicone putty over my ears just to make it last more than a few laps.

Alas, I doubt that I'll own a Mac in the foreseeable future. I rarely have a need to upgrade my computer(s) wholesale -- they're like George Washington's axe, wherein each component has been replaced at various times so that none of the original parts still exist. If I remember correctly, my current machine started out life as a Cybermax (a company which went bankrupt years ago) AMD K6-2 with 512 MB of memory and a 8 GB hard drive, running Windows. It's now an Athlon 64 with 2 GB of memory, 250 GB RAID-1 array, in an understated Lian Li case, running Ubuntu 7.10.

Work is going well, though I can't post much in the way of specifics of what I've been working on. It's nothing exciting (well, to non-dev-types) or anything you'll hear about in the news, though; I only work on the backend systems, after all.