鍍金池/ 問(wèn)答/ Linux問(wèn)答
乞許 回答

nginx不做邏輯相關(guān)的業(yè)務(wù),你的需求直接用nginx無(wú)法實(shí)現(xiàn)。改用lua吧

熟稔 回答

訪(fǎng)問(wèn)路由給對(duì)方,過(guò)來(lái)方法直接獲取$_POST即可啊

枕邊人 回答

參考官方文檔

public static ExecutorService newFixedThreadPool(int nThreads)
創(chuàng)建一個(gè)線(xiàn)程池, 在重用共享無(wú)界隊(duì)列中運(yùn)行的固定線(xiàn)程數(shù)。在任何時(shí)候, nThreads 個(gè)線(xiàn)程都將是活動(dòng)的處理任務(wù)。如果在所有線(xiàn)程都處于活動(dòng)狀態(tài)時(shí)提交了其他任務(wù), 則它們將在隊(duì)列中等待, 直到線(xiàn)程可用為止。如果由于在關(guān)閉前執(zhí)行過(guò)程中出現(xiàn)故障而終止了任何線(xiàn)程, 則如果需要執(zhí)行后續(xù)任務(wù), 則新項(xiàng)將取代它。池中的線(xiàn)程將存在, 直到顯式關(guān)閉為止。

可以用下面的程序測(cè)試

import java.util.concurrent.Executors;
import java.util.concurrent.ExecutorService;

public class ThreadPoolTest1 {
    
    static class MyTask implements Runnable {
        private String name;
        
        public MyTask(String name){
            this.name = name;
        }

        
        @Override
        public void run() {
            for (int i = 0; i < 2; i++) {
                // 做點(diǎn)事情
                try {
                    Thread.sleep(100);
                    if(System.currentTimeMillis() % 3 == 0 ){
                         System.out.println("stop!");
                         throw  new RuntimeException("break!"); //(1)注釋掉這一行將只有兩個(gè)Thread!
                    }
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println(name + " said:" + i+" Thread="+Thread.currentThread().getName());
            }
        }
    }

    
    public static void main(String[] args) {
        // 創(chuàng)建線(xiàn)程池
//        ExecutorService threadPool = Executors.newSingleThreadExecutor();
        ExecutorService threadPool = Executors.newFixedThreadPool(2);
//        ExecutorService threadPool = Executors.newCachedThreadPool();

        
        // 向線(xiàn)程池里面扔任務(wù)
        for (int i = 0; i < 10; i++) {
            threadPool.execute(new MyTask("Task" + i));
        }

        
        // 關(guān)閉線(xiàn)程池
        threadPool.shutdown();
    }
}

注釋掉(1)處的異常會(huì)得到正常結(jié)果

Task0 said:0 Thread=pool-1-thread-1
Task1 said:0 Thread=pool-1-thread-2
Task0 said:1 Thread=pool-1-thread-1
Task1 said:1 Thread=pool-1-thread-2
Task2 said:0 Thread=pool-1-thread-1
Task3 said:0 Thread=pool-1-thread-2
Task2 said:1 Thread=pool-1-thread-1
Task3 said:1 Thread=pool-1-thread-2
......

任務(wù)將在thread 1和2之間切換
拋出異常RuntimeException會(huì)看到如下的情況:

.......
java.lang.RuntimeException: break!
    at ThreadPoolTest1$MyTask.run(ThreadPoolTest1.java:22)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Task4 said:0 Thread=pool-1-thread-5
Task5 said:0 Thread=pool-1-thread-6
......

能看到線(xiàn)程池在不斷創(chuàng)建新的線(xiàn)程.

笨小蛋 回答

你這樣配置不就可以了嗎

賤人曾 回答

看下machine的version:docker-machine --version
如果不是0.6.0,那就換成Machine 0.6.0試試

math.h里的函數(shù)需要libm,486以前CPU不集成協(xié)處理器,有的機(jī)器會(huì)沒(méi)有協(xié)處理器,這時(shí)浮點(diǎn)運(yùn)算需要軟件模擬。為了節(jié)約內(nèi)存和鏈接時(shí)間,所以早期編譯軟件包括Turbo C都把不常用的數(shù)學(xué)運(yùn)算單獨(dú)做一個(gè)模塊,不用浮點(diǎn)運(yùn)算就不需要它了,甚至可能在libm里實(shí)現(xiàn)了支持浮點(diǎn)版本的printf。

巫婆 回答

圖二 ,服務(wù)器端PHP版本過(guò)高,因?yàn)樵赑HP7中已經(jīng)完全移除了mysql_*系列函數(shù),導(dǎo)致函數(shù)不存在錯(cuò)誤。

喜歡你 回答

package.box和上面的ubuntu.box的區(qū)別是什么?

ubuntu.box不包含你后來(lái)安裝的lnmp環(huán)境
package.box包含你后來(lái)安裝的lnmp環(huán)境


不知道你有沒(méi)有裝過(guò)電腦系統(tǒng)。
ubuntu.box就相當(dāng)于系統(tǒng)鏡像文件。vagrant box add ubuntu E:ubuntu.box 之后就可以刪了。
之后安裝的lnmp環(huán)境并不會(huì)存儲(chǔ)到ubuntu.box中。
vagrant package打包的package.box相當(dāng)于是對(duì)你當(dāng)前的系統(tǒng)做一個(gè)備份鏡像,這個(gè)box才有你后來(lái)安裝的lnmp環(huán)境

話(huà)寡 回答
  1. grep 需要添加參數(shù) --line-buffered,才能過(guò)濾 continuous stream.
  2. docker logs 使用 grep 某些環(huán)境下需要添加 2>&1 才有效果, docker logs xx -f 2>&1| grep --line-buffered xxx

參考
How to 'grep' a continuous stream?
docker logs <container id> | grep <some value> doesn't work

In the formal c++, there is no such term called STL, STL is never an abbreviation of Standard Library or Standard Template Library. You can also refer to another my answer here. Yes, Allocators were invented by Alexander Stepanov. But his original library has been out of date and some components are adopted by the standard library.

stl中的allocator是如何接管operator new完成內(nèi)存申請(qǐng)的工作呢?對(duì)象的內(nèi)存申請(qǐng)權(quán)是如何轉(zhuǎn)移的?
all

From n4714 23.10.10.1 allocator members

[[nodiscard]] T* allocate(size_t n);
3 Remarks: the storage is obtained by calling ::operator new (21.6.2), but it is unspecified when or how often this function is called.

另外如果在棧上生成我們的stl對(duì)象,也會(huì)經(jīng)過(guò)allocator嗎?

There is no term stack in c++(only stack unwinding, which is not relevant here), in c, there is a term called activition record. Even if speaking to implementation, the choice of call stack or register should be decided by calling convention. No matter call stack or register, it will not invoke oeprator new function.

心悲涼 回答

死循環(huán)了,所以要用location = /no.png來(lái)優(yōu)先匹配

location ~ .*\.(jpg|png|gif|jpeg|swf|flv|rar|zip)$ {
    valid_referers none blocked my.weibo.com;
    if ($invalid_referer) {
        rewrite ^/ /no.png redirect;
    }
}

location = /no.png {
    root /some/path/;
    expires 30d;
}
孤毒 回答

把checkedList放到vue的data里面,且給它一個(gè)默認(rèn)值。BTW,radio button是單選,所以怎么能命名對(duì)應(yīng)的model叫checkedList呢?

魚(yú)梓 回答

此題已經(jīng)解決,解決方法很簡(jiǎn)單,在運(yùn)行測(cè)試命令: uwsgi --http :8001 --wsgi-file test.py時(shí),終端的位置必須要和test.py文件位置相同,才能正常運(yùn)行起來(lái)。

冷眸 回答
docker run -it 鏡像:版本 /bin/bash

生成容器后可以進(jìn)去看有哪些軟件。

Dockerfile看不到的。

莫小染 回答

你這個(gè)問(wèn)題解決了嗎?我也碰到問(wèn)題,不過(guò)jenkins提示成功了,但是沒(méi)有生成文件

殘淚 回答

你可以創(chuàng)建一個(gè) Windows 環(huán)境變量 MSYS2_PATH_TYPE=inherit,等這個(gè)環(huán)境變量生效,再打開(kāi) msys2 的 mintty 就好了。


其實(shí)這個(gè)問(wèn)題外國(guó)友人已經(jīng)幫你解決了,而且有多種辦法,可查閱 https://sourceforge.net/p/msy...