chrome跨域设置

在chrome快捷方式,目标里如下设置

“C:\Program Files (x86)\Google\Chrome\Application\chrome.exe” –disable-web-security

发表在 前端 | 留下评论

mysql将csv格式的文件导入

#!/bin/bash
source ~/.bashrc
db='bfb_db_finance'
#tables=('t_rate_configure')
tables=('t_rate_configure' 't_cnt_for_cal_fee' 't_bank_rate_modify_log' 't_reserve_bank_account' 't_reserve_bank_account_channel' 't_reserve_bank_account_channel_
details' 't_reserve_bank_account_channel_files' 't_reserve_bank_account_channel_log' 't_outercheck_summary' 't_holiday_dates')
export_dir=~/tmp/script/data
echo 'start to export from fndb online...'
fndb_mine -e "create database if not exists bfb_db_finance;"
for tab in ${tables[@]}; do
 fndb_online -N -e "select * from ${db}.${tab}" > $export_dir"/"$tab &
 create_sql=`fndb_online -N -e "show create table ${db}.${tab}"`
 len=${#tab}
 create_sql=${create_sql:$len}
 echo -e "$create_sql" > $export_dir"/create_"$tab &
done;
wait
echo 'finished to export from fndb online.'
echo 'start to import to fndb offline...'
for tab in ${tables[@]}; do
 fndb_mine -e "drop table if exists ${db} . ${tab}"
 create_sql=`cat ${export_dir}/create_${tab}`
 fndb_mine -e "use ${db}; $create_sql"
 fndb_mine -N -e "truncate ${db} . ${tab}; LOAD DATA LOCAL INFILE '$export_dir/$tab' INTO TABLE ${db} . ${tab}"
 wait
 echo ${tab}" done."
 rm $export_dir"/"$tab &
 rm $export_dir/"create_"$tab &
done;
echo 'done.'
发表在 mysql | 留下评论

mysqli中的MYSQLI_USE_RESULT和MYSQLI_STORE_RESULT(转载)

 Either the constant MYSQLI_USE_RESULT or MYSQLI_STORE_RESULT depending on the desired behavior. By default, MYSQLI_STORE_RESULT is used.

If you use MYSQLI_USE_RESULT all subsequent calls will return error Commands out of sync unless you call mysqli_free_result().

 

下面又有人注释了这样一句:

/* If we have to retrieve large amount of data we use MYSQLI_USE_RESULT */

if ($result = mysqli_query($link, “SELECT * FROM City”, MYSQLI_USE_RESULT)) {

 

/* Note, that we can’t execute any functions which interact with the

server until result set was closed. All calls will return an

‘out of sync’ error */

if (!mysqli_query($link, “SET @a:=’this will not work’”)) {

printf(“Error: %s\n”, mysqli_error($link));

}

mysqli_free_result($result);

}

 

MYSQLI_USE_RESULT和MYSQLI_STORE_RESULT决定了mysqli client和server之间取结果集的方式。前者查询的时候并没有从server将结果集取回,后者查询时提取结果集返回给client,并分配内 存,存储到用户程序空间中,之后mysqli_fetch_array()相当于是从本地取数据;而MYSQLI_USE_RESULT方式 下,mysqli_fetch_array()每次都要向server请求结果行。

难怪phpmanual上那人注释说当检索大量数据时建议使用MYSQLI_USE_RESULT,因为MYSQLI_USE_RESULT有较低 的内存需求,而MYSQLI_STORE_RESULT需要在client本地维护结果集,内存开销大。说到这里,可能会 想,MYSQLI_USE_RESULT每次取数据时都要请求server,网络开销是不是要比MYSQLI_STORE_RESULT大呢?它节省的内 存开销与带来的网络开销占比究竟如何,还需具体的测试数据来分析。

参考资料 http://www.cnblogs.com/wangyonghui/archive/2013/04/24/3040824.html

发表在 mysql, php | 留下评论

mysql字符串处理

记录个在工作中遇到的问题:

mysql> select substring_index(substring_index(‘batch_uname,0501201506240001′,’batch_uname,’,-1),’,',1);
+——————————————————————————————+
| substring_index(substring_index(‘batch_uname,0501201506240001′,’batch_uname,’,-1),’,',1) |
+——————————————————————————————+
| 0501201506240001                                                                         |
+——————————————————————————————+
1 row in set (0.01 sec)

mysql> select substring_index(‘batch_uname,0501201506240001′, ‘batch_uname,’, -1);
+———————————————————————+
| substring_index(‘batch_uname,0501201506240001′, ‘batch_uname,’, -1) |
+———————————————————————+
| 0501201506240001                                                    |
+———————————————————————+
1 row in set (0.00 sec)

参考的文章:http://justdo2008.iteye.com/blog/1141609

发表在 mysql | 留下评论

php中浮点数的问题

http://php.net/manual/zh/language.types.float.php

发表在 php | 标签为 | 留下评论

require/include_once的效率问题

http://www.laruence.com/2012/09/12/2765.html

发表在 php | 标签为 , , , | 留下评论

jquery 动态添加删除二级联动

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="utf-8" />
<script src="http://www.w3school.com.cn/jquery/jquery.js"></script>
<script type="text/javascript">
var configs = {
    parent_iframe : '.window_url',
    remark_count : 100,
    makesure_url : '/_u/finance/accountscheck/collateinfo',
    options_type : {
        SelStrSet: [
        { name: '请选择', value: '0', subname: '请选择', subvalue: '0'},
        { name: '线下收付款', value: '01', subname: '线下收款(手工充值)|线下付款(手工提现)|隔日退票|隔日退票转线下付款', subvalue: '01|02|03|04' },
        { name: '测试', value: '02', subname: '测试收款、测试退款、测试打款|测试退票', subvalue: '05|06' },
        { name: '银行错账', value: '03', subname: '银行错账(网银金额大于清算文件金额,资金有误)|银行错账(网银金额小于清算文件金额,资金有误)|银行错账(网银金额大于清算文件金额,清算文件错)|消去前期银行错账(网银金额小于清算文件金额,资金有误)|消去前期银行错账(网银金额大于清算文件金额,资金有误)|银行错账(网银金额小于清算文件金额,清算文件错)', subvalue: '07|08|09|10|11|12' },
        { name: '时间差', value: '04', subname: '银行到账与我方对账时间差|退款资金实时退我方T+1对账|线上付款,银行与我方记账时间差', subvalue: '13|14|15' },
        { name: '汇总文件付款', value: '05', subname: '汇总文件付款方式完成的退款|汇总文件付款,今日未把结果文件回导系统|汇总文件付款,补前期的回导', subvalue: '16|17|18' },
        { name: '退款退回', value: '06', subname: '退款退回(置失败)|退款退回(系统已置成功,需要转线下打款)|退款退回转线下打款', subvalue: '19|20|21' },
        { name: '误收款', value: '07', subname: '误收款|误收款退回', subvalue: '22|23' },
        { name: '当日撤销', value: '08', subname: '当日撤销', subvalue: '24' },
        { name: '其它', value: '09', subname: '其它', subvalue: '25' }]
    }
};
// option 操作
function initOptions(now,next,reset){
    if (reset === undefined) {
        reset = false;
    }    
    now.children("option").remove();
    jQuery.each(configs.options_type.SelStrSet, function () {
        var options_tmp = this;
        if(reset){
            now.append("<option value=" + options_tmp.value + ">" + options_tmp.name + "</option>");
        }else{
            if( now.attr('require') == options_tmp.value ){
                now.append("<option value=" + options_tmp.value + " selected >" + options_tmp.name + "</option>");
            }else{
                now.append("<option value=" + options_tmp.value + ">" + options_tmp.name + "</option>");
            }
        }
    });
    selchage(now,next);
}
function selchage(now,next,reset) {
    if (reset === undefined) {
        reset = false;
    }    
    now.children("option").each(function (i, o) {
        if (jQuery(this).attr("selected")) {
            next.children("option").remove();
            var temp = configs.options_type.SelStrSet[i].subname.split("|");
            var temp2 = configs.options_type.SelStrSet[i].subvalue.split("|");
            for (k = 0; k < temp.length; k++) {
                if(reset){
                    next.append("<option value=" + temp2[k] + ">" + temp[k] + "</option>");
                }else{
                    if( next.attr('require') == temp2[k] ){
                        next.append("<option value=" + temp2[k] + " selected >" + temp[k] + "</option>");
                    }else{
                        next.append("<option value=" + temp2[k] + ">" + temp[k] + "</option>");
                    }                    
                }
            };
        };
    });
}
// prepare the form when the DOM is ready
jQuery(document).ready(function() {
    jQuery('select[name="diff_reasons_max[]"]').each(function(index,element){    
        initOptions(jQuery(this),jQuery(this).parent().parent().find('SELECT[name="diff_reasons_min[]"]'));    
    });
    jQuery('select[name="diff_reasons_max[]"]').live("change",function(){
        selchage(jQuery(this),jQuery(this).parent().parent().find('SELECT[name="diff_reasons_min[]"]'));
    });
    //删除操作
    jQuery(".delDiffType").live("click",function(){
        jQuery(this).parent().parent().remove();
    });
    //新增差异
    jQuery(".addDiff").click(function(e){
        var html = jQuery(".diffType")
                            .clone(false)
                            .removeClass('diffType')
                            .find('td:last')
                            .html('<button type="button" >删除</button>')                        
                            .end()
                            .find('.num-pallets-input')
                            .val('')
                            .end();
            var obj_max = html.find('SELECT[name="diff_reasons_max[]"]');                
            var obj_min = html.find('SELECT[name="diff_reasons_min[]"]');
            jQuery('SELECT[name="diff_reasons_max[]"]').last().parent("TD").parent("TR").after(html);
            initOptions(obj_max,obj_min,true);
    });    
});
</script>
</head>

<body>

<table>
                <tr>
                    <td>差异类型:</td>
                    <td><select name="diff_reasons_max[]" require="02" ></select></td>
                    <td><select name="diff_reasons_min[]" ></select></td>
                    <td>异常金额:</td>
                    <td><input type="text" name="diff_reasons_amount[]" /></td>
                    <td width="20%"></td>
                </tr>                

                <tr><td colspan="6" align="left"><button type="button">新增</button></td></tr>                
</table>
</body>
</html>

发表在 jquery | 留下评论

jquery获取窗口高度

//alert(jQuery(window).height()); //浏览器时下窗口可视区域高度
//alert(jQuery(document).height()); //浏览器时下窗口文档的高度
//alert(jQuery(document.body).height());//浏览器时下窗口文档body的高度
//alert(jQuery(document.body).outerHeight(true));//浏览器时下窗口文档body的总高度 包括border padding margin
//alert(jQuery(window).width()); //浏览器时下窗口可视区域宽度
//alert(jQuery(document).width());//浏览器时下窗口文档对于象宽度
//alert(jQuery(document.body).width());//浏览器时下窗口文档body的高度
//alert(jQuery(document.body).outerWidth(true));//浏览器时下窗口文档body的总宽度 包括border padding margin
//alert(jQuery(document).scrollTop()); //获取滚动条到顶部的垂直高度
//alert(jQuery(document).scrollLeft()); //获取滚动条到左边的垂直宽度

发表在 jquery | 留下评论

awk用法

http://www.gnu.org/software/gawk/manual/gawk.html

发表在 awk | 留下评论

RBAC权限管理(转载)

http://www.cnblogs.com/xingmeng/category/576720.html

发表在 涨姿势 | 留下评论