分类 代码人生 下的文章

在实际工作中,通常会遇到某个进程或者请求运行的十分缓慢,其中大部分的时间都花在了数据库的查询和写入上,每次遇到这个问题就十分头痛。首先,鉴于我们是很底层的程序员,没法花钱给企业加硬件,那我们能完成的事情就是用头脑取分析并优化每一条查询,来获得查询效率的提升。

老高总结了一下工作中遇到的问题,以后再遇到相同的问题后可以快速排查。

- 阅读剩余部分 -

总结一下目前持有的币种吧(排名不分先后,量也都不大)

  • BTC(比特币)
  • ETH(以太坊)
  • ETC(以太坊经典)
  • QTUM(量子链)
  • BAT(注意力币)
  • PAY
  • DOGE(狗币)
  • EMC2(爱因斯坦币)
  • RDD
  • XVG
  • OMG(嫩模币)
  • JNT(2月上B网)

唉,错过了成为百万负翁的机会,买这个就当买个彩票吧 ?


顺便分享一波糖果:

需认证

  • 币乎社区注册送7万KEY,2月上交易所,算了一下大概值300,应该靠谱,不过需要实名认证,老高已经领了。。。

bihu

无需认证

  • iost糖果 链接 ,注册后需要到 telegram 发一下注册码就算激活了
  • 全民持股 BestBi 交易平台全新上线,点击或复制链接到浏览器进行注册,领取免费糖果:best.bi
  • www.btcaso.com支持币币和C2C交易,注册就送50个CAC币,交易费全返邀请人。

IP6用到现在,系统版本已经是11了,眼看着系统越来越卡,到现在逛个淘宝都不想用IP看了。废话不多说,这篇文章就是想记录一下查询能够降级的最低版本,让IP6再能撑几年吧。

下面两个地址可以查询能降级的版本,二者好像数据不太一致,待我降级完成后更新。

- 阅读剩余部分 -

方括号的[]在json中调试是一个数组,而花括号{}在json中表示一个对象,不过二者在PHP中基本上一个empty就可以判断为i空了,但在js里好像就有一些麻烦了,可能需要下面的判断方式。

p = []
if((Array.isArray(p) && p.length === 0)){
    alert('[]');
}

p = {}
if(Object.prototype.isPrototypeOf(p) && Object.keys(p).length === 0){
    alert('{}');
}

WAY1:


$a = json_decode('{}');

echo json_encode($a);

WAY2:


$a = new stdclass;
// $a = new ArrayObject();
echo json_encode($a);

虽然花括号{}和方括号的[]二者在PHP和JSON中都表示不同的东西,但是突然要返回空对象还是冷不丁的想一下,我上哪儿去找一个空对象啊? ?

<script>

NProgress.start();


(function(funcName, baseObj) {
    // The public function name defaults to window.docReady
    // but you can pass in your own object and own function name and those will be used
    // if you want to put them in a different namespace
    funcName = funcName || "docReady";
    baseObj = baseObj || window;
    var readyList = [];
    var readyFired = false;
    var readyEventHandlersInstalled = false;

    // call this when the document is ready
    // this function protects itself against being called more than once
    function ready() {
        if (!readyFired) {
            // this must be set to true before we start calling callbacks
            readyFired = true;
            for (var i = 0; i < readyList.length; i++) {
                // if a callback here happens to add new ready handlers,
                // the docReady() function will see that it already fired
                // and will schedule the callback to run right after
                // this event loop finishes so all handlers will still execute
                // in order and no new ones will be added to the readyList
                // while we are processing the list
                readyList[i].fn.call(window, readyList[i].ctx);
            }
            // allow any closures held by these functions to free
            readyList = [];
        }
    }

    function readyStateChange() {
        if ( document.readyState === "complete" ) {
            ready();
        }
    }

    // This is the one public interface
    // docReady(fn, context);
    // the context argument is optional - if present, it will be passed
    // as an argument to the callback
    baseObj[funcName] = function(callback, context) {
        if (typeof callback !== "function") {
            throw new TypeError("callback for docReady(fn) must be a function");
        }
        // if ready has already fired, then just schedule the callback
        // to fire asynchronously, but right away
        if (readyFired) {
            setTimeout(function() {callback(context);}, 1);
            return;
        } else {
            // add the function and context to the list
            readyList.push({fn: callback, ctx: context});
        }
        // if document already ready to go, schedule the ready function to run
        if (document.readyState === "complete") {
            setTimeout(ready, 1);
        } else if (!readyEventHandlersInstalled) {
            // otherwise if we don't have event handlers installed, install them
            if (document.addEventListener) {
                // first choice is DOMContentLoaded event
                document.addEventListener("DOMContentLoaded", ready, false);
                // backup is window load event
                window.addEventListener("load", ready, false);
            } else {
                // must be IE
                document.attachEvent("onreadystatechange", readyStateChange);
                window.attachEvent("onload", ready);
            }
            readyEventHandlersInstalled = true;
        }
    }
})("docReady", window);
docReady(function() {
    NProgress.done();
});

</script>

https://stackoverflow.com/questions/9899372/pure-javascript-equivalent-of-jquerys-ready-how-to-call-a-function-when-t/9899701

https://github.com/jfriend00/docReady/blob/master/docready.js