Media center with MythTV
Last November I upgraded my desktop PC. Recently I’ve repurposed it as a media center running MythTV (and also for print serving/file serving etc).
The hardware is as follows:
- Sonata III 500 W case
- Gigabyte GA965P-S3 motherboard
- Core2 Duo E6550 CPU
- Gigabyte 8400GS Nvidia video card
- WinFast DTV1000 digital tuner card
- 320MB SATA disk
- Kingston 1Gig DDR2 800MHz memory
Since then, I’ve added a 1Terabyte SATA disk - prices keep coming down every week. You can get a 1T disk for just over AUD200 now.
I installed MythBuntu 8.04 and found it a very simple process. I had to configure it for TwinView (Clone) so I’ve got the same output on my TV as I have on the LCD monitor. Then I had to get sound via the SPDIF optical output. To do this you have to:
- Unmute the ICE958 channel via alsamixer
- Configure MythTV to use ALSA:SPDIF and AC3 + DTS to SPDIF passthrough
- I also had to change my video player command to ‘mplayer -ao alsa:device=spdif -fs -zoom -quiet so -vo xv %s’ so that video with only stereo sound would use the SPDIF
I haven’t set up a remote control yet. The TV card I have doesn’t look like it is supported under LIRC. So I might look at getting a dual tuner sometime, hopefully one that has a supported remote.
The video has a slight defect when fast moving action is displayed - horizontal splits in the picture appear, but it hasn’t proved too bad so far. I haven’t had time to look into this one, hopefully sometime soon I’ll start looking around the forums. I hope the solution isn’t a better video card!
Grails, favicon, and urls
I’ve just spent a little too much time trying to get my favicon working properly on a new grails application.
The issue I encountered was due to the fact that I wanted users to be able to access their accounts using ‘/[username]’ - i.e. /paul
To accomodate this, I used a UrlMapping:
"/$id" {
controller='display'
action:'index'
}
Now, this meant that /favicon.ico would hit the controller, and not server the icon file. I first thought I could get around this by constraining the above mapping - so I tried:
"/$id" {
controller='display'
action:'index'
constraints {
id(notEqual:'favicon.ico')
}
}
It seems though that the only constraint you can use is ‘matches’. At least ‘notEqual’ resulted in a compile error, and all of the examples use ‘matches’.
So I thought I’d use matches with a regular expression of to exclude the word ‘favicon.ico’ - turns out that matching a word is simple, but negating it is not - I couldn’t find an expression to negate a word.
Anyway, I’ve noticed that when requesting ‘/favicon.ico’, the $id parameter resolves to ‘favicon’ - the extension has been stripped off! Luckily I stumbled across a forum post pointing me to the Content Negotiation section of the user guide. You can turn off this behaviour with
grails.mime.file.extensions = false
Luckily for me I’d restricted usernames with the constraint
matches:"[a-zA-Z0-9_-]+"
So now, I can use the same constraint on the controller:
"/$id" {
controller='display'
action:'index'
constraints {
id(matches:/[a-zA-Z0-9_-]+/)
}
}
Since the request for ‘/favicon.ico’ contains a dot, it fails this constraint and the controller no longer handles the request.
I wish I’d come to this conclusion more quickly (I also investigated what I could do on the Apache side of things, but didn’t get anywhere), but I’m glad I’ve learnt what I’ve learnt.
Note, you don’t necessarily need to do this - you can use the following code to specify an alternate url to the icon:
<link rel=”shortcut icon” href=”/common/apps/op/favicon.ico” type=”image/x-icon” />
Firefox 2 on Ubuntu 8.04
I’ve been a little frustrated with the lack of my usual Firefox plugins due to most of them not being available for Firefox 3, so I’ve decided to install Firefox 2.
It seems apparently easy:
sudo apt-get install firefox-2
Now, I can run Firefox 2 from the command line with
firefox-2
Firefox 3 still works, by running ‘firefox’ - so while I can use 3 for browsing, I can use 2 for developing.
Note, I had to create a new profile for FireFox 2, because it didn’t seem right to run it with the version 3 profiles (and the extensions had a few issues) - but this is fair enough. See Firefox Profiles for more information.
No Dialect mapping for JDBC type: -1
This Hibernate error came at me out of the blue while working on FilmSuggestions.com - I innocently added a constraint to one of my Grails domain models, setting the maxSize of one of the fields to 2000. This changed the table schema making the column type TEXT instead of VARCHAR.
The problem came from a native query:
sessionFactory.getCurrentSession().createSQLQuery(mostPopularFilmsSQL).list()
This selects the TEXT column which results in the error (as described here). Setting the dialect didn’t seem to make any difference, so for now I’ve changed the constraint so it’s back to being a VARCHAR.
Recycling electronic waste - www.thegreenpages.com.au
I’ve got a couple of old computers and a collection of components that are good for nothing in todays world. But I’ve had trouble finding somewhere that will take it off my hands and dispose of it in an environmentally friendly way. Imagine my surprise when I saw a google advert on my own blog for http://www.thegreenpages.com.au/ - a directory of Eco friendly organisations which includes a category on recycling.
Hopefully it won’t be long before I can clean out some of the rubbish.
Rhythmbox
I’ve just been playing with RhythmBox for the first time, and am very pleasantly surprised. This application so far takes care of my music and podcast requirements, and also supports the iTunes links you see on so many sites.
You can either copy the iTunes link and add it manually, or in FireFox, clicking on the link pops up a dialog asking what application should be used - specifying /usr/bin/rhythmbox achieves the desired result, and the podcast is added just like that.
Rhythmbox also supports my wifes ipod, which is great for managing that. Although I don’t use internet radio, I’d like to and it takes care of that too.
I’ve still got more to play with, but so far I’m happy and will be sticking with it for the foreseeable future.
(Ubuntu 8.04Beta, Linux Dell Inspiron 1525 Laptop, 2.6.24-16-generic #1 SMP Thu Apr 10 13:23:42 UTC 2008 i686 GNU/Linux)
Wordpress error - Allowed memory size of ## bytes exhausted
I just came across a problem using wordpress that stopped everything working - any request to the Wordpress site resulted in a blank page. In the log file for the host, I could see:
PHP Fatal error:Â Allowed memory size of 8388608 bytes exhausted (tried to allocate 14592 bytes) in <path to a plugin php file>
Removing the plugin specified just meant that the error was reported for the next plugin.
Searching Google showed many discussions about this problem. Luckily the solution for me was easy enough - as described in this topic:
In <wordpress root>/wp-includes/cache.php I just added:
ini_set("memory_limit","12M");
grails-selenium-0.4
Version 0.4 of the grails selenium plugin is now available.
This version adds:
- scripts to create and run tests
- a postResults url for displaying the final test results
Details are as follows:
run-selenium
Runs Selenium in the specified browser.
Specify the path to your browser as a command line parameter i.e.
grails run-selenium /usr/bin/firefox
or, if the executable is on the path you would just need
grails run-selenium firefox
In your application.properties, you can specify:
selenium.auto=true
selenium.close=true
selenium.multiWindow=true
selenium.highlight=true
selenium.resultsUrl=/your/url/here (defaults to ${appContext}/selenium/postResults)
selenium.runInterval=1000
selenium.baseUrl=
See http://selenium.openqa.org/installing.html (section titled Continuous Integration) for more information on selenium and continuous integration.
create-selenium-test
Generates a new empty selenium test.
Supply the path of the test you want to create, relative to ‘web-app/selenium/tests’. The extension of this must be one of html, psv, gsp. The test file will be created using the syntax based on the file extension.
Example use:
grails create-selenium-test registration/errors/InvalidUsername.gsp
creates
web-app/selenium/tests/registration/errors/InvalidUsername.gsp
create-selenium-domain-test
Generates a new selenium test for the given domain class.
Supply the name of the domain class you want to test, followed by and extension that identifies the sytax to use. The extension of this must be one of html, psv, gsp.
Example use:
grails create-selenium-domain-test book.gsp
creates
web-app/selenium/tests/book.gsp
The generated test exercises the default grails scaffolding for CRUD functionality.
postResults page
A basic postResults page is provided, and if required the results can be saved to xml.
When using grails run-selenium, you can add properties to application.properties:
- selenium.auto=true
- selenium.resultsUrl=/your/url/here (defaults to ${appContext}/selenium/postResults)
- selenium.saveXmlTo=/tmp/selenium.xml
By default resultsUrl is set as ${appContext}/selenium/postResults which is provided as a basic HTML implementation. Nothing fancy.
Download here or install with
grails install-plugin http://www.javathinking.com/grails/grails-selenium-plugin/0.4/grails-selenium-0.4.zip
grails-jsunit-0.1
grails-jsunit provides an easy and convenient way to utilize the JsUnit framework to your grails application. JsUnit allows you to unit test JavaScript functions in a similar way to using JUnit for Java.
To install the plugin, use:
grails install-plugin http://www.javathinking.com/grails/grails-jsunit-plugin/0.1/grails-jsunit-0.1.zip
This plugin adds the following new scripts:
create-jsunit-test
Generates a new empty jsunit test. Supply the path of the test you want to create, relative to ‘test/jsunit/tests’.
Example use:
grails create-jsunit-test registration/mytest
creates
${basedir}/test/jsunit/tests/registration/mytest.html
run-jsunit
Runs JsUnit in the specified browser. Specify the path to your browser as a command line parameter i.e.
grails run-jsunit /usr/bin/firefox
or, if the executable is on the path you would just need
grails run-jsunit firefox
In your application.properties, you can specify:
jsunit.autoRun=true
When executing this script, it overwrites ${basedir}/test/jsunit/suiteAll.html to build a suite that references all tests in ${basedir}/test/jsunit/test.
Firefox profiles
If you share a login with someone else (ie. family) Firefox profiles can be very useful. Likewise, if you are a developer and you have several different contexts or modes of operation, profiles can make life a lot easier.
I use them at home with family members - you can set each person up with their own profile, so all you have to do is restart Firefox (rather than logging out out of the operating system and then back on as someone else). Firefox will prompt you - asking who you want to be right now.
At work, how many times have you cleared all of your private settings while debugging, just to see if the problem is related to caching or some other previous state. Creating a profile is much easier - especially since you probably want to stay logged in to all of those websites you use every day.
Just start firefox from the command line with the parameter ‘-profilemanager’ - you’ll be prompted with a dialog so you can mange your profiles.
Read more about it here :


