星期二, 7月 21, 2015

[Raphael.js] ie8 圖片無法置中

今天測試在ie8執行時,發現圖片會無法置中,找到以下這個討論

https://github.com/DmitryBaranovskiy/raphael/issues/361


主要是svg使用vml轉換時的問題,解決方法如下:


只要打開原始碼找到以下這段

fill.size = _.fillsize[0] * abs(sx) + S + _.fillsize[1] * abs(sy);

修改如下即可解決

fill.size = _.fillsize[0] * abs(sx)/1.34 + "pt" + S + _.fillsize[1] * abs(sy)/1.34 + "pt";


星期二, 7月 14, 2015

[jQuery Plugin] jqplot 重新調整tooltip

在jqplot裡面的highlighter擴充模組提供了tooltipContentEditor方法讓使用者可以處理tooltip的效果,測試ok的範例如下:



tooltipContentEditor: function (str, seriesIndex, pointIndex, jqPlot) { plugin.logger.debug('tooltipContentEditor (x,y): ' + str); // console.log('str: ' + str);// x , y // console.log('seriesIndex: ' + seriesIndex); // console.log('pointIndex: ' + pointIndex); // console.log(jqPlot.options.axes.xaxis.ticks); // console.log(jqPlot.data[seriesIndex]); // console.log(jqPlot); var xAxis = jqPlot.options.axes.xaxis.ticks[parseInt(str) - 1]; // str.split(',')[0]; var yAxis = str.split(',')[1];//這樣取比較準 var newElem = '
' + '' //以下這個方法有時候取得的值會異常,例如設成年的時候 // +'
' + jqPlot.series[seriesIndex]["label"] + '
x axis: ' + xAxis + '
y axis: ' + jqPlot.data[seriesIndex][pointIndex] + '
'; + '
y axis:
' + yAxis + '
'; return newElem; }
http://stackoverflow.com/questions/17719534/jqplot-tooltip-content-editor

2015/12/28後記

被qa發了tooltip值異常的問題,擷圖來記錄一下,最後修正最完了的xaxis的解法請參上的範例即可。

星期日, 7月 12, 2015

[jQuery plugin] 解決jqplot 動態繪圖記憶體一直長大的問題

目前在專案上使用jqplot來繪圖,遇到記憶體一直長大的問題,
經過測試以下這個作者的解法是可用的
https://edsilverton.wordpress.com/2011/04/11/avoiding-jqplot-memory-leaks/

在每次重新繪圖時需要把元素整個幹掉,記憶體才會真的往下嶧放掉。

星期六, 7月 11, 2015

[CI] 記錄一下CI框架新手功能

記錄一些CI框架Seed常用的功能手記,讓日後可以快速回憶 :D
雖然已經是被很多人放棄的技術,不過還是有他方便的地方XD

測試版本

CI 2.x

設定起始的base url

Just overwrite the line in config/config.php with the following:
$config['base_url']    = 'http://'.$_SERVER['HTTP_HOST'].'/';
If you are using the sub folder you can use following code:
$root = "http://".$_SERVER['HTTP_HOST'];
$root .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
$config['base_url']    = "$root";

設定資料庫


application/config/database.php:

設定啟動的控制器


打開application/config/routes.php:
$route['default_controller'] = 'index';

設定啟動時載入相關的helper


打開application/config/autoload.php:
// $autoload['helper'] = array();
$autoload['helper'] = array('form','url','assets','images','load_view_helper');

星期五, 7月 10, 2015

[Wordpress] Limit Login Attempts 設定使用者登入太多次的鎖定外掛

如果要預防使用者一直嘗試登入電腦,可以透過 Limit Login Attempts
來限制使用者可以登入錯誤的次數,不過外掛已經有二年未更新了XD

https://wordpress.org/plugins/limit-login-attempts/

星期一, 7月 06, 2015

[Docker] 快快樂樂學Docker指令集

由於上周為了在MAC上面安裝跟開發機一樣的環境,結果費時費力還會爆炸,決定使用docker來統一一下開發的環境。

測試環境

Mac OS X 10.9.5

安裝Docker

1. 下載boot2docker
https://github.com/boot2docker/osx-installer/releases/

安裝後docker 和 boot2docker 的執行檔就已經放在 /usr/local/bin,而且也會多裝一個Virtualbox,因為docker是要跑在linux核心上面

2. 安裝新的linuxVM

$boot2docker init

執行過程中,會去下載 boot2docker.iso,並建立 Linux VM

3. 啟動 boot2docker-vm 虛擬機器 => 有了這個VM才有辦法開始使用docker
$boot2docker start


啟動後會提示需要export 以上設定,否則無法使用docker指令集



另外boot2docker安裝後,可以在應用程式看到一個boot2ocker iCON,也可以用來開這個vm



boot2docker 其他指令集

#取得boot2docker VM IP
$boot2docker ip

#可以在啟動前,先檢查有沒有新版的images
$boot2docker upgrade

docker常用指令集

其他你感興趣的文章

Related Posts with Thumbnails