我正在尝试使用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) 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) 我的登录表单验证器未按预期工作。当我将email
或password
字段留空或输入根据我设置的内容不被接受的内容时,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) 我正在尝试使用以下函数获取两个日期之间的天数
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。我该如何处理这个问题?
我正在尝试将 bigquery 表中的列的数据类型从INT64更改为STRING,条件是它不为 NULL。当我输入:
ALTER TABLE table_name ALTER COLUMN id STRING NOT NULL
我收到一个错误
语法错误:需要关键字 DROP 或关键字 SET,但得到标识符“STRING”
我应该如何解决这个问题?
我正在使用 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) 在我的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) 根据我的类的当前实现,当我尝试使用类方法获取私有属性的值时,我将其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 ×2
reactjs ×2
airflow ×1
dart ×1
datetime ×1
docker ×1
flutter ×1
material-ui ×1
pandas ×1
private ×1
putty ×1
react-hooks ×1
react-redux ×1
redux ×1
ssh ×1
ssh-keys ×1
use-effect ×1
validation ×1