วันพฤหัสบดีที่ 7 พฤศจิกายน พ.ศ. 2556

The way to cloud!

I have installed our system in private servers on Data Center in Thailand more than 5 years. This is the time to decide to stay with old infrastructure or going to try new technologies.

By the way!

Buy new servers and setup new system or try cloud!

Why Cloud?

The answer for future is "We need to scale".

Service Models


It's seem like i need to go to IaaS. Because our components can not fit in PaaS. But in the future i will go to provide our solution to SaaS.





วันจันทร์ที่ 4 พฤศจิกายน พ.ศ. 2556

dovecot sieve duplicate email message discard

After we finished install ISPConfig3, and configure all email forward and do redirect script in sieve. Unfortunately many duplicate messages happen!

So we try to google to find the way we can solve this issue!

-- We need develop package , dovecot-dev and dovecot-managesieved

# aptitude install dovecot-dev dovecot-managesieved
-- Unfortunately without pigeonhole we can not implement pigeonhole extension.

# wget http://pigeonhole.dovecot.org/releases/2.1/dovecot-2.1-pigeonhole-0.3.6.tar.gz
# tar xzvf dovecot-2.1-pigeonhole-0.3.6.tar.gz
# cd dovecot-2.1-pigeonhole-0.3.6
dovecot-2.1-pigeonhole-0.3.6# ./configure --with-dovecot=/usr/lib/dovecot
dovecot-2.1-pigeonhole-0.3.6# make
dovecot-2.1-pigeonhole-0.3.6# make install
# cd ..
-- Download and install duplicate extension

# wget http://hg.rename-it.nl/pigeonhole-0.3-sieve-duplicate/archive/tip.tar.gz# tar xzvf tip.tar.gz# cd pigeonhole-0-3-sieve-duplicate-6319bd61b834/pigeonhole-0-3-sieve-duplicate-6319bd61b834# ./autogen.shpigeonhole-0-3-sieve-duplicate-6319bd61b834# ./configure --with-dovecot=/usr/lib/dovecot --with-pigeonhole=/usr/include/dovecot/sievepigeonhole-0-3-sieve-duplicate-6319bd61b834# makepigeonhole-0-3-sieve-duplicate-6319bd61b834# make install
-- When finished install duplication we need to link seive to /usr/local/lib/dovecot/sieve


/usr/lib/dovecot/modules# ln -s /usr/local/lib/dovecot/sieve sieve

-- Then need to do sieve_before script to serve all custom_mailfilter for every user.

# cd /home/vmailhome/vmail# mkdir sievehome/vmail/sieve# vi duplicate-discard.sieve

--- edit file duplicate-discard.sieve like this

require "vnd.dovecot.duplicate";  
if duplicate {
     discard;
     stop;
}
-- compile sieve script

home/vmail/sieve# sievec duplicate-discard.sieve
-- edit dovecot configuration file in plugin directive

# vi /etc/dovecot/dovecot.conf

.. edit plugin like this

plugin {  quota = dict:user::file:/home/vmail/%d/%n/.quotausage  sieve=/home/vmail/%d/%n/.sieve  sieve_plugins = sieve_duplicate  sieve_extensions = +vnd.dovecot.duplicate  sieve_duplicate_period = 10m  sieve_before = /home/vmail/sieve/duplicate-discard.sieve}
-- Restart dovecot

# /etc/init.d/dovecot restart


reference

วันจันทร์ที่ 21 ตุลาคม พ.ศ. 2556

Hosting Service with ISPConfig

After we've run our solution for Web, Mail Hosting for long time. We decide to use ISPConfig (http://www.ispconfig.org/) in our solution.

With now ISPConfig 3.0.5 (http://www.ispconfig.org/) You could do most of things that administrator can do to manage your client.

It's very good product. It's very easy to start hosting.


วันเสาร์ที่ 3 พฤศจิกายน พ.ศ. 2555

Python? Django?

ช่วงนี้ Python กำลังรุมเข้ามา รวมทั้งคำถามต่าง ๆ มากมาย
ส่วนตัวแล้วใช้งาน Python ทำงานอยู่แล้ว  มันไม่ได้มีอะไรพิเศษมากมาย ไปกว่า ภาษาอื่น ๆ เท่าไหร่ แต่ที่ผมสนใจคือ ความเรียบง่าย และการจัดการที่เป็นระเบียบ มันเรียบง่าย แบบ "Simple is all complexities behind"

มันเป็นระเบียบจนบางคน บอกว่ามันเกินไปด้วย

แต่สำหรับผมที่เคยใช้ C PHP Java ผมคิดว่าสิ่งที่สำคัญของการพัฒนาร่วมกันคือ coding standard ซึ่งถ้าเป็นภาษาอื่น ๆ นั้น เวลาพัฒนาต้องมากำหนดกันให้รัดกุมเลยทีเดียว

อีกสิ่งหนึ่งที่สำคัญคือ Document on Coding หรือไม่ก็คู่มือการใช้งาน เพราะการพัฒนาอะไรขึ้นมานั้น ถ้าหากมีที่ไปที่มาได้แล้ว การดำเนินการต่อโดยตนเองหรือผู้อื่น นั้น ก็จะเป็นอะไรที่ง่ายต่อการเข้าใจได้

เพราะว่าหากเรากำลังพัฒนาอะไรซักอย่าง แล้วสามารถมีคนนำไปใช้ต่อได้นั้น ย่อมเป็นประโยชน์ไม่มากก็น้อย

เมื่อกล่าวถึงตรงนี้ ก็ขอ รวบรวมสิ่งที่ผมได้จากประสบการณ์ในการทำงานพัฒนาระบบ ดังนี้


  1. กำหนดไปให้แน่นอนเลยว่าเราจะพัฒนาอะไร
  2. ในสิ่งที่จะพัฒนานั้น สามารถแยกเป็นส่วนย่อย ๆ ได้หรือไม่ ถ้าได้ก็กำหนดให้แต่ละส่วนแยกออกจากกัน และสามารถรวมกันได้ในภายหลัง (http://en.wikipedia.org/wiki/Separation_of_concerns)
  3. จากส่วนต่างๆ ที่แยกออกมาจากกันนั้น ก็ให้ทำในแต่ละส่วนให้ดีที่สุด
  4. ถ้าหากในส่วนย่อย ๆ ใดมีคนที่เคยทำไว้แล้ว ให้นำกลับมาใช้ หรือนำมาปรับปรุงให้ดีขึ้น
  5. กำหนดอายุของระบบที่เราจะพัฒนา เช่น 5 ปี 10 ปี เพราะว่าไม่มีอะไรยืนยาว หรือไม่ก็กำหนดไปเลยว่าเมื่อถึงเวลาที่มีเทคโนโลยีอะไรที่ดีกว่า ก็แนะนำให้ลองเปลี่ยนแปลงดู
  6. นึกถึงคนอื่นที่ต้องมาสานต่อด้วย
  7. ทำทุกอย่างให้ง่าย เข้าใจง่าย อ่านง่าย ไว้

และสิ่งที่ผมเขียนไว้ ผมจะลองทำดูกับ django ที่ผมกำลังทำระบบอยู่
ref: http://en.wikipedia.org/wiki/Separation_of_concerns

วันศุกร์ที่ 2 พฤศจิกายน พ.ศ. 2555

ผ่านไปอีกวัน

มันผ่านไปด้วยอาการหืดหอบ

  1. ถ้าเป็นเมื่อ 5 ปีที่แล้ว ตัดสินใจได้เลย
  2. สิ่งที่ผมคิดจะทำ เหมือนกันกับที่ท่านกำลังจะทำ
  3. python มันยังครองโลกต่อไปอีก
  4. ชีวิตมีอะไรมากกว่างาน

วันพุธที่ 31 ตุลาคม พ.ศ. 2555

What make me here?

Life has no boundaries
...
Thank for พระพุทธเจ้า to give me the way to do
Thank to my family for living
Thank for my teacher to teach
Thank for friend to completed me
Thank for other to support me
...

Favorit
Music: Classic, Soundtrack,
Band: X-Japan, Within Temptation,
Movie: ET, Star war, Beautiful mind,
Cartoon: Ghibli
Country: Thailand, Japan, Germany,
Hobby: Traveling, Book, Movie,

Far Future
50-year old
A little house on High mountain
2 dogs run around me
A few farm
Fresh air

Near Future
Contribute my knowledge to community

Next
MQ i don't want to "lost" anything
Twisted Matrix "amazing project"

Migrate
PHP to Python
SQL to ORM
html to template
Web page to Web Application
Horizontal to Vertically
Everyone is user for system
"in Band, very skilled and less skilled musician need to adopt together"

Platform
2012
We need other platform
Codeigniter.... no
Cake PHP ... no
Zend ... no
Symfony ... no
Java? ... no
Python ... yes
django ... yes
"Simple is more complexities behind"

Software Project Management
2007
Flag ship, CRM
Project management on Trac
Revision control on SVN
{{Applications}}
CRM, Case management, Knowledge management
Sales Management, Marketing Management
Email Mass Marketing
Business Inteligent
{{Application}}
We'd get our platform?
Hosting service
Customization service
Software as service
Cloud service
Python
django, my hero
"Service on Software"

Size Does Matter
2006
Fast growing database, web application was delivered to biggest TV response company
AIX RS/600 was amazing in Thailand
PostgreSQL on AIX, Possible here!
... Now our system serve more than 150GB of data...
... more than 500 users concurrent ...
"Big Huge Giant"

Software Engineering
2003
Requirement analysis
Design
Documentation
Develop
Project management
Implement
Maintain
Version control was implement
CVS SVN
Software Test
Software Quality
"Imagine is more important"

Coding Era
2001
Open source came back
PHP + PostgreSQL+ Apache
First software/service served for businesses
All software written for web, web page!
"team work"

Telephony Network
2001
Move to PABX system
Where voice and data merge here!
Business applications, CRM, messaging system, monitoring software were introduced
Many software are integrated together to complete requirement
"meeting, meeting, business!"

Work!
2000
1-year computer networks, internet servers
ATM, Router, Switch had been setup to serve user
Some on MCU to make meeting over network
We served 600 users with single mail server! with Linux Debian
Open source begin!
Python first introduced
"i'm hungry to know more"

Big Moves
1999
Rosenheim, Germany was next moves
Signal Processing in Big Firm, Siemens
Linux first come in to my life
Environment change
Vision changes
Attitude changes
Life changes
Explore Resenheim
"2nd miracle, Amazing! Incridible"

University
1999
Electrical Engineering Department
Computer/Communication was my major
Digital Image processing using DSP was my project
i fork here
"First miracle, it happend all the time."

Technical School
1996
Knight Rider brought me here
"Time and Time to wait and go for get it"

Next School
1993
Math-Sci was my major here
Music, was my hobby
Trumpet, French-horn were my next instruments in school band
"in a Band, very skilled and low skilled musician need to adopt together"

School
1990
My school was near Wat
I had to walk to school from home every day
I played music on last 3 year in first school
My first instrument was melodeon
"music is one of meditation"

Childhood
I was the second child of three children
We lived close to Wat
I have to learn Buddhism without knowing it
"know nothing means know everything"

Begin
1977
I was born on 10 April
Male
Bangkok, Thailand was my birth place
"a Child can make things"

วันอาทิตย์ที่ 21 ตุลาคม พ.ศ. 2555

PHP Spreadsheet_Excel_Writer with text format

ในการสร้าง Excel ด้วย PHP นั้น ผมก็ใช้  Spreadsheet_Excel_Writer  เพื่อช่วยสร้าง Excel  
ปกติแล้ว เราก็กำหนด Format ของ ตัวเลข วันที่ ค่าเงิน จาก function setNumFormat() แต่พอต้องการแสดงหมายเลขโทรศัพท์ โดยเฉพาะที่ขึ้นต้นด้วย "0" ก็จะมีปัญหาที่เวลาแสดงใน excel แล้ว เลข "0" จะหายไปทำให้แสดงค่าผิดพลาด 

ค้นหาไปก็หลาย ๆ ที่แล้วก็บอกว่าให้ช้ setNumFormat('@') ตามนี้ (http://pear.php.net/manual/en/package.fileformats.spreadsheet-excel-writer.spreadsheet-excel-writer-format.setnumformat.php) แต่พอนำไปใช้งานก็ยังเป็นปัญหาอยู่

สุดท้ายก็ต้องไปแก้ที่ต้นทางเลยคือที่ Worksheet.php ตามนี้ (http://pear.php.net/bugs/bug.php?id=3514) หรือไม่ก็ไปใช้ writeString() แทน write() ที่ทำการตรวจสอบค่าทีหลัง 

แต่ผมใช้การกำหนด setNumFormat('@') เป็นอย่างนี้แล้วก็ไปเพิ่ม

function write($row, $col, $token, $format = null)
    {
        // leading zero or string format
        if ($format->_num_format=='@') // || preg_match("/^0/", $token))
               return $this->writeString($row,$col,$token,$format);


 สุดท้ายก็ขอขอบคุณ opensource ไว้เพราะว่าทำให้เราแก้ไขได้เอง และศึกษาเข้าไปในส่วนต่าง ๆ ได้อีก