小编Pot*_*ex5的帖子

检查字符串是否与正则表达式匹配

基本上,我希望能够有一个正则表达式,例如#[0-9] +,并能够检查字符串是否可以匹配它.例如,如果我收到用户输入并输入"#",则此字符串与正则表达式不匹配,但也可以是用户输入的数字.

我知道C++有match()函数,但有什么东西像我在寻找什么?还是某种方式呢?

谢谢

c++ regex

9
推荐指数
2
解决办法
3871
查看次数

将元素与HTML表格单元格的底部对齐

我在HTML表格的单元格中有多个元素。我希望某些元素与单元格的底部对齐,而另一些元素与顶部的单元格对齐。我在使元素与底部对齐方面遇到麻烦。我的桌子是:

    <tr>
        <td style="background-color: #007CE2">
            <p id="t1_list">test<br>another<br>testing</p>
            <input type="text" name="t1_input" id="t1_input">
            <button>
                Add
            </button>
        </td>
        <td style="background-color: #E54040">
            <p id="t2_list"></p>
            <div class="value_input2">
                <input type="text" name="t2_input" id="t2_input">
                <button>
                    Add
                </button>
            </div>
        </td>
    </tr>
Run Code Online (Sandbox Code Playgroud)

但是,div中的元素似乎想保持在单元格的中心,而不是保持在底部。到目前为止,我已经尝试了两种不同的CSS方法:

div.value_input {
    position: absolute;
    bottom: 0;
}
Run Code Online (Sandbox Code Playgroud)

这只是将div放到页面底部。和:

div.value_input2 {
    display: table-cell;
    vertical-align: bottom;
}
Run Code Online (Sandbox Code Playgroud)

哪个没有效果。

我在JSFiddle中有代码

我需要怎么做才能使输入框和按钮与单元格的底部对齐?

html css html-table alignment

5
推荐指数
1
解决办法
6899
查看次数

使用 Vue 2 设置 Webpack 5 时出现“找不到模块 'vue/compiler-sfc'”

我正在尝试使用 Vue 2 设置 Webpack 5,以使用 ModuleFederation。但是,当我尝试启动服务器时,遇到以下错误:

[webpack-cli] Failed to load '/Users/pottsiex5/Documents/Random Stuff/modulefed/hello-world/webpack.config.js' config
[webpack-cli] Error: Cannot find module 'vue/compiler-sfc'
Require stack:
- /Users/pottsiex5/Documents/Random Stuff/modulefed/hello-world/node_modules/vue-loader/dist/index.js
- /Users/pottsiex5/Documents/Random Stuff/modulefed/hello-world/webpack.config.js
- /Users/pottsiex5/Documents/Random Stuff/modulefed/hello-world/node_modules/webpack-cli/lib/webpack-cli.js
- /Users/pottsiex5/Documents/Random Stuff/modulefed/hello-world/node_modules/webpack-cli/lib/bootstrap.js
- /Users/pottsiex5/Documents/Random Stuff/modulefed/hello-world/node_modules/webpack-cli/bin/cli.js
- /Users/pottsiex5/Documents/Random Stuff/modulefed/hello-world/node_modules/webpack-dev-server/bin/webpack-dev-server.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/Users/pottsiex5/Documents/Random Stuff/modulefed/hello-world/node_modules/vue-loader/dist/index.js:8:24)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/pottsiex5/Documents/Random Stuff/modulefed/hello-world/node_modules/vue-loader/dist/index.js',
    '/Users/pottsiex5/Documents/Random Stuff/modulefed/hello-world/webpack.config.js', …
Run Code Online (Sandbox Code Playgroud)

webpack vue.js vuejs2 webpack-5

4
推荐指数
1
解决办法
5811
查看次数

如何在另一个类中设置静态变量?

我想在Coeffs.cpp中设置一个静态变量:

#include "Coeffs.h"
class Coeffs
{
    public:
    double Coeffs::alpha5b = 0.0;
};
Run Code Online (Sandbox Code Playgroud)

用头文件

#ifndef COEFFS_H
#define GOEFFS_H
class Coeffs
{
    public:
    static double alpha5b;
};
#endif
Run Code Online (Sandbox Code Playgroud)

使用以下代码:

#include <iostream>
#include <fstream>
#include <string>
#include "json/json.h"
#include "Coeffs.h"

using namespace std;

int main()
{
    cout << "start" << endl;

    string json;
    ifstream inputStream;
    inputStream.open("coeffTest.json");
    inputStream >> json;

    Json::Value root;
    Json::Reader reader;
    bool parseSuccess = reader.parse(json, root);
    if(!parseSuccess)
    {
        cout << "failed" << endl;
    }
    else
    {
        Coeffs::alpha5b = 1.1;
        //Coeffs::alpha5b = …
Run Code Online (Sandbox Code Playgroud)

c++ static-variables

2
推荐指数
1
解决办法
438
查看次数

使用"SELECT AS"创建具有其他新列的表

我想基于另一个表创建一个表,但同时也要添加新列.我试过这样做:

CREATE TABLE est_temp AS SELECT establishment_id, uc_l_p INT DEFAULT 0, uc_l_t_p INT DEFAULT 0 FROM establishment;
Run Code Online (Sandbox Code Playgroud)

但是我在新值uc_l_p和uc_l_t_p附近收到错误.有没有办法在不创建表格的情况下执行此操作,然后对其进行更改以添加新列?

mysql

0
推荐指数
1
解决办法
50
查看次数