我迁移到Android studio 3.0.因此,项目无法编译名为":animator"的模块,它会显示以下错误:
Error:Unable to resolve dependency for
':app@dexOptions/compileClasspath': Could not resolve project
:animators. <a
href="openFile:/home/mobilepowered/MobilePowered/MyInnovalee/trunk17-10-2017/app/build.gradle">Open
File</a><br><a href="Unable to resolve dependency for
':app@dexOptions/compileClasspath': Could not resolve project
:animators.">Show Details</a>
Run Code Online (Sandbox Code Playgroud)
并显示详细信息提供此日志:
Unable to resolve dependency for ':app@dexOptions/compileClasspath':
Could not resolve project :animators.
Could not resolve project :animators. Required by:
project :app
Unable to find a matching configuration of project :animators:
- Configuration 'debugApiElements':
- Required com.android.build.api.attributes.BuildTypeAttr 'dexOptions' and found incompatible value 'debug'.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and
found compatible value 'Aar'. …
Run Code Online (Sandbox Code Playgroud) 不确定这是否是Spring 5.0.3的一个错误或一个新功能来解决我的问题.
升级后,我收到此错误.有趣的是,此错误仅在我的本地计算机上.使用HTTPS协议的测试环境上的相同代码工作正常.
继续...
我收到此错误的原因是因为我加载生成的JSP页面的URL是/location/thisPage.jsp
.评估代码request.getRequestURI()
给了我结果/WEB-INF/somelocation//location/thisPage.jsp
.如果我将JSP页面的URL修复为此location/thisPage.jsp
,则工作正常.
所以我的问题是,我应该/
从JSP
代码中的路径中删除,因为这是未来需要的.或者Spring
引入了一个错误,因为我的机器和测试环境之间的唯一区别是协议HTTP
与HTTPS
.
org.springframework.security.web.firewall.RequestRejectedException:请求被拒绝,因为URL未规范化.org.springframework.security.web.firewall.StrictHttpFirewall.getFirewalledRequest(StrictHttpFirewall.java:123)org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:194)org.springframework.security.web.FilterChainProxy .doFilter(FilterChainProxy.java:186)org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357)org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)
我想知道,如果它是用在InnoDB中可能MySQL
有一个table
与外键引用在不同的另一个表database
?
如果是这样,如何做到这一点?
我正在尝试使用HashSet来存储我创建的类的对象,但显然相同的对象似乎有两个不同的哈希值,这就是为什么contains方法没有意识到该对象已经在HashSet中.这导致我的程序耗尽堆内存.
我不认为我做错了什么,但无论如何我想要第二意见.我做过类似的操作,之前一切正常,这使得这特别烦人.我很感激任何帮助.
这是我的代码
move1 = new Move(t,s);
if(move1.hashCode()==new Move(t,s).hashCode())
System.out.println("match");
move2 = new Move(s,t);
moves.add(move1);
moves.add(move2);
if(moves.contains(new Move(t,s)))
System.out.println("match found");
Run Code Online (Sandbox Code Playgroud)
这是Move类:
public class Move {
private int move1;
private int move2;
Move(int m1, int m2)
{
move1 = m1;
move2 = m2;
}
public String toString()
{
return String.valueOf(move1)+" "+String.valueOf(move2);
}
}
Run Code Online (Sandbox Code Playgroud)
这是我得到的输出
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.HashMap.addEntry(HashMap.java:797)
at java.util.HashMap.put(HashMap.java:431)
at java.util.HashSet.add(HashSet.java:194)
at makeMove.<init>(makeMove.java:33)
Run Code Online (Sandbox Code Playgroud) 有没有办法使用javax.validation验证一个名为color的字符串类型的变量,需要使用注释只有这些值(红色,蓝色,绿色,粉红色)?
我所看到的 @size(min=1, max=25)
和@notnull
,但有没有这样的事情@In(red, blue, green, pink)
或多或少类似于In-keyword
用于mysql
我有一个关于Java继承的问题.
我有两个班A
,并B
和B类,继承自答:
public class A {
public A() {
System.out.println("Hi!");
}
}
public class B extends A {
public B() {
System.out.println("Bye!");
}
public static void main(String[] args) {
B b = new B();
}
}
Run Code Online (Sandbox Code Playgroud)
当我运行程序B时,输出是:
Hi!
Bye!
Run Code Online (Sandbox Code Playgroud)
问:为什么构造函数的
class A
调用,当我创建和对象的class B
?
我知道B继承了A - 所有实例或类变量以及所有方法的所有内容,在这个意义上,B的对象具有A的所有特征以及B中定义的一些其他特征.但是,我不知道并且没有'我想象当我创建一个B类型的对象时,也会调用A的构造函数.所以写下这个:
B b = new B();
Run Code Online (Sandbox Code Playgroud)
创建两个对象 - 一个是B类,另一个是A类.
这很有趣,
有人可以解释为什么会发生这种情况吗?
我是春季启动的新手,当我尝试启动服务器时,我得到以下异常.我知道这与依赖冲突有关,但仍无法解决.我正在使用maven来管理我的依赖项.请帮助
Exception in thread "main" java.lang.IllegalArgumentException:
LoggerFactory is not a Logback LoggerContext but Logback is on the
classpath. Either remove Logback or the competing implementation
(class org.slf4j.impl.Log4jLoggerFactory) Object of class
[org.slf4j.impl.Log4jLoggerFactory] must be an instance of class
ch.qos.logback.classic.LoggerContext at
org.springframework.util.Assert.isInstanceOf(Assert.java:339) at
org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:93)
at
org.springframework.boot.logging.AbstractLoggingSystem.initializeWithSensibleDefaults(AbstractLoggingSystem.java:62)
at
org.springframework.boot.logging.AbstractLoggingSystem.beforeInitialize(AbstractLoggingSystem.java:45)
at
org.springframework.boot.logging.logback.LogbackLoggingSystem.beforeInitialize(LogbackLoggingSystem.java:69)
at
org.springframework.boot.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:135)
at
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:98)
at
org.springframework.boot.context.event.EventPublishingRunListener.publishEvent(EventPublishingRunListener.java:100)
at
org.springframework.boot.context.event.EventPublishingRunListener.started(EventPublishingRunListener.java:54)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:276)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:952)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:941)
at org.magnum.mobilecloud.video.Application.main(Application.java:30)
Run Code Online (Sandbox Code Playgroud)
已解决:将以下内容添加到POM.xml中
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency> …
Run Code Online (Sandbox Code Playgroud) 关于camera2人脸识别机制的信息不足.我使用了Google的Camera2示例: android-Camera2Basic
我将人脸识别模式设置为FULL.
mPreviewRequestBuilder.set(CaptureRequest.STATISTICS_FACE_DETECT_MODE,
CameraMetadata.STATISTICS_FACE_DETECT_MODE_FULL);
Run Code Online (Sandbox Code Playgroud)
我也查了一下
STATISTICS_INFO_MAX_FACE_COUNT
并且STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES
:
int max_count = characteristics.get(
CameraCharacteristics.STATISTICS_INFO_MAX_FACE_COUNT);
int modes [] = characteristics.get(
CameraCharacteristics.STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES);
Run Code Online (Sandbox Code Playgroud)
输出:maxCount:5,模式:[0,2]
我的CaptureCallback:
private CameraCaptureSession.CaptureCallback mCaptureCallback
= new CameraCaptureSession.CaptureCallback() {
private void process(CaptureResult result) {
Integer mode = result.get(CaptureResult.STATISTICS_FACE_DETECT_MODE);
Face [] faces = result.get(CaptureResult.STATISTICS_FACES);
if(faces != null && mode != null)
Log.e("tag", "faces : " + faces.length + " , mode : " + mode );
}
@Override
public void onCaptureProgressed(CameraCaptureSession session, CaptureRequest request,
CaptureResult partialResult) {
process(partialResult); …
Run Code Online (Sandbox Code Playgroud) 我尝试使用Amazon-SDK(Java)示例代码S3TransferProgressSample.java
将大文件上传到Amazon-S3存储(也在AWS docs上发布).
但是,当我尝试上传11 GB文件时,上传卡在不同的位置,并显示错误消息:
Unable to upload file to Amazon S3: Unable to upload part: Unable toexecute HTTP request: Unbuffered entity enclosing request can not be repeated " (attached screenshot).
Run Code Online (Sandbox Code Playgroud)
看起来在IOException发生后,SDK无法重试请求(见下文).
有没有人遇到这个?解决此问题的最佳做法是什么?任何代码表示赞赏.
INFO: Received successful response: 200, AWS Request ID:
2B66E7669E24DA75<br> Jan 15, 2011 6:44:46 AM
com.amazonaws.http.HttpClient execute<br> INFO: Sending Request: PUT
s3.amazonaws.com /test_file_upload/autogenerated.txt Parameters:
(uploadId:
m9MqxzD484Ys1nifnX._IzJBGbCFIoT_zBg0xdd6kkZ4TAtmcG0lXQOE.LeiSEuqn6NjcosIQLXJeKzSnKllmw--, partNumber: 1494, )<br> Jan 15, 2011 6:45:10 AM
org.apache.commons.httpclient.HttpMethodDirector executeWithRetry<br>
**INFO: I/O exception (java.net.SocketException) caught when processing request: Connection …
Run Code Online (Sandbox Code Playgroud) 我正在读一个字符串
Is Mississippi a State where there are many systems.
Run Code Online (Sandbox Code Playgroud)
我想用"t"或"T"替换每个单词中的第一个"s"或"S"(即保持相同的情况)...以便输出为:
It Mitsissippi a Ttate where there are many tystems.
Run Code Online (Sandbox Code Playgroud)
我试过了
s= s.replaceFirst("(?i)S", "t"); [which of course didn't work]
并且已经尝试尝试使用字符串[]分割字符串.split(Pattern.quote("\\s"))
,然后试图找出如何replaceFirst()
的每一个元素array
,然后返回值回string
[ 但不能想出这样做的正确的方式.
我认为\\G
可能有助于重新开始下一个单词,但没有在哪里.任何使用这3种方法的帮助表示赞赏.
java ×5
amazon-s3 ×1
android ×1
constructor ×1
database ×1
foreign-keys ×1
hashset ×1
inheritance ×1
innodb ×1
javax ×1
log4j ×1
mysql ×1
replace ×1
service ×1
split ×1
spring ×1
spring-boot ×1
spring-mvc ×1
string ×1
subclass ×1
validation ×1