Microsoft Outlook 2010 with Microsoft Online Service
For a moment that I search for the way to add the Microsoft Exchange ,which provided by Microsoft Online Service, manually add to the Microsoft Outlook 2010. This issue is occurs because the current Microsoft Online Service Single Sign-on client that install beside a client is not support for the Microsoft Outlook 2010 yet.
Finally, I found the solution from here. The way is that
- Login to your Microsoft Office Outlook Web Access that your company provided
May be https://red003.mail.apac.microsoftonline.com/owa or
https://red002.mail.emea.microsoftonline.com/owa or
https://red001.mail.microsoftonline.com/owa that is up on your region. (Information found here) - After you logged-in, Goto Options > About. Here, you will found the information that will use in the future
Looking for the Line
[Noted as B] Outlook Web Access host name: red003.mail.apac.microsoftonline.com
[Noted as A] Mailbox server name: SAMPLENAME.red003.local - Now, close your Microsoft Outlook 2010
- Go to Control Panel > E-Mail Account > Add New Email Account
Select Microsoft Exchange or compatible service
Add (A) to the Server
Type your username (Your full email address) to the username
Go to Connection tab > Select Connect to Microsoft Exchange using HTTP
In the URL, use information from (B)
Add information as below

- If everything correct, when you click Check Name, you will see a dialog to input your username and password
Subversion: Summary Useful Subversion Command
To commit the code, or sometimes that we would like to summarize which files we changes and what we change, we can use the following command to generate the difference between file in the repository and the working copy of ALL file.
Notes
In this command will show only the exists files which got changed. for the new file which just add to current working copy will not show up.
To see the user commit in the Subversion repository.
This command will help to filtering the view when we want to know the change of each file. Normally it will not show what it is changed. It possible that the file just move, or have a new properties but the contents have not change. So, this command will help to know the last change of each file.
DirectAdmin with Amazon AMI 32/64 Bits
This is guideline extend from previous general guideline to focus on the Amazon AMI 64 bits which based on CentOS/RHEL library.
Instance Configuration on Tested
- Basic 32-bits Amazon Linux AMI 2011.02.1 Beta (AMI Id: ami-6ef08e3c)
- DirectAdmin License (CentOS 5 - 32 Bits)
- Micro instance
- 1 Elastic IP Address
Pre-installation
# Make a symbolic link of missing library for DirectAdmin binary file (WARNING: This is may not the correct way)
ln -s /usr/lib/libcrypto.so /usr/lib/libcrypto.so.6
ln -s /usr/lib/libssl.so /usr/lib/libssl.so.6
Now, continue with general guideline here.
sed patterns – Streaming Editor Patterns
Patterns to change Serial number of DNS record DB
# Looking for 10 digits of Date
# Replace All matched with 2011041501
# All file that end with .db
sed -i 's/201[0-9]\{7\}/2011041501/g' *.db
sample of matched pattern,
Stop DirectAdmin Instance on Amazon EC2
This is things that you have to aware when you have to do something with a DirectAdmin instance.
Stop DirectAdmin instance
- Private IP Address will be change when start the instance
- Symbolic link in /tmp must rebinding.
- Software that licensing by IP Address
- Software that licensing by MAC Address
- Use AWS console to rebind Elastic IP address back to the instance
Warm Reboot DirectAdmin instance
- Running by `init 6`
- Private IP is not changed.
- local storage still mount to the volumn (ex. /mnt).
Limitation of DirectAdmin on Amazon EC2
This is some limitation of DirectAdmin when deploy in Amazon EC2.
Experience with outbound packet from DirectAdmin. Every features that needs outbound connection in DirectAdmin will not work. This is because the DirectAdmin configuration will automatically use interfaces in DirectAdmin configuration (also present as DirectAdmin License). The known functions that not working properly such as
- Automatic grab the license
Workaround: You have to use /usr/local/directadmin/scripts/getLicense.sh to manually grab your license. - Auto DirectAdmin Update
Workaround: You have to use /usr/local/directadmin/scripts/getDA.sh to manually upgrade your DirectAdmin. - Multi Server for DNS Service
Workaround: None
You cannot bind more than 1 ip address to each instance. You can have only 1 IP Address each instance.
- You cannot specific IP address to specific domain name. (Because you have only 1 IP Address).
- You cannot use SSL with specific IP Address. You may use Shared SSL as normally.
DirectAdmin in the Amazon EC2
Everything is now pointing to the cloud, how about Shared web hosting service? Nowadays, Cloud computing had been talking wildly in the topic of IaaS (Infrastructure as a service) which reduce costs in the machines resources and maintenance costs. This tutorial provide guideline to make Shared web hosting service based on Amazon EC2.
Assume that you already have Amazon AWS account. (If not, create one)
Reserve one of the Elastic IP address
In the most first step, you should reserved one elastic ip address. This ip address use to request for DirectAdmin license. You may wait for DirectAdmin license confirmation before continue in next step to save your EC2 instance costs.
Setup Security Group
Now, it is turn that you going to Amazon AWS Management Console, you have enable some ports to make your instance access from the Outside. You must add DNS, 21 (FTP), 2222, SSH, SMTP, SMTPS, IMAP, IMAPS, HTTP, HTTPS to your instance security policy. 2222 is known as DirectAdmin control panel default port.
Create Amazon EC2 Instance
When create an Amazon EC2 instance, I preferred to use Large -- an instance type. that take you benefits from high-memory and compute units. If you willing to use small or tiny, you will experience with very slow during compile step. You may use Large instance and then change to Tiny/Small later when system has completed installation and it is ready to be use.
Preferred : Large Amazon EC2 Instance
in the reference topic, they use CentOS x64. I have use Ubuntu 10.04 LTS x86 and it work well.
Running Amazon Instance
Once you created, run it and login to your instance. If you use Ubuntu 10.04 LTS x86 AMI from Amazon Community, you must use 'ubuntu' as username, and use authorized key when you created the instance. Now is step-by-step to install DirectAdmin
- Following DirectAdmin Pre-requirement guideline to install package that required by DirectAdmin. You also following the DirectAdmin installation guide here.
- Get setup script from DirectAdmin
wget http://www.directadmin.com/setup.sh - Remove bind-address from setup.sh script. Make it go though private interface (but it will be elastic IP address show up at DirectAdmin Licensing)
sed -i 's/--bind-address=\$IP//;' setup.sh - Attached Elastic IP Address to the instance interface
ifconfig eth0:0 inet $YOUR_IP_ADDRESS_HERE netmask 255.255.255.255 up - Running screen command to protect installation step from connection lost of your machine. this command will make Installation script running even you lost connection. (When you login back to the system can get back the previous session)
screen - Open the second terminal, We need to running one script parallel with installation process
- You may Replace this step with the next one
In the second terminal, be sure that you are root privilege and running following command
cd /usr/local/directadmin/scripts; while [ true ]; do sed -i 's/--bind-address=\$IP//; s/--bind-address=\${3}//;' *.sh > /dev/null > 2&>1; sleep 1; done
This script will be execute itself in infinite loop. You just terminate when installation completed. This is because when you run setup script, it will be download some of setup script that inside have --bind-address paramter which make you cannot retrieve the destination. - This step have replaced the previous one.
sed -i 's/tar xzf update.tar.gz/tar xzf update.tar.gz\n[JOMYUT]/' setup.sh
sed -i 's/\[JOMYUT\]/sh fix-binding.sh/' setup.sh
echo "cd /usr/local/directadmin/scripts/" > fix-binding.sh
echo "sed -i 's/--bind-address=\\\$IP//; s/--bind-address=\\\${3}//;' *.sh" >> fix-binding.sh
chmod 755 fix-binding.sh - Back to the first terminal, running setup script
./setup.sh $CLIENT_ID $LICENSE_ID $YOUR_HOSTNAME eth0:0 $ELASTIC_IP
Replace $CLIENT_ID with your client id received in DirectAdmin license
Replace $LICENSE_ID with your license id received in DirectAdmin license
Replace $YOUR_HOSTNAME with your hostname of this machine that you want
Replace $ELASTIC_IP with your elastic ip that you binding to current instance
Finalize Step
After completed the installation, you have to add ec2-user or ssh user back into /etc/ssh/sshd_config file. this is because DirectAdmin installation have change it. Just put your username in the last line. otherwise, the next time you will not able access SSH by your username. However, if you forget this step, you may use Administrator username that DirectAdmin provide on the final setup screen.
You may reconfigure the PHP temporary file path, PHP session path to the local storage. This configuration will help you save costs from EBS I/O but remembered that any data in local storage will be lost when stop the instance. So, remember to use it as temporary file only.
Boot script
- If you customize the machine such as PHP tmp path, PHP session path, you have to make a script that make temporary folder in local storage everytime that restart the instance. Any data in local storage will be lost when stop the instance. if you use `init 6` to restart your instance, data will still in your local storage.
- Wake up your License Ethernet connection when restart machine Set up your IP address in the /etc/interfaces to make it binding when startup the instance
cd /etc/network
echo "auto eth0:0" >> interfaces
echo "iface eth0:0 inet static" >> interfaces
echo "address $YOUR_ELASTIC_IP" >> interfaces
echo "netmask 255.255.255.255" >> interfaces
Test Running
Now, reboot! Hurey!, you may test your control panel after restart the instance, try login to your Control Panel.
Change Apache Template
At the time I wrote this guideline, Amazon can have only 1 Elastic IP per instance. Any incoming package will sent to internal ip address. This make a problem with default Apache config which handle each IP address in its configuration. So, we change /etc/httpd/conf/ips.conf to be global address instead of per IP address.
However, in any users created, it will also use IP address, so, we have to change httpd template where is in /usr/local/directadmin/data/templates/
find . -name "*virtual_host*" -exec sed -i 's/|IP|/\*/' '{}' \;
find . -name "*virtual_host*" -exec sed -i 's/|MULTI_IP|//' '{}' \;
The above command will replace all IP address in every apache template to be global (*). and remove |MULTI_IP| because you cannot use this features.
Now, try to create new user account and test.
Watch Out
the directory /usr/local/directadmin/data/templates/ will be replaced when get DirectAdmin update. you should backup whole directory and replace back after update your DirectAdmin.
Done.
[Update on 20 Apr 2011] setup.sh - add enhancement for detect update.tar.gz extraction.
TODO: /templates/custom in the last section
TODO: Add full EC2 management script to the entry
Install PHP 5.2/5.3 in the same machine
This is solution for DirectAdmin machine owner who would like to use both version of PHP5 in their system. First, you may see reference topic here and here. To install both PHP versions with custombuild, you are require to trick the DirectAdmin with PHP6 configuration because DirectAdmin itself doesn't support both PHP5 working at the same time.
One solution to choice
In the solution I provided, I make PHP5.3 as default compiler running as CLI. and PHP 5.2 can be optional used with .htaccess level configuration. (running by suPHP)
- Change the custombuild build script to version 1.2
cd /usr/local/directadmin/custombuild/
./build set custombuild 1.2 - Change automatic download new versions.txt to be No.
Later, explained../build set autover no - Build update and copy PHP5 configuration to PHP6 custombuild path
./build update
mkdir -p custom/suphp
cp -pf configure/suphp/configure.php5 custom/suphp/configure.php6 - For me, I implement PHP5.3 running as CLI and PHP5.2 as CGI by suPHP. This is difference from referenced topic
perl -pi -e 's/php5\:/phprep\:/' versions.txt
perl -pi -e 's/php6/php5/' versions.txt
perl -pi -e 's/phprep/php6/' versions.txt - Set build options
./build set php5_ver 5.3
./build set php6_cgi yes
./build set php6_cli no
./build set php5_cgi no
./build set php5_cli yes
Note that php6 is a configuration for PHP 5.2 and PHP5 is a configuration for PHP 5.3 and running as default engine. - Build both PHP versions.
./build php n - Change path of the PHP 5.2 package
Now, below is a configuration for PHP 5.2 based website. you have to put these code in .htaccess to root of public_html directory
AddHandler x-httpd-php6 .php
</FilesMatch>
if you don't like to use x-httpd-php6, you may change to x-httpd-php52 or somewhat you want. but you have to config below files
perl -pi -e 's/x-httpd-php6/x-httpd-php52/' /usr/local/suphp/etc/suphp.conf
perl -pi -e 's/x-httpd-php6/x-httpd-php52/' /etc/httpd/conf/extra/httpd-suphp.conf
Now, you can use website with PHP 5.2 and PHP 5.3 upon .htaccess configuration.
Netbean : Selected PHPUnit (version ?.?.?) is too old
If you experience with error message from Netbean "Selected PHPUnit (version ?.?.?) is too old, upgrade it if possible". you may set your PHP configuration file incorrected.
Try add Windows Environment variables
- PHPRC - Specific location of your PHP configuration file.
- PATH - add Path of your PHP execution file.
Try command line at your PHP binary directory
> phpunit
Verify that you MUST see manual page of phpunit command, otherwise, I may experience with your PEAR download problem. Try re-install them.
PHPUnit + Selenium = Code Coverage Report
โดยปกติ PHPUnit ซึ่งใช้ทำ Unit test นั้น จะไม่สามารถทำการทดสอบผ่านเว็บบราวเซอร์ตรงๆได้ ดังนั้น ถ้าหากใช้รูปแบบการพัฒนาโปรแกรมแบบ MVC อาจจะทำการทดสอบได้เฉพาะ Model เท่านั้น หากจะทดสอบ View / Control ต้องใช้เครื่องมือคือ Selenium ในการทำการทดสอบผ่านหน้าเว็บบราวเซอร์
ดังนั้น ถ้าเราต้องการสร้าง Code Coverage Report ขึ้นมา จะต้องทำผ่าน Selenium Interface ด้วย. ผมได้เขียน Guideline ในการสร้าง Code Coverage Report กับ Yii Framework ไว้ที่ Yii Framework Forum ครับ รายละเอียดสามารถตามอ่านได้ตามลิงค์
เครื่องมือที่ผมใช้พัฒนา PHP ประกอบด้วย
- Apache 2
- Windows 7
- Netbeans 6.9.1 พร้อมกับ Selenium Plugin
- PHP 5.3 กับ XDebug module
- PEAR/PHPUnit
จริงๆ แล้วใน Netbeans website มี Tutorial อยู่เช่นกัน แต่ว่า ในส่วนนี้ ผมจะแนะนำสำหรับคนที่ทำเวอร์ชวลโฮส ที่มีเว็บไซต์หลายๆเว็บไซต์ภายในเครื่อง. แนะนำให้ทำเฉพาะเครื่องสำหรับ Development เท่านั้น สำหรับ Production server จะทำให้ช้าลงมาก ไม่แนะนำ
ก่อนอื่น ทำการแก้ไขไฟล์ ดังรายละเอียดด้านล่างนี้
File: %PEAR_Directory%/PHPUnit/Extensions/SeleniumTestCase/prepend.php
// $GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'] = FALSE; $GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'] = $_SERVER["DOCUMENT_ROOT"] ;
File: %PEAR_Directory%/PHPUnit/Extensions/SeleniumTestCase/phpunit_coverage.php
//$GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'] = getcwd(); $GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'] = $_SERVER["DOCUMENT_ROOT"] ;
File: php.ini (ไฟล์ Configuration ของ PHP)
; Automatically add files before PHP document. auto_prepend_file = "D:\Service\var\scripts\PHPUnit\Extensions\SeleniumTestCase\prepend.php" ; Automatically add files after PHP document. auto_append_file = "D:\Service\var\scripts\PHPUnit\Extensions\SeleniumTestCase\append.php"
File: httpd.conf (ไฟล์ Configuration ของ Apache2)
<Directory "D:/Service/var/scripts"> Options FollowSymLinks Indexes Allow from all Order allow,deny AllowOverride All </Directory>
ขั้นตอนต่อไป เป็นขั้นตอนสำหรับทำให้ไดเรกทอรี่ดังกล่าว สามารถใช้ได้ในเว็บไซต์ใดๆ ที่อยู่ในเครื่อง
File: httpd.conf (ไฟล์ Configuration ของ Apache2)
# LoadModule alias_module modules/mod_alias.so LoadModule alias_module modules/mod_alias.so<IfModule alias_module> # ScriptAlias /cgi-bin/ "E:/Service/Process/Apache2.2/cgi-bin/" Alias /selenium-phpunit/ "D:/Service/var/scripts/PHPUnit/Extensions/SeleniumTestCase/" </IfModule>
ต่อมาขั้นตอนสำคัญ อย่าลืม Restart Apache 2 service
ต่อจากนี้เป็นขั้นตอนเพิ่มเติมสำหรับ Yii Framework
File: %YiiFramework%/protected/test/WebTest.php
// Add this to class protected $coverageScriptUrl = 'http://your.localhost./selenium-phpunit/phpunit_coverage.php';
จากนั้นอย่าลืมตรวจสอบไฟล์ phpunit.xml ให้ทำการสร้าง Code Coverage report เมื่อมีการทำการทดสอบ
File: %YiiFramework%/protected/test/phpunit.xml
<logging> <log type="coverage-html" target="%YiiFramework%\protected\tests\coverage" charset="UTF-8" yui="true" highlight="true" lowUpperBound="35" highLowerBound="70" /> </logging>
เสร็จครับ หมดแล้ว หลังจากนั้น เริ่มใช้งานได้เลย



