我正在尝试新的jdk8这里有什么http://jdk8.java.net/lambda/
我能够从命令行编译和运行我的项目.
我也可以Installed JREs在Eclipse中添加这个新的JDK .但是,我无法让Eclipse使用这个JDK编译和运行项目.
我正在尝试更改设置,Project Properties/Java Compiler但Use [JDK] compliance from execution environment on the 'Java Build Path'复选框已禁用,无论我点击此页面,我都无法使其正常工作.
我有Eclipse平台版本:3.7.1
有任何想法吗?
谢谢
编译(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)
有人能解释为什么吗?谢谢
编辑:编辑为后续
尝试为此项目安装依赖项时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) 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) 我想使用Lucene来索引/搜索文本.文本可能包含错误的单词,名称等.让Lucene找到包含文档的最简单方法是什么
"this is Licene"
Run Code Online (Sandbox Code Playgroud)
当用户搜索时
"Lucene"?
Run Code Online (Sandbox Code Playgroud)
这仅适用于演示应用,因此我们需要最简单的解决方案.
我们知道,当我反序列化一个序列化的Java对象树时,树中的所有类都必须在类路径上.因此,由于有人将某些类移动到另一个包中,因此反序列化会抛出ClassNotFoundException.
我的问题是,有没有比实现我自己的序列化/反序列化更简单的方法来解决这个问题?
从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) 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) 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) java ×3
python ×2
curl ×1
django ×1
eclipse ×1
fuzzy-search ×1
geckodriver ×1
generics ×1
java-8 ×1
lucene ×1
node.js ×1
npm ×1
reactjs ×1
selenium ×1
spring ×1
spring-mvc ×1
spring-web ×1
wildcard ×1
xpath ×1