Saturday, October 29, 2011

CSS แปลง anchor text ให้เป็นปุ่ม

  < style >
    a.button-like{
      background: #0000ff;
      border: 1px solid #FFFFFF;
      border-radius: 4px 4px 4px 4px;
      color: #FFFFFF;
      cursor: pointer;
      font-family: Tahoma,Verdana,Arial,Helvetica,sans-serif;
      font-size: 100%;
      font-weight: bold;
      margin: 0 4px;
      outline: 1px solid #9BABB0;
      text-transform: uppercase;
      text-decoration: none; /* to remove the underline */
      padding: 2px 4px;
    }
  < /style >

< a class="button-like" href="..." > text </a>

get absolute path in drupal modules

The following codes is in /var/www/drupal-6.22/sites/all/modules/mymodule/mymodule.module

  echo dirname(__FILE__)
  = /var/www/drupal-6.22/sites/all/modules/mymodule

  echo realpath(".");
  = /var/www/drupal-6.22

  echo realpath(drupal_get_path('module', 'mymodule'));
  = /var/www/drupal-6.22/sites/all/modules/mymodule

  echo $_SERVER['DOCUMENT_ROOT'] . base_path();
  = /var/www//drupal-6.22/

  global $base_url;
  echo $base_url;
  = http://bmms:8080/drupal-6.22

  echo base_path(); // drupal function
  = /drupal-6.22/

  $path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'filename.ext';
  $data = file( $path );
  foreach($data as $value) {
    $output .= "$value";
  }


http://php.net/manual/en/language.constants.predefined.php
http://php.net/manual/en/function.dirname.php
http://php.net/manual/en/function.realpath.php

Friday, October 28, 2011

attach files to drupal contemplate pages


[tag] embed height="310" width="720" type="image/svg+xml" src=< ? php print file_create_url( images/image1.svg ); ? > [tag]

Database Tools and Utilities

MySQL Workbench is a unified visual tool for database architects, developers, and DBAs.
MySQL Workbench provides data modeling, SQL development, and comprehensive administration tools for
server configuration, user administration, and much more.
MySQL Workbench is available on Windows, Linux and Mac OS.
http://www.mysql.com/products/workbench/

Database Reverse Engineering
http://schemaspy.sourceforge.net/

Monday, October 24, 2011

XML HTML Editor IDE for Linux

Name Version Free WYSIWYG Code Support inline script (PHP) Auto Complete Highlight Match Bracket Folding Tag Toggle Comment Note
KompoZer 0.8b3
20081229
Y +Prop. Dialog Box
+ HTML Form
BP: Y
RC: fill later
Y N N N N my note is here
Seamonkey
Composer
2.4.1 Y + Prop. Dialog Box
(No HTML Form)
BP: Y

N N N

less features than Komposer
BlueGriffon 1.2.1 Y + Prop. Dialog Box
+ HTML5
+ SVG
BP: Y N HTML N N
Because Gecko lives inside, the
document will look exactly the same in Firefox.
Amaya 11.3.1
May 11 2011
Y + HTML5
+ SVG
BP:Y




my note is here
Aptana 3.0.5
20111006
Y N BP: Y
RC: Y
Y Excellent
PHP+HTML
Y Y
+ outline
Excellent Eclipse Base
Eclipse
PHP
Helios
20100617-1415
Y N


Y Y
+ outline


Eclipse
HTML Editor










Netbean 7.0.1 Y N Poor
more info
Y Y
+ help
Y Y
+ outline


Intellij IDEA
Community Edition
10.5 Y N Customizable Y HTML Y Y

serna free
Y Y






Serna enterprise XML
N Y






Emacs 23

nXhtml nXhtml




Bluefish 2.0.3 Y N external
tools
Y HTML
PHP (pop up)
Y Y Y
Geany 0.2
Jun 23 2011
Y N external tools Y HTML
PHP (fix)
no build-in Y Y more
info
gedit 2.30.4 Y N external
tools
simple text editor no build-in no build-in no build-in no build-in
sublime 2 No but no enforced time limit for the evaluation





SciTE 2.25
Apr 14 2011



Partial no build-in no build-in HTML
Lightweight GTK-based
Programming Editor
kate 3.6.5

?




KDE app
OpenBEXI
Y Y






Arachnophilia 5.5 Y N RC: Y but not quite good




Java App.
Quanta Plus
Y






KDE App.
Quanta Gold
N







Komodo Edit 6 Y
No Build-in





Komodo IDE
N
Y





phpstorm
N






30-day trial
jedit 4.4 Y N Y (UTF8?)
more info





java app
medit 1.0.3 Y N No Build-in





gphpedit






bug

UniversalIndentGUI









EditiX
N






Evaluation : 30 days
oXygen
N






Evaluation : 30 days
Screem








Dead Project


Code
BP = Beauty Print : the code output when use ide to create html element
RC = Reformat Code : existing code including Javascript/PHP/JSP snippet.

Some External tools for tidy/beautify/reformat html code are
http://tidy.sourceforge.net (my note
on tidy here)
http://phptidy.berlios.de/

More info at
http://en.wikipedia.org/wiki/Comparison_of_HTML_editors
http://www.linuxdocs.org/HOWTOs/PHP-HOWTO-9.html
http://drupal.org/node/147789

Or Edit online at
http://lifehacker.biz/articles/web-developers-package-code-beautifier-and-formatter/


Conclusion
=======
I choice KompoZer as my primary WYSIWYG for HTML
,1) Bluefish 2) Aptana as PHP text editor (b/c of its help when autocomplete)
,Geany for small change in code and other xml files
,Inkscape when draft SVG
serna ??


Eclipse PHP Development Tools

Intellij IDEA

NetBeans

NetBeans Result

Amaya Tips

Amaya reads HTML documents by default as ISO-Latin-1 files.
If an author does not provide information about the character set (charset) in the HTTP header
or in a meta element, Amaya considers an HTML document to be encoded in ISO-Latin-1.

KompoZer Tips

KompoZer is a GTK application, it has nothing to do with KDE.

sudo apt-get install kompozer

with BOM : it show Thai properly, but after save Thai parts in the file become "+!2"@% ".
Fix by "Save and Change Charactor Encoding"

tidy reformat beautify html xml emacs

sudo apt-get install emacs

nxhtml-mode
==========
nxhtml-mode is derived from nxml-mode (NxmlMode).
It adds a lot of things useful for XHTML.
Among other things it adds some way of handling multiple modes, folding, an improved interface to Tidy etc.
http://www.emacswiki.org/emacs/NxmlModeForXHTML
http://ourcomments.org/Emacs/nXhtml/doc/nxhtml-changes.html


Installation instruction
=================
http://www.emacswiki.org/emacs/download/tidy.el


tidy html
=======
Go to nXhtml -> tools -> Tidy XHTML -> Tidy Buffer


Tips
====
To Compile nxhtml.el goto
Menu nXhtml -> nXhtml help and Setup -> Byte compile nXhtml


Note
====
work well with inline php b/c no bug of 'always shift/indent php code'
(3rd of execution lead 6 spaces indent,4th lead 8 ,5th lead 10 ....)

More info
=======
HTML Editing With Emacs

http://stackoverflow.com/questions/137043/can-emacs-re-indent-a-big-blob-of-html-for-me


tidy reformat beautify html xml gedit


Using tidy.sourceforge.net
==========================
sudo apt-get install tidy
sudo apt-get install gedit-plugins

Under Plugins Tab:
Enable External tools

(My note on tidy is here)



Using PHP_Beautifier
======================
http://pear.php.net/package/PHP_Beautifier
This tool will not be able to beautify inline html and php together.

sudo apt-get install php-pear
# Still in Beta state

sudo pear install PHP_Beautifier
sudo pear install PHP_Beautifier-0.1.15.tgz

php_beautifier -s4 -l "ArrayNested() IndentStyles(style=bsd) NewLines(before=if:switch:while:for:foreach:function:T_CLASS:return:break,after=T_COMMENT)"


Full instruction at http://www.masnun.me/2010/04/10/using-gedit-as-a-php-ide.html


Plug-in
=====
http://yuix.org/web-development/ubuntu-11-10-oneiric-ocelot-gedit-indent-lines-plugin/184



More info
==========
gedit-3 : http://live.gnome.org/Gedit/Plugins#third_party
gedit-2 : http://live.gnome.org/Gedit/PluginsOld

http://www.micahcarrick.com/gedit-html-editor.html

Tidy/reformat/beautify html in Bluefish

Setting
========
Menu Edit -> Preference(s) -> External filters -> Tiny HTML
Change Command from 'tiny' to 'tiny -i'
(My note on tiny is here)


Reformat Code
=============
Tools -> Filters -> Tiny HTML

tidy/reformat/beautify html/xml in Geany

tidy.sourceforge.net
====================
Menu Edit -> Format -> Send Selection to ->
tidy -config /path/to/tidy.conf
(My tidy.conf is here)

phptidy.berlios.de
===================


Autocomplete
============
http://www.krutant.com/2011/05/geany-perfect-web-development-ide.html


Geany = ?
==========
Geany is a small and lightweight integrated development environment.
It was developed to provide a small and fast IDE, which has only a few dependencies from other packages.
It is using only the GTK2 toolkit and therefore you need only the GTK2 runtime libraries to run Geany.

The basic features of Geany are:
 - syntax highlighting
 - code completion
 - auto completion of constructs like if, for and while, XML and HTML
 - call tips
 - folding
 - many supported filetypes like C, Java, PHP, HTML, Python, Perl, Pascal
 - symbol lists
 - embedded terminal emulation

https://github.com/codebrainz/geany-zencoding


tidy/reformat/beautify/pretty-print html by tidy.sourceforge.net

HTML syntax checker and reformatter

Corrects markup in a way compliant with the latest standards, and optimal for the popular browsers.
It has a comprehensive knowledge of the attributes defined in the HTML 4.0 recommendation from W3C, and understands the US ASCII, ISO Latin-1, UTF-8 and the ISO 2022 family of 7-bit encodings.

In the output:
 * HTML entity names for characters are used when appropriate.
 * Missing attribute quotes are added, and mismatched quotes found.
 * Tags lacking a terminating '>' are spotted.
 * Proprietary elements are recognized and reported as such.
 * The page is reformatted, from a choice of indentation styles.


Installation
=======
sudo apt-get install tidy


tidy.conf
======
// tidy version 25 March 2009


//markup: yes
//break-before-br: no
indent: yes
//indent-attributes: no
// add indent-spaces to avoid bug
indent-spaces: 2
vertical-space: yes
wrap: 0
wrap-php: yes
//char-encoding: utf8
input-encoding: utf8
output-encoding: utf8
tidy-mark: no
// output-xhtml to avoid error of save same buffer many times
output-xhtml: yes
// w/o quiet: yes option, error might show
quiet: yes
doctype: strict



Useful options
================
-indent, -i
= indent element content

-utf8
= use UTF-8 for both input and output

-asxml, -asxhtml
= convert HTML to well formed XHTML (output-xhtml: yes)

-wrap , -w
= wrap text at the specified .
Set wrap to zero if you want to disable line wrapping.
0 is assumed if is missing.

--tidy-mark no
= if Tidy should add a meta element to the document head to indicate that the document has been tidied.
(Default: yes)



More info
==========
http://tidy.sourceforge.net
http://tidy.sourceforge.net/docs/quickref.html
man tidy
http://www.w3.org/People/Raggett/tidy/

Subproject:
http://us3.php.net/manual/en/intro.tidy.php

Wednesday, October 19, 2011

Firefox cannot load websites but other programs can

แก้ปัญหา firefox เข้าบางเว็บไม่ได้
========================
- ไปที่ location bar (ตรงที่พิมพ์ url เช่น facebook.com)
แล้วพิมพ์คำว่า "about:config" แล้ว Enter
- กด "I'll be careful, I promise!"
- ในช่อง Filter, พิมพ์ ipv6
- double-click ที่ network.dns.disableIPv6 ให้ค่าเป็น true
- restart firefox

ที่มา
http://guru.google.co.th/guru/thread?tid=22da0b65060ea250
support.mozilla.com/en-US/kb/Firefox cannot load websites but other programs can

Tuesday, October 18, 2011

Chrome Extensions

Read Later Fast

Save as PDF



http://www.it24hrs.com/2011/10-tips-use-chrome-for-student/


chrome://extensions/

Saturday, October 15, 2011

Zoneminder Troubleshooting Guide

Is the card working properly?
======================
Try out these commands:
$ dmesg | grep bttv
....

$ sudo tail -f /var/log/syslog
.....

$ ls -ls /dev/video*
0 crw-rw-rw-+ 1 root video 81, 0 Oct 15 22:46 /dev/video0
0 crw-rw-rw-+ 1 root video 81, 2 Oct 15 22:46 /dev/video1
0 crw-rw-rw-+ 1 root video 81, 4 Oct 15 22:46 /dev/video2
0 crw-rw-rw-+ 1 root video 81, 6 Oct 15 22:46 /dev/video3

$ v4l-info /dev/video0
.....

$ ffmpeg -f video4linux2 -s 320x240 -r 30000/1001 -i /dev/video0 -y webcam.avi


Other useful commands
=================
$ sudo /etc/init.d/apache2 force-reload
$ sudo service zoneminder restart



Got unexpected memory map file size
===========================
$ sudo tail -f /var/log/syslog
....
Oct 14 17:17:52 penguin zmc_dvideo0[9153]: ERR [Got unexpected memory map file size 10801524, expected 12166644]
....

Solution
======
Open the file “/etc/sysctl.conf”, and paste these lines at the bottom of the file, then reboot.
kernel.shmall = 167772160
kernel.shmmax = 167772160

Ref: http://www.zoneminder.com/wiki/index.php/Debian_Squeeze#Inadequate_Memory_Allocation




Failed to set video format: Invalid argument
================================
$ sudo tail -f /var/log/syslog
.....
Oct 14 17:18:11 penguin zmc_dvideo1[9158]: FAT [Failed to set video format: Invalid argument]
.....

Solution
======
Change Configuration in Monitor -> Source
Device Format, Capture Palette, Capture Width, and Capture Hight
to be compatible with your camera


DVR Geovision GV-800 Zoneminder Linux

GV-800
Hardware version 3.5
16 ch video and 4 ch audio,120/100fps


Specification
==========
$ lspci -n
...
04:00.0 0400: 109e:036e (rev 11)
04:00.1 0480: 109e:0878 (rev 11)
04:04.0 0400: 109e:036e (rev 11)
04:04.1 0480: 109e:0878 (rev 11)
04:08.0 0400: 109e:036e (rev 11)
04:08.1 0480: 109e:0878 (rev 11)
04:0c.0 0400: 109e:036e (rev 11)
04:0c.1 0480: 109e:0878 (rev 11)
...

$ lspci -k
04:00.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11)
    Subsystem: Device 800a:763d
    Kernel driver in use: bttv
04:00.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 11)
    Subsystem: Device 800a:763d
04:04.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11)
    Subsystem: Device 800b:763d
    Kernel driver in use: bttv
04:04.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 11)
    Subsystem: Device 800b:763d
04:08.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11)
    Subsystem: Device 800c:763d
    Kernel driver in use: bttv
04:08.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 11)
    Subsystem: Device 800c:763d
04:0c.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11)
    Subsystem: Device 800d:763d
    Kernel driver in use: bttv
04:0c.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 11)
    Subsystem: Device 800d:763d

$ ls -ls /dev/video*
0 crw-rw----+ 1 root video 81, 0 Oct 14 06:41 /dev/video0
0 crw-rw----+ 1 root video 81, 2 Oct 14 06:41 /dev/video1
0 crw-rw----+ 1 root video 81, 4 Oct 14 06:41 /dev/video2
0 crw-rw----+ 1 root video 81, 6 Oct 14 06:41 /dev/video3

$ uname -r
3.0.0-1-amd64


Installation
============
only http://www.zoneminder.com/wiki/index.php/Debian_Squeeze
then http://www.zoneminder.com/wiki/index.php/Ubuntu_9.04_%28Jaunty%29_desktop_with_graphical_interface
For adding cameras
*NOT require /etc/modprob.d/bttv.conf configuration

Camera 1 -> /dev/video0 channel 0
Camera 2 -> /dev/video1 channel 0
Camera 3 -> /dev/video2 channel 0
Camera 4 -> /dev/video3 channel 0

Camera 5 -> /dev/video0 channel 1
Camera 6 -> /dev/video1 channel 1
Camera 7 -> /dev/video2 channel 1
Camera 8 -> /dev/video3 channel 1

Camera 9 -> /dev/video0 channel 2
Camera 10 -> /dev/video1 channel 2
Camera 11 -> /dev/video2 channel 2
Camera 12 -> /dev/video3 channel 2

Camera 13 -> /dev/video0 channel 3
Camera 14 -> /dev/video1 channel 3
Camera 15 -> /dev/video2 channel 3
Camera 16 -> /dev/video3 channel 3


Useful Commands
===============
$ v4l-info /dev/video0
$ sudo /etc/init.d/apache2 force-reload
$ sudo service zoneminder restart
$ dmesg | grep bttv
$ sudo tail -f /var/log/syslog
$ ffmpeg -f video4linux2 -s 320x240 -r 30000/1001 -i /dev/video0 -y webcam.avi



Output in dmesg
============
$ dmesg | grep bttv
[    5.805510] bttv: driver version 0.9.18 loaded
[    5.805512] bttv: using 8 buffers with 2080k (520 pages) each for capture
[    5.805720] bttv: Bt8xx card found (0).
[    5.805740] bttv 0000:04:00.0: PCI INT A -> GSI 21 (level, low) -> IRQ 21
[    5.805750] bttv0: Bt878 (rev 17) at 0000:04:00.0, irq: 21, latency: 64, mmio: 0xfdeff000
[    5.805770] bttv0: detected: GeoVision GV-800(S) (master) [card=157], PCI subsystem ID is 800a:763d
[    5.805772] bttv0: using: Geovision GV-800(S) (master) [card=157,autodetected]
[    5.805807] bttv0: gpio: en=00000000, out=00000000 in=00ff28ff [init]
[    5.806572] bttv0: tuner absent
[    5.806604] bttv0: registered device video0
[    5.806624] bttv0: registered device vbi0
[    5.806650] bttv0: PLL: 28636363 => 35468950 .. ok
[    5.839533] bttv: Bt8xx card found (1).
[    5.839544] bttv 0000:04:04.0: PCI INT A -> GSI 21 (level, low) -> IRQ 21
[    5.839552] bttv1: Bt878 (rev 17) at 0000:04:04.0, irq: 21, latency: 64, mmio: 0xfdefd000
[    5.839573] bttv1: detected: GeoVision GV-800(S) (slave) [card=158], PCI subsystem ID is 800b:763d
[    5.839575] bttv1: using: Geovision GV-800(S) (slave) [card=158,autodetected]
[    5.839602] bttv1: gpio: en=00000000, out=00000000 in=00ff7cff [init]
[    5.839639] bttv1: tuner absent
[    5.839667] bttv1: registered device video1
[    5.839690] bttv1: registered device vbi1
[    5.839717] bttv1: PLL: 28636363 => 35468950 .. ok
[    5.871530] bttv: Bt8xx card found (2).
[    5.871540] bttv 0000:04:08.0: PCI INT A -> GSI 21 (level, low) -> IRQ 21
[    5.871548] bttv2: Bt878 (rev 17) at 0000:04:08.0, irq: 21, latency: 64, mmio: 0xfdefb000
[    5.871568] bttv2: detected: GeoVision GV-800(S) (slave) [card=158], PCI subsystem ID is 800c:763d
[    5.871570] bttv2: using: Geovision GV-800(S) (slave) [card=158,autodetected]
[    5.871596] bttv2: gpio: en=00000000, out=00000000 in=00ffbeff [init]
[    5.871632] bttv2: tuner absent
[    5.871659] bttv2: registered device video2
[    5.871682] bttv2: registered device vbi2
[    5.871708] bttv2: PLL: 28636363 => 35468950 .. ok
[    5.903525] bttv: Bt8xx card found (3).
[    5.903534] bttv 0000:04:0c.0: PCI INT A -> GSI 21 (level, low) -> IRQ 21
[    5.903542] bttv3: Bt878 (rev 17) at 0000:04:0c.0, irq: 21, latency: 64, mmio: 0xfdef9000
[    5.903557] bttv3: detected: GeoVision GV-800(S) (slave) [card=158], PCI subsystem ID is 800d:763d
[    5.903559] bttv3: using: Geovision GV-800(S) (slave) [card=158,autodetected]
[    5.903584] bttv3: gpio: en=00000000, out=00000000 in=00fffcff [init]
[    5.903621] bttv3: tuner absent
[    5.903650] bttv3: registered device video3
[    5.903671] bttv3: registered device vbi3
[    5.903697] bttv3: PLL: 28636363 => 35468950 .. ok

DVR Techwell 6805a




$ uname -r
3.0.0-1-amd64


$ lspci -n
....
02:00.0 0c03: 1033:0194 (rev 03)
03:06.0 0400: 1797:6804 (rev 10)
03:06.1 0480: 1797:6805 (rev 10)
04:00.0 0101: 197b:2368
.....


$ lspci -k
.....
02:00.0 USB Controller: NEC Corporation uPD720200 USB 3.0 Host Controller (rev 03)
    Subsystem: Micro-Star International Co., Ltd. Device 7599
    Kernel driver in use: xhci_hcd
03:06.0 Multimedia video controller: Techwell Inc. Device 6804 (rev 10)
03:06.1 Multimedia controller: Techwell Inc. Device 6805 (rev 10)
04:00.0 IDE interface: JMicron Technology Corp. JMB368 IDE controller
    Subsystem: Micro-Star International Co., Ltd. Device 7599
    Kernel driver in use: pata_jmicron
....


$ ls -ls /dev/video*
ls: cannot access /dev/video*: No such file or directory


DVR Card 104C-E zoneminder

work with Zoneminder + linux
follow instruction on
http://www.zoneminder.com/wiki/index.php/Debian_Squeeze
(include instruction on other issues)

no need to create or edit /etc/modprobe.d/bttv.conf
Camera 1 -> /dev/video0 channel 0
Camera 2 -> /dev/video0 channel 1
Camera 3 -> /dev/video0 channel 2
Camera 4 -> /dev/video0 channel 3


$ uname -r
3.0.0-1-amd64

Card Specification
============
http://www.tungson.cn/en/product_info.asp?InfoID=163



$ lspci -k
03:06.0 Multimedia video controller: Conexant Systems, Inc. CX23880/1/2/3 PCI Video and Audio Decoder (rev 05)
    Subsystem: Device c180:c980
    Kernel driver in use: cx8800
03:06.1 Multimedia controller: Conexant Systems, Inc. CX23880/1/2/3 PCI Video and Audio Decoder [Audio Port] (rev 05)
    Subsystem: Device c180:c980
    Kernel driver in use: cx88_audio


$ ls -ls /dev/video*
0 crw-rw-rw-+ 1 root video 81, 0 Oct 15 11:23 /dev/video0


$ v4l-info /dev/video0

### v4l2 device info [/dev/video0] ###
general info
    VIDIOC_QUERYCAP
    driver                  : "cx8800"
    card                    : "Shenzhen Tungsten Ages Tech TE-"
    bus_info                : "PCI:0000:03:06.0"
    version                 : 0.0.8
    capabilities            : 0x5010011 [VIDEO_CAPTURE,VBI_CAPTURE,TUNER,READWRITE,STREAMING]

standards
    VIDIOC_ENUMSTD(0)
    index                   : 0
    id                      : 0x1000 [NTSC_M]
    name                    : "NTSC-M"
    frameperiod.numerator   : 1001
    frameperiod.denominator : 30000
    framelines              : 525
    VIDIOC_ENUMSTD(1)
    index                   : 1
    id                      : 0x2000 [NTSC_M_JP]
    name                    : "NTSC-M-JP"
    frameperiod.numerator   : 1001
    frameperiod.denominator : 30000
    framelines              : 525
    VIDIOC_ENUMSTD(2)
    index                   : 2
    id                      : 0x4000 [?]
    name                    : "NTSC-443"
    frameperiod.numerator   : 1001
    frameperiod.denominator : 30000
    framelines              : 525
    VIDIOC_ENUMSTD(3)
    index                   : 3
    id                      : 0x7 [PAL_B,PAL_B1,PAL_G]
    name                    : "PAL-BG"
    frameperiod.numerator   : 1
    frameperiod.denominator : 25
    framelines              : 625
    VIDIOC_ENUMSTD(4)
    index                   : 4
    id                      : 0x10 [PAL_I]
    name                    : "PAL-I"
    frameperiod.numerator   : 1
    frameperiod.denominator : 25
    framelines              : 625
    VIDIOC_ENUMSTD(5)
    index                   : 5
    id                      : 0xe0 [PAL_D,PAL_D1,PAL_K]
    name                    : "PAL-DK"
    frameperiod.numerator   : 1
    frameperiod.denominator : 25
    framelines              : 625
    VIDIOC_ENUMSTD(6)
    index                   : 6
    id                      : 0x100 [PAL_M]
    name                    : "PAL-M"
    frameperiod.numerator   : 1001
    frameperiod.denominator : 30000
    framelines              : 525
    VIDIOC_ENUMSTD(7)
    index                   : 7
    id                      : 0x200 [PAL_N]
    name                    : "PAL-N"
    frameperiod.numerator   : 1
    frameperiod.denominator : 25
    framelines              : 625
    VIDIOC_ENUMSTD(8)
    index                   : 8
    id                      : 0x400 [PAL_Nc]
    name                    : "PAL-Nc"
    frameperiod.numerator   : 1
    frameperiod.denominator : 25
    framelines              : 625
    VIDIOC_ENUMSTD(9)
    index                   : 9
    id                      : 0x800 [PAL_60]
    name                    : "PAL-60"
    frameperiod.numerator   : 1001
    frameperiod.denominator : 30000
    framelines              : 525
    VIDIOC_ENUMSTD(10)
    index                   : 10
    id                      : 0x10000 [SECAM_B]
    name                    : "SECAM-B"
    frameperiod.numerator   : 1
    frameperiod.denominator : 25
    framelines              : 625
    VIDIOC_ENUMSTD(11)
    index                   : 11
    id                      : 0x40000 [SECAM_G]
    name                    : "SECAM-G"
    frameperiod.numerator   : 1
    frameperiod.denominator : 25
    framelines              : 625
    VIDIOC_ENUMSTD(12)
    index                   : 12
    id                      : 0x80000 [SECAM_H]
    name                    : "SECAM-H"
    frameperiod.numerator   : 1
    frameperiod.denominator : 25
    framelines              : 625
    VIDIOC_ENUMSTD(13)
    index                   : 13
    id                      : 0x320000 [SECAM_D,SECAM_K,SECAM_K1]
    name                    : "SECAM-DK"
    frameperiod.numerator   : 1
    frameperiod.denominator : 25
    framelines              : 625
    VIDIOC_ENUMSTD(14)
    index                   : 14
    id                      : 0x400000 [SECAM_L]
    name                    : "SECAM-L"
    frameperiod.numerator   : 1
    frameperiod.denominator : 25
    framelines              : 625

inputs
    VIDIOC_ENUMINPUT(0)
    index                   : 0
    name                    : "Television"
    type                    : TUNER
    audioset                : 0
    tuner                   : 0
    std                     : 0x7f7ff7 [PAL_B,PAL_B1,PAL_G,PAL_I,PAL_D,PAL_D1,PAL_K,PAL_M,PAL_N,PAL_Nc,PAL_60,NTSC_M,NTSC_M_JP,?,SECAM_B,SECAM_D,SECAM_G,SECAM_H,SECAM_K,SECAM_K1,SECAM_L]
    status                  : 0x0 []
    VIDIOC_ENUMINPUT(1)
    index                   : 1
    name                    : "Composite1"
    type                    : CAMERA
    audioset                : 0
    tuner                   : 0
    std                     : 0x0 []
    status                  : 0x0 []
    VIDIOC_ENUMINPUT(2)
    index                   : 2
    name                    : "S-Video"
    type                    : CAMERA
    audioset                : 0
    tuner                   : 0
    std                     : 0x0 []
    status                  : 0x0 []

tuners
    VIDIOC_G_TUNER(0)
    index                   : 0
    name                    : "Television"
    type                    : ANALOG_TV
    capability              : 0x70 [STEREO,LANG2,LANG1]
    rangelow                : 0
    rangehigh               : 4294967295
    rxsubchans              : 0x1 [MONO]
    audmode                 : MONO
    signal                  : 65535
    afc                     : 0

video capture
    VIDIOC_ENUM_FMT(0,VIDEO_CAPTURE)
    index                   : 0
    type                    : VIDEO_CAPTURE
    flags                   : 0
    description             : "8 bpp, gray"
    pixelformat             : 0x59455247 [GREY]
    VIDIOC_ENUM_FMT(1,VIDEO_CAPTURE)
    index                   : 1
    type                    : VIDEO_CAPTURE
    flags                   : 0
    description             : "15 bpp RGB, le"
    pixelformat             : 0x4f424752 [RGBO]
    VIDIOC_ENUM_FMT(2,VIDEO_CAPTURE)
    index                   : 2
    type                    : VIDEO_CAPTURE
    flags                   : 0
    description             : "15 bpp RGB, be"
    pixelformat             : 0x51424752 [RGBQ]
    VIDIOC_ENUM_FMT(3,VIDEO_CAPTURE)
    index                   : 3
    type                    : VIDEO_CAPTURE
    flags                   : 0
    description             : "16 bpp RGB, le"
    pixelformat             : 0x50424752 [RGBP]
    VIDIOC_ENUM_FMT(4,VIDEO_CAPTURE)
    index                   : 4
    type                    : VIDEO_CAPTURE
    flags                   : 0
    description             : "16 bpp RGB, be"
    pixelformat             : 0x52424752 [RGBR]
    VIDIOC_ENUM_FMT(5,VIDEO_CAPTURE)
    index                   : 5
    type                    : VIDEO_CAPTURE
    flags                   : 0
    description             : "24 bpp RGB, le"
    pixelformat             : 0x33524742 [BGR3]
    VIDIOC_ENUM_FMT(6,VIDEO_CAPTURE)
    index                   : 6
    type                    : VIDEO_CAPTURE
    flags                   : 0
    description             : "32 bpp RGB, le"
    pixelformat             : 0x34524742 [BGR4]
    VIDIOC_ENUM_FMT(7,VIDEO_CAPTURE)
    index                   : 7
    type                    : VIDEO_CAPTURE
    flags                   : 0
    description             : "32 bpp RGB, be"
    pixelformat             : 0x34424752 [RGB4]
    VIDIOC_ENUM_FMT(8,VIDEO_CAPTURE)
    index                   : 8
    type                    : VIDEO_CAPTURE
    flags                   : 0
    description             : "4:2:2, packed, YUYV"
    pixelformat             : 0x56595559 [YUYV]
    VIDIOC_ENUM_FMT(9,VIDEO_CAPTURE)
    index                   : 9
    type                    : VIDEO_CAPTURE
    flags                   : 0
    description             : "4:2:2, packed, UYVY"
    pixelformat             : 0x59565955 [UYVY]
    VIDIOC_G_FMT(VIDEO_CAPTURE)
    type                    : VIDEO_CAPTURE
    fmt.pix.width           : 320
    fmt.pix.height          : 240
    fmt.pix.pixelformat     : 0x33524742 [BGR3]
    fmt.pix.field           : INTERLACED
    fmt.pix.bytesperline    : 960
    fmt.pix.sizeimage       : 230400
    fmt.pix.colorspace      : unknown
    fmt.pix.priv            : 0

vbi capture
    VIDIOC_G_FMT(VBI_CAPTURE)
    type                    : VBI_CAPTURE
    fmt.vbi.sampling_rate   : 35468950
    fmt.vbi.offset          : 244
    fmt.vbi.samples_per_line: 2048
    fmt.vbi.sample_format   : 0x59455247 [GREY]
    fmt.vbi.start[0]        : 6
    fmt.vbi.start[1]        : 318
    fmt.vbi.count[0]        : 17
    fmt.vbi.count[1]        : 17
    fmt.vbi.flags           : 0

controls
    VIDIOC_QUERYCTRL(BASE+0)
    id                      : 9963776
    type                    : INTEGER
    name                    : "Brightness"
    minimum                 : 0
    maximum                 : 255
    step                    : 1
    default_value           : 127
    flags                   : 0
    VIDIOC_QUERYCTRL(BASE+1)
    id                      : 9963777
    type                    : INTEGER
    name                    : "Contrast"
    minimum                 : 0
    maximum                 : 255
    step                    : 1
    default_value           : 63
    flags                   : 0
    VIDIOC_QUERYCTRL(BASE+2)
    id                      : 9963778
    type                    : INTEGER
    name                    : "Saturation"
    minimum                 : 0
    maximum                 : 255
    step                    : 1
    default_value           : 127
    flags                   : 0
    VIDIOC_QUERYCTRL(BASE+3)
    id                      : 9963779
    type                    : INTEGER
    name                    : "Hue"
    minimum                 : 0
    maximum                 : 255
    step                    : 1
    default_value           : 127
    flags                   : 0



Useful Commands
============
sudo service zoneminder restart
sudo /etc/init.d/apache2 force-reload
sudo /etc/init.d/udev restart
dmesg
sudo tail -f /var/log/syslog
ffmpeg -f video4linux2 -s 352x288 -r 30000/1001 -i /dev/video0 -y webcam.avi

sudo apt-get install xawtv
xawtv -nodga -device /dev/video3
xawtv -c /dev/video0

Adding Cameras:
go to http://www.zoneminder.com/wiki/index.php/Ubuntu_9.04_%28Jaunty%29_desktop_with_graphical_interface