小编Tho*_*hom的帖子

Android将我们的位置列入黑名单

我们在应用程序中创建了一个LocationListener.有时,手机会进入"GPS Gap",只是停止报告位置数据.我们已经观看了一段时间,似乎从这个状态移动它的唯一的事情是重新启动手机.

我把它们连接起来以便关闭日志并发现:

02-18 13:35:43.671   703   948 I LocationManagerService: handleLocationChanged for android.uid.system:1000, Provider: passive
02-18 13:35:43.671   703   948 I LocationManagerService: handleLocationChanged for com.google.uid.shared:10040, Provider: passive
02-18 13:35:43.671   703   948 I LocationManagerService: handleLocationChanged for com.google.uid.shared:10040, Provider: passive
02-18 13:35:43.671   703   948 D LocationManagerService: dropping location (blacklisted): com.google.android.apps.maps matches com.google.
Run Code Online (Sandbox Code Playgroud)

查看上面提到的源文件,它只是检查它创建的黑名单,如果它在黑名单中,则显然不会报告该点.

查看代码和上面的代码看起来像是阻止com.google的位置数据,但我不知道为什么.

我搜查了一下,没有发现任何事情,并希望得到一些帮助.

gps android

9
推荐指数
1
解决办法
588
查看次数

在Eclipse中,如何多次运行JUnit测试用例

我有一个单元测试有时会失败并调试它是一个痛苦,因为我不知道为什么它有时会失败.

在Eclipse中有没有办法让我可以运行5次或50次JUnit测试?

谢谢.

java eclipse junit

8
推荐指数
3
解决办法
8284
查看次数

Swift 3对元组数组进行排序

我找到了这些答案:

在swift 3中对元组数组 进行排序如何对元组数组进行排序?

但我还有问题.这是我的代码:

var countsForLetter:[(count:Int, letter:Character)] = []
...
countsForLetter.sorted(by: {$0.count < $1.count})
Run Code Online (Sandbox Code Playgroud)

Swift 3希望我添加by:现在它表示对sorted:by的调用结果未使用.

我是swift 3的新手.对不起,如果这是一个基本问题.

arrays sorting tuples swift swift3

8
推荐指数
2
解决办法
3590
查看次数

Spring - 无法转换javax.mail.session

我正在我的servlet上下文中创建一个邮件会话,然后使用JNDI将它注入我的spring框架设计中.以下是上下文的外观:

<Resource name="mail/session" auth="Container"
            type="javax.mail.Session"
            mail.smtp.from="noreply@xxxx.com"
            mail.smtp.user="noreply@xxxx.com"
            mail.smtp.auth="true"
            mail.smtp.starttls.enable="true"
/>
Run Code Online (Sandbox Code Playgroud)

我带它进去的地方:

  <bean id="smtpSession" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName" value="java:comp/env/mail/session"/>
  </bean>
Run Code Online (Sandbox Code Playgroud)

我将它注入spring java邮件发件人:

  <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
      <property name="host" ref="smtpHost"/>
      <property name="password" ref="smtpPassword"/>
      <property name="port" ref="smtpPort"/>
      <property name="username" ref="smtpFrom"/>
      <property name="session" ref="smtpSession"/>
  </bean>
Run Code Online (Sandbox Code Playgroud)

现在这是我得到的信息:

Caused by: java.lang.IllegalStateException: Cannot convert value of type [javax.
mail.Session] to required type [javax.mail.Session] for property 'session': no m
atching editors or conversion strategy found
        at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(Ty
peConverterDelegate.java:231)
        at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrap
perImpl.java:447)
        ... 51 more
Run Code Online (Sandbox Code Playgroud)

呃,什么???? 为什么要尝试转换呢?

java spring tomcat jakarta-mail

7
推荐指数
1
解决办法
8088
查看次数

Hibernate MS-SQL错误列类型找到:decimal,expected:float

注意:问题末尾的答案

我在My SQL数据库中创建了一些列,并且之前显然没有创建浮点数,因为我必须查找它.为了符合SQL,我创建了我的列:

ALTER TABLE传感器ADD Field1_Calibration_Offset DECIMAL(4,3);

每列时间8.

我在我的java代码中定义了这些:

@Column(name ="FIELD1_CALIBRATION_OFFSET")private Float field1CalibrationOffset;

这产生了错误:

列为FIELD1_CALIBRATION_OFFSET的PsDb.dbo.Sensor中的列类型错误.发现:十进制,预期:浮动

最终答案

按照下面@jbrookover的回答,我改为BigDecimal,我得到了:

Wrong column type in PsDb.dbo.Sensor for column FIELD1_CALIBRATION_OFFSET. Found: decimal, expected: numeric(19,2)
Run Code Online (Sandbox Code Playgroud)

所以我查看了我的hibernate映射并做了:

@Column(name = "FIELD1_CALIBRATION_SCALE", columnDefinition="decimal", precision=4, scale=3)
private BigDecimal field1CalibrationScale;
Run Code Online (Sandbox Code Playgroud)

java hibernate

6
推荐指数
2
解决办法
2万
查看次数

Intellij上的Android显示错误:不是活动

我刚从eclipse将我的android项目导入intellij.我是intellij的新手.

我已经完成了所有工作,并为Android设置了运行配置.当我运行它时,它给我编辑配置屏幕.

当我说启动默认活动时,它告诉我它找不到默认活动,这是奇怪的.当我将活动编码为立即启动时,它告诉我那不是活动子类或别名.我仔细检查过,课程肯定是一项活动.

当我忽略它并且无论如何都会运行时,它会在它打到手机时立即爆炸.

你能帮我理解/解决这些错误吗?

java android intellij-idea

6
推荐指数
1
解决办法
5875
查看次数

Gradle with artifactory

我正在尝试建立自己的常春藤存储库以用于我自己的库.我发现了神器,并决定在我的Ubuntu服务器上使用它.我按照这里的指示:

http://www.jfrog.com/video/artifactory-1-min-setup/

并创建了这个自动脚本:

buildscript {
    repositories {

        ivy {
            url 'http://picard:8080/artifactory/plugins-release'

        }
    }
    dependencies {
        //Check for the latest version here: http://plugins.gradle.org/plugin/com.jfrog.artifactory
        classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.0.3"
    }
}

allprojects {
    apply plugin: "com.jfrog.artifactory"
}

artifactory {
    contextUrl = "${artifactory_contextUrl}"   //The base Artifactory URL if not overridden by the publisher/resolver
    publish {
        repository {
            repoKey = 'libs-release-local'
            maven = false
            ivy {
                ivyLayout = '[organization]/[module]/[revision]/[type]s/ivy-[revision].xml'
                artifactLayout = '[organization]/[module]/[revision]/[type]s/[module](-[classifier])-[revision].[ext]'
                mavenCompatible = false
            }
        }
    }
    resolve {
        repository {
            repoKey = 'libs-release'
            maven = …
Run Code Online (Sandbox Code Playgroud)

artifactory gradle

6
推荐指数
1
解决办法
1万
查看次数

org.springframework.web.bind.MissingServletRequestParameterException:必需长参数'userId'不存在"

我在发布对Spring控制器的调用时遇到异常

例外情况是:

 org.springframework.web.bind.MissingServletRequestParameterException : Required Long parameter 'userId' is not present"
Run Code Online (Sandbox Code Playgroud)

我的Javascript文件是:

$scope.removeUser = function(user){
        var userId = JSON.stringify(user);
        $http.post('/portal/settings/user/deletecustomeruser', userId).success(function(data){
                $scope.response = data;
            })
        }
    }
Run Code Online (Sandbox Code Playgroud)

Spring控制器代码是:

      @RequestMapping( value = "/user/deletecustomeruser", method = RequestMethod.POST , headers="Accept=application/json")
public @ResponseBody String deleteCustomerUser( @RequestParam (value = "userId") Long userId,
        HttpServletRequest request )
                throws Exception
                {
    String returnString = "";
    User user = userService.getUserById( userId );
Run Code Online (Sandbox Code Playgroud)

当我放(required = false),然后userId价值变成了null.JavaScript控制器显然"userId"是以JSON格式发送的,但是从控制器端出现了一些问题.

我在stackoverflow中检查了几乎所有问题,但给定的解决方案没有帮助.

javascript java post spring spring-mvc

6
推荐指数
1
解决办法
2万
查看次数

如何获取所有远程分支?

不知何故,我的一个存储库拒绝获取新分支:

C:\temp>git fetch --all
Fetching origin

C:\temp>git branch -a
* develop
remotes/origin/develop

C:\temp>git ls-remote --heads origin
d130c97c1ccbe9ab35cd6e268c760781e37e3628 refs/heads/2.1.0.x
...
92685125df152fe053a2818de0c4d2ce8655c6b8 refs/heads/2.2.5.x
1e2eec16c7d63c84d6b53d0a221d22109b4de2a8 refs/heads/develop
f6447d5315fe777803b283bee7dac1dbdba92536 refs/heads/feature/0001089__icons_are_gone_-_move_inclusion_to_RC_files
e2cf0112b7e7fc18eb3467c7c42657208147efb2 refs/heads/feature/0001102__Debug_time_fix_exception_EIdSocketError_10060
6b2c89c6a39b3ce26cf42c5e8e5e0dd12c88abac refs/heads/feature/0001103__Research_cause_of_Internal_error_Stack_not_balanced
...
9f724b76b7c3533996fa03189e18a2f61fa5cf4f refs/heads/master
c233696172eb05522d1bb6705a3ea8cd730a762d refs/heads/origin/master
1db38f4fab2c41ee1931c9c6165aa6087556210a refs/heads/release
c233696172eb05522d1bb6705a3ea8cd730a762d refs/heads/trunk
Run Code Online (Sandbox Code Playgroud)

我如何强制git获取所有这些远程分支?

我在git version 2.8.2.windows.1.

git

6
推荐指数
1
解决办法
5782
查看次数

获取 NoClassDefFoundError:无法初始化类 org.codehaus.groovy.vmplugin.v7.Java7

启动 Spring Boot 应用程序时出现以下错误。

java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.reflection.ReflectionCache
    at org.codehaus.groovy.runtime.dgmimpl.NumberNumberMetaMethod.<clinit>(NumberNumberMetaMethod.java:33) ~[groovy-2.5.8.jar:2.5.8]
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:na]
    at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500) ~[na:na]
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481) ~[na:na]
    at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.createMetaMethodFromClass(MetaClassRegistryImpl.java:258) ~[groovy-2.5.8.jar:2.5.8]
    at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:111) ~[groovy-2.5.8.jar:2.5.8]
    at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:86) ~[groovy-2.5.8.jar:2.5.8]
    at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:36) ~[groovy-2.5.8.jar:2.5.8]
    at org.springframework.beans.factory.groovy.GroovyBeanDefinitionReader.<init>(GroovyBeanDefinitionReader.java:150) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.boot.BeanDefinitionLoader.<init>(BeanDefinitionLoader.java:85) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
    at org.springframework.boot.SpringApplication.createBeanDefinitionLoader(SpringApplication.java:738) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
    at org.springframework.boot.SpringApplication.load(SpringApplication.java:681) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
    at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:392) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
    at pizzainthecloud.pizzaplace.Application.main(Application.java:23) ~[main/:na]
Run Code Online (Sandbox Code Playgroud)

经过多次搜索,我发现了几个这样的实例,包括java.lang.NoClassDefFoundError:Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7,但大多数是关于旧版本 gradle 和 groovy 的旧帖子,或者它们与安卓。

这是我的版本信息: …

java groovy gradle spring-boot

6
推荐指数
1
解决办法
5805
查看次数