小编gar*_*may的帖子

使用react-hook-form注册第三方自定义组件

我正在使用react-hook-form并使用第三方DatePicker。由于它是一个自定义组件,因此将其用作受控组件来注册它。这很好用

<Controller
    control={control}
    name="reviewStartDate"
    render={({ field: { onChange, onBlur, value } }) => (
        <DatePicker
            className={`form-control ${errors.reviewStartDate ? 'is-invalid' : ''}`}
            customInput={<input />}
            wrapperClassName="datePicker"
            onChange={onChange}
            onBlur={onBlur}
            selected={value ? new Date(value) : ''}
            dateFormat='dd-MMM-yyyy'
        />
    )}
/>
Run Code Online (Sandbox Code Playgroud)

同样/但是,我正在使用第三方Multiselect。这里的值没有被注册。它确实显示了选定的值,但是当我提交表单时,该值不存在于数据中。

<Controller
    control={control}
    name="rootCauseAnalysisCategory"
    render={({ field: { value } }) => (
        <Multiselect
            options={rootCauseAnalysisCategorys}
            isObject={false}
            showCheckbox={true}
            hidePlaceholder={true}
            closeOnSelect={false}
            selectedValues={value}
        />
    )}
/>
Run Code Online (Sandbox Code Playgroud)

相似地

reactjs react-hooks react-hook-form

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

驱动程序 oracle.jdbc.OracleDriver 声称不接受 jdbcUrl

我正在尝试连接到 Oracle DB。

当我尝试通过简单的 jdbc 连接进行连接时,它可以工作。

Class.forName("oracle.jdbc.driver.OracleDriver");
connection = DriverManager.getConnection("jdbc:oracle:thin:@chbsux0097.eu.novartis.net:1530:AD14", "xxxx", "xxxxx")
Run Code Online (Sandbox Code Playgroud)

但是,它不适Spring-boot用于以下错误

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-05-09 12:48:51.189 ERROR 16236 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Unsatisfied dependency expressed through method 'entityManagerFactory' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactoryBuilder' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Unsatisfied dependency …
Run Code Online (Sandbox Code Playgroud)

java jdbc spring-boot

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

奇怪的输出python

请解释下面,我认为它应该打印为True或False,因为这些是布尔表达式.为什么它打印2 1然后1 2

print 1 and 2
print 2 and 1
print 1 or 2
print 2 or 1
Run Code Online (Sandbox Code Playgroud)

输出:

2
1
1
2
Run Code Online (Sandbox Code Playgroud)

python

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

Amazon SNS-发送短信,交付状态

我正在尝试使用Amazon SNS发送消息,但它显示出异常行为。它会向某些号码发送消息,而可能会或可能不会发送消息给其他号码。

import boto3
client = boto3.client('sns', .....)
client.publish(PhoneNumber, Message)
Run Code Online (Sandbox Code Playgroud)

我正在使用发布API直接为OTP发送SMS,而不使用主题。有什么方法可以获取他们的交货状态吗?区域/ DND是否会影响交付。这是印度数字。我同样使用事务性消息。

amazon-web-services amazon-sns boto3

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

Pandas 将两列合并为 Json

我有一个如下所示的 pandas 数据框

    Col1    Col2
0     a     apple
1     a     anar
2     b     ball
3     b     banana
Run Code Online (Sandbox Code Playgroud)

我希望输出 json,其输出如下

{ 'a' : ['apple', 'anar'], 'b' : ['ball', 'banana'] }
Run Code Online (Sandbox Code Playgroud)

pandas

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

Python:在Linux上的virtualenv上安装Tkinter

我在Linux机器上使用virtualenv.我没有sudo访问权限,所以只能使用pip.

使用以下命令:

 pip install python-tk
Run Code Online (Sandbox Code Playgroud)

但这导致了错误

Collecting python-tk
  Could not find a version that satisfies the requirement python-tk (from versions: )
No matching distribution found for python-tk
Run Code Online (Sandbox Code Playgroud)

tkinter virtualenv python-2.7

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

Gunicorn 记录对它发出的 HTTP 请求

我正在使用以下配置运行 gunicorn

$VIRT_ENV/gunicorn -c config.py utrade.wsgi:application \
                          --log-level=debug \
                          --timeout=0 \
                          --access-logfile=-\
                          --log-file=-
Run Code Online (Sandbox Code Playgroud)

但是,它不会像 Django 独立运行时那样记录 HTTP 请求(POST/GET)。像下面这些

INFO:django.server:"GET / HTTP/1.1" 302 0
INFO:django.server:"GET /login/?next=/ HTTP/1.1" 200 5676
Run Code Online (Sandbox Code Playgroud)

django logging gunicorn

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

使用wheel文件进​​行python Pip安装不起作用

由于网络限制和证书错误,我无法正常使用 pip 安装 python 库。

所以我尝试.whl手动下载并安装该库。但它也因同样的错误而失败。

C:\python3.7>python -m pip install requests-2.21.0-py2.py3-none-any.whl
Processing c:\python3.7\requests-2.21.0-py2.py3-none-any.whl
Collecting idna<2.9,>=2.5 (from requests==2.21.0)
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x039C3D90>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/idna/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x04567350>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/idna/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection …
Run Code Online (Sandbox Code Playgroud)

python pip

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

Angular Material:更改 &lt;mat-list-item&gt; 的字体大小

我在用Angular Material。我有一个包含各种字段和列表项的表单。mat-form-field我已经使用下面的内容更改了输入的大小

mat-form-field.mat-form-field {
  font-size: 14px;
}
Run Code Online (Sandbox Code Playgroud)

然而,由于列表不是其中的一部分,因此mat-form-field它们仍然是默认的16px。我怎样才能改变 的大小<mat-list-item>

<mat-list-item *ngFor="let file of files">{{file.name}}<mat-list-item>
Run Code Online (Sandbox Code Playgroud)

angular-material

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

Git rebase 忽略合并提交

我想将这四个提交消息压缩为一个。更改已经推送。

...95c2f Merge branch 'bugfix/final' of ssh://10.0.0.30:7999/mp/web into bugfix/final
...39e3c Merge branch 'version/I2-0' of ssh://10.0.0.30:7999/mp/web into bugfix/final
...cf444 Merge branch 'version/I2-0' of ssh://10.0.0.30:7999/mp/web into bugfix/final
...43d9d C0-235, CO-236, CO-215, CO-340, CO-367, CO-368 mobile order depth etc,etc...
Run Code Online (Sandbox Code Playgroud)

但是,如果我尝试使用下面的方法进行变基,它会忽略所有合并提交消息。

git rebase -i HEAD~4
Run Code Online (Sandbox Code Playgroud)

我如何才能实现相同的目标以及为什么忽略合并提交。

git

4
推荐指数
3
解决办法
6380
查看次数