小编bpg*_*rgo的帖子

如何让Eclipse使用JDK8编译项目?

我正在尝试新的jdk8这里有什么http://jdk8.java.net/lambda/

我能够从命令行编译和运行我的项目.

我也可以Installed JREs在Eclipse中添加这个新的JDK .但是,我无法让Eclipse使用这个JDK编译和运行项目.

我正在尝试更改设置,Project Properties/Java CompilerUse [JDK] compliance from execution environment on the 'Java Build Path'复选框已禁用,无论我点击此页面,我都无法使其正常工作.

我有Eclipse平台版本:3.7.1

有任何想法吗?

谢谢

java eclipse java-8

36
推荐指数
3
解决办法
7万
查看次数

Java泛型,嵌套的通配符集合

编译(1.6)

List<? extends Object> l = new ArrayList<Date>();
Run Code Online (Sandbox Code Playgroud)

但事实并非如此

List<List<? extends Object>> ll = new ArrayList<List<Date>>();
Run Code Online (Sandbox Code Playgroud)

有错误的

Type mismatch: cannot convert from ArrayList<List<Date>> to List<List<? extends Object>>
Run Code Online (Sandbox Code Playgroud)

有人能解释为什么吗?谢谢

编辑:编辑为后续

java generics wildcard

27
推荐指数
2
解决办法
2492
查看次数

npm 安装因对等依赖冲突而失败:react@16.14.0

尝试为此项目安装依赖项时npm install失败

> npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: ecommerce-app@0.1.0
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR!   react@"latest" from the root project
npm ERR!   peer react@"^16.8.0 || ^17.0.0" from @material-ui/core@4.11.4
npm ERR!   node_modules/@material-ui/core
npm ERR!     @material-ui/core@"latest" from the root project
npm ERR!     peer @material-ui/core@"^4.0.0" from @material-ui/icons@4.11.2
npm ERR!     node_modules/@material-ui/icons
npm ERR!       @material-ui/icons@"latest" from the root project
npm ERR!     1 more (@material-ui/lab)
npm ERR! …
Run Code Online (Sandbox Code Playgroud)

node.js npm reactjs

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

python list copy:旧[:]和list(旧)之间有区别吗?

old = [1, 2, 3]
Run Code Online (Sandbox Code Playgroud)

以下两行之间有什么区别(如果有的话)?

new = old[:]
new = list(old)
Run Code Online (Sandbox Code Playgroud)

更新我已经接受了ubershmekel的答案,但后来我学到了一个有趣的事实:[:]小列表(10个元素)list()更快,但更大的列表(100000个元素)更快.

~$ python -S -mtimeit -s "a = list(range(10))" "a[:]"
1000000 loops, best of 3: 0.198 usec per loop
~$ python -S -mtimeit -s "a = list(range(10))" "list(a)"
1000000 loops, best of 3: 0.453 usec per loop
~$ python -S -mtimeit -s "a = list(range(100000))" "a[:]"
1000 loops, best of 3: 675 usec per loop
~$ python -S -mtimeit -s "a = list(range(100000))" …
Run Code Online (Sandbox Code Playgroud)

python

5
推荐指数
2
解决办法
392
查看次数

找到Lucene的拼写错误

我想使用Lucene来索引/搜索文本.文本可能包含错误的单词,名称等.让Lucene找到包含文档的最简单方法是什么

"this is Licene" 
Run Code Online (Sandbox Code Playgroud)

当用户搜索时

"Lucene"? 
Run Code Online (Sandbox Code Playgroud)

这仅适用于演示应用,因此我们需要最简单的解决方案.

lucene fuzzy-search levenshtein-distance

3
推荐指数
1
解决办法
2298
查看次数

更改类的包名后,无法反序列化Java对象.我能做些什么呢?

我们知道,当我反序列化一个序列化的Java对象树时,树中的所有类都必须在类路径上.因此,由于有人将某些类移动到另一个包中,因此反序列化会抛出ClassNotFoundException.

我的问题是,有没有比实现我自己的序列化/反序列化更简单的方法来解决这个问题?

java serialization deserialization

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

给定xpath表达式“ // div [contains(@ class ='loader-overlay')]”对于Selenium无效

从2.53版升级到3.14版后,Selenium说

Given xpath expression "//div[contains(@class='loader-overlay')]" is invalid

这段代码

System.setProperty("webdriver.gecko.driver", "/path/to/geckodriver/v0.23.0");
FirefoxOptions options = new FirefoxOptions();
//...
driver = new FirefoxDriver(options);
WebElement loaderElement = driver.findElement(By.xpath("//div[contains(@class='loader-overlay')]"));
Run Code Online (Sandbox Code Playgroud)

产生这个错误

org.openqa.selenium.InvalidSelectorException: Given xpath expression "//div[contains(@class='loader-overlay')]" is invalid: [Exception... "<no message>"  nsresult: "0x8060000d (<unknown>)"  location: "JS frame :: chrome://marionette/content/element.js :: element.findByXPath :: line 401"  data: no]
For documentation on this error, please visit: http://seleniumhq.org/exceptions/invalid_selector_exception.html
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
System info: host: 'xxx', ip: '10.233.112.79', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-116-generic', java.version: '1.8.0_181' …
Run Code Online (Sandbox Code Playgroud)

selenium xpath selenium-firefoxdriver geckodriver

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

Spring仅返回查询字符串中的第一个参数

Spring 仅返回查询字符串中的第一个参数,后续参数丢失。

使用curl调用以下URL时:

 curl -i -X GET -b usercookie.txt -c usercookie.txt http://localhost:8080/appname/users/user-id/campaigns?title=JSON&itemPerPage=5&page=0&orderBy=startDate
Run Code Online (Sandbox Code Playgroud)

只有title参数具有非空值,request.getQueryString()仅包含“title=JSON”

当调用这个时:

curl -i -X GET -b usercookie.txt -c usercookie.txt http://localhost:8080/appname/users/user-id/campaigns?page=0&title=JSON&itemPerPage=5&orderBy=startDate
Run Code Online (Sandbox Code Playgroud)

仅包含request.getQueryString()“page=0”

控制器代码:

@Controller
public class Campaign {

...

    @RequestMapping(value = {"/users/{userId}/campaigns", "/users/{userId}/campaigns/"}, 
            method = RequestMethod.GET)
    @ResponseBody
    public CampaignListResponse getCampaignList(
            @PathVariable(value="userId") String reqUserId,
            @RequestParam(required=false) Integer page, 
            @RequestParam(required=false) Integer itemPerPage,
            @RequestParam(required=false) String orderBy,
            @RequestParam(required=false) String status,
            @RequestParam(required=false) String title,                                         
            HttpServletRequest request,
            HttpServletResponse response,
            @CookieValue("session") String session) {
        LOGGER.debug("reqUserId:{} page:{}, itemPerPage:{}, orderBy:{}, state:{}, title:{}", …
Run Code Online (Sandbox Code Playgroud)

spring curl spring-mvc spring-web

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

使用以下代码我收到错误AttributeError:'str'对象没有属性'items',

import json
import simplejson
import urllib2

data = urllib2.urlopen('www.example.com/url/where/i/get/json/data').read()

j = ""
j = simplejson.loads(data)

dump_data=simplejson.dumps(j)

for data in j["facets"]:
    print data.items()
    print "\n----------------\n"
Run Code Online (Sandbox Code Playgroud)

python django

0
推荐指数
1
解决办法
3494
查看次数