Moving a MythTV Master backend

This proved to be a whole lot easier than I thought. It required backing up the mythconverg MySQL database on the old system and restoring it on the new one.

   ~ /usr/share/mythtv/mythconverg_backup.pl
   ~ /usr/share/mythtv/mythconverg_restore.pl --filename mythconverg-VERSION-TIMESTAMP.sql.gz

A further step was needed to update the hostname of existing recordings to the new host.

   mysql> update 'recorded' set hostname='peeves' where hostname<>'peeves'

This machine became the frontend at the same time. The i3 GPU support was included in the xf86-video-intel driver from version 2.10. I ended up using 2.11 which had just become available and added the following entry to /etc/portage/package.keywords.

   =x11-drivers/xf86-video-intel-2.11.0 ~x86

posted by James Gemmell on Sun, 29 Aug 2010 at 12:13 | permalink | tags: gentoo, linux, mythtv

Faulty SOAPFaults and Java5

There may not be many good reasons for wanting to perform XML schema validation on a SOAP Fault. I had cause to as part of a unit test for a piece of fault generation code. I used SAAJ to create the fault and Spring's XMLValidator to validate.

The unit test passed on JDK 1.6 but failed with the exceptions below when run under JDK 1.5.

   org.xml.sax.SAXParseException: UndeclaredPrefix: Cannot resolve 'SOAP-ENV:Server' as a QName: the prefix 'SOAP-ENV' is not declared.
   org.xml.sax.SAXParseException: cvc-type.3.1.3: The value 'SOAP-ENV:Server' of element 'faultcode' is not valid.

The XML in question was the qualified name in the faultcode that had been created by default.

   <faultcode>SOAP-ENV:Server</faultcode>

The fix was to remove the SOAP-ENV namespace prefix by calling setFaultCode("Server") on the SOAPFault. The test then passed on both JDKs.

Here's the reason. Under the hood, XMLValidator uses the Xerces JAXP validator bundled in the JRE's rt.jar. From 1.5 to 1.6 the validator implementation was changed from using a SAX parser to DOM. It appears that the former is unable to resolve the prefix correctly when it features in the text content.

posted by James Gemmell on Mon, 17 May 2010 at 15:33 | permalink | tags: java, saaj, soap

Building a new Gentoo MythTV backend

After a few of years of fairly intensive use I am migrating a MythTV backend from a rather creaky and increasingly unstable Pentium 4 to a shiny new Core i3 530 based box. I was quite impressed with Phoronix's Linux benchmarks of the CPU. The performance of the integrated GPU will help too since this box is destined to run an HD frontend at some point.

It's been a while since I last set up a Gentoo box from scratch and thought I'd give the Gentoo Quick Install a go rather than the LiveCD. The i3's Hyper-Threading support meant that the boot was graced with a 4 penguin salute and I was pleasantly surprised by the performance.

When partitioning the 1TB drive I settled on the following layout, setting aside /dev/sda5 as a future amd64 root partition.

   /dev/sda1	/boot		256MB	ext2
   /dev/sda2	swap		2GB	swap
   /dev/sda3	/		100GB	ext3
   /dev/sda5	[amd64]		100GB	ext3
   /dev/sda6	/mnt/mythtv	729GB	xfs

I diverged from the install guide in a few places. When the gentoo-sources kernel download threatened to take more than a couple of hours I performed the mirror-select step early and portage pulled it from a local mirror. I prefer using genkernel and, setting MAKEOPTS="-j5", this and the emerge world steps took next to no time.

The backend is now up and recording and the next step is to promote it to master backend status and get the frontend working.

posted by James Gemmell on Tue, 20 Apr 2010 at 09:17 | permalink | tags: gentoo, linux, mythtv

Pretty printing with Emacs

I recently completed a proof of technology using Spring Web Services to host a SOAP over JMS service. While writing it up for distribution on a so-called Sharepoint "wiki" I needed to include the applicationContext.xml. Pretty printing the XML with syntax highlighting seemed like a good idea.

GNU's xmllint --format --htmlout was my first attempt but this does a pretty poor job in that all it does is wrap the formatted output in an HTML header and footer. I found nothing for Eclipse other than the Java2Html plugin.

A somewhat foggy recollection of doing a similar thing in the past led me to reacquaint myself with Emacs Htmlize which I hadn't updated since 1999. Needless to say quite a few new features have been added in the interim and using an htmlize-output-type of "inline-css" generated exactly what was needed to paste into the "wiki".

posted by James Gemmell on Wed, 31 Mar 2010 at 09:26 | permalink | tags: emacs, html, jms, spring, xml

NTFS recovery with SpinRite

Some more corrupted sectors appeared on the same disk mentioned in this earlier post. Once again, the Windows recovery console was no help as it would just hang but I could access the disk after booting Linux and found the corrupted sectors using badblocks. I pulled the sectors off, as I'd done before, using ddrescue utility. Since the last failure was less than 6 months ago and there may be more failures to come I decided that paying $89 for GRC's SpinRite was more than justified.

What a fabulous utility! It was pretty easy to get up and running after downloading and burning a boot disk. I initially had a problem with the laptop CPU overheating and shutting down. This happened when SpinRite was trying to recover some lost sectors and vexing the CPU. Moving the laptop too a cooler location on top of a fridge did the trick.

It took a few hours to run through the disk and recover the sectors, where possible. I then rebooted in the Windows recovery console and ran chkdsk. Job done!

At the same time I ran SpinRite over my aging Dell C400's 80GB drive. This laptop is now used as a Linux MythTV frontend and has been making a few noises sounding a little like seek errors in the making. The hard disk was running a little hot during the scan which resulted in some temperature warnings SpinRite. Moving the laptop into the fridge solved the cooling problem and the scan continued uninterrupted. SpinRite found and recovered a few bad sectors on the ext3 partition and I have yet to hear the noise again.

posted by James Gemmell on Sun, 07 Feb 2010 at 17:21 | permalink | tags: recovery

Intel XVideo problems following Mythbuntu 9.10 upgrade

Following an upgrade to Mythbuntu 9.10, one of my MythTV frontends failed play back video smoothly and without stuttering. The frontend is a rather old Pentium IIIM/i830M based Asus laptop but it played SD resolution video quite acceptably before the upgrade.

The mythfrontend.log revealed that the problem was that the driver no longer possessed the XVideo extension capability.

   VideoOutputXv Error: Could not find suitable XVideo surface.
   VideoOutputXv: Falling back to X11 video output over a network socket.
         *** May be very slow ***

No kidding. After much Googling of the Ubuntu forums I found a link to the solution in the Ubuntu 9.10 release notes. The trick is to disable kernel-mode-setting (KMS) using the nomodeset kernel boot option.

posted by James Gemmell on Sat, 02 Jan 2010 at 13:54 | permalink | tags: linux, mythbuntu, mythtv