Friday, March 11, 2011

SVN repository on Apple Xserve

Introductions:
Whew! How about that ? Well, it seems that it is going to build the application from scratch .Yes, my friend , this is a sort of little story how will you compile libraries and patched in a UNIX like OSX,oh a pain and tasky. I 've done this almost a year ago, but that's only for Linux/Unix like OS (say Fedora or CentOS); but now a little porting of compiling package in UNIX/OSX

Objectives:

To install Repository in MAC Xserve (period!);with yum ,sudo apt-get and fink(why??)

Requirements:

Note:
All the packages were stored at an "installer" named directory
apr-1.4.2.tar.gz
httpd-2.2.17.tar.gz
subversion-1.6.15.tar.gz
apr-util-1.3.10.tar.gz
libtool-2.2.tar.gz
subversion-1.6.16.tar.gz
autoconf-2.68.tar.gz
m4-1.4.tar.gz
db-5.1.25.tar.gz
neon-0.29.5.tar.gz
expat-2.0.1.tar.gz
php-5.3.5.tar.gz
zlib-1.2.5.tar.gz
sqlite-autoconf-3070500.tar.gz

Only fink help in a little while
yum-3.2.29.tar.gz
wget-1.9.tar.gz
fink-0.29.19.tar.gz


Methodology:
Basic Instructions:
1) Download all of those files mentioned above
2) Install and compile
3) debug with --prefixes

[autoconf]
root@localhost# curl -L -O http://ftp.gnu.org/gnu/autoconf/autoconf-2.68.tar.gz
root@localhos# tar -zxvf
autoconf-2.68.tar.gz
root@localhost# cd autoconf-1.2.8
root@localhost# ./configure
root@localhost# make && make install

[BerkerlelyDB]
root@localhost# curl -L -O http://ftp.riken.go.jp/pub/FreeBSD/distfiles/bdb/db-5.1.25.tar.gz
root@localhos# tar -zzxvf
db-5.1.25.tar.gz
root@localhost# cd db-5.1.25
root@localhost# cd build_unix
root@localhost# ../dist/configure --prefix=/usr/local/db5
root@localhost# make && make install

[libtool]
root@localhost# curl -L -O http://ftp.gnu.org/gnu/libtool/libtool-2.2.10.tar.gz
root@localhost# tar -zxvf
libtool-2.2.tar.gz
root@localhost# cd libtool-2.2.10
root@localhost# ./configure
root@localhost# make && make install

[expat]
root@localhost# curl -L -O http://nchc.dl.sourceforge.net/project/expat/expat/2.0.1/expat-2.0.1.tar.gz
root@localhost# tar -zxvf
expat-2.0.1.tar.gz
root@localhost# cd expat-2.0.1
root@localhost# ./configure --prefix=/usr/local/expat
root@localhost# make && make install

[neon]
root@localhost# curl -L -O http://webdav.org/neon/neon-0.29.5.tar.gz
root@localhost# tar -zxvf
expat-2.0.1.tar.gz
root@localhost# cd expat-2.0.1
root@localhost# ./configure --prefix=/usr/local/neon
root@localhost# make && make install

[zlib]
root@localhost# curl -L -O http://zlib.net/zlib-1.2.5.tar.gz
root@localhost# tar -zxvf
zlib-1.2.5.tar.gz
root@localhost# cd zlib-1.2.5
root@localhost# ./configure --prefix=/usr/local/zlib
root@localhost# make && make install

[sqlite]
root@localhost# curl -L -O http://www.sqlite.org/sqlite-autoconf-3070500.tar.gz
root@localhost# tar -zxvf
sqlite-autoconf-3070500.tar.gz
root@localhost# cd sqlite-autoconf-3070500
root@localhost# ./configure --prefix=/usr/local/sqlite
root@localhost# make && make install

[apr]
root@localhost# curl -L -O http://download.filehat.com/apache//apr/apr-1.4.2.tar.gz
root@localhost# tar -zxvf
apr-1.4.2.tar.gz
root@localhost# cd apr-1.4.2
root@localhost# ./configure --prefix=/usr/local/apr
root@localhost# make && make install

[apr-util]
root@localhost# curl -L -O http://ftp.wayne.edu/apache//apr/apr-1.4.2.tar.gz
root@localhost# tar -zxvf
apr-util-1.3.10.tar.gz
root@localhost# cd apr-util-1.3.10
root@localhost# ./configure --prefix=/usr/local/apr-util-1.3.10
root@localhost# make && make install

[mysql]
root@localhost# tar -zxvf mysql-5.xy.tar.gz
root@localhost# cd mysql-5.x.y
root@localhost# ./configure --prefix=/usr/local/mysql
root@localhost# make && make install

[gettext]
root@localhost# sudo su
root@localhost# curl -L -O ftp://ftp.gnu.org/gnu/gettext/gettext-0.17.tar.gz
root@localhost# tar xvzf gettext-0.17.tar.gz
root@localhost# cd gettext-0.17
root@localhost# cd gettext-tools/
root@localhost# ./configure --prefix=gettext
root@localhost# make
root@localhost# make install

[gdbm]
root@localhost# curl -L -O http://savory.googlecode.com/files/gdbm-1.8.3.tar.gz
root@localhost# tar -zxvf gdbm-1.8.3.tar.gz
root@localhost# cd gdbm-18.3
root@localhost# ./configure --prefix=/usr/local/gdbm
root@localhost# make && make install

[Apache]
root@localhost# curl -L -O http://www.ecoficial.com/apachemirror//httpd/httpd-2.2.17.tar.gz
root@localhost# tar -zxvf
httpd-2.2.17.tar.gz
root@localhost# cd httpd-2.2.17
root@localhost# ./configure --prefix=/usr/local/apache2 -with-apxs=/usr/local/apache2/bin/apxs --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-zlib=/usr/local/zlib --with-mysql=/usr/local/mysql/ --with-sqlite=/usr/local/sqlite --enable-dav --enable-so --enable-cgi --enable-info --enable-rewrite --enable-speling --enable-usertrack –with-dbm=db5 –with-berkeley-db=/usr/local/db5 --enable-deflate --enable-ssl
root@localhost# make && make install

Browse and test : http://localhost , then you should see the immortal..It Works!

[Subversion]
root@locahost# tar-zxvf
subversion-1.6.16.tar.gz
root@localhost# cd subversion-1.6.16
root@localhost@ ./configure --prefix=/usr/local/svn --with-apxs=/usr/local/apache2/bin/apxs --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr-util/bin/apu-1-config --disable-neon-version-check --with-neon=/usr/local/neon --with-sqlite=/usr/local/sqlite --with-zlib=/usr/local/zlib

[I]Correct path of SVN repository
root@locahost # chown -R daemon:daemon /usr/local/svn
root@localhost# svnadmin create datacenter

[II] Create a username and password stored in a txt file
root@localhost# mkdir /usr/local/password
root@locahost# cd /usr/local/password
root@localhost# httpswd -cm /usr/local/password/secret admin
root@localhost# enter a new password: "password"

[III]Config Apache now to access SVN services!

root@locahost# vim /usr/local/apache2/conf/http.conf
1) Add the following lines
1.a) to load dav modules
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
LoadModule php5_module modules/libphp5.so
DeflateFilterNote Input instream
DeflateFilterNote Output outstream
DeflateFilterNote Ratio ratio

1.b) to add location of SVN path with authentications
#
DAV svn
SVNPath /usr/local/svn/datacenter
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /usr/local/password/secret
Require valid-user
SetOutputFilter DEFLATE
SetInputFilter DEFLATE
#
root@locahost# cd /usr/local/apache2/bin/

root@locahost# ./apachectl restart

Browse and check : http://localhost/svn/datacenter then enter a user-name and password.

[Php]

root@localhost# curl -L -O http://ar.php.net/distributions/php-5.3.5.tar.gz
root@localhost# tar -zxvf
php-5.3.5.tar.gz
root@localhost# cd php-5.3.5
root@localhost# ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-mysqli --prefix=/usr/local/php --with-config-file-path=/usr/local/php --enable-force-cgi-redirect --disable-cgi --with-zlib --with-gdbm=/usr/local/gdbm
root@localhost# make
root@localhost make test
root@localhost# make install

Remarks:
Hints:
Problem : Forbidden Error
Solution:
1.0) Do it always in README
2.0) If ever forbidden error (404,405,400,etc) occurs
2.a) take note the ownership of the /usr/local/svn (directory)
root@localhost# chown -R daemon:daemon /usr/local/svn
root@localhost# ls -alt
Then you should see ownership of the file


Solution:
2.b) check the apahce ownership!
Username daemon
Usergoup daemon

Solution:
2.c) Try to edit the
SVNPath not SVNParentPAth

2.d) and also don't forget to memorize your password
mkdir /usr/local/password
vim secret , then save
htppasswd -cm /usr/local/password/secret

In installing Subversion
Problem: "/usr/bin/ld: cannot find -lexpat "
Solution: download and install expat

Problem:
configure: error: Cannot find libmysqlclient under /usr.
Note that the MySQL client library is not bundled anymore!
Note:
This happen because , we directly Yum installed mysql yet PHP now needs the complete path of MySQL- grrrr!

1) Be sure to download the mysql libraries and add ons:
mysql devel,mysql-php,libmysql

2) Use again "whereis"
root@localhost# cd /usr/local/php-5.version.xx
root@localhost# whereis mysql

Then use --with-mysql=/usr/bin/mysql libdir=lib64
root@locahost# ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/bin/mysql --with-libdir=lib64 --with-mysqli=/usr/bin/mysql_config --prefix=/usr/local/php --with-config-file-path=/usr/local/php --disable-cgi --with-zlib --with-gdbm
..and Yahoo it saves the day...

Conclusions:
Somehow it is always possible!

Thursday, March 3, 2011

Decapod for RoBook Scanner(Phase II)


Introductions:

Welcome back brethren,here once again we'll re figure out the application of Decapod.Its been a long time since the team had paused their development,and I cant wait to tweak the current version simply because most of the program flavor or add-ons are changing so quick .Through these, I needed to recompile Decapod for a chance to enhance its application to its changing flavors(add-ons).


Objectives:
Recompile /install Decapod with its new release add-ons
Debugging a Decapod scripts
Debugging the Decapod source code

Requirements:

sudo apt-get install
libaa1                           ascii art library 
libc6                             Embedded GNU C Library: Shared lib
libcdk5                         C-based curses widget library
libexif12                       library to parse EXIF files
libgphoto2-2                 gphoto2 digital camera library 
libgphoto2-port0          gphoto2 digital camera port library 
libjpeg62                      The Independent JPEG Group's JPEG 
libncurses5                  shared libraries for terminal hand 
libpopt0                        lib for parsing cmdline parameters
libreadline5                  GNU readline and history libraries 

Note : These are the release packages available as the date of writings; other libraries are also with their latest version
Decapod verion. 4.0
libgphoto2 version 10.1
gphoto2-10 version
Ocropus packages:
openfst-1.2.7.tar.gz
iulib-0.4.tgz

Methodology:
Download and Install
Re evaluate the integration of a new compiled Decapod
Test Cameras

root@localhost# sudo apt-get remove libgphoto2-*
root@localhost# sudo apt-get remove gphoto2
root@localhost# sudo apt-get install build-essential
root#localhost# sudo apt-get sudo apt-get install libpopt* libexif*

#for libgphoto2
root@localhost# wget http://sourceforge.net/projects/gphoto/files/libgphoto/2.4.10.1/libgphoto2-2.4.10.1.tar.gz
root@localhost# tar -xvf libgphoto2-2.4.10.1.tar.gz
root@localhost# cd libgphoto2-2.4.10.1/
root@localhost# ./configure
root@localhost# make
root@localhost# sudo make install
root@localhost# cd ..
root@localhost# rm -Rf libgphoto2-2.4.10.1/


# for gphoto2
wget http://sourceforge.net/projects/gphoto/files/gphoto/2.4.10/gphoto2-2.4.10.tar.gz
tar -zxvf gphoto2-2.4.10.tar.gz
cd gphoto2-2.4.10/
./configure
make
sudo make install
cd ..
rm -Rf gphoto2-2.4.10/
rm -f gphoto2-2.4.10.tar.bz2

1)A basic OCRopus installations
root@localhost# hg clone $release https://iulib.googlecode.com/hg/ iulib
root@localhost# hg clone $release https://ocropus.googlecode.com/hg/ ocropus
root@localhost# hg clone $release https://ocroswig.ocropus.googlecode.com/hg/ ocroswig
root@localhost# hg clone $release https://ocropy.ocropus.googlecode.com/hg/ ocropy
root@localhost$# wget -nd http://openfst.cs.nyu.edu/twiki/pub/FST/FstDownload/openfst-1.2.7.tar.gz openfst-1.2.7.tar.gz
root@localhost# hg clone $release https://pyopenfst.googlecode.com/hg/ pyopenfst
date;

2)Or,from Decapod-4.0 package modify "decapod-ocropus.sh" script to replace contents from line 56 to bottom
clone_and_install_ocropus_lib https://iulib.googlecode.com/hg/ iulib
clone_and_install_ocropus_lib https://ocropus.googlecode.com/hg/ ocropus
download_and_install http://openfst.cs.nyu.edu/twiki/pub/FST/FstDownload/openfst-1.2.7.tar.gz openfst-1.2.7.tar.gz openfst-1.2.7 openfst 1.2.7
clone_and_make_ocropus_lib https://pyopenfst.googlecode.com/hg/ pyopenfst
clone_and_make_ocropus_lib https://ocroswig.ocropus.googlecode.com/hg/ ocroswig
clone_and_install_python_lib https://ocropy.ocropus.googlecode.com/hg/ ocropy

# compile iulib
cd iulib
sudo sh uninstall
sudo sh ubuntu-packages
scons -j 4 sdl=1
sudo scons -j 4 sdl=1 install
cd ..
date;

# compile ocropus
cd ocropus
sudo sh uninstall
sudo sh ubuntu-packages
scons -j 4 omp=1
sudo scons -j 4 omp=1 install
cd ..
date;

# compile openfst
tar -zxvf openfst-1.2.7.tar.gz
cd openfst-1.1
./configure
make -j 4
sudo make install
cd ..
date;

# compile ocroswig
cd ocroswig
make
cd ..
date;

# compile ocropy
cd ocropy
sudo python setup.py install
cd ..
date;

# compile Python bindings for openfst
cd pyopenfst
make
cd ..
date;

Detail(1) Libgphoto2 and gphoto2 file dependencies-flow chart


Detail(2) Decapod stereo capture


Detail(3)
Detail(4)

Remarks:

Hints:
1)If you have a G10 which has an older version firmware and you want to update it. Please go to this website and input the serial number of your G10,do it carefully by reading the instruction manual (PDF) to avoid damage in your camera
http://www.canon.co.jp/imaging/dcp/firm-e/psg10/download.html?Submit=Go+to+the+download+page

2) Remove the SD Card of your G10 camera it is necessary to avoid the mounting of G10 memory card drive (it will cause conflict in USB ID and ports).

3)If you can not use a mercurial downloader "hg clone" and its connection is being aborted to that google.code server -one thing is certain. You dont have the certificate to access its "https://" host server.Better install openssl first in your computer so that you can work smoothly to a mercurial copy or downloading.
root@localhost# sudo apt-get openssl
Warning!
if you would change your proxy then (1) reinstall your openssl , (2) delete the ssl certificate; otherwise you can't get the host server (for security reasons).
Conclusions: