简单的课程:
class Pair<K,V> {
}
Run Code Online (Sandbox Code Playgroud)
还有一些任务:
Collection<Pair<String,Long>> c1 = new ArrayList<Pair<String,Long>>();
Collection<Pair<String,Long>> c2 = c1; // ok
Collection<Pair<String,?>> c3 = c1; // this does not compile
Collection<? extends Pair<String,?>> c4 = c1; // ok
Run Code Online (Sandbox Code Playgroud)
为什么第三个子弹不能编译而第四个完全合法?
编译错误:
Type mismatch: cannot convert from Collection<Pair<String,Long>> to Collection<Pair<String,?>>
Run Code Online (Sandbox Code Playgroud) 通过https://helm.sh/docs/chart_template_guide/getting_started/
ls -R mychart/ mychart/: charts Chart.yaml templates values.yaml
mychart/charts:
mychart/templates: configmap.yaml
Run Code Online (Sandbox Code Playgroud)
尝试安装图表:
helm install full-coral ./mychart
Run Code Online (Sandbox Code Playgroud)
但它失败了:
Error: This command needs 1 argument: chart name
Run Code Online (Sandbox Code Playgroud)
舵:
helm version
Client: &version.Version{SemVer:"v2.14.1", GitCommit:"5270352a09c7e8b6e8c9593002a73535276507c0", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.14.1", GitCommit:"5270352a09c7e8b6e8c9593002a73535276507c0", GitTreeState:"clean"}
Run Code Online (Sandbox Code Playgroud)
我错过了一些明显的东西吗?任何帮助将不胜感激
def fun(a, b, c, d):
print('a:', a, 'b:', b, 'c:', c, 'd:', d)
Run Code Online (Sandbox Code Playgroud)
为什么这个有效
fun(3, 7, d=10, *(23,))
Run Code Online (Sandbox Code Playgroud)
并打印出:
a: 3 b: 7 c: 23 d: 10
Run Code Online (Sandbox Code Playgroud)
而这
fun(3, 7, c=10, *(23,))
Run Code Online (Sandbox Code Playgroud)
才不是
Traceback (most recent call last):
File "/home/lookash/PycharmProjects/PythonLearning/learning.py", line 10, in <module>
fun(3, 7, c=10, *(23,))
TypeError: fun() got multiple values for argument 'c'
Run Code Online (Sandbox Code Playgroud) 目前,资源的逻辑 ID 是通过连接资源路径中所有构造的名称并附加一个八字符的 MD5 哈希来形成的。
这会产生垃圾VpcPrivateSubnet1DefaultRouteBE02A9ED
,不幸的是,它无法通过逻辑 ID 查询资源。
有没有办法控制逻辑ID的命名方式?
和
除非我做错了-我无法通过CF模板设置参数组名称,而可以通过GUI和CLI轻松设置参数组名称(https://docs.aws.amazon.com/cli/latest/reference/rds/create -db-parameter-group.html)。此外,无论出于何种原因,数据库集群参数组都希望使用非空参数。
有没有办法通过CloudFormation传递名称和参数?
python3 以及https://docker-py.readthedocs.io/en/stable/
我只是好奇,当我登录到 ecr(通过 aws ecr get-login)时,我 PC 上的 docker deamon 会记住令牌,即使重新启动 shell,我也可以登录到 ECR,直到令牌过期。我什至可以在 auths 密钥的 ~/.docker/config.json 文件中看到
令人惊讶的是,通过 python docker SDK 登录:
ecr_client = boto3.client('ecr')
token = ecr_client.get_authorization_token()
username, password = base64.b64decode(token['authorizationData'][0]['authorizationToken']).decode().split(':')
registry = token['authorizationData'][0]['proxyEndpoint']
docker_client.login(
username=username,
password=password,
registry=registry
)
client.pull(...)
Run Code Online (Sandbox Code Playgroud)
让我的 docker 守护进程对登录尝试一无所知。当我尝试通过命令行提取相同的图像时 - 我收到错误“无身份验证凭据”。更奇怪的是,当我通过命令行登录 ECR 时,我不再需要通过 python 脚本进行身份验证。
知道为什么会这样吗?
出于个人原因,我需要在 jsp 上回忆一些事情:) 我有一个简单的登录页面:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Login</title>
</heaf>
<body>
<form action="LoginServlet.do" method="POST">
<p>
First name: <input type="text" size="20" name="first">
</p>
<p>
Last name: <input type="text" size="20" name="last">
</p>
<input type="submit" value="send">
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
豆类:
package web.model;
public class User {
private String firstName;
private String lastName;
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName …
Run Code Online (Sandbox Code Playgroud) 我试图模拟一个私有方法并验证它已被执行.
模拟本身工作正常,即无论我评论/取消注释"何时"行,我都会得到正确的结果.但是,我在验证时遇到了麻烦.
@RunWith(PowerMockRunner.class)
@PrepareForTest(ClassToTest.class)
public class TestClass {
@Test
public void test() throws Exception {
ClassToTest spy = PowerMockito.spy(new ClassToTest());
when(spy, method(ClassToTest.class, "privMethod", int.class)).withArguments(anyInt()).thenReturn(20);
System.out.println(spy.pubMethod());
PowerMockito.verifyPrivate(spy, times(1)).invoke("privMethod", int.class);
}
}
class ClassToTest {
public int pubMethod() {
return privMethod(231);
}
private int privMethod(int whatever) {
return 10;
}
}
Run Code Online (Sandbox Code Playgroud)
基于https://code.google.com/p/powermock/wiki/MockitoUsage13创建此示例 这是我得到的,任何想法为什么?
java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.powermock.reflect.internal.WhiteboxImpl.performMethodInvocation(WhiteboxImpl.java:1873)
at org.powermock.reflect.internal.WhiteboxImpl.doInvokeMethod(WhiteboxImpl.java:773)
at org.powermock.reflect.internal.WhiteboxImpl.invokeMethod(WhiteboxImpl.java:638)
at org.powermock.reflect.Whitebox.invokeMethod(Whitebox.java:401)
at org.powermock.api.mockito.internal.verification.DefaultPrivateMethodVerification.invoke(DefaultPrivateMethodVerification.java:39)
at test.TestClass.test(TestClass.java:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native …
Run Code Online (Sandbox Code Playgroud) 技术堆栈:Oracle数据库11.2.0.2,Java 1.6,Hibernate 3.6.6.Final.
我是新来的冬眠,如果这是微不足道的话道歉.
以下代码应该进行一些优化:
Transaction tx = session.beginTransaction();
for (int i = 0; i < 10; i++) {
POJO pojo = new POJO(i);
session.save(pojo);
}
tx.commit();
Run Code Online (Sandbox Code Playgroud)
hibernate.cfg.xml
有以下条目
<property name="jdbc.batch_size">500</property>
Run Code Online (Sandbox Code Playgroud)
如果hibernate真的批量所有这些插入,我如何验证?如果它执行10次插入而不是没有增益.一个想法是在save()
检查记录是否已添加到db 之后立即放置jdbc普通查询:
String query = "retrieve previously added element"
PreparedStatement stmt = session.connection().prepareStatement(query.toString());
Result rs = statement.executeQuery();
/** check contents of rs */
Run Code Online (Sandbox Code Playgroud)
在我的例子中,它返回一个非空集与先前添加的元素.这有什么意义吗?我怎样才能检查批处理是否有效.
提前致谢