如何使用 PPA 升級 Ubunut Firefox 瀏覽器到 4.0
作者目前使用 Ubuntu 10.10 (maverick) 桌面環境,也是台灣 MozTW 成員之一,這次 FireFox 4.0 Release 介面有些改變,使用上來也非常順手,記憶體好像吃的比較少了?(有待商榷),現在就來升級 FireFox 吧,兩種升級方式,如果不熟悉 Command Line 就用 GUI 升級,另一種升級方式就是用 apt-get upgrade 啦。 如果用 Windows 請到這裡下載
利用 GUI 介面升級 (Install firefox 4 using GUI) 我的環境是英文,所以底下寫的是英文安裝方式: 按照底下步驟進行
Applications > Ubuntu Software Center > Edit > Software Sources之後點選 "Other Software" 選擇左下角 "Add" 按鈕,接著把底下文字輸入
ppa:mozillateam/firefox-stable最後到底下升級,就可以開始使用 FireFox 4 了
System > Administration > Update Manager
文字介面升級 (Install firefox 4 using terminal) 只要鍵入三行指令即可
$ sudo add-apt-repository ppa:mozillateam/firefox-stable $ sudo apt-get update $ sudo apt-get upgrade沒圖沒真相啦,底下附上桌面截圖
Reference: How to install firefox 4 in ubuntu using PPA Firefox 4 正式版現已推出,帶給您更棒的網路體驗
CodeIgniter 2.0.1 Release 發佈了

CodeIgniter Release 2.0.1 版本了,原本大家都很擔心為什麼 CodeIgniter 每發佈 Release 版本都要等個好幾個月甚至到半年以上,現在不用這麼久了,因為自從官方新增了 CodeIgniter Reactor 加速版本開發及修正,所以更多人貢獻了自己的程式碼及回報問題,我相信 CodeIgniter 會越來越好,希望有更多台灣的朋友來使用。 2.0.1 版本新增了 ENVIRONMENT 這環境變數,讓程式開發者可以任意調整環境狀況,最主要是改變 PHP error reporting 狀態:
/* * production => error_reporting(0) * development => error_reporting(E_ALL) */ define('ENVIRONMENT', 'production');當您設定為 production,表示網站不需要任意輸出錯誤訊息,如果調整成 development,系統就會打開全部錯誤訊息,這對開發者相當重要。如果想瞭解更多,請參考
Handling Multiple Environments。 歡迎大家下載最新版本: http://www.codeigniter.org.tw/downloads 如果想加入翻譯團隊,可以參考這裡: https://github.com/appleboy/PHP-CodeIgniter-Framework-Taiwan
Ubuntu (Debian) 架設 apache mpm worker mod_fcgid 筆記
最近想架設 Redmine 在 Ubuntu 伺服器上面,架設之前要先搞定 apache 搭配 mpm worker 及 mod_fcgi module,安裝步驟其實不難,就搭配懶人指令 apt 就可以了。
安裝 apache mpm worker 由於怕安裝過程會叫你把 apache2-mpm-worker 移除,改裝 apache2-mpm-prefork,所以安裝順序上面有些變化,請參考底下:
# 先安裝 $ apt-get install apache2.2-bin apache2.2-common apache2-mpm-worker libapache2-mod-fcgid php5-cli php5-cgi php5-common #後安裝 $ apt-get install apache2 php5 php5-gd php5-curl至於 PHP 5 套件就看你需要什麼就裝什麼吧,搜尋一下 php5-* 看看,apache 裝好預設看不到 PHP 網頁,也就是認不得 php type,請在 apache config 檔案加入底下 [Read More]
[Linux Kernel] 讀取 /proc 底下資料最佳方法: seq_file interface
前言 最近在整合公司內部
Atheros(被高通買下) 晶片的 Router,從原本 2.6.15 升級到 2.6.34.7,升級過程遇到很多困難,其中一項升級 Wireless Driver 部份,發現在 Kernel Socket 與 User Space 溝通之間出了問題,利用 Ioctl 來取得目前在 AP 上面所有 Client 資料(包含 mac address, 處於 N or G mode…等),在 User Space 上會掉資料,後來利用 /proc 底下檔案來跟 User 之間溝通,才沒有發生任何問題,由於輸出的檔案比較多,就偏向用 2.6 Kernel 提供的 seq_file 介面( interface )建立虛擬檔案 (virtual file) 與 User Space 溝通(此方法為 Alexander Viro 所設計),此功能其實在 2.4.15 已經實做了,只是在 2.6 版本才被大量使用。 程式設計師可以透過引入 <linux/seq_file.h> 來實做 seq_file interface,seq_file 最大優勢就是讀取完全沒有4k boundry 的限制,也就是不用管會不會超出 output buffer。
The iterator interface 為了能夠讓 iterator 正常運作,我們必須實做 4 個 function (start, next, stop, show),跑得過程為 start -> show -> next -> show -> next -> stop,為了方便講解,參考
Linux Kernel(4)- seq_file 裡面範例如下:
#include[Read More]#include #include /* Necessary because we use proc fs */ #include /* for seq_file */ #include MODULE_LICENSE("GPL"); #define MAX_LINE 1000 static uint32_t *lines; /** * seq_start() takes a position as an argument and returns an iterator which * will start reading at that position. */ static void* seq_start(struct seq_file *s, loff_t *pos) { uint32_t *lines; if (*pos >= MAX_LINE) { return NULL; // no more data to read } lines = kzalloc(sizeof(uint32_t), GFP_KERNEL); if (!lines) { return NULL; } *lines = *pos + 1; return lines; } /** * move the iterator forward to the next position in the sequence */ static void* seq_next(struct seq_file *s, void *v, loff_t *pos) { uint32_t *lines = v; *pos = ++(*lines); if (*pos >= MAX_LINE) { return NULL; // no more data to read } return lines; } /** * stop() is called when iteration is complete (clean up) */ static void seq_stop(struct seq_file *s, void *v) { kfree(v); } /** * success return 0, otherwise return error code */ static int seq_show(struct seq_file *s, void *v) { seq_printf(s, "Line #%d: This is Brook's demo\n", *((uint32_t*)v)); return 0; } static struct seq_operations seq_ops = { .start = seq_start, .next = seq_next, .stop = seq_stop, .show = seq_show }; static int proc_open(struct inode *inode, struct file *file) { return seq_open(file, &seq_ops); } static struct file_operations proc_ops = { .owner = THIS_MODULE, // system .open = proc_open, .read = seq_read, // system .llseek = seq_lseek, // system .release = seq_release // system }; static int __init init_modules(void) { struct proc_dir_entry *ent; ent = create_proc_entry("brook", 0, NULL); if (ent) { ent->proc_fops = &proc_ops; } return 0; } static void __exit exit_modules(void) { if (lines) { kfree(lines); } remove_proc_entry("brook", NULL); } module_init(init_modules); module_exit(exit_modules);
用 js 或 php 判斷 Android 手機上網
之前寫了一篇 jQuery 偵測瀏覽器版本, 作業系統(OS detection),這次可以來加上 Android 手機版本,其實就是分析瀏覽器 User Agent 來達到目的,底下分享 PHP 跟 Javascript 作法
PHP 方法
if(stripos($_SERVER['HTTP_USER_AGENT'],'Android') !== false) { header('Location: http://android.xxx.com'); exit(); }
Javascript 方法
if(navigator.userAgent.match(/Android/i)) { window.location = 'http://android.xxx.com'; }
Apache .htaccess 方法 用
RewriteCond %{HTTP_USER_AGENT} ^.*Android.*$ RewriteRule ^(.*)$ http://android.xxx.com [R=301]
Git 版本控制 branch model 分支模組基本介紹
我相信大家對於 Git 版本控制不陌生了,Git 最大強項就是可以任意建立 branch,讓您開發程式不需要擔心原本的程式碼會被動到,造成不知道該怎麼恢復原來的狀態。為了不影響產品發展,branch 對於大型工作團隊就顯得更重要了,今天在網路上看到一篇 A successful Git branching model 文章,裡面把 branch 使用方式寫得非常清楚,底下我會透過指令來說明如何使用簡單 branch 指令,當然請大家先去 github 註冊申請帳號,如果不想申請帳號,也可以自己在 local 端去執行。
底下所引用的圖片都是經由 A successful Git branching model 文章所提供。
看到這張圖其實就說明了 branch 最重要的精神:『無限建立分支』,大家也不用害怕看不懂這張圖,底下說明 branch 分支狀況
[Read More]利用 mb_strwidth 取代 mb_strlen 計算 Multi-byte 字數
切換 Ubuntu apt 的 mirror site
Update: 國網內部員工建議用 http://ftp.twaren.net 這台
最近常常會發生 apt-get update 指令失敗,台大這台 tw.archive.ubuntu.com 似乎常常掛點,所以網路上找一下其他的 mirror site,看到似乎很多人都在用國網的 Server ( http://free.nchc.org.tw ),要換的話,請更改 /etc/apt/sources.list
,將全部 tw.archive.ubuntu.com 都取代成 free.nchc.org.tw,其實還有另一個 domain 就是 opensource.nchc.org.tw,這些都可以用,沒有 apt 的 Ubuntu 或 Debian 簡直就不是 Server 了…XD
WordPress plugin 加強網址 SEO
由於網站 SEO 在大家心中都是非常重要,現在製作網站也都考慮了很多 SEO 的問題,其中一個功能就是可不可以自訂網址,Wordpress 很早之前就支援了此功能,站長我呢,在創站的時候使用 blog.wu-boy.com/2011/02/17/2542,為了使搜尋引擎更可以快速找到本站,所以打算將網址改成 blog.wu-boy.com/2011/02/php-codeigniter-google-url-shortener-api-library/,在後台 Permalink Settings 可以自訂部落格網址,將網址格式改成 /%year%/%monthnum%/%postname%/,可是改了之後,之前搜尋引擎及別人引用的網址就會變成 404 NOT Found,為瞭解決此問題,必須寫一支 Mapping Url 程式,讓之前的舊網址轉到新網址,剛好在 Roga Blog 找到一篇 加強部落格的 SEO,提供了轉換的 plugin,底下是該程式碼:
|
|