[技術分享 ] 29 十月, 2009 09:39

朋友轉寄的資料..超爆笑...

 

Research confirms that drinking gives you the same benefits yoga does!!! 
研究證實,喝酒具有和瑜珈相同的好處。

Savasana 
Position of total relaxation. 
 

 

Balasana
Position that brings the sensation of peace and calm. 

Setu Bandha Sarvangasana
This position calms the brain and heals tired legs. 

Marjayasana
Position stimulates the midirift area and the spinal comumn.

Halasana 
Excelent for back pain and imsomnia. 

Dolphin 
Excelent for the shoulder area, thorax, legs, and arms. 

Salambhasana 
Great excersice to stimulate the lumbar area, legs, and arms. 

Ananda Balasana 
This position is great for masaging the hip area. 

Malasana 
This position, for ankles and back muscles. 

真可惜,我連隨便一種動作都不會... 

[技術分享 ] 04 十月, 2009 17:44

當初會想要使用這個功能,是不打算讓使用者自行上傳網站圖片,可能會出現使用者亂上傳或不上傳,而不上傳又會造成資訊不完整,所以只能限制用程式來自動產生嘍!

找了許多資料,發現在Windows環境下的Apache Server可以輕鬆完成,利用IE + com元件可以輕鬆拍照成功,例如:WebPageGrabberimagegrabwindow),但是在Linux上,卻無該方法可以使用,在遍尋不著範例之下,只有自己整合資料來達成了,我發現了許多人事實上有實作,但是卻沒有很完整的交待所有有可能在安裝時所發生的問題,基於我很健忘的理由,所以又把他記錄在BLOG上,順便可以回憶,也可以分享給大家!

測試套件:
CutyCapt
http://cutycapt.sourceforge.net/
註:他很簡單的說明了一下,但是安裝時問題蠻多的,所以才會產生這篇! 

實作環境:
Linux Fedora Core 9
Without X Server

需求安裝:
Qt
gcc-c++
subversion

安裝步驟:
1、首先利用Yum套件安裝以下所有套件
# yum -y install subversion qt-devel qt-config SDL-devel gcc-c++ Xvfb

2、切換至您想安裝存放的目錄
# mkdir /path-to-you-want-to-installed
# cd /path-to-you-want-to-installed

(/path-to-you-want-to-installed 是由您自行決定命名)

3、取得CutyCapt套件並存放至指定目錄
# svn co
https://cutycapt.svn.sourceforge.net/svnroot/cutycapt

4、進入安裝目錄
# cd cutycapt/CutyCapt

5、執行安裝
這裡需要qmake跟g++套件,已經在第一步驟全部安裝。
# /usr/local/bin/qmake
# make

6、設定xvfb-run
這裡我並不知道為什麼他沒有自動預設安裝,但可以在Source裡找到,這裡已經有提供,請下載回去解開後將其放至 /usr/local/bin裡以利套作使用(此為使用者無進入 X Server時使用,因為是要給網站程式用,所以必須一定要使用此方法來虛擬運行並利用qt拍照)
# mv xvfb-run /usr/local/bin
# chmod +x /usr/local/bin/xvfb-run

下載:xvfb-run.rar

安裝完畢。

使用方法:
使用指令為
/usr/local/bin/xvfb-run /path-to-you-want-to-installed/cutycapt/CutyCapt/CutyCapt -f /tmp/path-to-your-temp --url=http://you.want.to.photo --out=/out-photo-to-dir-name

產生全站大小約需15~20秒左右,以下有其它參數資料,請參考:

% CutyCapt --help
 -----------------------------------------------------------------------------
 Usage: CutyCapt --url=http://www.example.org/ --out=localfile.png
 -----------------------------------------------------------------------------
  --help                         Print this help page and exit
  --url=<url>                    The URL to capture (http:...|file:...|...)
  --out=<path>                   The target file (.png|pdf|ps|svg|jpeg|...)
  --out-format=<f>               Like extension in --out, overrides heuristic
  --min-width=<int>              Minimal width for the image (default: 800)
  --max-wait=<ms>                Don't wait more than (default: 90000, inf: 0)
  --delay=<ms>                   After successful load, wait (default: 0)
  --user-styles=<url>            Location of user style sheet, if any
  --header=<name>:<value>        request header; repeatable; some can't be set
  --method=<get|post|put>        Specifies the request method (default: get)
  --body-string=<string>         Unencoded request body (default: none)
  --body-base64=<base64>         Base64-encoded request body (default: none)
  --app-name=<name>              appName used in User-Agent; default is none
  --app-version=<version>        appVers used in User-Agent; default is none
  --user-agent=<string>          Override the User-Agent header Qt would set
  --javascript=<on|off>          JavaScript execution (default: on)
  --java=<on|off>                Java execution (default: unknown)
  --plugins=<on|off>             Plugin execution (default: unknown)
  --private-browsing=<on|off>    Private browsing (default: unknown)
  --auto-load-images=<on|off>    Automatic image loading (default: on)
  --js-can-open-windows=<on|off> Script can open windows? (default: unknown)
  --js-can-access-clipboard=<on|off> Script clipboard privs (default: unknown)
 -----------------------------------------------------------------------------
  <f> is svg,ps,pdf,itext,html,rtree,png,jpeg,mng,tiff,gif,bmp,ppm,xbm,xpm
 -----------------------------------------------------------------------------
 
http://cutycapt.sf.net - (c) 2003-2008 Bjoern Hoehrmann - bjoern@hoehrmann.de

 

那要如何使用在PHP上呢,請看一個小範例....
<?php 
  // 要截圖的網址URL
  
$url = 'http://you.want.to.photo/';
  // 要輸出的路徑
  $outpath = /out-photo-to-dir-name/
  // 要輸出的圖片名
  $outname = 'test.png'; // 也可以用 .jpg等其它格式
  // 程式定義
  $progpath = '/usr/local/bin/xvfb-run /path-to-you-want-to-installed/cutycapt/CutyCapt/CutyCapt';
  $cmd = "$progpath --url=$url --out=$outpath/$outname";
  exec($cmd);
?>

搞定....收工.....

[技術分享 ] 02 二月, 2009 14:25

事情發生在2009年01月31日的晚上11:05分, 那時我正在打魔獸世界, 為了查一些任務資料必須要去魔獸世界藏寶箱尋找資料, 但我沒加書籤, 所以我都是直接用工具列的Google搜尋關鍵字, 因為排名很高, 所以都在前面, 很方便, 但是...事情就這樣發生了, 害我不知道該不該按下去!!

全部都是會危害我電腦的網站, 囧...我本來還以為是該站真的中毒了, 還提醒大家說藏寶箱可能有毒(真笨), 後來又點到了下一頁!!

維基跟中國台灣網也是!!

Google自己主站也無一倖免!!

funP也是, 無一倖免, 反正只要是搜尋引擎列出的都會被誤判!!

頓時我了解了, 原來是Google搜尋挫屎了.....最後連不理他要點都點不進去, 讓我了解了一件事!!

沒有Google的日子真是有一種說不出的感覺, 好像那裡都去不了了....真是百感交集!!

Google我愛你..我真的愛你..你千萬不要時不時發生這種事, 我的生活會像沒有網路一樣的失去了意義!!

隔天, 相關報導出來了, 工程師還真是不小心呀...呵呵..
一個小動作會造成全世界的伺服器掛掉, 工程師真的是神!!

相關資訊:
Google搜尋功能週六出現假警報

[技術分享 ] 01 十二月, 2008 14:45

說好的年終呢!? 影音實境剪輯...我的會聲會影處女秀...

前陣子看到了 Mark 兄重新填詞了周杰倫新歌 說好的幸福呢-原版 ,改編成 說好的年終呢-填詞版 之後,又看到了 Jackal 兄真人演唱 說好的年終呢-演唱版 ,雖然還有一位女網友 五斗米靠腰之神曲 也有演唱,但還是先用網友一致公認聲音像周董的 Jackal版本會傳神些。

因為小弟因工作需要剛學會聲會影一陣子而已,看了以上的大大的表演以後,也覺得意猶未盡,再加上手養之餘,就找了原始影音MV加上Jackal兄的音檔,再使用字幕檔載入再做特效而完成的 說好的年終呢-影音MV ,希望大家能喜歡。

當然了,做這個純粹是Kuso用的,希望周董的Fans不要對小弟下毒手,小弟也是周董的Fans之一,只是希望能在這麼不景氣的寒冬,帶給大家一點小小的歡樂氣氛嘍,我想Mark跟Jackal也是一樣的啦..^^

本來在製作時,有把開頭跟結尾的歌名蓋過處理掉了,後來想想,不要改得那麼過份,把字幕改過好了,所以真的只是為了Kuso喔..^^

因為是自己製作的,所以歡迎轉載,但須表明出處,祝大家看得開心......

PS:
本來是想要自己唱,但又怕星探發掘,所以作罷...(((踼...

[技術分享 ] 12 六月, 2008 18:04

使用FC7也有一陣子了, 但每次找到許多資料後, 安裝完成, 下次要重裝一台, 同樣的問題都會一直遇到, 突然之間想起這裡, 快點把他記下來吧....

如果使用網路上多種不同文件來安裝MRTG, 總是在indexmaker時會出現

Use of uninitialized value in hash element at /usr/bin/indexmaker line xxx.

就安裝不下去了, 有人說是SNMP的問題, 有人是說MRTG的問題, 但我好像已經試過好多次, 這次就直接把安裝方法記下, 以免下次又要再找一次, 怒呀....

這個方法是使用別人寫好了Shell Script來安裝, 預設裝在 /var/www/html/mrtg, 我都是會去改他的Shell Script把他改安裝為 /var/www/mrtg, 因為我通常都把MRTG指成子網域, 而非目錄, 但又不想被其它人用IP+目錄再指到, 所以把他安裝在/var/www外嘍, 以後就算我要在/var/www/html裡做一個預設的首頁, 也不會被破壞了..好吧..不多說來看看怎麼做吧..

首先下傳Shell Script....

wget http://serveio.com/da/install.mrtg.sh

改變為可執行檔權限

chmod 755 install.mrtg.sh

因為 /usr/bin/mrtg 無法在預設的 UTF-8 環境使用, 所以Shell Script要做點修正

編輯 install.mrtg.sh 找到 /xxx/xxx/mrtg(Shell Script裡的路徑不準, 請直接改成
env LANG=C
/usr/bin/mrtg , 其它同列的後面參數不變....

Example:
/usr/local/mrtg-2/bin/mrtg  ===>   env LANG=C /usr/bin/mrtg

接下來運行Script
./install.mrtg.sh

預設安裝路徑為 /var/www/html/mrtg
(或您自己有修正Shell Script內容)

請再至 /etc/httpd/conf.d/metg.conf 裡變更

#Alias /mrtg /var/www/mrtg
Alias /mrtg /var/www/html/mrtg

因為 install.mrtg.sh 預設安裝 mrtg 在 /var/www/html/mrtg
vi /etc/httpd/conf.d/mrtg.conf 修改如下

儲存後請重起SNMP跟APACHE

service snmpd restart
service httpd restart

好了...依照您apache的設定前往觀看, 是不是一下就成功了呢...恭喜呀..^^