MySQL User Defined Functions for FNV (Fowler/Noll/Vo) Hash

Sometimes you only need a 32- or 64-bit hash function. One of my favorites at Yahoo and something we’re using at Fraudwall Technologies is the FNV (Fowler/Noll/Vo) Hash.

If you’d like to use FNV inside of MySQL, you might find our udf_fnv.c useful. For example:

mysql> select FNV1A_64('The quick brown fox jumps over the lazy dog.');


| FNV1A_64('The quick brown fox jumps over the lazy dog.') |


| 75c4d4d9092c6c5a                                         |


1 row in set (0.00 sec)

mysql> select FNV1A_32('The quick brown fox jumps over the lazy dog.');


| FNV1A_32('The quick brown fox jumps over the lazy dog.') |


| ecaf981a                                                 |


1 row in set (0.00 sec)


The functions behave similarly to the MySQL built-ins MD5() and SHA1() in the sense that they return hex strings. The module defines 32- and 64-bit versions of all three variants of the FNV hash: FNV-0, FNV-1, and FNV-1a. Enjoy.

Time It Right™: home automation based on the Jewish Calendar

Time It Right™: home automation based on the Jewish Calendar looks pretty slick:

Never set another Shabbos clock! Introducing Time It Right™- the ultimate in home automation. Time It Right™ is the only home automation system with a built in Jewish calendar. Time It Right™ is custom scheduled around YOUR Zemanim and lifestyle, controlling your home according to your specific needs . Unlike other home automation systems, Time It Right™ adjusts your schedule for Shabbos and Yom Tov week by week, with no action from you, making it the ideal system for the Jewish home, Shul, or institution.

I wonder if they use Danny’s hebcal for Unix app in their implementation.

php.ini hacks: –with-config-file-scan-dir and ini variable expansion

I whipped up a quick 3-minute presentation entitled php.ini hacks for today’s PHP Lightning Talks session at the O’Reilly Open Source Convention. It demonstrates two features:

  1. The --with-config-file-scan-dir option to ./configure

  2. ini variable expansion (“open_basedir = ${open_basedir}:/tmp“)

Why? Because George and Laura asked me to, and this is all I could think of with 20 minutes notice. And because the ini variable expansion feature isn’t documented anywhere on the website except for a passing reference in the PHP 5 ChangeLog:

Added possibility to access INI variables from within .ini file. (Andrei)

Tomorrow I’ll be giving a talk entitled Hacking Apache HTTP Server at Yahoo! It’s a repeat performance of the well-attended presentation I gave at ApacheCon 2005.

Kosher Gummi Bears from

B000FH15SY.01.MZZZZZZZ.jpg I just got a 16-pack of Planet Harmony Organic Fruit Bears from’s new Grocery service for a mere 15 bucks. It arrived in two short days because it was elligible for Amazon Prime; is actually stocking inventory for grocery items and not just acting as a conduit for 3rd-party supermarkets like Gristedes.

Plus, these gummi bears have a hechsher from Rabbi Eli Frankel’s Kosher Certification Service.

Sweet. (pun intended)

JPod by Douglas Coupland

JPod, by Douglas Coupland Last night I finished reading JPod, Douglas Coupland’s “sequel” to Microserfs. Very entertaining and a quick read. I haven’t laughed out loud reading a book in months.

JPod has been described as “Microserfs for the Google generation”, but perhaps “Microserfs for the EA generation” would be more appropriate, given the setting of a bunch of coders working for a videogame company. I had assumed that jPod had something to do with Apple’s iPod (perhaps a “jPod = ++iPod;” joke of sorts), but you know what happens when you make an assumption. (You make an ass out of u and mption.) As we find out on page 47, the book is called jPod because the characters work in a part of the cubicle farm where each employee’s last name begins with the letter J.

The book was a little darker than Microserfs (murder, people smuggling, forced heroin addiction and slavery) but par for the course for Coupland. Still not as good as my favorite Coupland novel (the underappreciated Miss Wyoming) but it’s among his top best work.

Migrating MVHS Alumni Directory data from BerkleyDB to MySQL

MVHS Spartan I recently rewrote large parts of the MVHS Alumni Directory to use MySQL instead of BerkleyDB. I’ve been on paternity leave from Yahoo! for 7 weeks now, and this is one of the few projects on my todo list that I have actually completed.

I’ve been maintaining this list of alumni for over 10 years. It began as a bunch of Perl 4 scripts and a single text file (colon-delimited, a la /etc/passwd) back when I was an undergraduate in college, and has morphed over the years as I have moved from ISP to ISP.

I was forced to port it to Perl 5 at one point when one of my ISPs did an OS upgrade, and although I got it to work, there was no way I was going to go through the pain to make it use strict. Later, I rewrote all of the DBM access routines to use DB_File::Lock to avoid race conditions that occasionally corrupted the data.

At the end of last year, my ISP (DreamHost) upgraded their Linux distro from Perl 5.6 to Perl 5.8 and everthing broke again. Plus, the BerkleyDB file format on their new distro was incompatible with the old files, so I had to recreate the files from a text dump. I got it working again with a little hackery, but still wasn’t ready to spend the time to dump BerkleyDB for MySQL.

Well, it’s finally done. The only new functionality is an RSS feed for each graduating class. It was fun to do a little bit of hacking.

The new version is about 7,000 lines of code, and it’s still very ugly, largely because I have tried to adhere to the Principle of Least Change, and I wasn’t such a great coder back in 1995. Download it if you so desire; it is released under the BSD License. The README needs a little updating, but the Makefile should actually work.

Changing default Yahoo! language from English to Spanish

My cousin is spending quite a bit of time in South America, and he wants to change his Yahoo! Mail account to display user interface elements in Spanish instead of English. He asked me for help, and sure enough, there was nothing useful at the Yahoo! Mail Help site. I tried it out on my account, and these are the steps I had to go through to get it to work:

  1. When you go to Yahoo! Mail, at the top of the screen next to the Yahoo! logo, you’ll see a link that says “My Account”. Click that link.

  2. The next page says “Review My Account Information” and it has a section entitled “Member Information”, right below the Name/Yahoo ID, Yahoo Mail Address/Password section. Click the “Edit” link to the right of the “Member Information” to go to the next page.
  3. This page should say “Edit Member Information for: johnsmith” at the top. The third section says “General Preferences”. It says “Preferred Content: Yahoo! U.S.”. Click the “Yahoo! U.S.” link.
  4. On this page, find the “New Setting” pull-down menu and pick the choice you want (“Yahoo! U.S. in Spanish” or “Yahoo Argentina” or whatever). Click the “Finished” button.
  5. Accept the new terms of service (which should be displayed in Spanish) by clicking the “Accepto” button.
  6. Click the “Terminado” button to complete everything and go back to Yahoo Mail. It should be displayed in Spanish now.

It’s good that you’re able to do this (I imagine that some webmail sites won’t let you change your language preference at all after registering) but it shouldn’t be this hard.