11/30/07

export db in hibernate3 ant

I try the example in "Hibernate Quickly" ebook and found that using SchemaExportTask to export database in build.xml file is not work in hibernate3. In hibernate3, export database done by use annotations like this

<target name="schema-export" >
<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="schema.classpath" />
<hibernatetool destdir="${sql.dir}">
<annotationconfiguration configurationfile="${src.java.dir}/hibernate.cfg.xml" />
<hbm2ddldir}/hibernate.cfg.xml"
drop="true"
create="true"
export="true"
outputfilename="helloworld-ddl.sql"
delimiter=";"
format="true"/>
</hibernatetool>
</target>

thanks, Jon Rose for howto.

note1: transaction support in mysql need "TYPE=InnoDB" when create the table.
note2: InnoDB support begin with mysql4.0. In old version like 3.23 need to add this code in my.cnf [/etc/mysql/my.cnf or /etc/my.cnf in FC3].

[mysqld]
innodb_data_file_path=ibdata1:500M


Now to add "type=InnoDB" in generated script, Dialect property in hibernate.cfg.xml must be
<property name="dialect">
org.hibernate.dialect.MySQLInnoDBDialect
</property>

11/14/07

Install win32 codecs for mplayer in Ubuntu Gutsy

If you have trouble in playing media file, stream [like me] may be this will help. Today I try open video stream with mplayer and get no sound. So I go to run mplayer from terminal and get errors about codecs below

pnix@pnix-a7n:progdl$ mplayer mms://61.47.35.66/NTTV
MPlayer 2:1.0~rc1-0ubuntu13 (C) 2000-2006 MPlayer Team
CPU: AMD Athlon(tm) (Family: 6, Model: 8, Stepping: 1)
CPUflags: MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 0
...
Opening video decoder: [dmo] DMO video codecs
Win32 LoadLibrary failed to load: wmv9dmod.dll, /usr/lib/win32/wmv9dmod.dll, /usr/local/lib/win32/wmv9dmod.dll
IMediaObject ERROR: 0x8773d96 could not open DMO DLL (0x0 : 0)
Failed to create DMO filter
ERROR: Could not open required DirectShow codec wmv9dmod.dll.
You need to upgrade/install the binary codecs package.
Go to http://www.mplayerhq.hu/dload.html
VDecoder init failed :(
Opening video decoder: [dmo] DMO video codecs
Win32 LoadLibrary failed to load: wmvdmod.dll, /usr/lib/win32/wmvdmod.dll, /usr/local/lib/win32/wmvdmod.dll
IMediaObject ERROR: 0x8773d96 could not open DMO DLL (0x0 : 0)
Failed to create DMO filter
ERROR: Could not open required DirectShow codec wmvdmod.dll.
You need to upgrade/install the binary codecs package.
Go to http://www.mplayerhq.hu/dload.html
VDecoder init failed :(
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffwmv3] vfm: ffmpeg (FFmpeg M$ WMV3/WMV9)
==========================================================================
==========================================================================
Forced audio codec: mad
Opening audio decoder: [dmo] Win32/DMO decoders
Win32 LoadLibrary failed to load: wmspdmod.dll, /usr/lib/win32/wmspdmod.dll, /usr/local/lib/win32/wmspdmod.dll
IMediaObject ERROR: 0x8773d96 could not open DMO DLL (0x0 : 0)
ERROR: Could not open required DirectShow codec wmspdmod.dll.
ADecoder preinit failed :(
ADecoder init failed :(
Opening audio decoder: [dshow] Win32/DirectShow decoders
Win32 LoadLibrary failed to load: wmavds32.ax, /usr/lib/win32/wmavds32.ax, /usr/local/lib/win32/wmavds32.ax
Warning: DS_Filter() could not open DirectShow DLL. (DLL=wmavds32.ax, r=0x8ae1eb0)
ERROR: Could not open required DirectShow codec wmavds32.ax.
ADecoder preinit failed :(
ADecoder init failed :(
Cannot find codec for audio format 0xA.
Read DOCS/HTML/en/codecs.html!
Audio: no sound
Starting playback...
VDec: vo config request - 320 x 240 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is undefined - no prescaling applied.
VO: [xv] 320x240 => 320x240 Planar YV12
V:40148.2 803/803 4% 0% 0.0% 0 0 25%

So we need codecs files, go to mplayer download page and get correct package for the system[x86, AMD64 or whatever, the file will name as essential-xxx.tar.bz2]. Then unpack it and move all file to /usr/lib/win32 folder. Now try it again.
pnix@pnix-a7n:progdl$ mplayer mms://61.47.35.66/NTTV
MPlayer 2:1.0~rc1-0ubuntu13 (C) 2000-2006 MPlayer Team
CPU: AMD Athlon(tm) (Family: 6, Model: 8, Stepping: 1)
...
Opening video decoder: [dmo] DMO video codecs
Creating new registry
DMO dll supports VO Optimizations 0 1
DMO dll might use previous sample when requested
GetOutput r=0x0 size:230400 align:1
StreamCount r=0x0 1 1
Decoder supports the following formats: YV12 YUY2 UYVY YVYU RGB8 RGB555 RGB565 RGB24 RGB32
Decoder is capable of YUV output (flags 0x1b)
VDec: vo config request - 320 x 240 (preferred colorspace: Packed YUY2)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is undefined - no prescaling applied.
VO: [xv] 320x240 => 320x240 Planar YV12
Selected video codec: [wmv9dmo] vfm: dmo (Windows Media Video 9 DMO)
==========================================================================
==========================================================================
Forced audio codec: mad
Opening audio decoder: [dmo] Win32/DMO decoders
GetOutput r=0x0 size:8192 align:1
StreamCount r=0x0 1 1
AUDIO: 8000 Hz, 1 ch, s16le, 8.0 kbit/6.25% (ratio: 1000->16000)
Selected audio codec: [wma9spdmo] afm: dmo (Windows Media Audio 9 Speech DMO)
==========================================================================
AO: [alsa] 48000Hz 1ch s16le (2 bytes per sample)
Starting playback...
gnome_screensaver_control().462 ct: -1.063 2329/2329 3% 0% 4.0% 8 0 3%