utf8 lessons


The other day, I was working on a Drupal site. I based the theme for the site on the Zen theme (ver 1.1).

I was experiencing a very strange problem: I could not save any of the changes I made on the theme configuration page. I tried to change the logo. I tried to make it display the slogan. Nothing worked.

I started editing the database by hand, throwing serialized php arrays in there to set the settings I wanted. I watched in horror as I SELECTed the row, loaded the page, and SELECTed the row again, only to find that somehow my settings had been overwritten with the defaults.

"Is this some bug in the zen theme?" I thought. If so, it would be pretty major. Someone surely would have caught this by now.

No. No it wasn't. It turns out that my mysql database was using latin1 encoding rather than utf8. The settings for the theme included a fancy unicode character as the "breadcrumb separator". This caused the database to freak out and throw nonsense into the "variable" table. When I inspected the SELECT statements carefully, I found that the edit I made by hand did not get faithfully transferred into the database. This caused the serialized php array to be invalid. Drupal then helped me by sticking the default values in there, just to have something that made sense.

latin1 encoded datbases cause nothing but problems. utf8 databases have nothing but solutions.

So I dumped my data, dropped the database, recreated it using utf8 explicitly, and then reloaded my data. I was saved.

(this was the create-database syntax I used.

  1. CREATE DATABASE cooldrupaldatabase CHARACTER SET utf8;

Okay, but why? Why do I need to set that explicitly. We live in a utf8 world. Why would utf8 be the default?

It turns out that I had solved this problem awhile ago on another computer, so you'll have to excuse me for not having the links anymore.

Debian feels that backwards compatibility is the most important thing with their mysql package. They don't switch the default to utf8 because this will somehow break backward compatibility with debian systems that have been running for a long time? I guess? This is what they say. Ubuntu carries forward the debian mysql package, including this default setting.

So, to fix it, you can add a file to your /etc/mysql/conf.d that tells it to default to utf8. I have attached the file. Once again, I'm sorry that I forgot where I got it from.

Your rating: None Average: 3.3 (6 votes)
utf8.cnf348 bytes

Rhythmbox daap download queue

I sometimes use rhythmbox to download music from other people's daap shares. I wish I had a better interface to the download queue. Right now, there's just a progress bar. I want to see what songs are being downloaded. If a share suddenly goes down, I want to be able to delete those things from the queue without stalling the rest of it. Or set things to pause and resume later when the share comes back online.

Your rating: None Average: 3.7 (3 votes)

Rhythmbox playlist folders

I have a weekly freeform radio show on WCBN. I've had this show for a number of years. Every week, I put a playlist together. I like having them around for historical purposes, but now my list of playlists in rhythmbox is quite long.

I wish that I could create a playlist folder to store all my old playlists, and I could choose to show it expanded or not.

Your rating: None Average: 4.9 (21 votes)

DAAP proxy

So, "I" have a lot of computers at my house, and each of them has a part of "my" music collection. I opened up the daap port on my firewall and I have it go to the daap server on one of "my" computers.

But I want them ALL.

There should be a daap proxy that reads all available daap shares and exports them as one share, from which you can browse all the music. As an added bonus, you could include an interface so that the proxy could automatically fetch any music that is not already on a certain computer, and ship it over to that computer. You know, to synchronize all the music that I have onto one computer.

This would be useful.

Your rating: None Average: 5 (4 votes)

Firefox SSL Indication


Firefox 3 is, in several ways an improvement over Firefox 2. But there are just a few things that drive me crazy. One of them is the way it handles the display of sites using SSL.

It used to be that a quick glance at your Location bar would tell you whether or not the data you were sending was encrypted. You could say "Gosh. Am I about to send my password across the wire in plaintext?" And, if the Location bar was white, you were. If the location bar was tan, you were not.

Some misguided people took this away, so now it is very difficult to tell whether or not your data is encrypted.

The topic is covered in depth elsewhere. It makes reference to the Firefox bug that has the discussion on it, but allow me to summarize:

Go to your about:config page, and set browser.identity.ssl_domain_display to 1. This enables the new UI for this.

An alternative, suggested by CNET, is to add this to your ~/.mozilla/firefox/*.default/chrome/userChrome.css file:

  1. #urlbar[level] .autocomplete-textbox-container > *
  2. { background-color: #FFFFB7 !important; }

This method actually goes ahead and restores the tan url-bar. I think I prefer this solution.

Your rating: None Average: 2 (1 vote)

Firefox DNS Caching


The Domain Name System is a distributed database that maps names to computers' IP addresses. It's one of the cornerstones of the Internet.

Because it is so important, there are many standard ways of working with it. Some people, for example, may want to cache their DNS results if they have a slow connection to the Internet, or to their DNS server in particular. Linux, for example, provides caching hooks right in the GNU C library. Windows also provides DNS caching.

But Firefox decided that it's smarter than the traditional approaches and the operating systems that it's running on. It has its own rules about caching DNS. Therefore, when I monkey with my DNS (perhaps by adding new names, or adding things to /etc/hosts), I find that Firefox sometimes tries to access the old IP address of a computer I've just changed, even though the rest of my computer will go to the new one.


That is not how I want my computer to behave. If it was, I would have turned on DNS caching in my operating system.

There's a way to turn off this behavior.

Firefox secret "about:config" page, that lists all the configurable options, even if they aren't exposed to the UI.

Apparently, there's an even MORE secret set of config options, and you have to know the names and add them to the config page yourself.

I found this out from this guy's blog:

But that guy gets it all wrong. He's telling you how to increase the amount of caching that Firefox does, therefore breaking the traditional DNS approaches even further.

No. You should be turning off the DNS caching.

I found that I could turn off the DNS caching by going to about:config, and then right-clicking. I told it to add a New preference that is an integer. The name of that preference is:

Set it to 0.

You can now actually use your computer the way it was meant to be used.

Your rating: None Average: 4 (1 vote)

Rhythmbox daap should understand ratings

itunes music sharing protocol (the old one that we know how to use, not the new one that was created as a hostile attack against us) has the ability to serve ratings with its export.

But Rhythmbox doesn't seem to be able to read those ratings. That would be useful. Ratings are important to me, cuz I have too much music to keep in my head at once.

Rhythmbox also doesn't have the ability to serve those ratings out.

These things I would both like. mt-daapd has the ability to serve the ratings, and it's open-source, so that's a start to understanding the protocol.

Your rating: None

mt-daapd should understand rhythmbox database

mt-daapd, also known as "Firefly Media Server" is super-excellent. It's a daemon that lets me share my music over the itunes sharing protocol. Having it as a daemon is a good move, I think, because it can be serving regardless of whether I happen to be running rhythmbox at that time.

Also, it lets me have a machine that lets me serve my music and does little else. There's no reason to marry the serving of music with a GUI.

Anyway, I have one request: Let mt-daapd understand the Rhythmbox database. That way, it can serve my ratings and playlists. Those things are important to me. I can look at the ratings and go "Oh, THAT song is the good one on this album."

It already reads the itunes database xml export. The rhythmbox database is an xml file too! So it should be pretty easy to fit a parser for that into there. That's the whole point of xml.

Your rating: None

Gnome-terminal activity notifications

There is a terminal application for Mac OS X called iTerm. It's pretty excellent. If you're using Mac OS X, this is the terminal to use. It's got tabs and transparency and all the good, modern stuff.

But if you're a real person like me, you use Linux, and you use gnome-terminal. Or, I'll concede, you might use Konsole.

These programs each lack a feature present in iTerm that I happen to like a lot. In iTerm, if you are on tab A, and output is generated on tab B, the title text for tab B turns purple. After a couple of seconds with no output, the text turns red. When you switch to that tab, the text turns black again.

I like this a lot. It means that I can run a compilation in one tab and be notified when it ends, even if I forget to add "; beep" or something to the command-line (I always forget to do that).

Someone should do something about that.

Your rating: None Average: 3.8 (8 votes)

Drupal Autosave Module Without TinyMCE


The latest release of the Drupal Autosave module (version 5.x-3.2) was made with the explicit intention of making it work without the presence of the TinyMCE wysywig editor.

Sadly, this did not work out for me. Fortunately, the fix was quick and easy. I've posted it here, and also on their bugtracker. This diff applies against 5.x-3.2.

Your rating: None Average: 3.3 (13 votes)
autosave-without-tinymce.diff1.48 KB