Posts

BENEX ET-3173-A 試用心得

Image
承襲上一代 3171R 優異性能的血統 BENEX 力群科技又開發出更小更亮的 新一代自行車燈的代表作 3173-A 微小自動車前燈(簡稱 3173A) 既亮又小又輕又聰明是個人人夢寐以求車燈 3171R vs 3173A 上方照 不過沒有一支燈是完美的 我把這支燈歸類在市區、市郊使用 郊外不是不能用 郊外用這支燈超有優越感的~ 只是鄉下有燈光的地方少 燈會用最大的功率去輸出 自然可以用的時間就會變的短很多 如果您要長途騎乘用的 或許可以考慮 3170R 或是一次裝兩支 3173A 也都大有人在 (同時裝兩支會不會干擾的問題下面有提到) 以下是我使用後歸類的幾點特性 如有問題歡迎發問~ 汽車化車燈 可全天候使用,內建光源感應器,白天太亮燈光會自動關閉,一到光源不足的地方如隧道或室內,會立即自動開啟燈光,讓您的視線永遠是保持明亮的。晚上騎車更是方便,當經過有路燈的地方會自動調暗,換到了黑暗的地方就會自動調整為更亮的光源,這支光感比 3171R 還要靈敏,3171R 可能沒注意還感受不太到光源的調整,但 3173A 遇到明暗差異很大的地方會立即給予 由於這支內建震動/移動感應器,可以透過震動去感應您車子是否正處於移動的狀態,當車子靜止超過 50 秒,車燈會呈現休眠狀態,當車子移動後,又會立刻的亮起來。不過這個震動感應器非常的省電,燈開啟後如果都不去動他,官方號稱可以待機三個月喔! 右邊的視線比較遠,由於台灣是左駕,所以行人道會在右邊,右邊比較高的好處是可以比較早看到右邊的人或是車等,可提早反應。您或許會有疑問說為什麼不是左邊比較高呢?如果左邊比較高,那麼照到的就會是對方的來車喔!雖然是有截止線,但不正確的使用還是會讓對向的來車駕駛不舒服的! 完美的車燈光型 何謂光型?這邊指的是車燈照射出去涵蓋的範圍,如果在完全無光害的地方,可能可以照射得很遠很廣,但實際的使用情況我們只需要照射前方 10 公尺的距離大概就夠了,這個範圍內夠亮夠廣。車燈安裝得太遠或是太近都不會達到最好的效果,官方建議 10 公尺的照射範圍是最佳的。 3173A 的光型比較集中,遠、近區較不明顯,而 3171R 的遠近區明顯許多。3173A 前方照的比較集中,而 3171R 左右的部分會比較廣一點點,各有各的特色...

Google Cloud Message(GCM) Unauthorized

如果你發送推撥 Push Notification 遇到 Google 回應 Unauthorized 可以先檢查 Google Develop Console 的 white list 是否有加入主機的 IP 請注意一下是否你的主機有支援 IPV6 如果有也請把 IPV6 address 一併加入 以我使用的 LINODE 來說 設定 IPV4 還是會出現 Unauthorized 設定好 IPV6 就可以正常推撥囉! PS. IPV4 後面的 /64 可以不用加入,加入會驗證不過 Reference Android GCM Unauthorized 401 error with PHP

Google reCAPTCHA php sample code

Image
Google 推出了 驗證 是否為機器人的服務 以下這段是跟 Google 驗證資料是否正確的程式 $captcha = $_POST['g-recaptcha-response']; $secret_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; $response = validate_google_recaptcha($secret_key, $captcha); if ($response->success == false) { echo 'You are spammer ! Get the @$%K out'; } else { echo 'Thanks for posting comment.'; } function validate_google_recaptcha($secret_key, $captcha) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://www.google.com/recaptcha/api/siteverify"); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); $param = "secret=".$secret_key."&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']; curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $param); $temp = curl_exec($ch); curl_close($ch); return json_decode($temp); }

php: symbol lookup error: php: undefined symbol: rl_on_new_l

由於開發上的需求需要多版本的 php 網路上有提供不少的方式 我想用看看 c9s 的 phpbrew 看看 CentOS7 指令上改了不少 這次都是用 yum 安裝套件 原本一開始執行 phpbrew 都正常 後來重開執行 phpbrew 就會出現 php: symbol lookup error: php: undefined symbol: rl_on_new_l 後來發現只要執行 php 就會出現上面的錯誤(網頁執行正常,只有 console cli 有問題) 看到 CentOS 官方論壇 也有人有類似的問題 後來在幾次的回答中終於解決了! 請先確認你的 libedit 版本是否為 el7 我系統原本是安裝 20090923-3.0_1.el5.rf 請注意後面顯示 el5 移除後在重新安裝 libedit 就可以正常 work 了 提供給各位參考看看~

Drupal7 : How to add _blank to hyper link in views ?

如果在 Drupal7 裡面想要在系統產生出來的超連結上加入 _blank 另開視窗的標籤 該怎麼做呢? 一般都會用他內建的 rewrite 功能把 但你會發現某些東西例如檔案路徑不知道怎麼生出來 可能要裝某些 Token 才有辦法知道路徑 感覺很簡單的功能確距離好遙遠阿… 不過既然 Drupal7 是 OpenSource 就自然有熱心的朋友把這功能實做出來囉! 使用的方式也很簡單 這個 case 是當你的檔案是 pdf 或 txt 時 系統會自動在 hyper link 那加上 target="_blank" 的標籤 function THEMENAME_file_link($variables) {   $file = $variables['file'];   $icon_directory = $variables['icon_directory'];   $url = file_create_url($file->uri);   $icon = theme('file_icon', array('file' => $file, 'icon_directory' => $icon_directory));   // Set options as per anchor format described at   // http://microformats.org/wiki/file-format-examples   $options = array(     'attributes' => array(       'type' => $file->filemime . '; length=' . $file->filesize,     ),   );   // Use the description as the link text if available.   if (empty($file->description)) {     $link_text =...

Drupal 7 : How to remove viewpoint meta data ?

這問題的需求在於客戶網站不要支援 RWD (Responsive Web Resign) 由於我用 Drupal7 + Bootstrap 3.x Bootstrap 3.x 似乎內建就把這些 RWD 給設定好了 沒辦法透過後台 admin 設定 網路上看到人家說要改掉 meta tag 最多的方式都是用 html_header_alter() 但根本沒用阿… 原因在於 viewpoint 這個 meta 不是經由 html_header_alter() 產生的 後來找到用 javascript 的方式解決了 由於我是手機才需要加入這段 js 去 override 掉原本的 meta 所以我使用 mobiledetect 這個 lib 來達到我要的效果 將 viewpoint 的 content 改成 width = 1024 (px) 至於要設定多少就看你的畫面是設計給怎樣解析度看的 code 如下: function your_module_init() {   // call Mobile_Detect lib   require_once libraries_get_path('Mobile_Detect').'/Mobile_Detect.php';   $detect = new Mobile_Detect;   if ($detect->isMobile()) {     drupal_add_js("     viewport = document.querySelector(\"meta[name=viewport]\");     viewport.setAttribute('content', 'width=1024');     ", 'inline');   } } Reference Can I change the viewport meta tag in mobile safari on the fly?

'.\mysql-bin.000078' not found (Errcode: 2 - No such file or directory)

如果你的 mysql 有開啟 log-bin 那麼在 data 資料夾下就會有一堆的 mysql-bin.00001 等依序產生的檔案 這個檔案超過 1G 或是重開就會繼續產生下一個 (在 production mode 這些是很重要的) 但在測試的環境下還蠻占空間的 上次無意識的把他刪除了 今天要開啟 mysql 才發現無法啟動 會出現下面錯誤訊息: 2014-01-26 19:47:57 8844 [Note] Plugin 'FEDERATED' is disabled. 2014-01-26 19:47:57 8844 [Note] InnoDB: The InnoDB memory heap is disabled 2014-01-26 19:47:57 8844 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions 2014-01-26 19:47:57 8844 [Note] InnoDB: Compressed tables use zlib 1.2.3 2014-01-26 19:47:57 8844 [Note] InnoDB: Not using CPU crc32 instructions 2014-01-26 19:47:57 8844 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2014-01-26 19:47:57 8844 [Note] InnoDB: Completed initialization of buffer pool 2014-01-26 19:47:57 8844 [Note] InnoDB: Highest supported file format is Barracuda. 2014-01-26 19:47:57 8844 [Note] InnoDB: 128 rollback segment(s) are active. 2014-01-26 19:47:58 8844 [Note] InnoDB: Waiting for purge to start 2014-01-26 19:47:58 8844 [Note] InnoD...