2013-10-25

如何寫出網頁,寫出一個內容會依照裝置畫面大小而做比例縮放的網頁…(針對行動裝置為主) update(10/25)

最近寫一些網頁,手機用的…
但發現,寫出來的畫面字都很小,但內容明明就沒多少東西,為什麼它不能match到畫面大小上咧…

後來發現,是習慣問題,我習慣寫出來的東西用電腦去看…但現在行動裝置很多,在html結構上也不太一樣,尤其是html5…

現在,只要用行動裝置瀏覽網頁,最好在meta上加上

<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
content都算是重點…尤其是inital-scale…

參考資料:http://hahapoem.blogspot.tw/2011/01/blog-post.html

update (10/25)
本來都是如上在使用,但後來自己在用chrome時開了console在看錯誤repost發現…雖然上面在某些程度上是正常執行的,但console會報錯…如下

Viewport argument value "device-width;" for key "width" is invalid, and has been ignored. Note that ';' is not a separator in viewport values. The list should be comma-separated.
Viewport argument value "1.0;" for key "initial-scale" was truncated to its numeric prefix. Note that ';' is not a separator in viewport values. 
The list should be comma-separated. Viewport argument value "1.0;" for key "maximum-scale" was truncated to its numeric prefix. Note that ';' is not a separator in viewport values. 
The list should be comma-separated. Viewport argument value "0;" for key "user-scalable" was truncated to its numeric prefix. Note that ';' is not a separator in viewport values. The list should be comma-separated.
後來找了一下資料才發現,其實在html的meta tag中,分號是代表結束,所以最好改用逗號…所以改成如下

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
參考資料:http://ralphwhitbeck.com/2012/javascript-error-viewport/

2013-10-23

在RRD-tools 1.3.x的cacti下,能產生中文的圖與網頁值的方式

除了「如何讓Cacti用rrdtool畫圖時能出現中文?」與「關於Cacti plugin manage中文問題」可以滿足一些中文的狀況…(註:其實my.cnf設定utf8並不是必要的…)

還有一個設定也是重點…

請找到cacti的database.php(一般來說是在cacti安裝目錄的lib/database.php…以我來說就是在/usr/share/cacti/lib/database.php),找到『function db_connect_real(......)』,在裡面找到
while ($i <= $retries) {
                $cnn_id = ADONewConnection($dsn);
                if ($cnn_id) {
                        $cnn_id->EXECUTE("set names 'utf8'");
                        return($cnn_id);
                }

然後把上面紅色粗體的加上去…