Monday, July 19, 2010

capture images from avi using ffmpeg

this script would use ffmpeg to split a video into series of images on the second provided.

#!/bin/bash

for i in `seq -w 1 1 100`
do
   ffmpeg -itsoffset -00:02:03.$i -i video.avi -vcodec png -vframes 1 -an -f rawvideo pix-$i.png
done

Monday, May 31, 2010

Issues with installing DB2 8.1 Development Client on Linux

When running the most obvious command db2setup, it shows the following then nothing happens:

DBI1190I db2setup is preparing the DB2 Setup wizard which will guide you through the program setup process. Please wait.  

Perhaps it is because I am not running X as GUI, but strange it didn't complain about the DISPLAY message.

It can be installed by using db2_install

Post-install is unusual compare to other database installs, you need to run this to create an "instance" with an userid already exist on the system.
However, I get the following error on Red Hat Enterprise Linux Server release 5.4 (Tikanga)

/opt/IBM/db2/V8.1/instance/db2iutil/db2icrt -a SERVER -s client appuser
DBI1069E Unexpected error. Function = chk_fsystype, Return code = 
          22.  

It seems to be the version of tail issue, you need to change this script:
/opt/IBM/db2/V8.1/instance/db2iutil/db2iutil
global search for "tail +2", change it to "tail -n +2"

[root@hostname]# ./db2icrt -a SERVER -s client appuser
DBI1070I Program db2icrt completed successfully.  


Reference
http://oss.sgi.com/LDP/HOWTO/DB2-HOWTO/db2instance.html

Saturday, February 6, 2010

Subversion userid case-sensitivie validation for Active Directory

Subversion's user authentication is case sensitive for both userid and password.  While this is the standard in the *nix world, unfortunately Windows users tend to put their userid in whatever case they feel like.  I couldn't find a configuration option for this in Subversion, also no luck from the net...  So I went into the source code and did a quick & dirty workaround since all our users are validating their accounts against Windows Active Directory which is case-insensitive for their userid.

replace strcmp with strcasecmp in the following two lines.  This is for Subverison 1.4.0.  Just search for strcmp in the same file for newer version.

./subversion/libsvn_repos/authz.c

line 156:       else if (strcasecmp(user, group_user) == 0)
line 189:       else if (strcasecmp(name, b->user) != 0)

Monday, January 18, 2010

compiling tesseract for Linux 32-bit

compiling tesseract for Linux 32-bit under a 64-bit Linux environment wasn't the most straight forward thing... even with -m32 flag set for gcc flags,it failed during linking:

ld -r -o libtesseract_full.o tesseractfull.o \
    libtesseract_main.a \
    ../textord/libtesseract_textord.a \
    ../pageseg/libtesseract_pageseg.a \
    ../wordrec/libtesseract_wordrec.a \
    ../classify/libtesseract_classify.a \
    ../dict/libtesseract_dict.a \
    ../viewer/libtesseract_viewer.a \
    ../image/libtesseract_image.a \
    ../cutil/libtesseract_cutil.a \
    ../ccstruct/libtesseract_ccstruct.a \
    ../ccutil/libtesseract_ccutil.a
ld: Relocatable linking with relocations from format elf32-i386 (tesseractfull.o) to format elf64-x86-64 (libtesseract_full.o) is not supported
make[3]: *** [libtesseract_full.o] Error 1


setting -m32 for LDFLAGS didn't do the trick, ld likes this flag better "-melf_i386", but setting this in LDFLAGS would cause tesseract fail when running configure
I had to manually go under ccmain do the following with -melf_i386:
tesseract-2.03]$ cd ccmain
ccmain]$ ld -r -o libtesseract_full.o tesseractfull.o \
     libtesseract_main.a \
     ../textord/libtesseract_textord.a \
     ../pageseg/libtesseract_pageseg.a \
     ../wordrec/libtesseract_wordrec.a \
     ../classify/libtesseract_classify.a \
     ../dict/libtesseract_dict.a \
     ../viewer/libtesseract_viewer.a \
     ../image/libtesseract_image.a \
     ../cutil/libtesseract_cutil.a \
     ../ccstruct/libtesseract_ccstruct.a \

     ../ccutil/libtesseract_ccutil.a -melf_i386

after that go back one level up and run make ; make install again.
cd ..
make

Monday, October 26, 2009

Hudson config for SVN credentials

I've been integrating Hudson into our build process, interesting enough that I couldn't find where to set the subversion credentials from Hudson's config menus.  Found the solution from web, simply go to URL to config:
http://${HUDSON_HOST:PORT}/scm/SubversionSCM/enterCredential 

the file on the server is under:
${HOME}/.hudson/hudson.scm.SubversionSCM.xml

Not sure if it supports multiple repositories with different credentials.

Reference:
http://www.testearly.com/2007/06/12/subversion-authentication-in-hudson/

Friday, August 28, 2009

integrate Subversion with Windows Active Directory

apache httpd.conf

<Location /reponame>

DAV svn
SVNPath /opt/subversion/rep/reponame
AuthzSVNAccessFile /opt/subversion/rep/reponame/conf/authz
Require valid-user
AuthBasicProvider ldap
AuthType Basic
AuthName "subversion repository"
AuthLDAPURL "ldap://hostname:389/OU=Users,OU=Shire,DC=shire,DC=org?sAMAccountName?sub?(objectClass=hobbitName)" NONE
AuthLDAPBindDN "CN=Bilbo,CN=Users,DC=shire,DC=org"
AuthLDAPBindPassword "RiNg"
</Location>



authz example

[groups]
wizard = gandalf
hobbit = forodo, sam

[/]
#* = r
@wizard = rw
@hibbot = r

Thursday, August 13, 2009

solaris ps wide

ps -awwx doesn't work under solaris?
don't use the one under /usr/bin/
try this:
/usr/ucb/ps -awwx