เกี่ยวกับวันเวลาของ Linux
วิธีดูเวลา Local time ในเครื่อง ใช้คำสั่ง
# date
ผลลัพท์จะออกมาประมาณนี้
Thu Aug 18 05:28:47 ICT 2011
การตั้งเวลานั้นให้ใช้ ntp เป็นตัว Sync เวลากับ Server เพื่อปรับเวลาอัตโนมัติได้เลย
วิธีลง ntp
# yum install ntp
เปิด Service
# chkconfig ntpd on
Synchronize กับ Server ntp
# ntpdate pool.ntp.org
สั่ง Start Service
# /etc/init.d/ntpd start
เสร็จเรียบร้อย
วิธีดัก Error อัตโนมัติโดย PHP
ก่อนอื่นให้สร้าง Function รองรับค่า Error ก่อน ตัวอย่างดังนี้
function customError($error_level,$error_message,$error_file,$error_line,$error_context) { $text = "<b>Error Level:</b> $error_level<br />"; $text .= "<b>Error Level:</b> $error_message<br />"; $text .= "<b>Error File:</b> $error_file<br />"; $text .= "<b>Error Line:</b> $error_line<br />"; $text .= "<b>Error Context:</b> $error_context<br />"; }
เราสามารถนำตัวแปร $text ไปประยุกต์ใช้เพิ่มข้อมูล Error Log ลง Database หรือให้ส่งเมล์ก็ได้
หลังจากนั้นใช้ฟังก์ชั่นด้านล่าง เพื่อให้ PHP ทราบว่าจะส่งค่า Error ไปที่ฟังก์ชั่นไหน และต้องการดัก Error Level ใด
set_error_handler(“customError”,E_ALL);
Error Report levels
สามารถเปลี่ยนแปลงการแจ้ง Error ได้ ด้วยการระบุ Level Error ที่ต้องการดัก
Value | Constant | Description |
---|---|---|
2 | E_WARNING | Non-fatal run-time errors. Execution of the script is not halted |
8 | E_NOTICE | Run-time notices. The script found something that might be an error, but could also happen when running a script normally |
256 | E_USER_ERROR | Fatal user-generated error. This is like an E_ERROR set by the programmer using the PHP function trigger_error() |
512 | E_USER_WARNING | Non-fatal user-generated warning. This is like an E_WARNING set by the programmer using the PHP function trigger_error() |
1024 | E_USER_NOTICE | User-generated notice. This is like an E_NOTICE set by the programmer using the PHP function trigger_error() |
4096 | E_RECOVERABLE_ERROR | Catchable fatal error. This is like an E_ERROR but can be caught by a user defined handle (see also set_error_handler()) |
8191 | E_ALL | All errors and warnings, except level E_STRICT (E_STRICT will be part of E_ALL as of PHP 6.0) |
เท่านี้ก็ดัก Error ได้ตามที่ต้องการแล้ว
วิธีเข้าถึง Tab Jquery โดย Url ตรง
Code ตัวอย่าง
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // initialize tabs var $tabs = $("#tabs").tabs(); $tabs.tabs('select', document.location.hash+"_x"); $("#tabs").bind('tabsshow', function(event, ui){ document.location.hash = ui.panel.id.replace("_x",""); }); }); </script> <div id="tabs"> <ul> <li><a href="#tab1_x"><span>Tab 1</span></a></li> <li><a href="#tab2_x"><span>Tab 2</span></a></li> <li><a href="#tab3_x"><span>Tab 3</span></a></li> </ul> <div id="tab1_x">[content 1 ]</div> <div id="tab2_x">[content 2 ]</div> <div id="tab3_x">[content 3 ]</div> </div>
หลังจากนั้นลองคลิกเพื่อ Url ที่เปลี่ยน คุณสามารถนำ Url นั้นมาเข้า Tab ได้โดยตรงเลย