我创建了一个字典使用两种阵列zip()
状
list1 = [1,2,3,4,5]
list2 = [6,7,8,9,19]
dictionary1 = Dict(zip(list1,list2))
Run Code Online (Sandbox Code Playgroud)
现在我想按key(list1)
或通过这个词典排序list2
.有人可以告诉我一个方法或功能,如何实现它?
我想学习hibernate基础知识,并且在使用@EmbeddedId
复合主键的annontations 向表中添加条目时,不明白为什么我的应用程序不起作用:
代表PK的类:
@Embeddable
public class OHLCVKey implements Serializable{
private static final long serialVersionUID = -3996067621138883817L;
@Column(name="Symbol")
protected String symbol;
@Column(name="Currency")
protected String currency;
@Column(name="Datum")
protected java.sql.Date datum;
public OHLCVKey() {}
public OHLCVKey(String symbol, String currency, Date datum) {
super();
this.symbol = symbol;
this.currency = currency;
this.datum = datum;
}
public String getSymbol() {
return symbol;
}
public void setSymbol(String symbol) {
this.symbol = symbol;
}
public String getCurrency() {
return currency;
}
public void setCurrency(String currency) { …
Run Code Online (Sandbox Code Playgroud) 我正在尝试在Julia中创建一个特殊类型的数组.
例如,我想创建一个保存整数值列表(数组)的列表.
我需要知道如何:
append!
/ push!
将特定数据结构的数组(在本例中为整数数组)添加到列表中我认为这是一个非常简单的问题(可能在文档中的某处回答),但我之前的研究让我越来越困惑.
是否有区别:
List = Int64[]
Run Code Online (Sandbox Code Playgroud)
和
List = Array{Int64,1}
Run Code Online (Sandbox Code Playgroud)
这样的事情对我不起作用:
ListOfList = Int64[Int64]
ListOfList = Array{Int64[],1}
ListOfList = Array{Array{Int64,1},1}
Run Code Online (Sandbox Code Playgroud) 我在 linux (ubuntu 18.04) 上有一个 glassfish 服务器版本 5.1。我可以毫无问题地启动它,但是在通过以下方式启用安全管理员之后
asadmin --host localhost --port 4848 enable-secure-admin
服务器似乎无法永久启动。我不能stop-domain
或restart-domain
,虽然start-domain
说有一些东西在端口 4848 上运行。所以我必须手动终止该进程。
服务器日志:
[2020-08-01T18:02:53.647+0000] [glassfish 5.1] [SEVERE] [] [] [tid: _ThreadID=58 _ThreadName=Thread-9] [timeMillis: 1596304973647] [levelValue: 1000] [[
java.lang.NoClassDefFoundError: sun/security/ssl/HelloExtension
at sun.security.ssl.SSLExtension.<clinit>(SSLExtension.java:225)
at sun.security.ssl.SSLConfiguration.getEnabledExtensions(SSLConfiguration.java:369)
at sun.security.ssl.ClientHello$ClientHelloKickstartProducer.produce(ClientHello.java:562)
at sun.security.ssl.SSLHandshake.kickstart(SSLHandshake.java:509)
at sun.security.ssl.ClientHandshakeContext.kickstart(ClientHandshakeContext.java:110)
at sun.security.ssl.TransportContext.kickstart(TransportContext.java:234)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:393)
at sun.security.ssl.SSLSocketImpl.ensureNegotiated(SSLSocketImpl.java:727)
at sun.security.ssl.SSLSocketImpl.access$200(SSLSocketImpl.java:74)
at sun.security.ssl.SSLSocketImpl$AppOutputStream.write(SSLSocketImpl.java:1012)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
at java.io.DataOutputStream.flush(DataOutputStream.java:123)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:229)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:342)
at sun.rmi.registry.RegistryImpl_Stub.rebind(RegistryImpl_Stub.java:150)
at com.sun.jndi.rmi.registry.RegistryContext.rebind(RegistryContext.java:175)
at com.sun.jndi.toolkit.url.GenericURLContext.rebind(GenericURLContext.java:251)
at javax.naming.InitialContext.rebind(InitialContext.java:433) …
Run Code Online (Sandbox Code Playgroud) 我有一个短暂的循环,如:
boolean a = false;
MyClass b = new MyClass();
b.b = false;
// b is used in other thread...
while(!a){
if(b.b){
throw new Exception("b is true");
}
}
Run Code Online (Sandbox Code Playgroud)
在这种情况下,a
永远不会成为现实,但在一些运行之后,布尔变量b.b
应该变为真.奇怪的是,while循环从未离开,我的程序在无限循环中发挥作用.
我想知道为什么并决定System.out.print
在循环中添加一个语句:
while(!a){
if(b.b){
throw new Exception("b is true");
}
System.out.println("there is something more to execute");
}
Run Code Online (Sandbox Code Playgroud)
值得注意的是我的代码应该是这样的.while循环遍历if语句,直到b.b
为true,并抛出异常离开循环.
可能是在第一种情况下,程序停止检查if语句,因为编译器认为没有必要再次检查?如果没有,有人可以向我解释,为什么第一个案例不起作用,但第二个案件不起作用?
java ×3
julia ×2
arrays ×1
database ×1
dictionary ×1
glassfish ×1
hibernate ×1
if-statement ×1
jakarta-ee ×1
java-ee-8 ×1
orm ×1
sorting ×1
while-loop ×1