Blog บทความ ความรู้ ประสบการณ์ หรือแปล เกี่ยวกับ PHP และเทคโนโลยีที่เกี่ยวข้อง นอกจากนี้ยังมี php forum ถาม-ตอบ ทุกคำถาม จะมีคำตอบ ... ที่นี่ - Blog and forum from the PHP zealots and PHP user groups in Thailand

Smarty 2.6.19 Released

Version: 
2.6.19
Released Date: 
2008/02/11

 This release addresses a couple of bug fixes, and a bug with the regex_replace modifier that can allow php functions to be called in templates. If you use the security features of Smarty, you should upgrade immediately. As a quick fix, you can replace the modifier.regex_replace.php plugin with the new one.

ChangeLog here. download it here.

 

PHP 5.2.6 Released

Version: 
5.2.6
Released Date: 
2008/05/06

 

The PHP development team would like to announce the immediate availability of PHP 5.2.6. This release focuses on improving the stability of the PHP 5.2.x branch with over 120 bug fixes, several of which are security related. All users of PHP are encouraged to upgrade to this release.

Security Enhancements and Fixes in PHP 5.2.6:

  • Fixed possible stack buffer overflow in the FastCGI SAPI identified by Andrei Nigmatulin.
  • Fixed integer overflow in printf() identified by Maksymilian Aciemowicz.
  • Fixed security issue detailed in CVE-2008-0599 identified by Ryan Permeh.
  • Fixed a safe_mode bypass in cURL identified by Maksymilian Arciemowicz.
  • Properly address incomplete multibyte chars inside escapeshellcmd() identified by Stefan Esser.
  • Upgraded bundled PCRE to version 7.6

Key enhancements in PHP 5.2.6 include:

mb_truncate จำกัดขนาดของ string ใน smarty แบบ multi-byte

เป็น modifier ที่แปลงจาก modifier truncate มา เพราะว่า truncate อันเก่า เวลาเอามาตัด UTF-8 ภาษาไทย แล้วตัดไม่เนียน มักจะมี ?? ติดท้ายมาอยู่เรื่อยๆ เนื่องจาก truncate อันเก่าทำงานในโหมด ASCII ก็เลยทำงานออกมาอย่างนั้น

แต่สำหรับใครใช้ truncate กับ UTF-8 ภาษาไทย ลองเอา mb_truncate นี้ไปใช้ดูคับ ผมปรับจาก truncate ตัวเก่า ก็ไม่ได้ทำอะไรมาก ก็เปลียน string function ให้เป็น multi-byte string function แทน และตอนนี้ fixed encoding ไว้ที่ UTF-8 ถ้าใครทำงานกับ encoding แบบอื่น ไม่ใช่ UTF-8 ก็ต้องเอาไปปรับเพิ่มเอง

 

CSS มุมโค้งมนๆ เขาทำกันยังงัยครับ??

ผมเพิ่งใช้ css ไม่นาน โดยเฉพาะ css 2 หรือ สูงกว่า ... อยากทำกรอบ ขอบ แบบมุมมน (ไม่เป็นเหลี่ยมๆ) เขาทำกันยังงัยเหรอครับ เคยไป hack ของชาวบ้านดู ที่พอทราบมา คือก็เอารูปมาแป่ะตรงมุม (cornner) โดยใช้ css คุม แต่ว่าเวลาเปลี่ยนสี อาจลำบากหน่อย ก็ต้องเปลี่ยนสีของรูปเตรียมไว้

หรือเขามีวิธีอะไรง่ายๆ มั้ยครับ เขามี framework ให้ใช้ไหม?

ใครมีของดีๆ เอามาแนะนำหน่อยครับ ^___^

ใครมี solution ดีๆ แนะนำเกี่ยวกับ การ Export MySQL บ้างคับ

เรื่องของเรื่องคือ

ผมจะต้องทำการย้ายข้อมูลจาก mysql 3.2xxx ไปยัง 5.xxx
ข้อมูลทั้งหมดที่จะต้อง  export ก็ไ่ม่น้อยไม่น้อย นะคับ :)

เกือบ 7 ล้าน กว่า แถว ใน 30 กว่าตาราง

เพื่อนมี solution ดีๆน่าสนใจก็ ขอไอเดียด้วยนะคับ
 

YUI 2.5.1 Released: Improved AIR support, JSON security patch, YUI Configurator, and bug fixes

Version: 
2.5.1
Released Date: 
2008/03/19

 หลักๆ ก็จะเป็น การ fix bugs แล้วก็ ปรับสภาพ ของตัว YUI ให้สามารถใช้งาน กับ AIR ได้ิดียิ่งขึ้น

SMF 2.0 Beta3 Public Released!

Version: 
2.0 Beta3
Released Date: 
2008/03/18

หลังจากรอกันมานานแสนนาน SMF 2.0 beta ก็เผยตัวสู่สาธารณะครั้งแรก หลังจากผ่านการพัฒนามานานถึง 18 เดือน ซึ่งก่อนหน้านี้เปิดให้ทดสอบเฉพาะ สมาชิกที่บริจาคเงินสนับสนุนเท่านั้นตั้งแต่เดือนสิงหาคมปีที่แล้ว

การเปิดเบต้าทดสอบกับสาธารณะ ก็เพื่อให้มีการทดสอบในวงกว้างขึ้น โอกาสที่จะค้นพบบั๊กก็มากขึ้นด้วย อย่างไรก็ตาม อย่าลืมว่านี่ยังเป็นรุ่นทดสอบอยู่ ดังนั้นจึงไม่เหมาะที่จะใช้งานจริง

อ้อ รุ่นนี้จะสนับสนุน OpenID แล้วนะครับ มาแรงจริง ๆ

สนใจร่วมทดสอบ ดาวน์โหลดได้แล้ว ที่

http://download.simplemachines.org/

Zend Framework 1.5 ออกแล้ว

Version: 
1.5
Released Date: 
2008/03/17

เมื่อวาน (2008/03/17) ทาง Zend Technologies ได้ออก Zend Framework 1.5 ออกมา ผมยังไม่ได้ดูรายละเอียด แต่คร่าวๆ เห็นว่ามีไฮไลท์ ประมาณนี้

  • Google ยังคงร่วมกันกับ Zend เพื่อพัฒนา ZF ให้ใช้งาน GData APIs ได้ง่ายยิ่งขึ้น โดยเขาบอกว่า ในเวอร์ชั่น 1.5 นี้ ได้เพิ่มความสามารถการใช้งาน YouTube APIs เพื่อให้สามารถ upload vdo เข้า YouTube ได้จาก php program
  • รุ่นนี้ support OpenID ด้วย

ถ้าสนใจลองอ่านรายละเอียดได้ ที่นี่ ครับ

ปล. Zend Framework เปลียนหน้าตาเว็บใหม่ด้วยน้ะ: http://framework.zend.com/

 

การ query เอาจำนวนแถวจากตาราง แบบไหนน่าใช้กว่ากัน??

ในการ query เอาจำนวนแถวของข้อมูล จาก mysql standard functions เท่าที่ผมทราบ จะมีวิธีการอยู่ 2 ลักษณะ ด้วยกัน ได้แก่

วิธีที่ 1: SELECT *

<?php
 ... // some code
 $sql = "SELECT * FROM $myVeryBigTable WHERE $myCondition ";
 $rs = mysql_query($sql) or die("Some error occurred with DB: "
   . mysql_error());
 $numRows = mysql_num_rows($rs);
 ... // some code
?>

 

วิธีที่ 2: SELECT COUNT(*) AS numRows

<?php
 ... // some code<br />
 $sql = "SELECT COUNT(*) AS numRows FROM $myVeryBigTable "
   . "WHERE $myCondition ";
 $rs = mysql_query($sql) or die("Some error occurred with DB: "
   . mysql_error());
 $row = mysql_fetch_array($rs);
 $numRows = $row['numRows'];
 ... // some code
?>

ทั้งสองวิธีไม่ได้ยุ่งยากอะไร และทำงานได้เหมือนๆ กัน แต่ลึกๆ แล้ว วิธีไหนมีประสิทธิภาพมากกว่ากัน กันแน่??? มีใครเคยทำวิจัย หรือ อ่านมามั้ยครับ??

การประมวลผล UTF-8 ภาษาไทย ด้วย Multibyte string function

หลังจากที่แปลงตัวเอง หันมาใช้ utf-8 อยู่พักหนึ่ง จะได้ไม่ตก trend ^^ แต่มาไม่นานนี้ เพิ่งได้ลงไปยุ่งกับ string processing แบบเยอะๆ สักหน่อย คือเขียน app มา parse blog content ที่มาจาก WYSIWYG ที่ output html มาแบบไม่ welform แต่ต้องเอาไปขึ้นแสดงใน wap page จึงต้องไป parse มันสักหน่อย อย่างน้อยๆ ก็ให้มัน welform และตัด tag ส่วนใหญ่ออกไป

ถ้าจะมองแค่ว่า html ที่ได้มามันไม่ welform เราก็ strip_tags ออกไปเลยสิ ... มันก็ทำได้ ไม่ได้ยากอะไร และผมก็ทำอยู่ แต่ว่าผมก็ยังอยากจะเก็บ tag img ไว้ เพื่อใน blog ที่แสดงใน wap page จะได้ไม่จืดชืดเกินไป และนอกจากจะเก็บ img ไว้แล้ว ก็ยังจะต้องมานั่งตัดแบ่งหน้า ให้เนื้อหาของ blog อีก เช่น ถ้า blog มีเนื้อหาเยอะ เราก็จะแบ่งหน้าให้มันแสดงหน้าละไม่เกิน ประมาณ 400-500 ตัวอักษร เป็นต้น



©2007-2008 PHPZealots.com. All right reserved.
Syndicate content