当我想要更新时,我想用hibernate将对象更新到数据库时有问题(branchDao.update(be);)它抛出异常
a different object with the same identifier value was already associated with the session
Run Code Online (Sandbox Code Playgroud)
我的代码:
LoginEntity le = loginDao.getSpecificLogin(pkId);
le.setPassword(password);
le.setRoles(role);
loginDao.update(le);
HumanEntity he = humanDao.getHumanById(humanID); // humanEntuty farde morede nazar ro bar hasbe Email taraf load mikonad
he.setHumanEmail(oemail);
he.setHumanFamily(olname);
he.setHumanName(ofname);
humanDao.update(he);
superBranchUsername = branch.getFatherUsername();
int superBranchId = branchDao.getBranchIdByUserName(superBranchUsername);
BranchEntity superBranch = branchDao.load(superBranchId);
BranchEntity be = new BranchEntity();
setBranchEntity(be, he, pkId, bname, confirmed, level, studentCount, uname, superBranch, le);
branchDao.update(be); //this line throw exception
Run Code Online (Sandbox Code Playgroud)
和更新:
public void update(T …Run Code Online (Sandbox Code Playgroud) 我有一个字符串,"GoTo: 7018 6453 12654\n"我只想得到这样的数字['7018', '6453', '12654'],我尝试正则表达式,但我不能拆分字符串得到只是数字这里是我的代码:
样本1:
splitter = re.compile(r'\D');
match1 = splitter.split("GoTo: 7018 6453 12654\n")
my output is: ['', '', '', '', '', '', '', '', '7018', '6453', '12654', '']
Run Code Online (Sandbox Code Playgroud)
样本2:
splitter = re.compile(r'\W');
match1 = splitter.split("GoTo: 7018 6453 12654\n")
my output is: ['GoTo', '', '7018', '6453', '12654', '']
Run Code Online (Sandbox Code Playgroud) 我曾经能够将记录发送到 firehose 而不会出现任何这样的问题
aws firehose put-record --delivery-stream-name my-stream --record='Data="{\"foor\":\"bar\"}"'
Run Code Online (Sandbox Code Playgroud)
但自从我将 cli 更新到版本 2 后,我收到此错误:
Invalid base64: "{"foor":"bar"}"
Run Code Online (Sandbox Code Playgroud)
我尝试将 {"foo":"bar"} 转换为 based64 但后来我得到了InvalidArgumentException
aws firehose put-record --delivery-stream-name my-stream --record='Data=e1wiYXNkZlwiOlwidGVzdGFtXCJ9Ig=='
An error occurred (InvalidArgumentException) when calling the PutRecord operation: This operation is not permitted on KinesisStreamAsSource delivery stream type.
Run Code Online (Sandbox Code Playgroud) 我不太确定我是否可以在这里或在SuperUser上提出这个问题,
我想知道如何在excel中绘制输出的CDF图表.
我的数据是这样的(我的真实数据有22424条记录):
1 2.39E-05
1 2.39E-05
1 2.39E-05
2 4.77E-05
2 4.77E-05
2 4.77E-05
4 9.55E-05
4 9.55E-05
4 9.55E-05
4 9.55E-05
4 9.55E-05
4 9.55E-05
8 0.000190931
8 0.000190931
Run Code Online (Sandbox Code Playgroud) 基于apache Kafka docs KStream-to-KStream Joins are always windowed joins,我的问题是如何控制窗口的大小?保持主题数据的大小是否相同?或者,例如,我们可以将数据保留1个月,但过去一周加入流?
是否有任何好的示例来显示窗口化的KStream-to-kStream窗口连接?
在我的情况,让我们说我有2 KStream,kstream1并且kstream2我希望能够加入十天kstream1至30天kstream2.
我在2个单独的表格中有以下数据:
Sheet1:
A B C D
a ff dd ff ee
b 12 10 10 12
Run Code Online (Sandbox Code Playgroud)
Sheet2中:
A B C D
a ge ff ff ee
b 11 13 14 10
Run Code Online (Sandbox Code Playgroud)
现在我想写一个公式来汇总第2行中包含ff在上面的所有值(即第1行)
在上面的例子中,我想添加(Cell Sheet1 [A,b],Sheet1 [C,b],Sheet2 [B,b],Sheet2 [C,b])等于49.
我有 (n,2) numpy 数组,其中包含 n 个点的坐标,现在我想根据每个元素与特定点 (x,y) 的近似值对它们进行排序,并选择最接近的一个。我怎样才能做到这一点?
现在我有:
def find_nearest(array,value):
xlist = (np.abs(array[:, 0]-value[:, 0]))
ylist = (np.abs(array[:, 1]-value[:, 1]))
newList = np.vstack((xlist,ylist))
// SORT NEW LIST and return the 0 elemnt
Run Code Online (Sandbox Code Playgroud)
在我的解决方案中,我需要根据 (0,0) 的接近度对 newList 进行排序,但我不知道如何?这个或任何其他解决方案的任何解决方案?
我的点数组看起来像:
array([[ 0.1648, 0.227 ],
[ 0.2116, 0.2472],
[ 0.78 , 0.546 ],
[ 0.9752, 1. ],
[ 0.384 , 0.4862],
[ 0.4428, 0.2204],
[ 0.4448, 0.4146],
[ 0.1046, 0.2658],
[ 0.5668, 0.7792],
[ 0.1664, 0.0746],
[ 0.5636, 0.6372],
[ 0.7822, 0.5536], …Run Code Online (Sandbox Code Playgroud) 这是我的hibernate.hbm.xml,我使用的是MySQL
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/dbName?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">******</property>
<property name="hbm2ddl.auto">update</property>
<property name="hibernate.connection.useUnicode">true</property>
<property name="hibernate.connection.characterEncoding">UTF-8</property>
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<property name="hibernate.use_sql_comments">true</property>
<property name="current_session_context_class">thread</property>
<!-- configuration pool via c3p0-->
<property name="c3p0.acquire_increment">1</property>
<property name="c3p0.idle_test_period">100</property> <!-- seconds -->
<property name="c3p0.max_size">100</property>
<property name="c3p0.max_statements">0</property>
<property name="c3p0.min_size">10</property>
<property name="c3p0.timeout">100</property> <!-- seconds -->
<!-- DEPRECATED very expensive property name="c3p0.validate>-->
</session-factory>
</hibernate-configuration>
Run Code Online (Sandbox Code Playgroud)
当我第一次运行我的程序时它在数据库中创建了表但我的问题是Charset仍然是latin1_swedish_ci(拉丁语)并且不是utf8我应该在hibernate.hbm.xml设置中更改什么?
当我们想要部署Web应用程序时,我们应该使用singleton Object还是使用Static而不是?使用它们的瓶颈是什么?我应该知道内存问题,并发问题和.......
PS:对于那些只是可读的类(应该使用static或Singleton)会发生什么
PS 2:可读写的类会发生什么
我有一个巨大的文件(大约30GB),每行包括2D曲面上一个点的协调。我需要将文件加载到Numpy array:中points = np.empty((0, 2)),并对其进行应用scipy.spatial.ConvexHull。由于文件的大小很大,因此无法立即将其加载到内存中,因此我想将其作为一批N行scipy.spatial.ConvexHull加载,然后应用到一小部分,然后再加载下N行!什么是有效的方法?
我发现在python中,您可以islice用来读取文件的N行,但问题是lines_gen生成器对象,它为您提供了文件的每一行,应该在循环中使用,因此我不确定如何转换所述lines_gen成numpy的阵列中的一个有效的方法是什么?
from itertools import islice
with open(input, 'r') as infile:
lines_gen = islice(infile, N)
Run Code Online (Sandbox Code Playgroud)
我的输入文件:
0.989703 1
0 0
0.0102975 0
0.0102975 0
1 1
0.989703 1
1 1
0 0
0.0102975 0
0.989703 1
0.979405 1
0 0
0.020595 0
0.020595 0
1 1
0.979405 1
1 1
0 0
0.020595 0
0.979405 1
0.969108 1
...
...
...
0 …Run Code Online (Sandbox Code Playgroud)