Sunday, April 13, 2008

I spent my weekend mostly naked.

Probably more information than you wanted to know. But I was at the PNA/NW Zone swim meet, so I had an excuse this time. This was my first ever swim meet that I've actually swum in (I've spent others timing and running the computer).

The King County Aquatic Center is nice. The competition pool is an LCM (long course (50) meter), dividable into various arrangements; for this meet, it was divided into two SCY (short course (25) yard) pools. It's 9 feet deep throughout -- no worrying about hitting your head turning in the shallow end -- and has waveless gutters. You could warm up during the meet in the dive tank -- 25 yards square and 17.5 feet deep. When you jump into it, you feel like you're just going to float forever downward.

Anyway, I did the 1000 and 1650 ("swimmer's mile") freestyle events, and a relay event where I swam another 50 freestyle. I learned that I'm faster than I think I am, but still nowhere near as fast as I'd like to be. I managed a 15:13 in the 1000 (vs. expected 18:00), and 25:08 for 1650 (expected 29:00). However, I know that I was faster here than I am in my normal pool -- all those niceties plus the adrenaline rush add up.

Tuesday, April 8, 2008

A decent web framework?

I've been playing with a combination of CherryPy, Genshi, and Dojo to put together a website for a friend. So far, I've been quite pleased.

CherryPy is the request router -- it's responsible for cracking open the HTTP message and deciding how to process it. I have a few nits about it -- mainly documentation related -- but getting a webserver set up which did something along the lines of, "Route everything through Genshi except this path, which you should serve from the filesystem," was very straightforward.

Genshi is the first page framework which evoked a response from me of, "Hm, this could work," instead of, "God, I feel like I'm going to throw up." It uses an interesting approach: you write everything in XML and embed the programmatic constructs in the attributes. The rendering phase takes care of the transformation to HTML (or text, or ). For example, here's how you might render a table full of sliders for every integer or floating-point parameter:
<tr py:for="param in parameters">
<td py:if="param.valueType in ('int', 'float')">
<div dojoType="dijit.form.HorizontalSlider"
id="${param.name}Slider"
py:attrs="param.sliderAttributes"
intermediateChanges="true"
onChange="onNumericSliderChange('${name}')" />
</td>
</tr>


I'm used to the frameworks which require you to escape any code. Genshi lets you do that, if you absolutely insist upon it:
<?python
for param in parameters:
?><tr><?python
if param.valuetype in ('int', 'float'):
?><div dojoType="dijit.form.HorizontalSlider"
id="${param.name}Slider"
py:attrs="param.sliderAttributes"
intermediateChanges="true"
onChange="onNumericSliderChange('${name}')" />
</td>
</tr>


Dojo is a set of widgets. Not quite Google Web Toolkit, but it's simple and gets the job done.

Friday, April 4, 2008

SpamAssassin's multiple personality disorder

SpamAssassin has become a bit overly aggressive in its filtering as of late. A few of my friends' e-mails are getting sucked up in there, so I've had to monitor it a bit more closely.

Today, however, I found this gem in there. Clearly, it was conflicted as to whether the e-mail was spam or not, though ultimately it decided it was (and was correct in this determination). What amazes me is that, even with 12.3 positive points subtracted, this e-mail still scores as spam.
Content analysis details:   (8.6 points, 5.0 required)

pts rule name description
---- ---------------------- --------------------------------------------------
1.0 NO_REAL_NAME From: does not include a real name
0.1 FORGED_RCVD_HELO Received: contains a forged HELO
0.1 HTML_90_100 BODY: Message is 90% to 100% HTML
0.0 HTML_MESSAGE BODY: HTML included in message
0.5 BAYES_99 BODY: Bayesian spam probability is 99 to 100%
[score: 1.0000]
0.0 MIME_HTML_ONLY BODY: Message only has text/html MIME parts
-4.3 RCVD_IN_BSP_TRUSTED RBL: Sender is in Bonded Sender Program (trusted
relay)
[Return Path SenderScore Certified (formerly]
[Bonded Sender) - ]
1.6 URIBL_SBL Contains an URL listed in the SBL blocklist
[URIs: selleis.com]
3.8 URIBL_AB_SURBL Contains an URL listed in the AB SURBL blocklist
[URIs: selleis.com]
4.1 URIBL_JP_SURBL Contains an URL listed in the JP SURBL blocklist
[URIs: selleis.com]
2.1 URIBL_WS_SURBL Contains an URL listed in the WS SURBL blocklist
[URIs: selleis.com]
3.0 URIBL_OB_SURBL Contains an URL listed in the OB SURBL blocklist
[URIs: selleis.com]
4.5 URIBL_SC_SURBL Contains an URL listed in the SC SURBL blocklist
[URIs: selleis.com]
0.0 MIME_HTML_ONLY_MULTI Multipart message only has text/html MIME parts
-8.0 AWL AWL: From: address is in the auto white-list

Office/cubicle location

I've decided that it's not the size of the office which matters; it's the location. While I wouldn't pass up a posh corner window office on the penthouse floor, that's not what I'm thinking of. I need an office deep within a maze of twisty passages, all alike. The effort required to find me would place a high premium on interrupting me, and hopefully I could get more done.

Then again, maybe this will ensure that I only get determined idiots bugging me. Hm.

Tamara and I went down to Sacramento to visit a friend for an extended weekend. It was fabulous -- we spent a few days at her family's cabin in the Sierras, got together with a bunch of college buddies in the Bay Area, and otherwise just hung out.

Remember that fitness challenge I was doing in February? Well, the results have been posted; I came in second in my age group again. The guy who beat me won't beat me next year, though -- if only because I'll move up to the next age group. :-)

Monday, March 17, 2008

Value of a dollar?

If you are paid in or have bank accounts valued in U.S. dollars, the news that Bear Stearns was sold for $2 per share -- in a deal backed with $30 billion [edit: I originally mistyped "million" here] of your tax dollars -- should be extremely worrying.

This means that Bear Stearns is valued at $236 million. Last Monday, when it was trading at $70/share, it was valued at $8.26 billion. In the span of a week, $8 billion dollars effectively vanished into thin air -- in other words, investors overvalued BSC by 3500%.

If we were talking about Moe's Junkyard and Hot Dog Stand and other places with shoddy or non-existent accounting, nobody would care. But we're talking about a bank, whose finances were tracked by other banks.

This is like going to the ATM, withdrawing $20, and then trying to buy lunch -- only to find you can't afford it because there's only 57¢ in your wallet. Or going to the gas station and finding that the price of gas has risen from $3.50/gallon to $122.50/gallon. All stuff which is supposed to be unthinkable.

Yet it's here. And I'm worried.

Saturday, March 15, 2008

Mirroring blog entries from Blogger to LiveJournal

I've gotten a few questions on how I'm using Blogger while having posts mirrored to LiveJournal. The magic is a little Python script I wrote, which I've sanitized (that is, I got rid of my hard-coded and tossed up here.

It's not for the faint of heart in its current form. You'll need:

  • A Unix-ish computer. MacOS X is probably sufficient, but I don't have a Mac to test it on. Sorry, porting this to Windows is just too much effort.
  • Python 2.5.
  • The GData API for Python.

You'll probably want to install it as a cron job. My crontab runs this every 15 minutes:

# m h  dom mon dow   command
*/15 * * * * /home/dacut/bin/blogger2lj.py

Why would you want to do this? In my case, I'm getting weary of the goings-on with the suits over in LJ land, but still have a bunch of folks who read the version over there. I guess we got settled in before LJ became the platform for emo tweens. Heh, live and learn.

Anyway, I'm not saying that others should move to a new blogging platform. This just gives you the option to move without having to cut ties with your existing social circle. Could you imagine what real life would be like if decisions like this dictated your social circle? "Bob, Linda, Jake: It's been great hanging out with you guys, and I'm going to miss you. But I'm changing mobile phone companies, and the new one doesn't take phone calls from you. Sorry."

Thursday, March 13, 2008

Oracle Poetry

It's interesting what you can stumble across when you turn stones over while walking along a path. Or, in my case, when you snoop on network traffic. Worry not; I was doing this for a good cause: to track down a problem with the Oracle database driver.
@"Oracle

Everybody follows
Speedy bits exchange
Stars await to gl@ow"
The preceding key is copyrighted by Oracle Corporation.
Dupl@ication of this key is not allowed without permission
from Oracl1e Corporation. Copyright 2003 Oracle Corporation.

It looks like this is a creative way of making sure nobody else writes their own software for talking to Oracle databases -- to do that, you would have to copy the poem, which is a violation of Oracle's copyrights.

Saturday, March 8, 2008

Either I'm losing my edge....

... or the jargon beast has eaten the Eclipse folks and changed their website.

Granted, I'm only develop in Java because it's the langue du jour in software circles today and am not overly enamored of it (or its fanboys), but I do have a reasonably deep understanding of the lingo. But I can't make heads or tails of the Eclipse Equinox mission statement:

From a code point of view, Equinox is an implementation of the OSGi R4 core framework specification, a set of bundles that implement various optional OSGi services and other infrastructure for running OSGi-based systems.

More generally, the goal of the Equinox project is to be a first class OSGi community and foster the vision of Eclipse as a landscape of bundles. As part of this, it is responsible for developing and delivering the OSGi framework implementation used for all of Eclipse. In addition. the project is open to:

  • Implementation of all aspects of the OSGi specification (including the MEG and VEG work)
  • Investigation and research related to future versions of OSGi specifications and related runtime issues
  • Development of non-standard infrastructure deemed to be essential to the running and management of OSGi-based systems
  • Implementation of key framework services and extensions needed for running Eclipse (e.g., the Eclipse Adaptor, Extension registry) and deemed generally useful to people using OSGi
As a peer of the Platform, JDT and PDE projects, the Equinox OSGi code is managed by the Eclipse PMC and ships with the Eclipse project major releases. The various other bundles developed here may ship independently and on different schedules.

On the other hand, I think I'd be more worried if I did understand this...

Saturday, March 1, 2008

February is over...

And that means the February Fitness Challenge is done. Which is good, because my body desperately needs a day off.

I'm rather pleased with how I did. I swam 121,000 yards (68¾ miles/110 kilometers), beating my goal of 100,000 yards.

In pictorial form:

Monday, February 25, 2008

Am I radiant?

If you're going to steal something from an abandoned building, I recommend choosing something other than the old, radioactive X-ray source. It's also probably not a great idea to sell it on eBay.

Friday, February 22, 2008

Vista -- sorry, it's my bad...

At least according to Slashdot, Amazon caused Vista to ship before it was ready by stealing a key Microsoft SVP, Brian Valentine. He's the SVP of my org at Amazon now.


They also point out that we're paying him something like $33M over four years; for once, though, I'll say it's money well spent. He's probably saved the company that much already by cutting out crap. Very effective leader in my book.

Monday, February 11, 2008

I wax statistical...

I'm watching "Deal or No Deal" -- they have a new gimmick where they're putting up multiple cases with $1 million (12 of 26 for the current contestant), replacing the other high dollar amounts on the board. However, I'm not sure it actually changes the gameplay at all.

Computing the expected value at any point is straightforward. The bank's offers, however, are not solely dependent on the expected value; the number of turns appears to be a factor. A comment on this blog post suggests offer = <value> * turn / 10 (where <value> is the expectation value). The offers the bank is making in the early rounds of the 12 $1 million case version, however, seem low -- almost as if the values on the board were not $1 million but the previous values. The episode ended before the contestant finished, so I'm left wondering at this point.

One thing which strikes me, however, is that the endgame is probably the same. If he/she makes it to the final round, in all likelihood (though I have yet to confirm this statistically) the choice will be between a low dollar amount and a $1 million suitcase. Maybe it's somehow easier to get to this endgame? Hm. You know, I'm going to have to do the math on this one.

Saturday, February 9, 2008

Oof...

Silly me. Silly fitness challenge. I swam just over 6 miles today (10,600 yards). That's the most I've done in a single day and my arms are complaining like crazy.

I'm currently at 23.8 miles for the month; my goal is 56.8 miles (100,000 yards), so I'm a good part of the way there. Let's hope my muscles don't fall apart.

Early results from Washington

At least if the precincts in my caucus were anything to go by, it looks like Obama will have a solid lead in Washington. The breakdown in my precinct was 188 (12 delegates) for Obama, 55 (3 delegates) for Clinton, and 19 (1 delegate) undecided. Other precincts split similarly. Turnout was heavy, as one might expect.

This is the first time I've ever participated in a caucus -- my previous experiences were voting in lame duck primaries in California and Pennsylvania. I quite like Washington's system; you don't register for a particular party, so you can go to either of the caucuses. Since McCain has the Republican nomination pretty much locked up, it made far more sense to attend a Democratic caucus. Listening to people campaign makes for a far more lively atmosphere; participating in the political process is more fun this way.

Sunday, February 3, 2008

When work intrudes on your personal life...

I just saw the Super Bowl ad for Pepsi Stuff. Unremarkable, except they flashed the Amazon.com logo for a fraction of a second. It's so weird seeing that. I forget just how big Amazon is sometimes. It's unusual, because the work I do often has a direct impact on the website.

At every other big company I've worked (IBM, Seagate, Cadence), my work usually ends up being a footnote for some minor offshoot project which never made it into a real product. Until now, it's only been the startups (AstroTerra, Neolinear) where my contributions actually have had a measurable impact for a customer.

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.

Monday, December 24, 2007

Merry Christmas!

Visiting Tamara's family over in D.C. (the other Washington). Lots of merriment is being had.

This came from my sister-in-law: what really happens to the glassware in hotels, with a follow-on edition for five-star hotels.

I guess I can understand why I was able to eat at the roach coaches parked in front of CMU and not get sick during my grad school years and not get sick: it's not that different from real life.