鍍金池/ 問答/ C++問答
伴謊 回答
  1. 關(guān)于數(shù)據(jù)錯(cuò)誤的問題。數(shù)據(jù)錯(cuò)誤是由于axios的post方法和jQuery帶的參數(shù)在HTTP請(qǐng)求里的位置不一樣,這就導(dǎo)致了一些服務(wù)器解析不到你請(qǐng)求中帶上的參數(shù)就報(bào)錯(cuò)了;
  2. qs并不是在data里使用的,正確的方法應(yīng)該是
axios({
    url: yourUrl,
    data:data,
    method: 'POST',
    transformRequest:[function(data){
        return qs.stringify(data)
    }]
})
我甘愿 回答

除了上面大神給的正則以為,還可以在onchange事件里,判斷當(dāng)前輸入的長度,有多少個(gè)長度,就再設(shè)一個(gè)參數(shù),那個(gè)參數(shù)就有多少個(gè)*。代碼如下:
// 密碼輸入框事件

onpwdChange(e) {
    let password = e.target.value;
    let pad = '';
    for (let i=0;i<password.length;i++){
        pad=pad+"*"
    }
    this.setState({
        password: password,
        pad:pad,
    })
}
悶油瓶 回答

因?yàn)間++不會(huì)正確的編譯其他的CPP文件,你可以看VSCode的命令:
g++ /Users/stanhu/Desktop/Git/Foundation/CPP_Learn/main.cpp -o /Users/stanhu/Desktop/Git/Foundation/CPP_Learn/main.out -g -Wall -fcolor-diagnostics -std=c++11
只編譯了main.cpp文件而沒有編譯a.cpp文件,所以會(huì)出現(xiàn)symbols for architecture x86_64錯(cuò)誤
所以正確的做法是:g++ main.cpp a.cpp -o main.out
再執(zhí)行./main.out
就沒問題了,所以現(xiàn)在問題出來了,那么怎么樣才能讓VSCode正確的編譯所有鏈接的CPP文件呢。

病癮 回答

extensions: ['', '.js', '.json', '.scss'];
新版本的空字符是會(huì)報(bào)錯(cuò);
改成extensions: ['*', '.js', '.json', '.scss'];

雨蝶 回答

你的cpp文件應(yīng)該放在source files文件夾里而不是resource files文件夾

陪我終 回答
"010203".match(/\d{2}/g);

或者

"010203".split(/\B(?=(?:\d{2})+\b)/);

或者

"010203".split(/\B(?=0)/);
執(zhí)念 回答
let root = [{
  id: '1',
  name: '姓名1',
  items: [
    {
      id: '2',
      name: '姓名2',
      items: [
        {
          id: '3',
          name: '姓名3',
          items: [
            {
              id: '4',
              name: '姓名4',
            },
          ],
        },
      ],
    },
    {
      id: '5',
      name: '姓名5',
    },
    {
      id: '6',
      name: '姓名6',
    },
  ],
}];

function search(root, id) {
  for (let i = 0; i < root.length; i += 1) {
    if (root[i].id === id) {
      return [{ id, name: root[i].name }];
    }
  }
  for (let i = 0; i < root.length; i += 1) {
    if (root[i].items && Array.isArray(root[i].items)) {
      const res = search(root[i].items, id);
      if (res.length) return [...res, { id: root[i].id, name: root[i].name }];
    }
  }
}

console.log(search(root, '5'));
console.log(search(root, '3'));
舊螢火 回答

read failed的原因是因?yàn)楫惒揭?,返回了EAGAIN, 需要對(duì)它做特殊處理

read message的原因還沒找到

妖妖 回答

是的,一個(gè)類的public static方法可以靜態(tài)調(diào)用

若相惜 回答

不可取代。
編譯型編譯需要時(shí)間,如果開發(fā)的時(shí)候頻繁編譯時(shí)間上是個(gè)問題,項(xiàng)目越大編譯越久

解釋型就沒有這個(gè)問題

墨沫 回答

This question is not bad. As a CS(or any other majors) student, skepticism in the class is pretty significant.

而老師給我們教的鏈表跟網(wǎng)上的實(shí)現(xiàn)的方式不一樣。

Yes, your teacher's implementation is uncommon and treats Link and Node as a whole entity, which is not reasonable. Because they are two different classes.

KISS principle

In c++'s OO design, keeping every class/struct simple is an important principle and it requires you to obey separate concerns. This is the first reason you should keep your node's data(and what it point to) in a separation class.

List may be empty

It is a good practice to initialize all data member in the constructor(though not required forcefully), so, once you create an object of your List, the size will be 1(because of the data private member. Mostly, List should be able to be empty. This is the second reason you should keep your node's data(and what it point to) in a separation class.

To solve the problem, you may want to regard the first element(data) as length(like @BecomeBright said), so the list is empty-able, but there still exists problem. Pascal strings actually use this trick(first member records length), but if list member's type is not integral type, the trick is invalid(you should know that list can also be used to store std::string, float, double or other user-defined class/struct, and etc).BTW, the list's length will also not be able to be longer than the maximum value of the type, e.g. pascal string's length cannot be longer than 255);

As you can see above, allowing node integrate into the List is not a good practice.

真難過 回答

start_routine 參數(shù)的原型是

void *(*start_routine) (void *)

不是

void (start_routine)(void)

void (start_routine)(void*)

請(qǐng)參照文檔 http://man7.org/linux/man-pag...


默認(rèn)情況下,gcc 要開啟 -Wreturn-type 才會(huì)警告 “在非 void 返回值函數(shù)中沒有 return 語句”,
一般建議打開 -Wall 選項(xiàng),可將所有警告當(dāng)成編譯錯(cuò)誤,如

gcc -Wall a.c

若使用 g++ 編譯,則不必顯式指定 -Wreturn-type,因它規(guī)定要寫 return(對(duì)非 void 返回值)。

雨蝶 回答

socket進(jìn)程數(shù)跟CPU核數(shù)有關(guān)系,一般2核開4個(gè)進(jìn)程,保持幾十萬的并發(fā)鏈接是沒問題的

九年囚 回答

進(jìn)度只有你的Fortran自己知道。你的Fortran DLL如果沒有報(bào)告進(jìn)度的接口的話,QT這邊是不可能猜得到的。只能用假進(jìn)度條或無限進(jìn)度條。

柚稚 回答

這么說吧,你用brew install packagename是用來安裝命令行工具的,一般不可能影響到圖形界面。
brew cask install packagename倒是有可能。
mysql官方文檔是通過dmg文件安裝的:

The MySQL Installation Package includes a MySQL preference pane that enables you to start, stop, and control automated startup during boot of your MySQL installation.

這個(gè)面板就只有開啟、關(guān)閉、控制開機(jī)自啟mysql功能。 你用brew install mysql安裝的mysql能用Homebrew Services來實(shí)現(xiàn)這些功能。

# 啟動(dòng)
$ brew services run mysql
# 關(guān)閉
$ brew services stop mysql
# 重啟
$ brew services restart mysql
# 開啟自啟
$ sudo brew services start mysql
安若晴 回答

luaJIT屌屌的,甩所有語言到后排。
這個(gè)問題沒有技術(shù)含量,提問者也是小菜吧;

眼雜 回答

https://github.com/ElemeFE/el...
最左邊有 License 類型,這個(gè)項(xiàng)目是 MIT

參考 https://baike.baidu.com/item/...

  • 被授權(quán)人有權(quán)利使用、復(fù)制、修改、合并、出版發(fā)行、散布、再授權(quán)及販?zhǔn)圮浖败浖母北尽?/li>
  • 被授權(quán)人可根據(jù)程式的需要修改授權(quán)條款為適當(dāng)?shù)膬?nèi)容。
  • 在軟件和軟件的所有副本中都必須包含版權(quán)聲明和許可聲明。
  • 此授權(quán)條款并非屬copyleft的自由軟件授權(quán)條款,允許在自由/開放源碼軟件或非自由軟件(proprietary software)所使用。

阮一峰 的 blog 里有個(gè)一圖流,可以看
http://www.ruanyifeng.com/blo...

我覺著你可能不是相對(duì)路徑,相對(duì)路徑默認(rèn)的圖片路徑都會(huì)被編譯

檢查以下是不是圖片路徑寫的是/img/pic1.jpg

玩控 回答

下載一個(gè)git,看看人家從初始項(xiàng)目到最后的每一步提交,從初始提交開始研究別人的代碼。

最好結(jié)合別人提供的文檔

僅供參考