August 12th, 2005

Databases, streaming video and PHP

Got a good bit of work done today. One of the projects I'd had on the todo list for a while is an automatic reminder system for my user's domain renewals. I don't have a whole lot of these, so I had been doing it semi-automated. But that means that I was a bit inconsistent on how often and how soon I'd send out reminders.

I already have a mysql db on my server for some forum boards and a game, so I figured I'd make a new db in that and use it for storing the info. I had to go through a few iterations before getting the schema right, but not too bad. I have a feeling I'll want to expand it in the future though.

Then I created a few perl scripts to manage the data. I entered most of the data manually through one perl script, and just for domains expiring through the end of the year. The one piece of data that is automatically updated is the expiration date for each domain, which is automatically fetched in a perl script from whois queries and then updated in the db if needed.. I'll have to add a way to only do intermittent updates of these though, as whois servers dislike it when one server makes lots of queries in a short period of time.

Then the third perl script goes through the db and sends out renewal notices for domains expiring in less than 60 days, urgent renewal notices for less than 14 days, and an urgent expired domain notice from when the domain expired until it is actually deleted. This reminder service is scheduled to run weekly. I want to expand it though so it runs daily but only sends biweekly notices until less than 14 days, and then weekly from then until it is deleted.

While there's still some improvements to be made, including automatically seeding the db from the server's DNS and/or web server configs, it's all up and working after only a few hours of hacking on it. Not bad.

Yesterday I was playing around with streaming video after edwardv demoed his streaming audio experiments with Windows Media Encoder. I have a video server back in Santa Clara where I can record US TV and download it to watch here. I'd thought about doing video streaming as well, but hadn't really looked at what would be required. After seeing what edwardv had thrown together, I decided to look into it myself.

It was actually surprisingly easy to set things up. I have a 768kbps uplink over there, so I played around with various encoding rates to see what was stable. I found that 525kbps video and 64kbps audio was very stable and while not great quality, was quite watchable. Unfortunately, the satellite receiver on it has flaked out, so I need to wait for Voodoo to get home and give it a kick. For testing, I was streaming AVI files, though I verified that streaming from inputs worked, though all I could see were the receiver's menus.

If the NHL gets their act together, this will be nice for watching hockey games live. It'll be interesting to see how well watchable fast action like hockey is with those kinds of bitrates. Thanks edwardv for giving me a push on video streaming.

The last technical puzzle this week is one my friend in Austria, Pazu and I have been trying to solve for a while. He has a PHP application that is supposed to allow one to upload files to the server, except on my server it doesn't work. Our first suspicion was that it was because my server runs PHP5 which is incompatible with some apps designed for PHP4.

This week we got it to the point where if he ran his own instance of Apache on my server that it would work. Since we thought it was the PHP version, and since he tested with an installation of PHP4, I downgraded the main server to PHP4, and it still failed. We then did various tests to show that his personal version of Apache could run it under PHP5, so eliminated that as a problem. There's still several differences between his install and the main server's so I'll need to sit down and test each change one at a time to see what makes it break. We've already eliminated the most obvious one of what user id the server runs as.

Chinese on the comics page

The first panel of today's Luann comic strip is in Chinese. Apparently Luann's old flame Aaron Hill is shacking up with a Chinese girl in Hawaii and is learning to speak Chinese. Since the strip doesn't provide subtitles, as a public service here's what they said:

Aaron: 對不起 (pronounced dui bu qi): Sorry.
Girl: 沒關係 (pronounced mei guan xi): It doesn't matter.

OK, maybe not too exciting, but it's kinda neat seeing actual Chinese instead of the random scribbles that often are used instead.