EditPlus new patch ! (3.00 build 358)

ไม่มีอะไรมากครับ เพิ่ง update ไปเมื่อวาน ตามไปโหลดได้ที่ Latest Bug Patch File (2008-02-29)

DATE: 2008-02-29
BUILD: 358

This is a patch file to fix the bugs of EditPlus v3.00

Copyright © 1998-2008 ES-Computing
Contact: [email protected]
Homepage: http://www.editplus.com/

FIXED BUGS
==========

* The default encoding of open file follows system language instead of keyboard language.
* User tool setting could not handle more than 500 characters.
* Increases max number of projects to 200.
* ‘New’ command on the Cliptext Window did not work.
* Default encoding setting did not apply to new document.
* Upward Regular expression replace did not work correctly.
* ‘Cut Marked Lines’ did not work correctly with selected text.
* -n command-line option did not work with existing instance.
* Browser menu could temporarily cause program freeze.
* Regular expression ‘.’ could cause program crash.

2008-03-05_100201

 

จาก DBA สู่ Web Developer

หลังจาก ทำงานด้าน DBA มาได้ 10 เดือน รู้สึกว่าไม่ใช่ตัวเราเท่าไหร่ T_T ตอนนี้เลยทำเรื่องลาออกแล้ว กำลังจะไปทำงานที่ใหม่ ตอนนี้อยู่ในช่วงเปลี่ยนถ่ายงานต่าง ๆ ของบริษัทเก่าครับ ส่วนบริษัทใหม่ นี่ เดี่ยวคงบอกอีกทีตอนเริ่มทำงานวันแรก

ผมมันเป็นโรค coding-lism (โรคเสพติดการโค้ดโปรแกรมคอมฯ, บัญญิตขึ้นมาเอง) ไปแล้ว วันไหนไม่ได้เขียนโปรแกรมนิด ๆ หน่อย ๆ ก็รู้สึกมันขาดอะไรไปอย่าง

ไว้กลับมาเป็น Developer แล้วคงจะเข้าที่เข้าทางอีกครั้ง

ก้าวแรกของการเป็นผู้ใหญ่ ก็คือการตัดสินใจเลือกทางเดินชีวิตของตัวเอง !

 

มาบวกเลขป้องกัน spam จาก comment (หรืออื่น ๆ ) กันดีกว่าดีกว่า (ใน PHP)

เริ่มแรกง่าย ๆ เลย สุ่มตัวเลขสัก 2 ตัวก่อน แล้วเก็บลง Session ไว้ซะ

session_start();
// เริ่มสร้างตัวเลขสุ่มไว้สองตัว
$_SESSION['rand_x'] = rand(1, 9);
$_SESSION['rand_y'] = rand(1, 9);
// จบการสร้างตัวเลขสุ่ม

แล้วก็เอาค่าที่ได้ไปแสดง แล้วก็ให้กรอกผลของการบวก

<!-- เริ่มส่วนของการบวกเลข -->
กรุณาบวกเลขต่อไปนี้
<?php echo $_SESSION['rand_x']; ?> + <?php echo $_SESSION['rand_y']; ?> = <input type="text" name="rand_ans" size="10">
<!-- จบส่วนของการบวกเลข -->

โค้ดด้านบนก็เอาไปใส่ใน form เพื่อให้เอาคำตอบให้มันส่งค่าไปยังปลายทาง

ส่วนปลายทางที่รับค่าจาก form ซึ่งก่อนทำเรื่องอื่น ๆ ก็เช็คก่อนเลยว่า บวกเลขมาถูกต้องหรือเปล่า โดยเอาค่าที่อยู่ใน session มาบวกและเืทียบค่ามันซะ ถ้าใช่ก็ปล่อยไปทำอย่างอื่น ถ้าไม่ใช่ก็ die มัน หรือจะทำอะไรต่อก็สุดแล้วแต่ครับ

session_start();
// เริ่มตรวจสอบการบวกเลข
if(($_SESSION['rand_x'] + $_SESSION['rand_y']) != $_POST['rand_ans']) {
die("คุณบวกเลขผิด");
}
// จบการตรวจสอบการบวกเลข

แค่นี้ก็พอกัน comment ที่มา spam ได้ อาจจะปรับเปลี่ยนรูปแบบการแสดงผล หรือตำแหน่งในการวาง input form ต่าง ๆ ได้ตามความเหมาะสม หรือจะสุ่มตำแหน่งก็ได้ เพื่อป้องกัน bot ที่สามารถปรับตัวได้ตามลักษณะของการบวกเลขแบบนี้ครับ ซึ่งการ ทำระบบบวกเลขนี้ก็คล้าย ๆ กับการทำ captcha แหละครับ แต่อันนี้จะง่ายและไม่ซับซ้อนมากเท่าครับ

โดยตัวแนวคิดได้มาจากแนวคิดของ Match Captcha ของ Drupal แหละครับ

 

เอาโหมด Offline 3 วัน

ช่วงวันศุกร์-อาทิตย์นี้ คงไปเที่ยวเชียงใหม่ คงไม่ได้ online สักพักนึง ไปเปิดหัวบ้าง หลังจากอยู่แต่หน้าจอคอมฯ เผื่อจะได้ idea จากธรรมชาติบ้าง งานนี้คงไม่ได้หิ้ว notebook ไป คงเอาไปแต่หนังสือที่ค้าง ๆ จากการอ่านไว้เท่านั้นเอง ;) ส่วนงานการต่าง ๆ ก็ break ไว้ก่อน พักผ่อน ๆ ๆ ……

แต่อาจจะทำการ update เข้า Twitter เอาน่าจะง่ายกว่าเยอะ ;)

 

Library vs. Framework

จาก Library vs. Framework

A framework is more than a library, and actually maybe has nothing to do with a library.

Here is an interesting article on Martin Fowler’s blog about Inversion of control, but in the article, Martin discuss the difference between the library and the framework, as well he refers to another article about frameworks.

I can summarize the points in both articles in the following:

A library is about reusable functionalities, but a framework is about reusable behaviors.

A library is something you call/inherit from your code, but framework is something that calls your code or provide services for your code.

A library is a collection of components and classes, where framwork is how abstract classes and components interact with each others.

I can explain the framework by this definition: Framework is an abstract design that embodies how the application works, and it has "hooks" where you can "inject" your module, or component.

เป็นบทสรุปที่ดีมาก ๆ ครับ ไม่ขอแปลแล้วกัน ตรงตัวมาก ๆ มองเห็นภาพชัดเลยสำหรับข้อแตกต่างของ Library กับ Framework ครับผม