July 27, 2004

Using Castor with Ant

If you ever had a need to generate Java beans from the XSD by Castor, you probably have used Castor's SourceGenerator class (org.exolab.castor.builder.SourceGenerator). Unfortunately, this main style class can not be easily integrated into the Ant driven build process (and, from my experience, 90% of projects out there use Ant). For example, SourceGenerator can process only one XSD schema at a time, and can't generate Java beans from multiple files.

This problem can be solved by using custom Ant task, which provides convinient way of running Castor's SourceGenerator on single file, directory, or a fileset:

<castor file="schema.xsd" todir="build/src"
        package="com.foo.bar"
        warnings="false" types="j2"/>

<castor dir="schemas" todir="build/src"
        package="com.foo.bar"
        warnings="false" types="j2"/>

<castor todir="build/src"
        package="com.foo.bar"
        warnings="false" types="j2">
  <fileset dir="schemas">
    <include name="*.xsd"/>
  </fileset>
</castor>

Don't forget to declare the task with:

<path id="class.path">
  <pathelement location="ant-optional-castor-20040412.jar"/>
  <pathelement location="castor-0.9.5.3-xml.jar"/>
  <pathelement path="${java.class.path}"/>
</path>
<taskdef name="castor"
         classname="org.apache.tools.ant.taskdefs.optional.castor.Castor"
         classpathref="class.path"/>

Source for the Castor Ant task can be found as attachement to the Bug# 885 in Castor's Bugzilla. Task accepts following parameters (they mostly correspond to SourceGenerator's arguments):

  • file: Input file name
  • dir: Directory name with input files
  • fileset: Fileset with input files
  • package: Destination Java package name
  • todir: Destination directory
  • lineseparator
  • types: setting to j2 makes Castor use Java2 collections
  • verbose
  • warnings
  • nodesc
  • nomarshall
  • testable
Posted by Vadim at 9:05 PM

July 21, 2004

Fedora Core 2 on Dell Inspiron 8600

I finally got Fedora Core 2 installed on my Dell Inspiron 8600, and finally decided to write about it :-)

Most exciting part in all this is that I got wireless network working and am typing this from the couch... My notebook came with optional Dell Truemobile 802.11b/g wireless card built-in which had no Linux driver. But thanks to the efforts of the NdisWrapper project, it is now possible a miracle of using Windows driver DLL with Linux. Articles about setting NdisWrapper up are published on FedoraNEWS, LinuxElectrons, as well as in other places. The only gotcha there was that the version 0.7 of NdisWrapper does not work with WEP enabled, and this was reportedly fixed in next version (I've not tested it yet).

List of issues with Fedora C2 default installation are almost same as with beta releases of C2:

  • CD-ROM does not read disks reliably. After poking around, it seems that problem is with low timeout, as seen from the dmesg output:
    hdc: irq timeout: status=0xd0 { Busy }
    hdc: irq timeout: error=0xd0LastFailedSense 0x0d
    hdc: DMA disabled
    hdc: ATAPI reset complete
    Worst part? This sequence repeats without end.
  • 1680x1050 screen resolution is missing.
  • system-config-packages insists that installation Disk 1 is not available even when I see its content in Konqueror.
  • DNS Name Resolution is very slow, makes internet browsing tiresome.
  • up2date needs changes in configuration in order to work.
  • K Menu sometimes freezes for several seconds.

Ways to fix above follow below...

After extensive googling, I found only single suggestion on how to overcome CD-ROM Mounting issue. Somebody suggested passing parameter to the kernel at the boot prompt:

linux hdc=cdrom
I went with another way to fix this problem: I disabled autorun :-) And I recommend you also kill this annoying thing:
mv ~/.kde/Autostart/Autorun.desktop ~/.kde/Autostart/.Autorun.desktop

1680x1050 screen resolution (with 16:10 aspect ration) can be easily added by editing /etc/X11/xorg.conf. Add this section at the beginning of the file:

# Added 16:10 modes
Section "Modes"
    Identifier "16:10"
    # 1280x800 @ 75.00 Hz (GTF) hsync: 62.62 kHz; pclk: 107.21 MHz
    Modeline "1280x800"  107.21  1280 1360 1496 1712  800 801 804 835
    # 1280x800 @ 85.00 Hz (GTF) hsync: 71.40 kHz; pclk: 123.38 MHz
    Modeline "1280x800"  123.38  1280 1368 1504 1728  800 801 804 840
    # 1280x800 @ 100.00 Hz (GTF) hsync: 84.80 kHz; pclk: 147.89 MHz
    Modeline "1280x800"  147.89  1280 1376 1512 1744  800 801 804 848
    # 1680x1050 @ 60.00 Hz (GTF) hsync: 65.22 kHz; pclk: 147.14 MHz
    Modeline "1680x1050"  147.14  1680 1784 1968 2256  1050 1051 1054 1087
    # 1680x1050 @ 75.00 Hz (GTF) hsync: 82.20 kHz; pclk: 188.07 MHz
    Modeline "1680x1050"  188.07  1680 1800 1984 2288  1050 1051 1054 1096
    # 1680x1050 @ 85.00 Hz (GTF) hsync: 93.76 kHz; pclk: 214.51 MHz
    Modeline "1680x1050"  214.51  1680 1800 1984 2288  1050 1051 1054 1103
    # 1680x1050 @ 100.00 Hz (GTF) hsync: 111.20 kHz; pclk: 256.20 MHz
    Modeline "1680x1050"  256.20  1680 1808 1992 2304  1050 1051 1054 1112
    # 1920x1200 @ 75.00 Hz (GTF) hsync: 93.97 kHz; pclk: 246.59 MHz
    Modeline "1920x1200"  246.59  1920 2064 2272 2624  1200 1201 1204 1253
    # 1920x1200 @ 85.00 Hz (GTF) hsync: 107.10 kHz; pclk: 282.74 MHz
    Modeline "1920x1200"  282.74  1920 2072 2280 2640  1200 1201 1204 1260
    # 1920x1200 @ 100.00 Hz (GTF) hsync: 127.10 kHz; pclk: 337.58 MHz
    Modeline "1920x1200"  337.58  1920 2072 2288 2656  1200 1201 1204 1271
EndSection
And find section Monitor and modify it to use these modes (UseModes directive):
Section "Monitor"
        Identifier   "Monitor0"
        VendorName   "Monitor Vendor"
        ModelName    "LCD Panel 1400x1050"
        HorizSync    31.5 - 90.0
        VertRefresh  59.0 - 75.0
        Option      "dpms"
        UseModes     "16:10"
EndSection

Slow DNS resolution is apparently happenning because IPv6 protocol is compiled into the kernel. For now, it is safe to remove IPv6 support on the desktop machines, but this requires kernel recompilation. I changed several kernel options at once before recompiling, most important are:

  • Removed all SCSI drivers
  • Removed ISA bus support
  • Turned on preemptive kernel option
  • Turned off IPv6 support

Configuration of up2date utility includes editing /etc/sysconfig/rhn/sources file:

yum fedora-core-2 http://distro.ibiblio.org/pub/linux/distributions/fedora/linux/core/2/i386/os/
yum updates-released-fc2 http://distro.ibiblio.org/pub/linux/distributions/fedora/linux/core/updates/2/i386/
There are multiple Fedora Core mirror sites, you can pick any instead of ibiblio above. Similar configuration change can be done to /etc/yum.conf:
[base]
name=Fedora Core $releasever - $basearch - Base
baseurl=http://distro.ibiblio.org/pub/linux/distributions/fedora/linux/core/$releasever/$basearch/os/

[updates-released]
name=Fedora Core $releasever - $basearch - Released Updates
baseurl=http://distro.ibiblio.org/pub/linux/distributions/fedora/linux/core/updates/$releasever/$basearch/
With this change you can use command line yum utility to upgrade / install packages.

Ok, that's it for now.

Posted by Vadim at 10:09 PM | Comments (1)

July 11, 2004

The Apache Community

Another visualization of the Apache community was published on Libre SoftEng. This visualization was based on CVS commits, and groups developers who have worked on the same project into the same community.

Posted by Vadim at 11:25 AM