如何获得两个numpy数组之间的交叉点索引?我可以得到相交的值intersect1d:
import numpy as np
a = np.array(xrange(11))
b = np.array([2, 7, 10])
inter = np.intersect1d(a, b)
# inter == array([ 2, 7, 10])
Run Code Online (Sandbox Code Playgroud)
但是如何才能获得a值的索引inter呢?
正如标题所示,我如何为每个应用程序运行创建一个新的日志文件?我知道怎么做分钟/小时/等.但不是应用程序.跑
我现在有:
target name="Debug" archiveEvery="Hour"
archiveFileName="${basedir}/logs/Debug.{#####}.txt" maxArchiveFiles="4"
archiveNumbering="Sequence" xsi:type="File" fileName="${basedir}/logs/Debug.txt"
layout="${date:format=HH\:mm\:ss} | ${level} | ${message} ${exception}
${exception:format=stacktrace}"
Run Code Online (Sandbox Code Playgroud)
但实际上我不需要每小时存档,我想要的是每次运行我的应用程序时存档.我在旧论坛中找到了,但我不知道如何使用Cached_layout_renderer
我尝试安装pytable模块.我使用win7 x32,python 2.7.3(x32),cython 0.16,visual studio 2008(9.0).在cmd.exe'以管理员身份运行'时写:'python setup.py install --hdf5 ="C:\ Program Files\HDF Group\HDF5\1.8.9"'.
但是有未解析的外部符号和构建失败:
* Found numpy 1.6.2 package installed.
* Found numexpr 2.0.1 package installed.
* Found Cython 0.16 package installed.
* Found HDF5 headers at ``C:\Program Files\HDF Group\HDF5\1.8.9\include``, libra
ry at ``C:\Program Files\HDF Group\HDF5\1.8.9\lib``.
* Could not find LZO 2 headers and library; disabling support for it.
* Could not find LZO 1 headers and library; disabling support for it.
* Could not find bzip2 headers and library; …Run Code Online (Sandbox Code Playgroud) 我是Spring的新手,我不喜欢代码重复.我写了一个工作正常的ImapAdapter:
@Component
public class GeneralImapAdapter {
private Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private EmailReceiverService emailReceiverService;
@Bean
@InboundChannelAdapter(value = "emailChannel", poller = @Poller(fixedDelay = "10000", taskExecutor = "asyncTaskExecutor"))
public MessageSource<javax.mail.Message> mailMessageSource(MailReceiver imapMailReceiver) {
return new MailReceivingMessageSource(imapMailReceiver);
}
@Bean
@Value("imaps://<login>:<pass>@<url>:993/inbox")
public MailReceiver imapMailReceiver(String imapUrl) {
ImapMailReceiver imapMailReceiver = new ImapMailReceiver(imapUrl);
imapMailReceiver.setShouldMarkMessagesAsRead(true);
imapMailReceiver.setShouldDeleteMessages(false);
// other setters here
return imapMailReceiver;
}
@ServiceActivator(inputChannel = "emailChannel", poller = @Poller(fixedDelay = "10000", taskExecutor = "asyncTaskExecutor"))
public void emailMessageSource(javax.mail.Message message) {
emailReceiverService.receive(message);
}
}
Run Code Online (Sandbox Code Playgroud)
但我想要大约20个这样的适配器,唯一的区别是imapUrl.
没有代码重复怎么做?