วันพฤหัสบดีที่ 2 สิงหาคม พ.ศ. 2555

Pentaho 3.8 Linux PostgreSQL. A Guilde to getting start with postgresql-8.4 on Mac

Pentaho 3.8 Linux PostgreSQL. A Guilde to getting start with postgresql-8.4 on Mac


After i configure many Pentaho BI on many machines. I have to do it again today for teach my student how to install and getting start on postgresql.

References


  1. http://www.prashantraju.com/2010/12/pentaho-3-7-with-mysql-postgresql-oracle-and-sql-server/
  2. https://docs.google.com/document/edit?id=1OnvHYsa-nYgwP8bjqRqjP5Vy-gLI5xomOHZtOvA00Ns&pli=1
  3. http://wiki.pentaho.com/display/ServerDoc2x/Configuring+for+PostgreSQL
  4. http://interestingittips.wordpress.com/2011/05/05/complete-pentaho-installation-on-ubuntu-part-2/
(1) and (2) are good articles to starting.
(3) and (4) are more articles to set after you see error about system listener.

Introduction

About

I assume you have installed java and postgresql on your system. And have privilege to create new database. 
Please follow (1) and (2) if you have not complete with Java and Postgresql

Deploying Platform

For me it is a good way to get everything pack into one source. So i download pentaho-source from here 3.8.0-stable

I want to setting my BI in my home directory so i extracted source to my home directory and change name to bi-3.8

wattana@localhost:/home/wattana/bi-3.8$

The following directories show have contents like these.

bi-3.8
|-- administration-console
|-- bi-server-ce

PostgreSQL Java Connector

You have to download postgresql java connector from here http://jdbc.postgresql.org/ . Then put java connector to library path like these.

wattana@localhost:/home/wattana/bi-3.8/biserver-ce/tomcat/lib/postgresql-8.4-703.jdbc4.jar
and
wattana@localhost:/home/wattana/bi-3.8/administration-console/jdbc/postgresql-8.4-703.jdbc4.jar


Configuring PostgreSQL Database

If you follow (2) you must edit script to run on postgresql. You can ask me for postgresql backup archive.!

to create databases run this command

wattana@localhost:/home/wattana $ su                                                    
wattana@localhost:/home/wattana $ su - postgres
postgres@localhost:/var/lib/postgersql $ createuser -d -s -P wattana      # create super user for database
# then create databases
wattana@localhost:/home/wattana $ createdb -U wattana shark
wattana@localhost:/home/wattana $ createdb -U wattana quartz
wattana@localhost:/home/wattana $ createdb -U wattana hibernate
wattana@localhost:/home/wattana $ createdb -U wattana sample data

After you created database you must open script files from (1)  and edit them correctly for postgresql

wattana@localhost:/home/wattana $ psql -U wattana -d hibernate < hibernate.sql wattana@localhost:/home/wattana $ psql -U wattana -d quartz < quarz.sql wattana@localhost:/home/wattana $ psql -U wattana -d shark < shark.sql wattana@localhost:/home/wattana $ psql -U wattana -d hibernate < sampledata.sql


Here you can now follow (2). It's perfect!

After that if you start pentaho by 
wattana@localhost:/home/wattana/bi-3.8/biserver-ce# ./start-pentaho.sh

you may get error about system listener error,


When trying to access the Pentaho BI platform (http://localhost:8080), if you have this error
Error while trying to execute startup sequence for org.pentaho.platform.scheduler.QuartzSystemListener
Then you’ll find a file pentaho.xml in biserver-ce/tomcat/conf/Catalina/localhost/
Replace the contents (or modify the settings) with the same from biserver-ce/tomcat/webapps/pentaho/META-INF/context.xml
Hope it helps someone.

You can follow (4) to solve this.

















วันพฤหัสบดีที่ 23 กุมภาพันธ์ พ.ศ. 2555

Auto-responder บน Postfix กับ Virtual Domain

ตามชื่อเลยครับ Auto-responder หรือบางคนก็เรียกว่า auto reply  ปกติแล้วการทำ auto-reply มันจะง่ายมากถ้าหากเป็นการติดตั้ง postfix แบบ domain เดียว เพราะค่า configure ต่าง ๆ สำหรับแต่ละ user ก็จะเป็นการกำหนดค่าของแต่ละ user ใน home directory นั่นเอง

แต่พอเป็น Virtual Domain/ User เราก็ต้องมาศึกษากันอีกทีว่าทำอย่างไร

พูดถึง Postfix พอเราไปดูก็จะพบว่า การใช้งาน Autoresponse ไม่ได้พูดถึงมานานแล้ว ก็คงเป็นเพราะว่าเดี๋ยวนี้เป็นการติดต่อแบบ realtime คือใช้งานผ่าน มือถือ social network แล้ว

แต่ก็ขอเขียนไว้ที่นี่ถึงวิธีการสักหน่อยเผื่อต้องใช้งาน auto-reply กันจริง ๆ

เริ่มจาก หน้านี้ http://workaround.org/ispmail/etch ก็จะพูดไว้ว่ามีคนทำ add-on ไว้เหมือนกันที่ http://www.remofritzsche.ch/goldfish/  แต่ก็อยากให้ไปอ่านต่อที่ http://eugenesklyar.com/roundcube-autoresponder-goldfish-autoreply-plugin เพื่อติดตั้ง plug-in ของ roundcube เพื่อเปิดให้ user ทำการกำหนดค่าเองได้ด้วย

พอผมมาดูก็ปรากฏว่าต้องมีการแก้ไขบางอย่างอีกนิดหน่อยกว่าจะใช้งานได้

แก้ไขไฟล์ autoresponder.php (ที่ได้จาก http://www.remofritzsche.ch/goldfish/ ตอนนั้นเป็น Version 1.0-STABLE)


/* General */
    $conf['cycle'] = 5 * 60;
   
    /* Logging */
    $conf['log_file_path'] = "/var/log/autoreply";
    $conf['write_log'] = true;
 
   
    # This query has to return the path (`path`) of the corresponding
    # maildir-Mailbox with email-address %m
    $conf['q_mailbox_path'] = "SELECT CONCAT('/home/vmail/', SUBSTRING_INDEX(email,'@',-1), '/', SUBSTRING_INDEX(email,'@',1), '/Maildir/') as `path` FROM virtual_users WHERE `email` = '%m'";
   
    # This query has to return the following fields from the autoresponder table: `from`, `to`, `email`, `message` where `enabled` = 2
    $conf['q_forwardings'] = "SELECT * FROM `autoresponder` WHERE `enabled` = 1 AND `force_enabled` = 1;";
   
    # This query has to activate every autoresponder entry which starts today
    $conf['q_enable_forwarding'] = "UPDATE `autoresponder` SET `enabled` = 1 WHERE `from` >= CURDATE();";
   

ภายหลังจากของใช้งานจาก /usr/bin/php autoresponder.php แล้วก็จะพบว่ามีการส่ง email ออกไปแล้วตามกำหนดค่าของ $conf['cycle'] คือเป็นการกำหนดว่าจะทำการส่ง auto-reply ให้กับ email ที่ส่งเข้ามาหา user คนนี้ไม่เกิน 5 นาที (5x60 วินาทีนั่นเอง)


วันอังคารที่ 14 กุมภาพันธ์ พ.ศ. 2555

ระบบต่อไป อะไรเอ๋ย?

ระบบต่อไป... อะไรเอ๋ย?

ดูเหมือนช่วงนี้วุ่น ๆ กับการติดตั้งเพื่อใช้งานระบบ นี่ก็พึ่งจะได้ระบบ Survey มาใช้งาน ด้วยระยะเวลาอันน้อยนิด

ต่อมาคงเป็นระบบประมาณนี้

http://www.postgis.org/documentation/casestudies/2008-09-rento/





แนวคิดแบบนี้จะติดตามมาอีกเยอะในอนาคต เช่น



  • จากตรงนี้ โรงหนังที่กำลังจะฉายเรื่อง Titanic ณ เวลา 14:00 น. มีที่ไหนบ้าง โดยใช้เวลาเดินทางไม่เกิน 30 นาที
  • ข้าวขาหมู อร่อย ๆ ที่ยังไม่เคยไปกิน และมีเพื่อนอยู่ใกล้ ตรงนั้น (จะได้ชวนกันไป)



วันศุกร์ที่ 30 กันยายน พ.ศ. 2554

Manually Build Pentaho Bi-Server on Debian

อ้างอิงจาก http://www.prashantraju.com/2010/03/customising-the-pentaho-user-console-part-3/ และ http://phytodata.wordpress.com/2011/01/17/how-to-build-the-pentaho-biserver/

เหตุเกิดก็ตอนที่ต้องการจะ build pentaho เพื่อแก้ไข menu ตาม page ที่อ้างอิงนั้นแหละ แต่ไม่อยากติดตั้ง Eclipe เพราะว่ามันใหญ่เกินไป

ก็เลยต้องทำการ build บน Debian   มาเริ่มกันเลย

ติดตั้ง package ที่จำเป็น
# aptitude  install sun-java6-bin sun-java6-jre sun-java6-jdk sun-java6-plugin sun-java6-fonts ant
# update-alternatives --config java

ติดตั้ง subversion
# aptitude install subversion


checkout pentaho
$ mkdir sources
$ svn co http://source.pentaho.org/svnroot/bi-platform-v2/tags/3.8.0-stable bi-3.8-stable

เริ่ม build กัน
$ cd bi-3.8-stable
$ cd bi-platform-build
$ ant -v publish-all

ผมใช้เวลาไปประมาณ 1 ชั่วโมง เพราะว่า internet มันช้าเกิน

แก้ไขส่วน Mantle
$ cd mantle
แล้วทำการแก้ไข menu ที่ต้องการตามเอกสารอ้างอิง
จากนั้นก็ compile ใหม่
$ ant
แล้วก็ copy mantle, mantleLogin และ mantle-3.5.0.stable.jar 

... เดี๋ยวขอเขียนไว้เท่านี้ก่อน รายละเอียดจะมาใส่ที่หลัง

วันอังคารที่ 20 กันยายน พ.ศ. 2554

postgresql cluster บน Debian

เป็นที่เข้าใจกันว่าหากทำการติดตั้ง PostgreSQL แล้ว package manager จะทำการกำหนดค่าต่าง ๆ ไว้ รวมถึง Folder ที่เก็บ Data

แต่โดยส่วนมากแล้วผมจะสร้าง partition ไว้สำหรับเก็บ Data ไว้ต่างหาก ทำให้เวลาจะใช้งาน PostgreSQL ทีไร ต้องมาทำการแก้ไขค่า configure ต่าง ๆ ยุ่ง

มาคราวนี้ทาง Package นั้นมีเครื่องมือต่าง ๆ ไว้ให้เล่นอีกมากมาย เช่น

  • pg_createcluster
  • pg_dropcluster
  • pg_upgradecluster
  • pg_ctlcluster
  • pg_lsclusters
ผมเลยขอย้าย Data Directory ไปไว้ที่ /db/PGDATA/8.4/main

เริ่มจาก ตรวจดูก่อนว่า cluster เดิมของเราอยู่ที่ไหน



# pg_lsclusters
Version Cluster   Port     Status     Owner        Data directory                         Log file
8.4         main      5432    online    postgres      /var/lib/postgresql/8.4/main    /var/log/postgresql/postgresql-8.4-main.log

ลบ cluster เดิมออก
# pg_dropcluster --stop 8.4 main

สร้าง Folder ไว้รอก่อน
# mkdir -p /db/PGDATA

สร้าง cluster 


# pg_createcluster -u postgres -d /db/PGDATA/8.4/main  --locale=en_US.utf8 --start --start-conf=auto  8.4 main 
Creating new cluster (configuration: /etc/postgresql/8.4/main, data: /db/PGDATA/8.4/main)...
Moving configuration file /db/PGDATA/8.4/main/postgresql.conf to /etc/postgresql/8.4/main...
Moving configuration file /db/PGDATA/8.4/main/pg_hba.conf to /etc/postgresql/8.4/main...
Moving configuration file /db/PGDATA/8.4/main/pg_ident.conf to /etc/postgresql/8.4/main...
Configuring postgresql.conf to use port 5432...

ตรวจดูความเรียบร้อย
# pg_lsclusters 
Version   Cluster   Port     Status    Owner       Data directory                     Log file
8.4          main       5432    online   postgres     /db/PGDATA/8.4/main      /var/log/postgresql/postgresql-8.4-main.log


เรียกได้ว่าเหนื่อยน้อยลงเยอะ


5 Nov 2012:
วันนี้พอเอกสารอ้างอิง อีกอันทีนี่ http://people.debian.org/~mpitt/architecture.html


วันพุธที่ 27 กรกฎาคม พ.ศ. 2554

exfat

ผมมักจะมีปัญหากับ usbdisk โดยเฉพาะอย่างยิ่งเวลาต้องใช้งานทั้ง 3 ระบบ คือ Mac, Linux และ Windows

แรก ๆ ก็ใช้ file system เป็น fat แต่พอติดปัญหาเรื่องของขนาดของข้อมูลที่มีปริมาณมาก ๆ ก็ใช้งานไม่ได้ อีกทั้งเดี๋ยวนี้ไม่ค่อยมีเครื่อง Windows ใช้งานเท่าไหร่

สุดท้ายก็มาลงตัวที่ exFat  มันใช้ได้ทั้ง Windows, Linux และ Mac

ส่วนการใช้งาน exFat บน Linux นั้นต้องติดตั้ง package ตามนี้ก่อน

Debian # aptitude install scons
Debian # wget http://exfat.googlecode.com/files/fuse-exfat-0.9.5.tar.gz
Debian # cd fuse-exfat-0.9.5
Debian # scons install
Debian # mkdir /media/exfat
Debian # modprobe fuse
Debian # mount.exfat /dev/sda1 /media/exfat/
Debian # echo 'fuse' >> /etc/modules

เท่านี้เราก็สามารถใช้งาน usbdisk ที่เป็น exfat ได้แล้วครับ