How to install Docmgr 0.58 in Debian 6.0 Squeeze

DocMgr is a PHP/Postgresql based document management system (DMS): I use it a lot, because it is simple to use and configure. It is not difficult to install in Debian Squeeze 6.0: here I will show you how to install an old version (0.58), because I had to migrate an instance of this version running in an old server (in the future I will upgrade that to the brand new version DocMgr 1.2.2).

apt-get update
apt-get upgrade
apt-get dist-upgrade
apt-get install apache2
apt-get install postgresql

To check that Apache2 is installed and to verify the current running version.

apachectl -v

During installation process of postgres a new user was created (named postgres): you must change the password related to this user.

passwd postgres

Use a strong password !

Now to check that Postgres is installed and verify the current running version type the command on the next.

su postgres
psql -c "select version();" template1

Now we have to install php5.

apt-get install php5
apt-get install php5-cli
apt-get install php5-pgsql
apt-get install php5-imap

To check that Php5 is installed and to verify the current running version create in /var/www/ a file named test.php, and insert this single line.

<!--?php phpinfo() ?-->

After that with the web browser get this URL: http://<server ip address>/test.php
If all works fine we can continue with the creation of the db in postgres

su postgres
createuser userdb
psql template1
alter user userdb password '<password for the postgres user named userdb>';
\q
exit
createdb -h localhost -W -U userdb docmgrbase

Now we have to restart apache to verify that all work fine, and we can install the docmgr files.

/etc/init.d/apache2 restart
cd /var/www

Download DocMgr v 0.58 (docmgr-0.58.tar.gz) and copy it in /var/www: we have to decompress this archive.

tar -zxvf docmgr*

Rename the created folder doc in docmgr

mv doc docmgr
mkdir /opt/docmgr
mkdir /opt/docmgr/import
cd /var/www/docmgr
mv files /opt/docmgr
chown -R www-data:www-data /opt/docmgr/files/
chown -R www-data:www-data /opt/docmgr/import/

In /etc/postgresql/8.4/main/pg_hba.conf add the line at the end of the file.

host docmgrbase userdb 127.0.0.1 255.255.255.255 md5

Restart postgres to check & load the modified version of pg_hba.conf.

/etc/init.d/postgresql restart

Now it is possible to create all the table in the database using the script docmgr.pgsql.

psql -h localhost -W -U userdb -d docmgrbase -f /var/www/docmgr/scripts/docmgr.pgsql

We have to modifiy the file /var/www/docmgr/config/config.php as in the following.

//connection settings
define("DBHOST","127.0.0.1");
define("DBUSER","userdb");
define("DBPASSWORD","<password for the postgres user named userdb>");
define("DBPORT","5432");
define("DBNAME","docmgrbase");

//use ldap for accounts. If set, alter ldap settings
//in ldap-config.php
//define("USE_LDAP","1");

//the directory you want the import module to look at (no trailing slash)
define("IMPORT_DIR","/opt/docmgr/import");

//absolute or relative path to the docmgr files directory (no trailing slash)
define("FILE_DIR","/opt/docmgr/files");

//administrator email (also return address for outgoing emails
define("ADMIN_EMAIL","admin@3tsistemi.it");

//site url for emailing links to files in event and task notifications
//also, this must be set appropriately for fckeditor to work. If a client
//uses a url different from this one, fckeditor will not load
define("SITE_URL","http://localhost/docmgr/");

Now we would have ended, but if you try to use the web browser with http://<Server Ip Address>/docmgr we get a blank page, and an error in /var/log/apache2/error.log like that in the next line.

PHP Fatal error:  Cannot redeclare date_diff() in /var/www/docmgr/lib/data_formatting.php on line 191

It is an error in the function date_diff that is no longer used: to solve you can edit the file /var/www/docmgr/lib/data_formatting.php and comment all the lines related the date_diff function.

//function date_diff($firstDate,$lastDate) {

//$fdArray = explode("-",$firstDate);
//$ldArray = explode("-",$lastDate);

//get how many days the difference is
//$diff = mktime(0,0,0,$fdArray[1],$fdArray[2],$fdArray[0]) - mktime(0,0,0,$ldArray[1],$ldArray[2],$ldArray[0]);
//$diff = abs($diff / 86400);

//return $diff;
//}

Now you can enter in docmgr with user admin and password admin
If all works fine you cant install these others external application (not mandatory) to use all the other function in docmgr.

apt-get install xpdf-reader
apt-get install xpdf-utils
apt-get install gocr
apt-get install zip
apt-get install gs
apt-get install enscript
apt-get install antiword
apt-get install libtiff-tools
apt-get install imagemagick
apt-get install ocrad

Linkografia
http://www.docmgr.org

Removing duplicate messages in Evolution 3.2.0

This morning I have re-installed Ubuntu in my laptop (Ubuntu 11.10): when I have installed the last version of evolution, version 3.2.0, in the restore process of all my mail saved from my old Ubuntu installation I have found a lot of duplicate messages. I do not know why, and I didn’t have time to investigated.
How it is possible remove these messages ?
Att.: Evolution 3.2.0 have changed the format of email-store: from Mbox (only 1 file for all the email) to Maildir (1 file for every email).
From this change the idea: using a tool that remove duplicate files in the path where all mails are saved (in my case ~/.local/share/evolution/mail/local/cur).
I turned off evolution, and I used the tool fdupes

fdupes -d -N ~/.local/share/evolution/mail/local/cur

After the restart evolution used 5 minutes for check the integrity of InBox folder, but at the end all the duplicate emails have disappeared !
Update: Now I have found in Evolution 3.2.0 a new feature: “Remove Duplicate Messages”. Edit -> Select All Messages -> Message -> Remove Duplicate Messages

Avantfax Cover

A few days ago I had the need to personalized/create a cover page for use with Avantfax, the famous web interface to Hylafax. I had little time to use the service provided by the site Avantfax itself.

I thought it was easier to create cover page, but it is really a nightmare !

If you want to create a text-only cover page, the most convenient is to use a page created in html: to make sure everything works you MUST install html2ps (see link).

Att.: I think that should work with pages with pictures, but I could not get it to work ! I have installaed all the dependencies (ImageMagick, etc etc) but…. nothing…… I have obtained only text in my fax, all the image disappered  !

To obtain  cover page with images, I have used Freehand from adobe: in that page I have used the next value.

XXXX-to
XXXX-to-company
XXXX-to-location
XXXX-to-voice-number
XXXX-to-fax-number
XXXX-regarding
XXXX-from
XXXX-from-company
XXXX-from-location
XXXX-from-voice-number
XXXX-from-fax-number
XXXX-page-count
XXXX-todays-date
XXXX-comments0 … XXXX-comments30

At the end I have save it in freehand format, and exported the file in encapsulated postscript (.eps) (NOT  “encapsulated postscript wtih TIFF Preview”),  and I have renamed the extension of the file  eps in ps: you have the brand new cover for Avantfax (maybe…) !

You can run into a problem ! Some field won’t be reported correctly.

If all works fine if you launch

grep XXXX cover.ps

You MUST obtain someting like next.

0 0 32 0 0 (To / Company: XXXX-to-company) ts
0 0 32 0 0 (Fax number: XXXX-to-fax-number) ts
0 0 32 0 0 (Date: XXXX-todays-date) ts
0 0 32 0 0 (From: XXXX-from) ts

…with all the field used in the cover page. If you do not get all the fields used then the cover-page , that page will not work properly !

My real case:

>grep XXXX cover.ps
0 0 32 0 0 (:XXXX-todays-date) ts
0 0 32 0 0 (XXXX-regarding) ts
0 0 32 -0.058502 0 (: XXXX-p) ts
0 0 32 -0.058502 0 (XXXX-comment) ts
0 0 32 -0.058502 0 (XXXX-comment) ts
0 0 32 -0.058502 0 (XXXX-comment) ts
0 0 32 -0.058502 0 (XXXX-comment) ts

The field XXXX-page-count and  XXXX-comments0 etc etc disappeared !

To solve I have opened the file with nano in Linux, and I have modified like next.

Old

....
{
f1 [18 0 0 18 0 0] makesetfont
0 0 32 -0.058502 0 (: XXXX-p) ts
-0.2159 0 rmoveto }
true
[0 0 0 1]sts
{
f1 [18 0 0 18 0 0] makesetfont
0 0 32 -0.058502 0 (age-count) ts
}
....

New

....
{
f1 [18 0 0 18 0 0] makesetfont
0 0 32 -0.058502 0 (: XXXX-p) ts
-0.2159 0 rmoveto }
true
[0 0 0 1]sts
{
f1 [18 0 0 18 0 0] makesetfont
0 0 32 -0.058502 0 ( ) ts
}
...........

The same for  XXXX-comment (for all the field related to comment)

Old

....
{
f1 [18 0 0 18 0 0] makesetfont
1816.7482 1930.0422 m
0 0 32 -0.058502 0 (XXXX-comment) ts
-0.2159 0 rmoveto }
true
[0 0 0 1]sts
{
f1 [18 0 0 18 0 0] makesetfont
0 0 32 -0.058502 0 (s0) ts
}
....

New

....{
f1 [18 0 0 18 0 0] makesetfont
1816.7482 1930.0422 m
0 0 32 -0.058502 0 (XXXX-comments0) ts
-0.2159 0 rmoveto }
true
[0 0 0 1]sts
{
f1 [18 0 0 18 0 0] makesetfont
0 0 32 -0.058502 0 ( ) ts
}....

Linkografia
http://www.avantfax.com
http://user.it.uu.se/~jan/html2ps.html
http://pbxinaflash.com/forum/showthread.php?t=3645&page=12
http://www.adobe.com/products/freehand/