Solutions

Every time I come across a major annoyance, then solve it, I'm going to put it here for google to find!

Debian/Xen problems with MySQL, named and portmap

Recently I had an annoyance at work with a Xen domain running Debian. I installed it using debootstrap, and so configured some stuff manually.

The problem was several services had weird problems binding to TCP sockets, with no apparent cause. Portmap kept crashing, named refused to stop, and MySQL refused to start. The error messages were as follows:

MySQL:
Jul 14 08:54:57 mercury mysqld_safe[438]: started
Jul 14 08:54:57 mercury mysqld[442]: 050714 8:54:57 Can't start server: Bind on TCP/IP port: Cannot assign requested address
Jul 14 08:54:57 mercury mysqld[442]: 050714 8:54:57 Do you already have another mysqld server running on port: 3306 ?
Jul 14 08:54:57 mercury mysqld[442]: 050714 8:54:57 Aborting
Jul 14 08:54:57 mercury mysqld[442]:
Jul 14 08:54:57 mercury mysqld[442]: 050714 8:54:57 /usr/sbin/mysqld: Shutdown Complete

named:
syslog.5:Jul 12 10:27:26 mercury named[2043]: socket.c:1119: unexpected error:
syslog.5:Jul 12 10:27:26 mercury named[2043]: internal_send: 210.55.104.31#53: Invalid argument
syslog.5:Jul 12 10:28:28 mercury named[2043]: client 203.79.119.139#34288: query 'tasmanstudios.co.nz/IN' denied
syslog.5:Jul 12 10:29:18 mercury named[2043]: received notify for zone 'tasmanstudios.co.nz'

What was the problem? Well they were all trying to bind to the loopback interface, which I'd neglected to configure in /etc/network/interfaces (I've been spoiled by years of debian installer). All it needed was an "auto lo", and "iface lo inet loopback" and everything was fine.

Flash in AJAX/DOM-based pages

Well. Since this has frustrated me for over a month, and I appear to have solved most issues, I thought I'd share some stuff.

I've been developing a site for work which uses multiple Flash 8 movies communicating with each other with LocalConnection objects, and communicates with some coordinating javascript using ExternalConnection objects. All movies were inserted using DOM scripting, and swapped in/out as necessary. The site had to work on Firefox, IE6 and Safari (Opera would be nice, but Macromedia don't support it for ExternalCommunication yet).

The site is XHTML 1.1 based.

Only Firefox was an easy ride, everything working as expected. I inserted the Flash movies by creating embed nodes (no object) using DOM stuff. All worked fine. IE came next, and turned out to be a real bitch, as usual. IE can't embed Flash movies using the DOM (even with object nodes) while still allowing the movies to use LocalConnections. Real weird. Anyway, I solved that one basically by attaching Macromedia-standard (object and embed) Flash embedding code to a div using the bad naughty no .innerHTML property. This worked as expected, and I could swap flash movies in and out using these divs.

Safari was a more minor problem, but still a problem. It's fine with the same DOM stuff as Firefox, but it was reloading the flash movies when I swapped out the page stylesheet. This was difficult to diagnose! I ended up solving it by consolidating all the stylesheets into one static file, then using CSS selectors and changing the ID of the body tag for each "template".

If anyone is having issues with Flash and the DOM, get in touch and I'll see if I can help out...