2012年8月20日 星期一

Elastix 2.30 錄音格式改成MP3

原文連結: http://www.osslab.com.tw/VoIP/IP_PBX/%E8%BB%9F%E9%AB%94%E5%BC%8F_IP_PBX/Asterisk/%E7%99%BC%E8%A1%8C%E5%A5%97%E4%BB%B6%E5%8F%8A%E7%B3%BB%E7%B5%B1%E5%AE%89%E8%A3%9D/Elastix/%E8%AE%8A%E6%9B%B4%E9%80%9A%E8%A9%B1%E9%8C%84%E9%9F%B3%E6%AA%94%E6%A0%BC%E5%BC%8F%E7%82%BA_MP3


Elastix 2.0 會出現 404 file not found
請編輯 /var/www/html/modules/monitoring/index.php

找到這幾行


更新 2.30版
    if (!file_exists($path) || !is_file($path)) {
        Header('HTTP/1.1 404 Not Found');
        die("404 4 "._tr("no_file")." ");
    }
替換成
    if (!file_exists($path) || !is_file($path)) {
           // modified by alang
           // check the format mp3
           $mp3file = str_replace(".wav",".mp3",$file);
           $mp3path = $path_record.$mp3file;
           if (!is_file($mp3path)) {
              die("404 40 ".$arrLang["no_file"]." ");
           }else{
              $file = $mp3file;
              $path = $mp3path;
           }
        }
 
PS.如果在Elastix / monitoring 顯示 404 40
則要手動修改/var/www/html/modules/monitoring/configs/default.conf.php
 #$arrConfModule['records_dir']       = '/var/spool/asterisk/monitor/';
改為你所指定的錄音檔存放路徑. 

2012年5月23日 星期三

Ruby Android = Ruboto 安裝/問題紀錄



要安裝Ruboto (https://github.com/ruboto/ruboto/)之前,要先安裝JRuby  (http://jruby.org/)

裝好JRuby 後,將目錄切換到您所安裝的JRuby目錄

進行安裝Ruboto
  gem install ruboto

-----------------------

Getting Started

Before you use Ruboto, you should do the following things:
  • Install the JDK if it's not on your system already
  • Install jruby if you don't already have it. JRuby has a very easy install process, or you can use rvm
  • Install the Android SDK
  • Add the sdk's tools/ directory to your $PATH (問題1 )
  • Generate an Emulator image unless you want to develop using your phone
問題1: 設定Android SDK路徑於 $PATH

範例:


測試:
  執行 ruboto
 
 找不到檔案及目錄???  
$PATH都加上SDK路徑了..怎麼還是提示錯誤!!

檢查了Ruboto源碼
  C:\jruby-1.7.0.preview1\lib\ruby\gems\shared\gems\ruboto-0.6.0\lib\ruboto\sdk_versions.rb 

編輯檔案..把 "/tools" 刪掉、並存檔。
再測試執行 ruboto


Ruboto開發環境..設定完成

至於..怎麼開發Android ..
請參考 
(簡體) http://www.ibm.com/developerworks/cn/web/wa-ruby/
(英文) http://www.ibm.com/developerworks/web/library/wa-ruby/index.html

2012年5月14日 星期一

使用Google自訂搜尋功能,顯示一條空白的長條型

使用Google自訂搜尋功能,遇到了css styles的問題
 
會在自訂顯示區,顯示一條空白的長條型,經檢查後是原來的Css Style中,.gsc-control-cse有設定border-width
=13padding=1;

 Google Search:
放置div顯示區:
 

2012年5月8日 星期二

吃的健康

本文節錄自:happyleading.sg1004.myweb.hinet.net
 
再說不吃葡萄柚、不喝牛奶
大家寄來email的問題,大半都在我的書上說得很清楚。所以容我"工商服務時間"一下 :「吃,從頭學起」這本書真的值得大家買回去當參考書 。更有學員說讀起來好像"笑話精選"!看吧,真的是一本多功能的書呢!
問得最多的還是要不要喝牛奶,吃葡萄柚的老問題。如果有一天,牛奶(優酪乳及乳製品)沒有IGF-1, PGE-2這些東西,它的蛋白質和鈣又是人體容易吸收的,加上原有這麼多的副作用都不見了,或許我會和大家牛飲一番。 我曾在對農民的演講說到葡萄柚是不好的水果,一位種葡萄柚的農友當場調頭就走.......。很多人只會告訴妳葡萄柚的一些好處,卻沒人告訴過你Nargin在腸胃道中代謝成Naringenin,進而抑制肝臟解毒功能, 還有其中的Furanno-Coumarin 影響體內的什麼機能等等…… 天下有這麼多的水果,你並非毫無選擇。我努力替我們的農漁民推廣好產品的同時,我也要說實話。



只要不"亂鈣" Part II
簡單原則:如果只標示本產品含「鈣」,卻不敢說含什麼「鈣」的,一定不要吃!大家用膝蓋想:廠商怎可能會"為善不欲人知"呢!? 如果是用了好原料,一定巴不得召告全宇宙讓外星人也來買。「Calcium Carbonate」就是最便宜的碳酸鈣啦! 其他看不懂的,再來問我唄。

只要不"亂鈣" Part I
很多人問什麼樣的綜合維他命,才是我們需要的?
無論是什麼大小廠牌,原料的採用和品質是最重要的。就拿"鈣"來說,天然的或者人工合成的,只要是人體不易吸收的鈣質,都是身體的負擔,也不會因此增加骨質密度。磷酸鈣、碳酸鈣、檸檬酸鈣 、珊瑚鈣…等等都是難以吸收的鈣質。鈣的吸收難易,也不是因為分子顆粒的大小,而是鈣的本質。碳酸鈣是不會因為”奈米化”就會變成了別的鈣。
人體主要吸收鈣的位置是在腸道,尤其在十二指腸吸收最多,如果鈣質不好或者吸收得不夠快,馬上就會通過這短短的十二指腸。這就是為何我只推薦「左旋光譜發 酵型乳酸鈣」(Calcium-L-Lactate)。至於為何要左旋?是因為細胞受體的原因,終於知道生物老師的重要吧!

「找茶」的事
我為了能夠真正了解這千古的神奇作物,「茶」,我曾在台灣研究茶的最高學府「農委會茶業改良場」受過專業課程和 交流取經。
相信喜歡普洱的茶友,也都知道它有生茶熟茶之分。雖然生普洱少了可怕的渥堆,但為了趕快上市及風味上的要求,都免不了要讓茶「快速陳化」。生茶經過「快速 陳化」處理,其優點在於能立即將苦澀度降低、湯色轉紅、滑口帶甜。而熟茶則能將渥堆味(我們叫臭舖味或腥味)快速去掉,湯質滑潤,出現明顯陳香。
增濕、增溫、不通風、添加藥劑等等,就是最常用的快速陳化方法。將茶品長時間儲存於平均相對濕度85%以上、平均溫度攝氏30度以上、緊閉不通風環境,就 是一般所說的「入倉」。就算有些人會以,濕度、溫度沒有這麼高,或者用「先進」的方法來解釋。但最最可怕的就是肉眼看不見的「黴變」!!
其他的生菌我都不這麼害怕,如果是黃麴毒素,便是引起肝癌的重要元凶。而黃麴毒的頑強,是眾所皆知的 (有研究說180度以上,更有說260度以上的溫度可以消滅)。
不少朋友說,喝普洱有很多好處,例如可以降……等幾大功效。寶島台灣的好茶中,我們熟知的不發酵、半發酵、全發酵茶也都有,又何必去冒這種風險。因為你無法要求,每一塊茶磚、茶餅都有檢驗證書吧?
 

2012年5月3日 星期四

Ruby - gem 指令備忘

省略安裝 ri 及 Rdoc指令 
gem install --no-ri --no-rdoc 套件名稱 -v '版本'

Rails: bundle install ; gem install json 發生問題

bundle install 提示缺少json 1.7.0
安裝 json 
gem install json -v '1.7.0'
發生錯誤
"""
$ gem install json     
Building native extensions.  This could take a while...
ERROR:  Error installing json:
        ERROR: Failed to build gem native extension.

        c:/Ruby193/bin/ruby.exe extconf.rb
creating Makefile

make
generating parser-i386-mingw32.def
compiling parser.c
cc1.exe: error: unrecognized command line option "-Wno-missing-field-initializers"
make: *** [parser.o] Error 1


Gem files will remain installed in c:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.7.0 for inspection.

Results logged to c:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.7.0/ext/json/ext/parser/gem_make.out
"""
 檢查錯誤 出在 cc1.exe, 先拜Google
查出問題在於 Ruby - DevKit 版本 我安裝錯誤!!  裝到舊版本的DevKit了 XD

Requirements

  • Window XP or greater (32 or 64-bit).
  • A Ruby installation from RubyInstaller. This is important as it will not work with any other version of Ruby (e.g. old One-Click)
  • NOTE: for the legacy RubyInstaller v1.8.6 use the DevKit-3.4.5 available at our archive downloads page. For RubyInstaller versions 1.8.7, 1.9.2, and 1.9.3 use the DevKit 4.5.2 from our main downloads page.
  •  

Development Kit


安裝步驟

Extract Files

  • Left double-click the self-extracting executable (SFX) downloaded from Step 2 and choose a directory (without spaces) to install the DevKit artifacts into. For example, C:\DevKit. NOTE: the SFX is really a 7-Zip archive with a bit of embedded magic. If you already have 7-Zip installed, you can simply right-click it and extract its contents as you would a normal 7z archive. In the instructions that follow, the directory that you selected is identified as .
  • (翻白話) 點二下所下載的執行檔,並將解壓路徑設定為 C:\DevKit

Run Installation Scripts

  • cd from Step 3 above.
  • 切換路徑到 cd C:\Devkit
  • ruby dk.rb init to generate the config.yml file to be used later in this Step. Your installed Rubies will be listed there (only those installed by a RubyInstaller package are detected at present).
  • 執行 ruby dk.rb init
  • edit the generated config.yml file to include installed Rubies not automagically discovered or remove Rubies you do not want to use the DevKit with.
  • 提示 己自動變更config.yml檔案
  • [optional] ruby dk.rb review to review the list of Rubies to be enhanced to use the DevKit and verify the changes you made to it are correct.
  • 自選執行  ruby dk.rb review
  • finally, ruby dk.rb install to DevKit enhance your installed Rubies. This step installs (or updates) an operating_system.rb file into the relevant directory needed to implement a RubyGems pre_install hook and a devkit.rb helper library file into \lib\ruby\site_ruby. NOTE: you may need to use the --force option to update (with backup of the originals) the above mentioned files as discussed at the SFX DevKit upgrade FAQ entry.
  • 最後步驟 執行 ruby dk.rb install  開始安裝DevKit!!

Test Installation

  • Confirm your Ruby environment is correctly using the DevKit by running gem install rdiscount --platform=ruby. RDiscount should install correctly and you should see Temporarily enhancing PATH to include DevKit... in the screen messages. Next run ruby -rubygems -e "require 'rdiscount'; puts RDiscount.new('**Hello RubyInstaller**').to_html" to confirm that the rdiscount gem is working.
  • 測試  gem install rdiscount --platform=ruby  第二步驟..省略




安裝流程
C:\DevKit>ruby dk.rb init
[INFO] found RubyInstaller v1.9.3 at C:/Ruby193

Initialization complete! Please review and modify the auto-generated
'config.yml' file to ensure it contains the root directories to all
of the installed Rubies you want enhanced by the DevKit.

C:\DevKit>ruby dk.rb review
Based upon the settings in the 'config.yml' file generated
from running 'ruby dk.rb init' and any of your customizations,
DevKit functionality will be injected into the following Rubies
when you run 'ruby dk.rb install'.

C:/Ruby193

C:\DevKit>ruby dk.rb install
[INFO] Updating convenience notice gem override for 'C:/Ruby193'
[INFO] Installing 'C:/Ruby193/lib/ruby/site_ruby/devkit.rb'

C:\DevKit>gem install rdiscount --platform=ruby
Fetching: rdiscount-1.6.8.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
Successfully installed rdiscount-1.6.8
1 gem installed
Installing ri documentation for rdiscount-1.6.8...
Installing RDoc documentation for rdiscount-1.6.8...
再回到發生錯誤的地方 # bundle install 應該就能跳過 cc1.exe的錯誤了^^萬歲