My first patch to Grails accepted

November 23rd, 2009

I recently wrote a patch for Grails to support dateCreated and lastUpdated when using mockDomain in unit tests.

This patch has now been applied to 1.2-SNAPSHOT.

http://jira.codehaus.org/browse/GRAILS-4540

The mockDomain method makes it possible to test code that uses GORMs dynamic methods, without having to use a real database.

IBM Developerworks has a great article on mock testing in Grails here.

How to debug grails run-app loop

November 9th, 2009

I recently had a problem where grails run-app would start the server, then immediately recompile 1 class, then restart… and repeat.

Google told me that the problem probably was an empty Java file in my project and to look in the ~/.grails/1.2-M4/projects/myproject/classes directory to see which file kept changing timestamp.

However, no files did that. The solution was to modify $GRAILS_HOME/scripts/_GrailsCompile.groovy and add listFiles:true to the compile target:

ant.groovyc(destdir:classesDirPath,
    classpathref:classpathId,
    encoding:"UTF-8",
    listFiles:true,
    compilerPaths.curry(classpathId, false))

And it turned out Google was right, I had a Java file with only the package specification in it.

Hello world!

August 12th, 2009

Hello world!

July 2nd, 2007

ipw2100 wireless adapter and Linux

June 26th, 2007

After reinstalling Linux on a IBM Thinkpad X31 i forgot that the wireless adapter was not just plug-and-play. Linux detected the adapter, but because of license issues the firmware is not bundled with the kernel:

ipw2100: eth2: Firmware 'ipw2100-1.3.fw' not available or load failed.
ipw2100: eth2: ipw2100_get_firmware failed: -2
ipw2100: eth2: Failed to power on the adapter.
ipw2100: eth2: Failed to start the firmware.
ipw2100Error calling register_netdev.

The firmware must be downloaded from http://ipw2100.sourceforge.net/firmware.php and the extracted files must be put in /lib/firmware.

After rmmod ipw2100 && modprobe ipw2100 the adapter works again…

TDC digital signature with Firefox on Linux

May 28th, 2007

I was unable to import my digital signature into Firefox using the HTML file provided by TDC.

However, the following small script will extract the pkcs12 file from it and this file can then be imported using “Advanced->Encryption->View certificates->Import”.

Download script to extract pkcs12 file from TDC signature backup

3G high speed data with a Huawei USB modem and Linux

April 30th, 2007

Danish mobile operator 3 recently launched high speed mobile data for pretty reasonable prices. You can get up to 3 Mbit/s!. They both have PCMCIA cards and USB versions. In Windows the USB device also acts as a storage device containing drivers and a dialer, so it is pretty easy to get working. In Linux it’s a bit more difficult to get working, but it can be done!

First, the minimum required kernel version seems to be 2.6.20. With 2.6.18 the storage device was detected, but not the serial devices. With 2.6.20 the storage device is ignored but 3 serial devices are detected. 3 devices you say? Yes, it makes it possible to use the modem to send text messages, use high speed data and GPRS – all at the same time.

Sometimes the devices are not detected correctly, this can be solved by simply removing the driver and loading it again (rmmod usbserial option && modprobe usbserial && modprobe option).

Each time to modem is connected to your USB port it must be initialized with your PIN-code. It will only accept it once though. Use this perlscript to send pincode to USB modem.

After that, the following wvdial.conf should get you online:

[Dialer Defaults]
Modem = /dev/ttyUSB0
Baud = 460800
SetVolume = 0
Dial Command = ATDT
Init1 = ATZ
Init2 = ATM0
FlowControl = NOFLOW

Username = VFD2
Password = WAP
Phone = *99***1#
Stupid Mode = 1
Init3 = AT+CGDCONT=1,”IP”,”data.tre.dk”
Dial Attempts = 3
Inherits = ModemUMTS

DVB-C card for digital TV on my mediacenter

April 1st, 2007

I was not happy with the quality of my analogue TV signal, so i finally decided to buy a DVB-C card to receive digital TV from my provider in Denmark, TDC Kabel TV.

To receive the signal you need a DVB-C card. To receive non-free-to-air channels you need a Common Interface (CI) and a CAM (Common Access Module) to decode the signal. In the CAM you must insert a decoder card bought from your provider.

I ended up ordering the following at dvbshop.net:

  • Technotrend Premium C-2300 Hybrid
  • Technotrend Premium 3.5″ CI incl. TT-remotecontrol
  • Viaccess I/II CAM (V484)

I have no use for the remote control, but could not find a CI for the C-2300 card without it.

The card was pretty easy to get working in Linux. When I first booted after inserting the card, the kernel log showed:

[ 57.704473] dvb-ttpci: could not load firmware, file not found: dvb-ttpci-01.fw
[ 57.704509] dvb-ttpci: usually this should be in /usr/lib/hotplug/firmware or /lib/firmware
[ 57.704550] dvb-ttpci: and can be downloaded from http://www.linuxtv.org/download/dvb/firmware/


So i downloaded http://www.linuxtv.org/download/dvb/firmware/dvb-ttpci-01.fw-2622 and saved it as /lib/firmware/dvb-ttpci-01.fw and reloaded the driver:

# rmmod dvb-ttpci
# modprobe dvb-ttpci

and the card was now detected and initialized just fine:

[ 571.805460] saa7146: register extension 'dvb'.
[ 571.806038] PCI: Enabling device 0000:05:07.0 (0000 -> 0002)
[ 571.806223] saa7146: found saa7146 @ mem ffffc20000070000 (revision 1, irq 3) (0x13c2,0x000a).
[ 571.812619] DVB: registering new adapter (Technotrend/Hauppauge WinTV Nexus-CA rev1.X).
[ 571.846734] adapter has MAC addr = 00:d0:5c:04:ae:d4
[ 572.052113] dvb-ttpci: gpioirq unknown type=0 len=0
[ 572.077680] dvb-ttpci: info @ card 0: firm f0240009, rtsl b0250018, vid 71010068, app 80002622
[ 572.077683] dvb-ttpci: firmware @ card 0 supports CI link layer interface
[ 572.725120] dvb-ttpci: DVB-C analog module @ card 0 detected, initializing MSP3415
[ 573.072477] dvb_ttpci: saa7113 not accessible.
[ 573.133828] saa7146_vv: saa7146 (0): registered device video2 [v4l2]
[ 573.134080] saa7146_vv: saa7146 (0): registered device vbi2 [v4l2]
[ 573.134357] DVB: registering frontend 0 (ST STV0297 DVB-C)...
[ 573.134549] input: DVB on-card IR receiver as /class/input/input3
[ 573.134630] dvb-ttpci: found av7110-0.
[ 577.936266] spurious 8259A interrupt: IRQ7.

To test and scan for channels I created a file called dk-TDCKabelTV containing the frequences used by TDC Kabel TV in Copenhagen:

C 143000000 6875000 NONE QAM64
C 156000000 6875000 NONE QAM64
C 490000000 6875000 NONE QAM64
C 498000000 6875000 NONE QAM64
C 506000000 6875000 NONE QAM64
C 514000000 6875000 NONE QAM64
C 522000000 6875000 NONE QAM64
C 530000000 6875000 NONE QAM64
C 538000000 6875000 NONE QAM64
C 546000000 6875000 NONE QAM64
C 554000000 6875000 NONE QAM64
C 578000000 6875000 NONE QAM64
C 586000000 6875000 NONE QAM64
C 602000000 6875000 NONE QAM64
C 610000000 6875000 NONE QAM64
C 618000000 6875000 NONE QAM64
C 626000000 6875000 NONE QAM64
C 674000000 6875000 NONE QAM64

I then used scan dk-TDCKabelTV > channels.conf to scan for channels. I later used the generated file when setting up the tuner card in MythTV. I had to delete a lot of channels though. It looks like MythTV cannot handle the radio channels – and I haven’t bought access to all 100 channels or so available with TDCs Selector…

Hauppauge MediaMVP and MythTV

October 15th, 2006

I was looking for a cheap and easy way to connect my seconday TV to my MythTV media center.

The Hauppauge MediaMVP combined with the “MediaMVP Media Center” open source application from www.mvpmc.org looked like it supported all my requirements:

  • It is noiseless and small
  • It supports output to SCART
  • It can be hacked to act as a MythTV frontend.

From the HOWTO’s on the MediaMVP Media Center it also looked like it was very easy to get working. That, however it was not. ;-)

I now have a somewhat working setup where I can watch recorded shows, but not really anything else. Which is OK for now.

My problem was that the new versions of the Hauppauge MediaMVP dosn’t just boot via tftp. Here is what I had to do to make it boot the MediaMVP Media Center software:

On my DHCP server I added the following group:
group {
host mvp { # NOTE: Change the hardware ethernet to the MAC address of your actual MVP
hardware ethernet 00:0d:fe:0b:b3:fc;
fixed-address 192.168.1.3;
}
}

This will just assign a static IP to the box. No need to set TFTP server, filename etc here since it will just ignore it anyway.

To boot the application you must be a tftp server on port 16869 (use dpkg-reconfigure atftp to reconfigure atftp to run on this port) and you must run the mvprelay application from the MVPServer package. For example:
./mvprelay 16881 5906 6337 192.168.1.2
In your /tftpboot directory the files must be called dongle.bin, dongle.bin.config and dongle.bin.ver. You cannot set other filenames in the DHCP server configuration or the relay application…

So far my box only fetches the application and not the config file, so I have to telnet to it, kill the running application and execute the commands from dongle.bin.config…..

ipw2100 wireless, WPA and Linux 2.6.17

July 20th, 2006

I have a Thinkpad X31 with a build in ipw2100 wireless network adaptor. When i bought it (a long time ago) Linux did not support a lot of the hardware in it, so I ended up running Windows XP…

But, now I finally installed Linux and almost everything seems to be working. I did have problems with wireless and WPA-PSK authentication though. I used wpa_supplicant with the following configuration:
ctrl_interface=/var/run/wpa_supplicant
ap_scan=1
eapol_version=1
network={
ssid="myssid"
group=TKIP
pairwise=TKIP
key_mgmt=WPA-PSK
priority=5
proto=WPA
psk=psk generated with wpa_passphrase
}

When calling wpa_supplicant one of the arguments is the driver name. The help message says to use ipw for Intel ipw2100/2200 driver. So I did that… The output was:
ioctl[IPW_IOCTL_WPA_SUPPLICANT]: Operation not supported
ioctl[IPW_IOCTL_WPA_SUPPLICANT]: Operation not supported
Failed to set encryption.
ioctl[IPW_IOCTL_WPA_SUPPLICANT]: Operation not supported
Failed to set encryption.
ioctl[IPW_IOCTL_WPA_SUPPLICANT]: Operation not supported

etc… Google suggested that I was missing encryption modules, that the driver shipped with the kernel was buggy and other things. And then finally I found this link that sugested to use the generic wireless driver instead. I tried that, and:
# wpa_supplicant -Dwext -c/etc/wpa_supplicant.conf -i eth2
Trying to associate with 00:16:b6:5c:00:f1 (SSID='myap' freq=0 MHz)
Associated with 00:16:b6:5c:00:f1
WPA: Key negotiation completed with 00:16:b6:5c:00:f1 [PTK=TKIP GTK=TKIP]
CTRL-EVENT-CONNECTED - Connection to 00:16:b6:5c:00:f1 completed (auth) [id=0 id_str=]

it finally works!

With the following in /etc/network/interfaces the interface comes up automatically:
iface eth2 inet dhcp
wpa-driver wext
wpa-conf /etc/wpa_supplicant.conf
auto eth2