ผู้สนับสนุน

วันอังคารที่ ๘ กันยายน พ.ศ. ๒๕๕๒

find replace text หลายไฟล์หลาย directory

#! /usr/bin/sh
for file in `find . -type f`
do sed -i 's/เก่า/ใหม่/g' $file
done


http://forums.devshed.com/unix-help-35/how-to-use-sed-to-search-replace-files-throughout-a-184662.html

แล้วจทำให้มัน print ผล หรือ print เพื่อ confirm ก่อนไงอ่าาาาา TT^TT

วันจันทร์ที่ ๗ กันยายน พ.ศ. ๒๕๕๒

ติดตั้ง codigniter

บน windows
1. download จาก http://codeigniter.com/download.php
2. ติดตั้ง appserv
3. เอาไฟล์ zip ที่โหลดมาแตกไปไว้ที่ที่ install appserv (โดยทั่วไปเป็น C:\appserv\www\)
4. เปลี่ยนชื่อ dir Codeigniter/ >> myproject/ อะไรทำนองนี้ 
5. เปิดไฟล์ system/application/config/config.php แก้ base_url เป็น http://localhost/myproject/

ปล. ที่เหลือลองดูตาม video Hello-form-~~.avi http://dl.getdropbox.com/u/599479/Videos/code.rar

บน linux 
1-2. คล้ายๆ กันกับ windows แตกต่างกันไปแต่ละ dist
3. แตกไฟล์ไว้ที่ /var/www หรือ public_html
4. เหมือน windows
5. เหมือน windows ; อาจจะเป็นประมา๊ณว่า http://hostname.domain.com/~username/myproject, หรือ http://name.domain.com/myproject, http://domain.com/ , ... แล้วแต่คนจะตั้งแล้วแหละ

วันอังคารที่ ๑ กันยายน พ.ศ. ๒๕๕๒

เขียน my_helper ให้โหลด helper ใน Codeigniter

<?php
//my_datetime_helper.php in system/application/helper/         
function unix_time_to_mysql_time($time){
   $ci=& get_instance();
   $ci->load->helper('date');
   $datestring = "%Y-%m-%d %h:%i:%s";
   $time = now();
   return mdate($datestring, $time);
}
?>
ง่ายได้อีก! แค่ไม่รู้เท่านั้นเอง และก็ไม่รู้จะ search ด้วย keyword อะไร
ที่มาจร้า stackoverflow ,ci user guide-> create_lib
keyword (ที่ทำให้หาหน้า stackoverflow เจอ) : helper load other helper codeigniter