Archive

Archive for January, 2012

Forcing 3G only mode – CyanogenMod 7

January 25, 2012 Leave a comment
  1. เปิดหน้าจอโทรออกขึ้นมา แล้วกดรหัสตามนี้ *#*#4636#*#*
  2. เลือก Phone information
  3. เลื่อนมาด้านล่าง เลือก WCDMA only

ตรงกล่องข้อความชนิดเครือข่ายอาจต่างไปตามรุ่นมือถือ 3G = WCDMA

Categories: ETC Tags: ,

Convert Relative Path to Absolute Path

January 13, 2012 Leave a comment

function reltoabs($host, $path) {

$resulting = array();
$hostparts = parse_url($host);
$pathparts = parse_url($path);
if (array_key_exists(“host”, $pathparts)) return $path; // Absolute
// Relative
$opath = “”;
if (array_key_exists(“scheme”, $hostparts)) $opath .= $hostparts[“scheme”] . “://”;
if (array_key_exists(“user”, $hostparts)) {
if (array_key_exists(“pass”, $hostparts)) $opath .= $hostparts[“user”] . “:” . $hostparts[“pass”] . “@”;
else $opath .= $hostparts[“user”] . “@”;
} elseif (array_key_exists(“pass”, $hostparts)) $opath .= “:” . $hostparts[“pass”] . “@”;
if (array_key_exists(“host”, $hostparts)) $opath .= $hostparts[“host”];
if (!array_key_exists(“path”, $pathparts) || $pathparts[“path”][0] != “/”) {
$dirname = explode(“/”, $hostparts[“path”]);
$opath .= implode(“/”, array_slice($dirname, 0, count($dirname) – 1)) . “/” . basename($pathparts[“path”]);
} else $opath .= $pathparts[“path”];
if (array_key_exists(“query”, $pathparts)) $opath .= “?” . $pathparts[“query”];
if (array_key_exists(“fragment”, $pathparts)) $opath .= “#” . $pathparts[“fragment”];
return $opath;

}

Categories: PHP Tags: ,

Fire Log Spark – Codeigniter log viewer

January 13, 2012 Leave a comment

Download/Screenshot :: Fire Log Spark

วิธีติดตั้งโดยไม่ใช้ Spark

1. ดาวน์โหลดและนำไฟล์ทุกไฟล์ไปวางตามตำแหน่ง Folder ยกเว้นไฟล์ config/autoload.php

2. สร้าง Class ใหม่ขึ้นมาในโฟลเดอร์ controlelr ยกตัวอย่างเช่น log.php (Class log)

3. ใน __construct ให้ทำการสั่งโหลดไฟล์ของ Fire Log Spark ตัวอย่าง Class ด้านล่าง

<?php

if (!defined(‘BASEPATH’))exit(‘No direct script access allowed’);

Class Log extends CI_Controller {

function __construct() {

parent::__construct();
$this->load->helper(‘spark_url’);
$this->load->helper(‘fire_log’);
$this->load->config(‘fire_log’);
$this->load->language(‘fire_log’);
$this->load->library(‘fire_log’);

}

function index(){

}

}

?>

4. ตรวจสอบ config/config.php ตรงค่า $config[‘log_threshold’] ปรับเอาตามต้องการ ถ้าค่าตรงนี้เท่ากับ 0 จะไม่มีการเขียน Log ครับ

5. เช็คโฟลเดอร์ application/logs ว่า chmod 777 ไว้หรือไม่ ถ้ายัง chmod 777 ด้วย

6. หลังจากนั้นให้เข้า URL ของ Class และ Function index ตัวอย่างเช่น http://www.domain.com/index.php/log/index

*** ตรง function index สร้างไว้เปล่าๆ ตามตัวอย่างก็พอครับ เข้าตามลิ้งค์ตัวอย่างด้านบน library Fire Log จะทำงานของมันเองจ้าาาา