1/11/2008

How to convert mpg to flv

ffmpeg -i M2U00240.MPG -ar 22050 -s 428x240 -b 300000 M2U00240.flv

ar means the audio rate
b means the quality
s means size. You should determine the size with regarding to the aspect ratio (e.g. 4:3, 16:9)

12/12/2007

CSS IE hacks

* html #content {} is accepted by IE, but other browsers ignore them.
html>body #content is accepted by other browsers, but gets ignored by IE.
IE has a bug called Box Model problem. http://css-discuss.incutio.com/?page=BoxModelHack
* html div
{
width: 140px; /* all accept this */
w\idth: 100px; /* Only IE 6 accepts */
}

12/03/2007

There is another selector called Descendant Selectors

Descendant Selectors

We can specify the style of an element only when it is inside another element. To accomplish this, we use the concept of descendant selectors.

The syntax for declaring a descendant selector is:

[Parent Selector] [Child Selector] {
property:value;
...
}

The style defined above will apply to child selectors only when they are inside the parent selector. Such declarations can go on for more than two levels.

For example, in the declaration below,

li b {
color:yellow;
}

means that text in the element inside the
  • element will be yellow. Text in the elements not within the
  • element will not be affected by this stylesheet.
  • 11/27/2007

    for loop in DOS

    http://www.computerhope.com/forhlp.htm

    for /L %i in (1,1,100) do wget -w 5 -O %i.jpg "url"
    for %i in (*.foo) do move %i %~ni.bar

    11/20/2007

    How to loop an array in bash

    ids=(3333 3334 3335)
    for id in ${ids[@]}
    do
    echo $id
    done

    11/13/2007

    Auto start PostgreSQL when Linux boots (Ubuntu)



    *as root*:
    - Configure the PostgreSQL SysV Script. This script is useful for
    starting, stopping, and checking the status of PostgreSQL.

    # cd /usr/local/src/postgresql-7.x
    # cp contrib/start-scripts/linux /etc/init.d/postgres
    # chmod 755 /etc/init.d/postgresql
    .... then edit the file to specify the data directory, etc. and sets the
    environment variabes (PGDATA etc). The file is well documented. If you
    installed Postgres manually, it should have the correct values already set.

    - To have PostgreSQL start automatically when the computer boots add
    symbolic links from the correct /etc/rc*.d/ directories to
    /etc/init.d/postgresql.

    ln -s /etc/init.d/postgresql /etc/rc0.d/K27postgresql
    ln -s /etc/init.d/postgresql /etc/rc1.d/K27postgresql
    ln -s /etc/init.d/postgresql /etc/rc2.d/S85postgresql
    ln -s /etc/init.d/postgresql /etc/rc3.d/S85postgresql
    ln -s /etc/init.d/postgresql /etc/rc4.d/S85postgresql
    ln -s /etc/init.d/postgresql /etc/rc5.d/S85postgresql

    etc ...

    - Start PostgreSQL for the first time:

    # /etc/init.d/postgres start

    <\start>

    Auto start PostgreSQL when Linux boots

    *as root*:
    - Configure the PostgreSQL SysV Script. This script is useful for starting, stopping, and checking the status of PostgreSQL.

    # cd /usr/local/src/postgresql-7.x
    # cp contrib/start-scripts/linux /etc/init.d/postgres
    # chmod 755 /etc/init.d/postgres
    .... then edit the file to specify the data directory, etc. and sets the environment variabes (PGDATA etc). The file is well documented. If you installed Postgres manually, it should have the correct values already set.

    - To have PostgreSQL start automatically when the computer boots add symbolic links from the correct /etc/rc*.d/ directories to /etc/init.d/postgres. If the normal runlevel is 3 then you really only need to add it to rc3.d:

    # ln -s /etc/init.d/postgres /etc/rc2.d/S85postgres
    # ln -s /etc/init.d/postgres /etc/rc3.d/S85postgres

    etc ...

    - Start PostgreSQL for the first time:

    # /etc/init.d/postgres start