小编Sha*_*ker的帖子

如何使用 PuTTY 生成的密钥连接到远程服务器

我正在尝试使用VSCode 中的远程资源管理器扩展连接到远程服务器,但是当我使用 putty 生成私钥时private.ppk出现错误

无法建立连接

当我通读错误日志时,在它尝试加载 key 时C:\Users\user\.ssh\private.ppk,它说

无效的格式

如何使用 PuTTY 格式密钥进行连接?下面是我的config样子

Host ###.##.##.###
  HostName ###.##.##.###
  User <user>
  Port 22
  IdentityFile C:\Users\user\.ssh\private.ppk
Run Code Online (Sandbox Code Playgroud)

ssh putty remote-server ssh-keys visual-studio-code

6
推荐指数
1
解决办法
6191
查看次数

How do I make React js Material-UI table responsive as well as make it have equal column spacing?

I'm using MaterialTable from material-ui but there are two problems I'm having.

1. How do I make my columns equally spaced since, after the first two columns, there is a huge & unnecessary space to the 3rd column.

2. This particular table is not responsive, how do I make it responsive?

<MaterialTable
        title="All Surveys"
        columns={this.state.columns}
        data={this.state.data}
        options={{
          actionsColumnIndex: -1,
          exportButton: true,
          draggable: true,
        }}
        editable={{
          onRowAdd: (newData) => this.addNew(newData),
          onRowUpdate: (newData, oldData) => this.update(newData, oldData),
          onRowDelete: (oldData) => this.delete(oldData),
        }} …
Run Code Online (Sandbox Code Playgroud)

responsive-design reactjs material-ui material-table

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

Flutter 表单验证不起作用(_formKey.currentState.save())

我的登录表单验证器未按预期工作。当我将emailpassword字段留空或输入根据我设置的内容不被接受的内容时,validator会显示错误,但当我单击登录按钮时,我会被定向到登录成功页面,但情况不应该如此。我想留在登录页面,直到输入正确的值。

登录表格

class SignForm extends StatefulWidget {
  @override
  _SignFormState createState() => _SignFormState();
}

class _SignFormState extends State<SignForm> {
  // GlobalKey This uniquely identifies the Form , and allows validation of the form in a later step.
  final _formKey = GlobalKey<FormState>();
  String email, password;
  bool remember = false;
  final List<String> errors = [];

// func with named parameter
  void addError({String error}) {
    if (!errors.contains(error))
      setState(() {
        errors.add(error);
      });
  } …
Run Code Online (Sandbox Code Playgroud)

validation dart flutter flutter-form-builder

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

如何使用pandas获取两个日期之间的天数

我正在尝试使用以下函数获取两个日期之间的天数

df['date'] = pd.to_datetime(df.date)

# Creating a function that returns the number of days
def calculate_days(date):
    today = pd.Timestamp('today')
    return today - date

# Apply the function to the column date
df['days'] = df['date'].apply(lambda x: calculate_days(x))
Run Code Online (Sandbox Code Playgroud)

结果看起来像这样

153 天 10:16:46.294037

但我想让它说153。我该如何处理这个问题?

python datetime python-datetime pandas

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

如何更改 BigQuery 中列的数据类型

我正在尝试将 bigquery 表中的列的数据类型从INT64更改为STRING,条件是它不为 NULL。当我输入:

ALTER TABLE table_name ALTER COLUMN id STRING NOT NULL

我收到一个错误

语法错误:需要关键字 DROP 或关键字 SET,但得到标识符“STRING”

我应该如何解决这个问题?

google-bigquery

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

如何访问Airflow 2.0 cli

我正在使用 docker 运行气流,并且我想使用 cli 来执行暂停取消暂停dag,因为我无法在远程Digital Ocean Droplet 服务器上安装浏览器来访问气流 UI。

目前我正在尝试使用命令访问气流 cli,sudo docker exec -it $(docker-compose -f docker-compose.yaml ps -q webserver) bash 但出现错误

docker.errors.DockerException: 获取服务器 API 版本时出错: ('连接中止。', PermissionError(13, '权限被拒绝')) [95826] 无法执行脚本 docker-compose “docker exec” 需要至少 2 个参数。

下面是我的docker-compose.yaml文件

version: '3'
x-airflow-common:
  &airflow-common
  image: ${AIRFLOW_IMAGE_NAME:-apache/airflow:2.0.1}
  environment:
    &airflow-common-env
    AIRFLOW__CORE__EXECUTOR: LocalExecutor
    AIRFLOW__CORE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:airflow@postgres/airflow
    AIRFLOW__CORE__FERNET_KEY: ''
    AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION: 'true'
    AIRFLOW__CORE__LOAD_EXAMPLES: 'false'
  volumes:
    - ./dags:/opt/airflow/dags
    - ./logs:/opt/airflow/logs
    - ./plugins:/opt/airflow/plugins
  user: "${AIRFLOW_UID:-50000}:${AIRFLOW_GID:-50000}"
  depends_on:
    postgres:
      condition: service_healthy

services:
  postgres:
    image: …
Run Code Online (Sandbox Code Playgroud)

docker docker-compose airflow airflow-scheduler

3
推荐指数
1
解决办法
3143
查看次数

缺少依赖:React 中的“dispatch”

在我的react/redux应用程序中,我使用dispatch来调用每次安装组件时从redux中的状态检索数据的操作。问题发生在useState我的方法不起作用

以下是我收到的错误:

React Hook useEffect 缺少依赖项:“dispatch”。包含它或删除依赖项数组。像“getInvoiceData”这样的外部范围值不是有效的依赖项,因为改变它们不会重新渲染组件react-hooks/exhaustive-deps

这是我的代码:

const TableSection = () => {

  const invoiceData = useSelector((state => state.tables.invoiceData));

  const dispatch = useDispatch() 

  useEffect(() => {
    dispatch(getInvoiceData());
  }, [getInvoiceData]);

(...)

export default TableSection;
Run Code Online (Sandbox Code Playgroud)

reactjs redux react-redux react-hooks use-effect

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

名称以两个下划线开头的实例属性被奇怪地重命名

根据我的类的当前实现,当我尝试使用类方法获取私有属性的值时,我将其None作为输出。关于我哪里出错的任何想法?

代码

from abc import ABC, abstractmethod

class Search(ABC):
    @abstractmethod
    def search_products_by_name(self, name):
        print('found', name)


class Catalog(Search):
    def __init__(self):
        self.__product_names = {}
    
    def search_products_by_name(self, name):
        super().search_products_by_name(name)
        return self.__product_names.get(name)


x = Catalog()
x.__product_names = {'x': 1, 'y':2}
print(x.search_products_by_name('x'))
Run Code Online (Sandbox Code Playgroud)

python private double-underscore name-mangling

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