我正在尝试复制ItemizedOverlay.boundCenterBottom()我的一个Overlay类中的行为.
我相当肯定我可以使用setBounds(),但我完全迷失了setBounds()实际做的事情.
我正在寻找一种在 GitLab 合并请求关闭(合并与否)时运行“清理”作业/管道/等的方法。
问题是这样的 - 每当打开合并请求时,我们都会在集群上创建功能部署。目前,我没有检测 MR 何时关闭的机制。随着时间的推移,这些旧的“功能部署”会在集群上累积。
我可以从集群中编写一个手动清理脚本(查看所有打开的功能,删除不再存在的功能),但这会有点麻烦而且容易出错。希望 GitLab 有一种方法可以使用非常简单/很好的管道+作业功能来进行此类清理
我正在尝试尝试 Android 的 Jetpack Benchmark 库,但似乎无法克服此错误。已经尝试了我能想到的一切,如果您能帮助使这个简单的示例工作,我将不胜感激。
java.lang.AssertionError: ERRORS (not suppressed): ACTIVITY-MISSING
(Suppressed errors: DEBUGGABLE EMULATOR UNLOCKED)
WARNING: Not using IsolationActivity via AndroidBenchmarkRunner
AndroidBenchmarkRunner should be used to isolate benchmarks from interference
from other visible apps. To fix this, add the following to your module-level
build.gradle:
android.defaultConfig.testInstrumentationRunner
= "androidx.benchmark.junit4.AndroidBenchmarkRunner"
Run Code Online (Sandbox Code Playgroud)
我已按照此处的示例指南进行操作,defaultConfig其中包含:
testInstrumentationRunner 'androidx.benchmark.junit4.AndroidBenchmarkRunner'
// Suppressing errors I can ignore while I'm testing. Unfortunately, suppressing
// the ACTIVITY-MISSING error causes runtime crashes
testInstrumentationRunnerArgument 'androidx.benchmark.suppressErrors', 'EMULATOR,DEBUGGABLE,UNLOCKED'
Run Code Online (Sandbox Code Playgroud)
我的依赖项包含:
androidTestImplementation 'androidx.annotation:annotation:1.1.0'
androidTestImplementation …Run Code Online (Sandbox Code Playgroud) 在Java中,web.xml可能包含一些<welcome-file>元素.我试图在python中做一些相同的事情而没有运气.
application: wk
version: 1
runtime: python
api_version: 1
handlers:
- url: /
static_dir: docs
welcome_files:
- index.html
Run Code Online (Sandbox Code Playgroud)
有什么想法吗?我收到一条错误,"welcome_files"未被理解.
我使用Spring来渲染我的JSP,而我的url-pattern DispatcherServlet是"/".这似乎是为了使欢迎文件列表永远不会被考虑.我真的想DispatcherServlet处理除"/"之外的所有事情.但是,我想避免文件扩展名(例如,*.html,.do等),并且我正在使用InternalResourceViewResolver,因此将调度程序servlet的url-pattern设置为"/ "会使其接受太多(例如对InternalResourceViewResolver生成的JSP页面的内部请求将被调度程序servlet拦截,然后调度程序servlet会因为没有/WEB-INF/jsp/about.jsp的映射而抛出错误.任何帮助将不胜感激 - 我对Spring 很新(例如2天;-))
以下是相应的文件:
目录结构
/war (I'm using AppEngine)
index.jsp (Simply includes WEB-INF/jsp/index.jsp)
/WEB-INF
XML Config files
/jsp
index.jsp
about.jsp
...
Run Code Online (Sandbox Code Playgroud)
web.xml中
<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!--
We purposefully do not make this /*. The convention here is to define
mappings for files that exist, and write a good 404 page for anything
else. …Run Code Online (Sandbox Code Playgroud) 试图将文件加载到python中.这是一个非常大的文件(1.5Gb),但我有可用的内存,我只想做一次(因此使用python,我只需要对文件进行一次排序,因此python是一个简单的选择).
我的问题是,加载该文件导致的方式,以多大的内存使用情况.当我将大约10%的行加载到内存中时,Python已经使用了700Mb,这显然太多了.脚本挂起大约50%,使用3.03 Gb的实内存(并缓慢上升).
我知道这不是排序文件最有效的方法(内存方式),但我只是想让它工作,所以我可以继续处理更重要的问题:D所以,下面的python代码导致了什么问题大量内存使用:
print 'Loading file into memory'
input_file = open(input_file_name, 'r')
input_file.readline() # Toss out the header
lines = []
totalLines = 31164015.0
currentLine = 0.0
printEvery100000 = 0
for line in input_file:
currentLine += 1.0
lined = line.split('\t')
printEvery100000 += 1
if printEvery100000 == 100000:
print str(currentLine / totalLines)
printEvery100000 = 0;
lines.append( (lined[timestamp_pos].strip(), lined[personID_pos].strip(), lined[x_pos].strip(), lined[y_pos].strip()) )
input_file.close()
print 'Done loading file into memory'
Run Code Online (Sandbox Code Playgroud)
编辑:如果有人不确定,普遍的共识似乎是每个分配的变量会占用越来越多的内存.我在这种情况下"修复"了1)调用readLines(),它仍然加载所有数据,但每行只有一个'string'变量开销.这使用大约1.7Gb加载整个文件.然后,当我调用lines.sort()时,我将一个函数传递给key,该函数在选项卡上分割并返回正确的列值,转换为int.这在计算上是缓慢的,并且总体上是内存密集型的,但它可以工作.今天学到了关于变量分配的大量报道:D
在Android的SSE方案是跨平台的加密和解密伟大的开源项目。它们为其他系统提供了客户端(基于它们对基于Java的弹性城堡库的使用),但是我想知道是否可以使用openssl进行解密。这主要是我的练习,但是允许其他人通过向他们发送openssl命令来解密我的文件会很好。
SSE是开源的,但这是生成加密密钥的核心代码:
/** Generate password-base Keys (128, 256, 448 bits) */
private void generatePBKeys448Max(String pw, boolean unicodeAllowed) throws NoSuchAlgorithmException, InvalidKeySpecException
{
pw = pw.trim();
if(unicodeAllowed) pw = convertToCodePoints(pw);
byte[] shaL1 = getSHA512Hash(pw.getBytes());
byte[] shaSalt = getSHA256Hash(Helpers.getSubarray(shaL1, 0, 8));
byte[] shaIV = getSHA256Hash(Helpers.getSubarray(shaL1, 8, 8));
PKCS12ParametersGenerator pGen = new PKCS12ParametersGenerator(new SHA1Digest());
char[] passwordChars = pw.toCharArray();
final byte[] pkcs12PasswordBytes = PBEParametersGenerator.PKCS12PasswordToBytes(passwordChars);
pGen.init(pkcs12PasswordBytes, shaSalt, 600);
CBCBlockCipher aesCBC = new CBCBlockCipher(new AESFastEngine());
ParametersWithIV aesCBCParams = (ParametersWithIV) pGen.generateDerivedParameters(256, 128);
aesCBC.init(false, aesCBCParams);
byte[] key …Run Code Online (Sandbox Code Playgroud) 您好我正在尝试使用HTTPURLConnection作为练习提交以下表单.
<form name="popnames" method="post" action="/cgi-bin/popularnames.cgi" onsubmit="return submitIt();">
<p>
<label for="year">Birth Year:</label><br>
<input type="text" name="year" size="5" maxlength="4" id="year" value="2011">
</p>
<p>
<label for="rank">Popularity:</label><br>
<select name="top" size="1" id="rank">
<option value="20">Top 20</option>
<option value="50">Top 50</option>
<option value="100">Top 100</option>
<option value="500">Top 500</option>
<option value="1000">Top 1000</option>
</select>
</p>
<fieldset>
<legend>Name rankings may include:</legend>
<input type="radio" name="number" value="p" id="percent">
<label for="percent">Percent of total births</label><br>
<input type="radio" name="number" value="n" id="number">
<label for="number">Number of births</label>
</fieldset>
<hr>
<input class="uef-btn uef-btn-primary" type="submit" value=" Go ">
</form>
Run Code Online (Sandbox Code Playgroud)
我使用HTTPURLConnection来提交这是我的代码和我的测试类
public class …Run Code Online (Sandbox Code Playgroud) 我git ls-files --others --ignored --exclude-standard没有列出一些被忽略的文件的问题.
我的项目有这个目录结构
.
??? aspnet
? ??? .gitignore
? ??? __init__.py
? ??? lib
? ? ??? <lots of big stuff>
Run Code Online (Sandbox Code Playgroud)
该aspnet/.gitignore名单lib/*,并git add aspnet/lib/foo报告此路径将被忽略.
但是git ls-files --others --ignored --exclude-standard不列出下的文件lib.这些是未跟踪的文件,如果我这样做,它们会显示在输出中git ls-files --others,但如果我提供了忽略的标记则不会显示.
使用git版本1.7.9.5
编辑:使用git版本1.8.5.2(Apple Git-48)按预期工作,这似乎是一个git bug
我无法让 Hibernate 记录 SQL 查询的 LIMIT 部分。常规参数绑定按预期记录,只有 LIMIT 值绑定不记录。
代码相当简单:
TypedQuery<UserEntity> query = entityManager
.createQuery("SELECT u from UserEntity u WHERE u.email LIKE :domain", UserEntity.class);
query.setParameter("domain", "%test%");
query.setFirstResult(startIndex);
query.setMaxResults(count);
List<UserEntity> users = query.getResultList();
Run Code Online (Sandbox Code Playgroud)
这会生成以下日志。如您所见,常规参数绑定的记录没有问题,但没有限制绑定的日志行。
Hibernate:
select
userentity0_.id as id1_53_,
userentity0_.created_at as created_2_53_,
userentity0_.dob as dob3_53_,
userentity0_.email as email4_53_,
userentity0_.fullname as fullname5_53_,
userentity0_.mobile as mobile6_53_,
userentity0_.product_id as product_7_53_
from
user_entity userentity0_
where
userentity0_.email_id like ? limit ?
TRACE o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [VARCHAR] - [%test%]
Run Code Online (Sandbox Code Playgroud)
我已经进行了广泛的搜索,似乎没有一个常规属性值可以解决这个问题,并且似乎没有其他问题针对这个确切的问题
可能相关的细节:
java ×4
android ×3
python ×2
benchmarking ×1
bouncycastle ×1
docker ×1
encryption ×1
git ×1
gitignore ×1
gitlab ×1
gitlab-ci ×1
google-maps ×1
hibernate ×1
logging ×1
openssl ×1
overlay ×1
slf4j ×1
spring ×1
spring-mvc ×1
url-pattern ×1
yaml ×1