鍍金池/ 問答/ 網(wǎng)絡(luò)安全問答
尕筱澄 回答

圖片資源放跟 app 同級目錄下。使用的時(shí)候直接
<img src="assets/xx" alt="logo">
就行了

奧特蛋 回答
  1. 如果是阻塞式的,那只能代表數(shù)據(jù)已發(fā)出去,但不能保證對方已收到;如果是非阻塞式的,select到OP_WRITE就說明數(shù)據(jù)已發(fā)出去;無論哪種方式似乎都無法確保對方收到,除非對方用數(shù)據(jù)來應(yīng)答;
  2. 對方宕機(jī)(或者拔網(wǎng)線),理論上我方是無法知道狀態(tài)的,如果對方進(jìn)程被kill掉,那么操作系統(tǒng)可能會給回一個(gè)FINRST,你應(yīng)該會select到一個(gè)OP_READ,并在read時(shí)得到-1或異常。
放開她 回答

根據(jù)你的問題描述來看,是這樣的一個(gè)數(shù)組:

$array = [
    [commodityCode] => 1000026
    [isSale] => false
]

但是,不存在這樣的寫法,請將代碼粘貼完整。

貓館 回答

看了你的評論。
swiper 體積大,功能豐富。
better-scroll 體積小,有基本功能??勺鱿吕蜕侠?br>平時(shí)做滾動我一般用better-scroll。
如果有復(fù)雜一點(diǎn)的輪播效果,又不想自己寫,就用swiper

陌離殤 回答

telnet localhost 3306 這個(gè)命令支行不了。

吃藕丑 回答

pc web端的直播跟node和php都沒有半毛錢關(guān)系。直接http hls要不就rtmp了。用腳本語言去處理視頻流數(shù)據(jù)太不適合了,有更加專業(yè)的ffmpeg和c和go

苦妄 回答

User.findOne()的內(nèi)容能發(fā)一下嗎?User.findOne()是不是返回Promise?你這樣寫試試:

user.post('/register', async(ctx) => {
let {username, password, rePassword} = ctx.request.body;

if (!username) {
    responseClient(ctx, 400, 2, '用戶名不可為空');
    return;
}
if (!password) {
    responseClient(ctx, 400, 2, '密碼不可為空');
    return;
}
if (password !== rePassword) {
    responseClient(ctx, 400, 2, '兩次密碼不一致');
    return;
}   

try{
   User.findOne({username}).then(function(doc,err){
        if(err){
             responseClient(ctx);
         }

         if(doc){
             responseClient(ctx, 200, 1, '用戶名已存在');
             return;  
         }else{
             //保存到數(shù)據(jù)庫
            let user = new User({
                 username: username,
                 password: password,
                 type: 'user'
             });

             user.save(function(err, doc){
                 if(err){
                     console.log(err);
                 }
                 if(doc){
                     let data = {};
                     data.username = doc.username;
                     data.userType = doc.type;
                     data.userId = doc._id;
                     responseClient(ctx, 200, 0, '注冊成功', data);
                     return;
                 }
             });   
         }
     })

       }

}catch(e){
    responseClient(ctx);
}

})

別瞎鬧 回答

建議重新新建項(xiàng)目 小程序tabbar字體大小都是設(shè)置好了的

失心人 回答

可以監(jiān)聽手勢移動的距離,然后映射出控件上移的距離,這個(gè)思路應(yīng)該可以實(shí)現(xiàn)。

不考慮IO的話,只要不寫一些作死的邏輯,php的在cli的處理能力基本不需要擔(dān)心不夠用,但是存在IO的情況下,瓶頸大多都是在這些IO操作和等待上,不好給你的數(shù)值。
php的配置一般改動也不會太多,cli下運(yùn)行主要注意下可以使用的最大內(nèi)存。
增加多個(gè)php腳本是可行的,監(jiān)控下CPU和內(nèi)存的使用就可以了
官方文檔有簡要描述,但是看你的這個(gè)場景,你不考慮使用 swoole或者workerman這類異步、并行、高性能網(wǎng)絡(luò)通信引擎嗎?

舊城人 回答

ajax原則上不會影響性能,查查你點(diǎn)了之后有什么大量循環(huán)的dom操作吧,這倒是會影響性能

詆毀你 回答

找了一些內(nèi)容來:

3.14內(nèi)核新增了一個(gè)內(nèi)存信息MemAvailable , 當(dāng)調(diào)用free命令時(shí)可以顯示為available
之前沒留意過

[root@VM_167_46_centos etc]# free -h
                         total         used             free      shared     buff/cache      available
Mem:           993M        253M        334M         39M               405M             556M
Swap:           2.0G          82M             1.9G

我們知道used + free + buff 基本等于 total

  • used是被使用的
  • free是完全沒有被使用的
  • shared是被程序之間可以(已經(jīng)被)共享使用的
  • buffers是指用來給塊設(shè)備做的緩沖大小,它只記錄文件系統(tǒng)的metadata以及 tracking in-flight pages
  • cached是用來給文件做緩沖

也就是 buffers是用來存儲目錄里面有什么內(nèi)容,權(quán)限等等。而cached直接用來緩存我們打開的文件
available到底是什么

Many load balancing and workload placing programs check /proc/meminfo to estimate how much free memory is available. They generally do this by adding up "free" and "cached", which was fine ten years ago, but is pretty much guaranteed to be wrong today.
It is wrong because Cached includes memory that is not freeable as page cache, for example shared memory segments, tmpfs, and ramfs, and it does not include reclaimable slab memory, which can take up a large fraction of system memory on mostly idle systems with lots of files.Currently, the amount of memory that is available for a new workload,without pushing the system into swap, can be estimated from MemFree, Active(file), Inactive(file), and SReclaimable, as well as the "low"watermarks from /proc/zoneinfo.However, this may change in the future, and user space really should not be expected to know kernel internals to come up with an estimate for the amount of free memory.It is more convenient to provide such an estimate in /proc/meminfo. If things change in the future, we only have to change it in one place.

也就是說available才是你的"可用內(nèi)存" , 而不是像過去那樣簡單的把free和buffer加起來

available 小于 free+buffer 是一定的了

若相惜 回答

webpack 3.0以上的版本,熱更新中要去掉hot:true選項(xiàng)并且命令啟動要取消--hot參數(shù)。

你可以試試,雖然你的版本不是3.0以上。

六扇門 回答

你可以計(jì)算下這個(gè)高度下大概會有多少行,然后用空數(shù)據(jù)填充

let i = 5;
data.concat(new Array(i).fill({}))