Mar 17, 2011

SopCast on my Mac

Here is the solution of watching live soccer match with SopCast that works on my Mac.

Hardware
MacBook
2 GHz Intel Core 2 Duo
1 GB 667 MHz DDR2 SDRAM

Software
Mac OS X 10.4.11
X11 1.1.3
WineBottler 1.1.44 (http://winebottler.kronenberg.org/)
SopCast 3.2.9 (http://www.sopcast.org/)
MPlayer OSX Extended rev11 (http://www.mplayerosx.ch/)

Steps
1. Make sure X11 is properly installed.
2. Open WineBottler dmg file and install Wine.app.
3. Run Wine. It should have created a virtual "drive_c" under the user directory in Mac.
4. Place the SopCast exe installation file somewhere inside "drive_c" in the Mac environment.
5. Open Control Panel in Wine. (which would also launch X11)
6. Install SopCast by locating the installation file in Wine. (which would be installed in "driver_c/Program Files")
7. Open File Manager in Wine. Run SopCast.
8. Connect to a channel. A Player should slide out without screen (but it's progressing).
10. Run MPlayer OSX Extended in Mac. Open Preferences and make sure Cache is enabled, like say 16 MB.
11. Open location mms://127.0.0.1:8902. (Try 8903 or 8912 if it failed)

That's it!

Notes
If the OS version is later than 10.4, newer software version or different combination could be used. This is just one of the possible solutions that works in my situation.

Reference
http://www.myp2pforum.eu/threads/9529-Sopcast-on-Mac?p=180663#post180663

Mar 9, 2011

notes on hibernate many-to-one, one-to-many

many-to-one
usage:
<many-to-one name="parentDao" class="xxx.ParentDAO" column="REF_ID" lazy="false" update="false"/>
name - data member in dao class
column - foreign key of child dao in database
class - package + class name in java project
lazy - false means retrieve the corresponding parent dao anyway; true means retrieve only when needed, only works for Session.load()
update/insert - indicate whether the operation would be performed

one-to-many
usage:
<list name="childList" table="CHILD_TBL" lazy="false" cascade="all,delete-orphan">
    <key column="CT_REF_ID"/>
    <list-index column="CT_SEQ"/>
    <one-to-many class="xxx.ChildDAO"/>
</list>
name - data member in dao class: private List<childdao> childList;
lazy - false means retrieve the corresponding child dao anyway; true means retrieve only when needed, only works for Session.load()
cascade - see hibernate manual
key - foreign key of child dao in database
list-index - sequence used by list in hibernate
use <composite-element> as alternative

Mar 1, 2011

javax.servlet.ServletException: BeanUtils.populate

troubleshooting

error log in browser
javax.servlet.ServletException: BeanUtils.populate

possible solution

in dao class, if the data member is of self-defined class, test for null in its get method and assign a new object to it.
for example
class Dao extends VersionDAO {
    private String str;
    private DateInput sampleDate = new DateInput();
    public String getStr() {
        return str;
    }
    public void setStr(String str) {
        this.str = str;
    }
    public DateInput getSampleDate() {
        if (sampleDate == null)
            sampleDate = new DateInput();
        return sampleDate;
    }
    public void setSampleDate(DateInput sampleDate) {
        this.sampleDate = sampleDate;
    }
}

comments
may have other causes if this is not the case